@vectros-ai/mcp-server 0.9.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 +43 -0
- package/README.md +34 -3
- package/dist/cli-http.js +396 -503
- package/dist/cli-http.js.map +1 -1
- package/dist/cli-http.mjs +396 -503
- package/dist/cli-http.mjs.map +1 -1
- package/dist/cli.js +396 -503
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +396 -503
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +259 -500
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +259 -500
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/cli.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",
|
|
@@ -734,8 +688,7 @@ var SchemaRequest;
|
|
|
734
688
|
Record: "record",
|
|
735
689
|
Document: "document",
|
|
736
690
|
User: "user",
|
|
737
|
-
|
|
738
|
-
Client: "client"
|
|
691
|
+
Entity: "entity"
|
|
739
692
|
};
|
|
740
693
|
})(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
|
|
741
694
|
})(SchemaRequest || (SchemaRequest = {}));
|
|
@@ -758,8 +711,7 @@ var SchemaResponse;
|
|
|
758
711
|
Record: "record",
|
|
759
712
|
Document: "document",
|
|
760
713
|
User: "user",
|
|
761
|
-
|
|
762
|
-
Client: "client"
|
|
714
|
+
Entity: "entity"
|
|
763
715
|
};
|
|
764
716
|
})(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
|
|
765
717
|
})(SchemaResponse || (SchemaResponse = {}));
|
|
@@ -2314,7 +2266,7 @@ function withNoOpAuthProvider(options) {
|
|
|
2314
2266
|
authProvider: new NoOpAuthProvider()
|
|
2315
2267
|
};
|
|
2316
2268
|
}
|
|
2317
|
-
function handleNonStatusCodeError(error, rawResponse, method,
|
|
2269
|
+
function handleNonStatusCodeError(error, rawResponse, method, path2) {
|
|
2318
2270
|
switch (error.reason) {
|
|
2319
2271
|
case "non-json":
|
|
2320
2272
|
throw new VectrosError({
|
|
@@ -2328,7 +2280,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
|
2328
2280
|
rawResponse
|
|
2329
2281
|
});
|
|
2330
2282
|
case "timeout":
|
|
2331
|
-
throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${
|
|
2283
|
+
throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path2}.`, {
|
|
2332
2284
|
cause: error.cause
|
|
2333
2285
|
});
|
|
2334
2286
|
case "unknown":
|
|
@@ -2400,7 +2352,7 @@ var AuthClient = class {
|
|
|
2400
2352
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
|
|
2401
2353
|
}
|
|
2402
2354
|
/**
|
|
2403
|
-
* 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.
|
|
2404
2356
|
*
|
|
2405
2357
|
* @param {Vectros.GetAccessLogRequest} request
|
|
2406
2358
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2413,7 +2365,6 @@ var AuthClient = class {
|
|
|
2413
2365
|
* subjectType: "user",
|
|
2414
2366
|
* subjectId: "user_abc123",
|
|
2415
2367
|
* contextId: "ctx_intake",
|
|
2416
|
-
* clientId: "client_xyz789",
|
|
2417
2368
|
* action: "read",
|
|
2418
2369
|
* callerKeyId: "key_abc123",
|
|
2419
2370
|
* resourceType: "intake_form",
|
|
@@ -2428,7 +2379,6 @@ var AuthClient = class {
|
|
|
2428
2379
|
subjectType,
|
|
2429
2380
|
subjectId,
|
|
2430
2381
|
contextId,
|
|
2431
|
-
clientId,
|
|
2432
2382
|
from: from_,
|
|
2433
2383
|
to,
|
|
2434
2384
|
action,
|
|
@@ -2443,7 +2393,6 @@ var AuthClient = class {
|
|
|
2443
2393
|
subjectType,
|
|
2444
2394
|
subjectId,
|
|
2445
2395
|
contextId,
|
|
2446
|
-
clientId,
|
|
2447
2396
|
from: from_,
|
|
2448
2397
|
to,
|
|
2449
2398
|
action,
|
|
@@ -2877,7 +2826,7 @@ var AuthClient = class {
|
|
|
2877
2826
|
);
|
|
2878
2827
|
}
|
|
2879
2828
|
/**
|
|
2880
|
-
* 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.
|
|
2881
2830
|
*
|
|
2882
2831
|
* @param {Vectros.CreateAccessProfileRequest} request
|
|
2883
2832
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4167,7 +4116,7 @@ var AuthClient = class {
|
|
|
4167
4116
|
* "userId": "550e8400-e29b-41d4-a716-446655440000"
|
|
4168
4117
|
* },
|
|
4169
4118
|
* dataScope: {
|
|
4170
|
-
* "
|
|
4119
|
+
* "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
|
|
4171
4120
|
* }
|
|
4172
4121
|
* },
|
|
4173
4122
|
* expiresInSeconds: 3600
|
|
@@ -4617,7 +4566,7 @@ var DocumentsClient = class {
|
|
|
4617
4566
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
4618
4567
|
}
|
|
4619
4568
|
/**
|
|
4620
|
-
* 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.
|
|
4621
4570
|
*
|
|
4622
4571
|
* @param {Vectros.ListDocumentsRequest} request
|
|
4623
4572
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4625,8 +4574,6 @@ var DocumentsClient = class {
|
|
|
4625
4574
|
* @example
|
|
4626
4575
|
* await client.documents.listDocuments({
|
|
4627
4576
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
4628
|
-
* orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
4629
|
-
* clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
4630
4577
|
* scope: "group:eng-team",
|
|
4631
4578
|
* folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
4632
4579
|
* startFrom: "doc_prev123"
|
|
@@ -4636,11 +4583,9 @@ var DocumentsClient = class {
|
|
|
4636
4583
|
return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
|
|
4637
4584
|
}
|
|
4638
4585
|
async __listDocuments(request = {}, requestOptions) {
|
|
4639
|
-
const { userId,
|
|
4586
|
+
const { userId, scope, folderId, startFrom, limit } = request;
|
|
4640
4587
|
const _queryParams = {
|
|
4641
4588
|
userId,
|
|
4642
|
-
orgId,
|
|
4643
|
-
clientId,
|
|
4644
4589
|
scope,
|
|
4645
4590
|
folderId,
|
|
4646
4591
|
startFrom,
|
|
@@ -5373,7 +5318,7 @@ var FoldersClient = class {
|
|
|
5373
5318
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
5374
5319
|
}
|
|
5375
5320
|
/**
|
|
5376
|
-
* 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.
|
|
5377
5322
|
*
|
|
5378
5323
|
* @param {Vectros.ListFoldersRequest} request
|
|
5379
5324
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5381,9 +5326,8 @@ var FoldersClient = class {
|
|
|
5381
5326
|
* @example
|
|
5382
5327
|
* await client.folders.listFolders({
|
|
5383
5328
|
* parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
5384
|
-
* orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
5385
5329
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
5386
|
-
*
|
|
5330
|
+
* scope: "group:eng-team",
|
|
5387
5331
|
* startFrom: "fld_prev123"
|
|
5388
5332
|
* })
|
|
5389
5333
|
*/
|
|
@@ -5391,12 +5335,11 @@ var FoldersClient = class {
|
|
|
5391
5335
|
return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
|
|
5392
5336
|
}
|
|
5393
5337
|
async __listFolders(request = {}, requestOptions) {
|
|
5394
|
-
const { parentFolderId,
|
|
5338
|
+
const { parentFolderId, userId, scope, startFrom, limit } = request;
|
|
5395
5339
|
const _queryParams = {
|
|
5396
5340
|
parentFolderId,
|
|
5397
|
-
orgId,
|
|
5398
5341
|
userId,
|
|
5399
|
-
|
|
5342
|
+
scope,
|
|
5400
5343
|
startFrom,
|
|
5401
5344
|
limit
|
|
5402
5345
|
};
|
|
@@ -5682,7 +5625,7 @@ var FoldersClient = class {
|
|
|
5682
5625
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
|
|
5683
5626
|
}
|
|
5684
5627
|
/**
|
|
5685
|
-
* 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.
|
|
5686
5629
|
*
|
|
5687
5630
|
* @param {Vectros.PatchFolderRequest} request
|
|
5688
5631
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5815,54 +5758,48 @@ var IdentityClient = class {
|
|
|
5815
5758
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
5816
5759
|
}
|
|
5817
5760
|
/**
|
|
5818
|
-
* 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.
|
|
5819
5762
|
*
|
|
5820
|
-
* @param {Vectros.
|
|
5763
|
+
* @param {Vectros.ListEntitiesRequest} request
|
|
5821
5764
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5822
5765
|
*
|
|
5823
5766
|
* @example
|
|
5824
|
-
* await client.identity.
|
|
5825
|
-
*
|
|
5826
|
-
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
5827
|
-
* externalId: "patient_789",
|
|
5828
|
-
* startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
5829
|
-
* type: "client_v1",
|
|
5830
|
-
* field: "industry",
|
|
5831
|
-
* value: "healthcare",
|
|
5832
|
-
* prefix: "health"
|
|
5767
|
+
* await client.identity.listEntities({
|
|
5768
|
+
* namespace: "team"
|
|
5833
5769
|
* })
|
|
5834
5770
|
*/
|
|
5835
|
-
|
|
5836
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5771
|
+
listEntities(request, requestOptions) {
|
|
5772
|
+
return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
|
|
5837
5773
|
}
|
|
5838
|
-
async
|
|
5774
|
+
async __listEntities(request, requestOptions) {
|
|
5839
5775
|
const {
|
|
5840
|
-
|
|
5776
|
+
namespace,
|
|
5841
5777
|
userId,
|
|
5842
5778
|
externalId,
|
|
5843
|
-
|
|
5844
|
-
limit,
|
|
5779
|
+
scope,
|
|
5845
5780
|
type: type_,
|
|
5846
5781
|
field,
|
|
5847
5782
|
value,
|
|
5848
5783
|
from: from_,
|
|
5849
5784
|
to,
|
|
5850
5785
|
prefix,
|
|
5851
|
-
order
|
|
5786
|
+
order,
|
|
5787
|
+
startFrom,
|
|
5788
|
+
limit
|
|
5852
5789
|
} = request;
|
|
5853
5790
|
const _queryParams = {
|
|
5854
|
-
orgId,
|
|
5855
5791
|
userId,
|
|
5856
5792
|
externalId,
|
|
5857
|
-
|
|
5858
|
-
limit,
|
|
5793
|
+
scope,
|
|
5859
5794
|
type: type_,
|
|
5860
5795
|
field,
|
|
5861
5796
|
value,
|
|
5862
5797
|
from: from_,
|
|
5863
5798
|
to,
|
|
5864
5799
|
prefix,
|
|
5865
|
-
order: order != null ? order : void 0
|
|
5800
|
+
order: order != null ? order : void 0,
|
|
5801
|
+
startFrom,
|
|
5802
|
+
limit
|
|
5866
5803
|
};
|
|
5867
5804
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
5868
5805
|
const _headers = mergeHeaders(
|
|
@@ -5873,7 +5810,7 @@ var IdentityClient = class {
|
|
|
5873
5810
|
const _response = await fetcher({
|
|
5874
5811
|
url: url_exports.join(
|
|
5875
5812
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5876
|
-
|
|
5813
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}`
|
|
5877
5814
|
),
|
|
5878
5815
|
method: "GET",
|
|
5879
5816
|
headers: _headers,
|
|
@@ -5894,12 +5831,12 @@ var IdentityClient = class {
|
|
|
5894
5831
|
rawResponse: _response.rawResponse
|
|
5895
5832
|
});
|
|
5896
5833
|
}
|
|
5897
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/
|
|
5834
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
|
|
5898
5835
|
}
|
|
5899
5836
|
/**
|
|
5900
|
-
* 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.
|
|
5901
5838
|
*
|
|
5902
|
-
* @param {Vectros.
|
|
5839
|
+
* @param {Vectros.CreateEntityRequest} request
|
|
5903
5840
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5904
5841
|
*
|
|
5905
5842
|
* @throws {@link Vectros.BadRequestError}
|
|
@@ -5907,17 +5844,18 @@ var IdentityClient = class {
|
|
|
5907
5844
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
5908
5845
|
*
|
|
5909
5846
|
* @example
|
|
5910
|
-
* await client.identity.
|
|
5847
|
+
* await client.identity.createEntity({
|
|
5848
|
+
* namespace: "team",
|
|
5911
5849
|
* body: {
|
|
5912
|
-
* externalId: "
|
|
5850
|
+
* externalId: "team_eng_platform"
|
|
5913
5851
|
* }
|
|
5914
5852
|
* })
|
|
5915
5853
|
*/
|
|
5916
|
-
|
|
5917
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5854
|
+
createEntity(request, requestOptions) {
|
|
5855
|
+
return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
|
|
5918
5856
|
}
|
|
5919
|
-
async
|
|
5920
|
-
const { upsert, body: _body } = request;
|
|
5857
|
+
async __createEntity(request, requestOptions) {
|
|
5858
|
+
const { namespace, upsert, body: _body } = request;
|
|
5921
5859
|
const _queryParams = {
|
|
5922
5860
|
upsert
|
|
5923
5861
|
};
|
|
@@ -5930,7 +5868,7 @@ var IdentityClient = class {
|
|
|
5930
5868
|
const _response = await fetcher({
|
|
5931
5869
|
url: url_exports.join(
|
|
5932
5870
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5933
|
-
|
|
5871
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}`
|
|
5934
5872
|
),
|
|
5935
5873
|
method: "POST",
|
|
5936
5874
|
headers: _headers,
|
|
@@ -5963,26 +5901,27 @@ var IdentityClient = class {
|
|
|
5963
5901
|
});
|
|
5964
5902
|
}
|
|
5965
5903
|
}
|
|
5966
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/
|
|
5904
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
|
|
5967
5905
|
}
|
|
5968
5906
|
/**
|
|
5969
|
-
*
|
|
5907
|
+
* Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
|
|
5970
5908
|
*
|
|
5971
|
-
* @param {Vectros.
|
|
5909
|
+
* @param {Vectros.GetEntityRequest} request
|
|
5972
5910
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5973
5911
|
*
|
|
5974
5912
|
* @throws {@link Vectros.NotFoundError}
|
|
5975
5913
|
*
|
|
5976
5914
|
* @example
|
|
5977
|
-
* await client.identity.
|
|
5978
|
-
*
|
|
5915
|
+
* await client.identity.getEntity({
|
|
5916
|
+
* namespace: "team",
|
|
5917
|
+
* id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
|
|
5979
5918
|
* })
|
|
5980
5919
|
*/
|
|
5981
|
-
|
|
5982
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5920
|
+
getEntity(request, requestOptions) {
|
|
5921
|
+
return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
|
|
5983
5922
|
}
|
|
5984
|
-
async
|
|
5985
|
-
const { id } = request;
|
|
5923
|
+
async __getEntity(request, requestOptions) {
|
|
5924
|
+
const { namespace, id } = request;
|
|
5986
5925
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
5987
5926
|
const _headers = mergeHeaders(
|
|
5988
5927
|
_authRequest.headers,
|
|
@@ -5992,7 +5931,7 @@ var IdentityClient = class {
|
|
|
5992
5931
|
const _response = await fetcher({
|
|
5993
5932
|
url: url_exports.join(
|
|
5994
5933
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5995
|
-
`v1/
|
|
5934
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
|
|
5996
5935
|
),
|
|
5997
5936
|
method: "GET",
|
|
5998
5937
|
headers: _headers,
|
|
@@ -6018,30 +5957,31 @@ var IdentityClient = class {
|
|
|
6018
5957
|
});
|
|
6019
5958
|
}
|
|
6020
5959
|
}
|
|
6021
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/
|
|
5960
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
|
|
6022
5961
|
}
|
|
6023
5962
|
/**
|
|
6024
|
-
* 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.
|
|
6025
5964
|
*
|
|
6026
|
-
* @param {Vectros.
|
|
5965
|
+
* @param {Vectros.UpdateEntityRequest} request
|
|
6027
5966
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6028
5967
|
*
|
|
6029
5968
|
* @throws {@link Vectros.NotFoundError}
|
|
6030
5969
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6031
5970
|
*
|
|
6032
5971
|
* @example
|
|
6033
|
-
* await client.identity.
|
|
5972
|
+
* await client.identity.updateEntity({
|
|
5973
|
+
* namespace: "team",
|
|
6034
5974
|
* id: "id",
|
|
6035
5975
|
* body: {
|
|
6036
|
-
* externalId: "
|
|
5976
|
+
* externalId: "team_eng_platform"
|
|
6037
5977
|
* }
|
|
6038
5978
|
* })
|
|
6039
5979
|
*/
|
|
6040
|
-
|
|
6041
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5980
|
+
updateEntity(request, requestOptions) {
|
|
5981
|
+
return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
|
|
6042
5982
|
}
|
|
6043
|
-
async
|
|
6044
|
-
const { id, body: _body } = request;
|
|
5983
|
+
async __updateEntity(request, requestOptions) {
|
|
5984
|
+
const { namespace, id, body: _body } = request;
|
|
6045
5985
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6046
5986
|
const _headers = mergeHeaders(
|
|
6047
5987
|
_authRequest.headers,
|
|
@@ -6051,7 +5991,7 @@ var IdentityClient = class {
|
|
|
6051
5991
|
const _response = await fetcher({
|
|
6052
5992
|
url: url_exports.join(
|
|
6053
5993
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6054
|
-
`v1/
|
|
5994
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
|
|
6055
5995
|
),
|
|
6056
5996
|
method: "PUT",
|
|
6057
5997
|
headers: _headers,
|
|
@@ -6082,27 +6022,28 @@ var IdentityClient = class {
|
|
|
6082
6022
|
});
|
|
6083
6023
|
}
|
|
6084
6024
|
}
|
|
6085
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/
|
|
6025
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
|
|
6086
6026
|
}
|
|
6087
6027
|
/**
|
|
6088
|
-
* Permanently deletes
|
|
6028
|
+
* Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
|
|
6089
6029
|
*
|
|
6090
|
-
* @param {Vectros.
|
|
6030
|
+
* @param {Vectros.DeleteEntityRequest} request
|
|
6091
6031
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6092
6032
|
*
|
|
6093
6033
|
* @throws {@link Vectros.NotFoundError}
|
|
6094
6034
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6095
6035
|
*
|
|
6096
6036
|
* @example
|
|
6097
|
-
* await client.identity.
|
|
6037
|
+
* await client.identity.deleteEntity({
|
|
6038
|
+
* namespace: "team",
|
|
6098
6039
|
* id: "id"
|
|
6099
6040
|
* })
|
|
6100
6041
|
*/
|
|
6101
|
-
|
|
6102
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6042
|
+
deleteEntity(request, requestOptions) {
|
|
6043
|
+
return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
|
|
6103
6044
|
}
|
|
6104
|
-
async
|
|
6105
|
-
const { id } = request;
|
|
6045
|
+
async __deleteEntity(request, requestOptions) {
|
|
6046
|
+
const { namespace, id } = request;
|
|
6106
6047
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6107
6048
|
const _headers = mergeHeaders(
|
|
6108
6049
|
_authRequest.headers,
|
|
@@ -6112,7 +6053,7 @@ var IdentityClient = class {
|
|
|
6112
6053
|
const _response = await fetcher({
|
|
6113
6054
|
url: url_exports.join(
|
|
6114
6055
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6115
|
-
`v1/
|
|
6056
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
|
|
6116
6057
|
),
|
|
6117
6058
|
method: "DELETE",
|
|
6118
6059
|
headers: _headers,
|
|
@@ -6140,27 +6081,36 @@ var IdentityClient = class {
|
|
|
6140
6081
|
});
|
|
6141
6082
|
}
|
|
6142
6083
|
}
|
|
6143
|
-
return handleNonStatusCodeError(
|
|
6084
|
+
return handleNonStatusCodeError(
|
|
6085
|
+
_response.error,
|
|
6086
|
+
_response.rawResponse,
|
|
6087
|
+
"DELETE",
|
|
6088
|
+
"/v1/entities/{namespace}/{id}"
|
|
6089
|
+
);
|
|
6144
6090
|
}
|
|
6145
6091
|
/**
|
|
6146
|
-
*
|
|
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.
|
|
6147
6093
|
*
|
|
6148
|
-
* @param {Vectros.
|
|
6094
|
+
* @param {Vectros.LookupEntitiesRequest} request
|
|
6149
6095
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6150
6096
|
*
|
|
6151
6097
|
* @throws {@link Vectros.BadRequestError}
|
|
6152
6098
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6153
6099
|
*
|
|
6154
6100
|
* @example
|
|
6155
|
-
* await client.identity.
|
|
6156
|
-
*
|
|
6157
|
-
*
|
|
6101
|
+
* await client.identity.lookupEntities({
|
|
6102
|
+
* namespace: "team",
|
|
6103
|
+
* body: {
|
|
6104
|
+
* type: "person_v1",
|
|
6105
|
+
* field: "ssn"
|
|
6106
|
+
* }
|
|
6158
6107
|
* })
|
|
6159
6108
|
*/
|
|
6160
|
-
|
|
6161
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6109
|
+
lookupEntities(request, requestOptions) {
|
|
6110
|
+
return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
|
|
6162
6111
|
}
|
|
6163
|
-
async
|
|
6112
|
+
async __lookupEntities(request, requestOptions) {
|
|
6113
|
+
const { namespace, body: _body } = request;
|
|
6164
6114
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6165
6115
|
const _headers = mergeHeaders(
|
|
6166
6116
|
_authRequest.headers,
|
|
@@ -6170,14 +6120,14 @@ var IdentityClient = class {
|
|
|
6170
6120
|
const _response = await fetcher({
|
|
6171
6121
|
url: url_exports.join(
|
|
6172
6122
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6173
|
-
|
|
6123
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
|
|
6174
6124
|
),
|
|
6175
6125
|
method: "POST",
|
|
6176
6126
|
headers: _headers,
|
|
6177
6127
|
contentType: "application/json",
|
|
6178
6128
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6179
6129
|
requestType: "json",
|
|
6180
|
-
body:
|
|
6130
|
+
body: _body,
|
|
6181
6131
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6182
6132
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6183
6133
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -6201,26 +6151,32 @@ var IdentityClient = class {
|
|
|
6201
6151
|
});
|
|
6202
6152
|
}
|
|
6203
6153
|
}
|
|
6204
|
-
return handleNonStatusCodeError(
|
|
6154
|
+
return handleNonStatusCodeError(
|
|
6155
|
+
_response.error,
|
|
6156
|
+
_response.rawResponse,
|
|
6157
|
+
"POST",
|
|
6158
|
+
"/v1/entities/{namespace}/lookup"
|
|
6159
|
+
);
|
|
6205
6160
|
}
|
|
6206
6161
|
/**
|
|
6207
|
-
* 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.
|
|
6208
6163
|
*
|
|
6209
|
-
* @param {Vectros.
|
|
6164
|
+
* @param {Vectros.GetEntityVersionsRequest} request
|
|
6210
6165
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6211
6166
|
*
|
|
6212
6167
|
* @throws {@link Vectros.NotFoundError}
|
|
6213
6168
|
*
|
|
6214
6169
|
* @example
|
|
6215
|
-
* await client.identity.
|
|
6170
|
+
* await client.identity.getEntityVersions({
|
|
6171
|
+
* namespace: "team",
|
|
6216
6172
|
* id: "id"
|
|
6217
6173
|
* })
|
|
6218
6174
|
*/
|
|
6219
|
-
|
|
6220
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6175
|
+
getEntityVersions(request, requestOptions) {
|
|
6176
|
+
return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
|
|
6221
6177
|
}
|
|
6222
|
-
async
|
|
6223
|
-
const { id, startFrom } = request;
|
|
6178
|
+
async __getEntityVersions(request, requestOptions) {
|
|
6179
|
+
const { namespace, id, startFrom } = request;
|
|
6224
6180
|
const _queryParams = {
|
|
6225
6181
|
startFrom
|
|
6226
6182
|
};
|
|
@@ -6233,7 +6189,7 @@ var IdentityClient = class {
|
|
|
6233
6189
|
const _response = await fetcher({
|
|
6234
6190
|
url: url_exports.join(
|
|
6235
6191
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6236
|
-
`v1/
|
|
6192
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
|
|
6237
6193
|
),
|
|
6238
6194
|
method: "GET",
|
|
6239
6195
|
headers: _headers,
|
|
@@ -6259,174 +6215,31 @@ var IdentityClient = class {
|
|
|
6259
6215
|
});
|
|
6260
6216
|
}
|
|
6261
6217
|
}
|
|
6262
|
-
return handleNonStatusCodeError(
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
* @param {Vectros.ListOrgsRequest} request
|
|
6268
|
-
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6269
|
-
*
|
|
6270
|
-
* @example
|
|
6271
|
-
* await client.identity.listOrgs({
|
|
6272
|
-
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
6273
|
-
* externalId: "clinic_001",
|
|
6274
|
-
* startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
6275
|
-
* type: "org_v1",
|
|
6276
|
-
* field: "region",
|
|
6277
|
-
* value: "us-east",
|
|
6278
|
-
* prefix: "us-"
|
|
6279
|
-
* })
|
|
6280
|
-
*/
|
|
6281
|
-
listOrgs(request = {}, requestOptions) {
|
|
6282
|
-
return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
|
|
6283
|
-
}
|
|
6284
|
-
async __listOrgs(request = {}, requestOptions) {
|
|
6285
|
-
const {
|
|
6286
|
-
userId,
|
|
6287
|
-
externalId,
|
|
6288
|
-
startFrom,
|
|
6289
|
-
limit,
|
|
6290
|
-
type: type_,
|
|
6291
|
-
field,
|
|
6292
|
-
value,
|
|
6293
|
-
from: from_,
|
|
6294
|
-
to,
|
|
6295
|
-
prefix,
|
|
6296
|
-
order
|
|
6297
|
-
} = request;
|
|
6298
|
-
const _queryParams = {
|
|
6299
|
-
userId,
|
|
6300
|
-
externalId,
|
|
6301
|
-
startFrom,
|
|
6302
|
-
limit,
|
|
6303
|
-
type: type_,
|
|
6304
|
-
field,
|
|
6305
|
-
value,
|
|
6306
|
-
from: from_,
|
|
6307
|
-
to,
|
|
6308
|
-
prefix,
|
|
6309
|
-
order: order != null ? order : void 0
|
|
6310
|
-
};
|
|
6311
|
-
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6312
|
-
const _headers = mergeHeaders(
|
|
6313
|
-
_authRequest.headers,
|
|
6314
|
-
this._options?.headers,
|
|
6315
|
-
requestOptions?.headers
|
|
6218
|
+
return handleNonStatusCodeError(
|
|
6219
|
+
_response.error,
|
|
6220
|
+
_response.rawResponse,
|
|
6221
|
+
"GET",
|
|
6222
|
+
"/v1/entities/{namespace}/{id}/versions"
|
|
6316
6223
|
);
|
|
6317
|
-
const _response = await fetcher({
|
|
6318
|
-
url: url_exports.join(
|
|
6319
|
-
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6320
|
-
"v1/orgs"
|
|
6321
|
-
),
|
|
6322
|
-
method: "GET",
|
|
6323
|
-
headers: _headers,
|
|
6324
|
-
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
6325
|
-
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6326
|
-
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6327
|
-
abortSignal: requestOptions?.abortSignal,
|
|
6328
|
-
fetchFn: this._options?.fetch,
|
|
6329
|
-
logging: this._options.logging
|
|
6330
|
-
});
|
|
6331
|
-
if (_response.ok) {
|
|
6332
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6333
|
-
}
|
|
6334
|
-
if (_response.error.reason === "status-code") {
|
|
6335
|
-
throw new VectrosError({
|
|
6336
|
-
statusCode: _response.error.statusCode,
|
|
6337
|
-
body: _response.error.body,
|
|
6338
|
-
rawResponse: _response.rawResponse
|
|
6339
|
-
});
|
|
6340
|
-
}
|
|
6341
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
|
|
6342
6224
|
}
|
|
6343
6225
|
/**
|
|
6344
|
-
*
|
|
6226
|
+
* Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
|
|
6345
6227
|
*
|
|
6346
|
-
* @param {Vectros.
|
|
6347
|
-
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6348
|
-
*
|
|
6349
|
-
* @throws {@link Vectros.BadRequestError}
|
|
6350
|
-
* @throws {@link Vectros.ForbiddenError}
|
|
6351
|
-
* @throws {@link Vectros.TooManyRequestsError}
|
|
6352
|
-
*
|
|
6353
|
-
* @example
|
|
6354
|
-
* await client.identity.createOrg({
|
|
6355
|
-
* body: {
|
|
6356
|
-
* externalId: "clinic_001"
|
|
6357
|
-
* }
|
|
6358
|
-
* })
|
|
6359
|
-
*/
|
|
6360
|
-
createOrg(request, requestOptions) {
|
|
6361
|
-
return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
|
|
6362
|
-
}
|
|
6363
|
-
async __createOrg(request, requestOptions) {
|
|
6364
|
-
const { upsert, body: _body } = request;
|
|
6365
|
-
const _queryParams = {
|
|
6366
|
-
upsert
|
|
6367
|
-
};
|
|
6368
|
-
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6369
|
-
const _headers = mergeHeaders(
|
|
6370
|
-
_authRequest.headers,
|
|
6371
|
-
this._options?.headers,
|
|
6372
|
-
requestOptions?.headers
|
|
6373
|
-
);
|
|
6374
|
-
const _response = await fetcher({
|
|
6375
|
-
url: url_exports.join(
|
|
6376
|
-
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6377
|
-
"v1/orgs"
|
|
6378
|
-
),
|
|
6379
|
-
method: "POST",
|
|
6380
|
-
headers: _headers,
|
|
6381
|
-
contentType: "application/json",
|
|
6382
|
-
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
6383
|
-
requestType: "json",
|
|
6384
|
-
body: _body,
|
|
6385
|
-
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6386
|
-
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6387
|
-
abortSignal: requestOptions?.abortSignal,
|
|
6388
|
-
fetchFn: this._options?.fetch,
|
|
6389
|
-
logging: this._options.logging
|
|
6390
|
-
});
|
|
6391
|
-
if (_response.ok) {
|
|
6392
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6393
|
-
}
|
|
6394
|
-
if (_response.error.reason === "status-code") {
|
|
6395
|
-
switch (_response.error.statusCode) {
|
|
6396
|
-
case 400:
|
|
6397
|
-
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6398
|
-
case 403:
|
|
6399
|
-
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6400
|
-
case 429:
|
|
6401
|
-
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
6402
|
-
default:
|
|
6403
|
-
throw new VectrosError({
|
|
6404
|
-
statusCode: _response.error.statusCode,
|
|
6405
|
-
body: _response.error.body,
|
|
6406
|
-
rawResponse: _response.rawResponse
|
|
6407
|
-
});
|
|
6408
|
-
}
|
|
6409
|
-
}
|
|
6410
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
|
|
6411
|
-
}
|
|
6412
|
-
/**
|
|
6413
|
-
* Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
|
|
6414
|
-
*
|
|
6415
|
-
* @param {Vectros.GetOrgRequest} request
|
|
6228
|
+
* @param {Vectros.GetNamespaceRequest} request
|
|
6416
6229
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6417
6230
|
*
|
|
6418
6231
|
* @throws {@link Vectros.NotFoundError}
|
|
6419
6232
|
*
|
|
6420
6233
|
* @example
|
|
6421
|
-
* await client.identity.
|
|
6422
|
-
*
|
|
6234
|
+
* await client.identity.getNamespace({
|
|
6235
|
+
* namespace: "team"
|
|
6423
6236
|
* })
|
|
6424
6237
|
*/
|
|
6425
|
-
|
|
6426
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6238
|
+
getNamespace(request, requestOptions) {
|
|
6239
|
+
return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
|
|
6427
6240
|
}
|
|
6428
|
-
async
|
|
6429
|
-
const {
|
|
6241
|
+
async __getNamespace(request, requestOptions) {
|
|
6242
|
+
const { namespace } = request;
|
|
6430
6243
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6431
6244
|
const _headers = mergeHeaders(
|
|
6432
6245
|
_authRequest.headers,
|
|
@@ -6436,7 +6249,7 @@ var IdentityClient = class {
|
|
|
6436
6249
|
const _response = await fetcher({
|
|
6437
6250
|
url: url_exports.join(
|
|
6438
6251
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6439
|
-
`v1/
|
|
6252
|
+
`v1/namespaces/${url_exports.encodePathParam(namespace)}`
|
|
6440
6253
|
),
|
|
6441
6254
|
method: "GET",
|
|
6442
6255
|
headers: _headers,
|
|
@@ -6462,30 +6275,31 @@ var IdentityClient = class {
|
|
|
6462
6275
|
});
|
|
6463
6276
|
}
|
|
6464
6277
|
}
|
|
6465
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/
|
|
6278
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
|
|
6466
6279
|
}
|
|
6467
6280
|
/**
|
|
6468
|
-
* 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.
|
|
6469
6282
|
*
|
|
6470
|
-
* @param {Vectros.
|
|
6283
|
+
* @param {Vectros.UpdateNamespaceRequest} request
|
|
6471
6284
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6472
6285
|
*
|
|
6286
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6473
6287
|
* @throws {@link Vectros.NotFoundError}
|
|
6474
6288
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6475
6289
|
*
|
|
6476
6290
|
* @example
|
|
6477
|
-
* await client.identity.
|
|
6478
|
-
*
|
|
6291
|
+
* await client.identity.updateNamespace({
|
|
6292
|
+
* namespace: "team",
|
|
6479
6293
|
* body: {
|
|
6480
|
-
*
|
|
6294
|
+
* namespace: "team"
|
|
6481
6295
|
* }
|
|
6482
6296
|
* })
|
|
6483
6297
|
*/
|
|
6484
|
-
|
|
6485
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6298
|
+
updateNamespace(request, requestOptions) {
|
|
6299
|
+
return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
|
|
6486
6300
|
}
|
|
6487
|
-
async
|
|
6488
|
-
const {
|
|
6301
|
+
async __updateNamespace(request, requestOptions) {
|
|
6302
|
+
const { namespace, body: _body } = request;
|
|
6489
6303
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6490
6304
|
const _headers = mergeHeaders(
|
|
6491
6305
|
_authRequest.headers,
|
|
@@ -6495,7 +6309,7 @@ var IdentityClient = class {
|
|
|
6495
6309
|
const _response = await fetcher({
|
|
6496
6310
|
url: url_exports.join(
|
|
6497
6311
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6498
|
-
`v1/
|
|
6312
|
+
`v1/namespaces/${url_exports.encodePathParam(namespace)}`
|
|
6499
6313
|
),
|
|
6500
6314
|
method: "PUT",
|
|
6501
6315
|
headers: _headers,
|
|
@@ -6514,6 +6328,8 @@ var IdentityClient = class {
|
|
|
6514
6328
|
}
|
|
6515
6329
|
if (_response.error.reason === "status-code") {
|
|
6516
6330
|
switch (_response.error.statusCode) {
|
|
6331
|
+
case 403:
|
|
6332
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6517
6333
|
case 404:
|
|
6518
6334
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6519
6335
|
case 429:
|
|
@@ -6526,27 +6342,28 @@ var IdentityClient = class {
|
|
|
6526
6342
|
});
|
|
6527
6343
|
}
|
|
6528
6344
|
}
|
|
6529
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/
|
|
6345
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
|
|
6530
6346
|
}
|
|
6531
6347
|
/**
|
|
6532
|
-
*
|
|
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.
|
|
6533
6349
|
*
|
|
6534
|
-
* @param {Vectros.
|
|
6350
|
+
* @param {Vectros.DeleteNamespaceRequest} request
|
|
6535
6351
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6536
6352
|
*
|
|
6353
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6537
6354
|
* @throws {@link Vectros.NotFoundError}
|
|
6538
6355
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6539
6356
|
*
|
|
6540
6357
|
* @example
|
|
6541
|
-
* await client.identity.
|
|
6542
|
-
*
|
|
6358
|
+
* await client.identity.deleteNamespace({
|
|
6359
|
+
* namespace: "team"
|
|
6543
6360
|
* })
|
|
6544
6361
|
*/
|
|
6545
|
-
|
|
6546
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6362
|
+
deleteNamespace(request, requestOptions) {
|
|
6363
|
+
return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
|
|
6547
6364
|
}
|
|
6548
|
-
async
|
|
6549
|
-
const {
|
|
6365
|
+
async __deleteNamespace(request, requestOptions) {
|
|
6366
|
+
const { namespace } = request;
|
|
6550
6367
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6551
6368
|
const _headers = mergeHeaders(
|
|
6552
6369
|
_authRequest.headers,
|
|
@@ -6556,7 +6373,7 @@ var IdentityClient = class {
|
|
|
6556
6373
|
const _response = await fetcher({
|
|
6557
6374
|
url: url_exports.join(
|
|
6558
6375
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6559
|
-
`v1/
|
|
6376
|
+
`v1/namespaces/${url_exports.encodePathParam(namespace)}`
|
|
6560
6377
|
),
|
|
6561
6378
|
method: "DELETE",
|
|
6562
6379
|
headers: _headers,
|
|
@@ -6572,6 +6389,8 @@ var IdentityClient = class {
|
|
|
6572
6389
|
}
|
|
6573
6390
|
if (_response.error.reason === "status-code") {
|
|
6574
6391
|
switch (_response.error.statusCode) {
|
|
6392
|
+
case 403:
|
|
6393
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6575
6394
|
case 404:
|
|
6576
6395
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6577
6396
|
case 429:
|
|
@@ -6584,27 +6403,26 @@ var IdentityClient = class {
|
|
|
6584
6403
|
});
|
|
6585
6404
|
}
|
|
6586
6405
|
}
|
|
6587
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/
|
|
6406
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
|
|
6588
6407
|
}
|
|
6589
6408
|
/**
|
|
6590
|
-
*
|
|
6409
|
+
* Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
|
|
6591
6410
|
*
|
|
6592
|
-
* @param {Vectros.
|
|
6411
|
+
* @param {Vectros.ListNamespacesRequest} request
|
|
6593
6412
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6594
6413
|
*
|
|
6595
|
-
* @throws {@link Vectros.BadRequestError}
|
|
6596
|
-
* @throws {@link Vectros.TooManyRequestsError}
|
|
6597
|
-
*
|
|
6598
6414
|
* @example
|
|
6599
|
-
* await client.identity.
|
|
6600
|
-
* type: "person_v1",
|
|
6601
|
-
* field: "ssn"
|
|
6602
|
-
* })
|
|
6415
|
+
* await client.identity.listNamespaces()
|
|
6603
6416
|
*/
|
|
6604
|
-
|
|
6605
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6417
|
+
listNamespaces(request = {}, requestOptions) {
|
|
6418
|
+
return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
|
|
6606
6419
|
}
|
|
6607
|
-
async
|
|
6420
|
+
async __listNamespaces(request = {}, requestOptions) {
|
|
6421
|
+
const { startFrom, limit } = request;
|
|
6422
|
+
const _queryParams = {
|
|
6423
|
+
startFrom,
|
|
6424
|
+
limit
|
|
6425
|
+
};
|
|
6608
6426
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6609
6427
|
const _headers = mergeHeaders(
|
|
6610
6428
|
_authRequest.headers,
|
|
@@ -6614,14 +6432,11 @@ var IdentityClient = class {
|
|
|
6614
6432
|
const _response = await fetcher({
|
|
6615
6433
|
url: url_exports.join(
|
|
6616
6434
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6617
|
-
"v1/
|
|
6435
|
+
"v1/namespaces"
|
|
6618
6436
|
),
|
|
6619
|
-
method: "
|
|
6437
|
+
method: "GET",
|
|
6620
6438
|
headers: _headers,
|
|
6621
|
-
|
|
6622
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6623
|
-
requestType: "json",
|
|
6624
|
-
body: request,
|
|
6439
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
6625
6440
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6626
6441
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6627
6442
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -6632,42 +6447,33 @@ var IdentityClient = class {
|
|
|
6632
6447
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6633
6448
|
}
|
|
6634
6449
|
if (_response.error.reason === "status-code") {
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
default:
|
|
6641
|
-
throw new VectrosError({
|
|
6642
|
-
statusCode: _response.error.statusCode,
|
|
6643
|
-
body: _response.error.body,
|
|
6644
|
-
rawResponse: _response.rawResponse
|
|
6645
|
-
});
|
|
6646
|
-
}
|
|
6450
|
+
throw new VectrosError({
|
|
6451
|
+
statusCode: _response.error.statusCode,
|
|
6452
|
+
body: _response.error.body,
|
|
6453
|
+
rawResponse: _response.rawResponse
|
|
6454
|
+
});
|
|
6647
6455
|
}
|
|
6648
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
6456
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
|
|
6649
6457
|
}
|
|
6650
6458
|
/**
|
|
6651
|
-
*
|
|
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.
|
|
6652
6460
|
*
|
|
6653
|
-
* @param {Vectros.
|
|
6461
|
+
* @param {Vectros.NamespaceRequest} request
|
|
6654
6462
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6655
6463
|
*
|
|
6656
|
-
* @throws {@link Vectros.
|
|
6464
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6465
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6466
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
6657
6467
|
*
|
|
6658
6468
|
* @example
|
|
6659
|
-
* await client.identity.
|
|
6660
|
-
*
|
|
6469
|
+
* await client.identity.registerNamespace({
|
|
6470
|
+
* namespace: "team"
|
|
6661
6471
|
* })
|
|
6662
6472
|
*/
|
|
6663
|
-
|
|
6664
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6473
|
+
registerNamespace(request, requestOptions) {
|
|
6474
|
+
return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
|
|
6665
6475
|
}
|
|
6666
|
-
async
|
|
6667
|
-
const { id, startFrom } = request;
|
|
6668
|
-
const _queryParams = {
|
|
6669
|
-
startFrom
|
|
6670
|
-
};
|
|
6476
|
+
async __registerNamespace(request, requestOptions) {
|
|
6671
6477
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6672
6478
|
const _headers = mergeHeaders(
|
|
6673
6479
|
_authRequest.headers,
|
|
@@ -6677,11 +6483,14 @@ var IdentityClient = class {
|
|
|
6677
6483
|
const _response = await fetcher({
|
|
6678
6484
|
url: url_exports.join(
|
|
6679
6485
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6680
|
-
|
|
6486
|
+
"v1/namespaces"
|
|
6681
6487
|
),
|
|
6682
|
-
method: "
|
|
6488
|
+
method: "POST",
|
|
6683
6489
|
headers: _headers,
|
|
6684
|
-
|
|
6490
|
+
contentType: "application/json",
|
|
6491
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6492
|
+
requestType: "json",
|
|
6493
|
+
body: request,
|
|
6685
6494
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6686
6495
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6687
6496
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -6693,8 +6502,12 @@ var IdentityClient = class {
|
|
|
6693
6502
|
}
|
|
6694
6503
|
if (_response.error.reason === "status-code") {
|
|
6695
6504
|
switch (_response.error.statusCode) {
|
|
6696
|
-
case
|
|
6697
|
-
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);
|
|
6698
6511
|
default:
|
|
6699
6512
|
throw new VectrosError({
|
|
6700
6513
|
statusCode: _response.error.statusCode,
|
|
@@ -6703,7 +6516,7 @@ var IdentityClient = class {
|
|
|
6703
6516
|
});
|
|
6704
6517
|
}
|
|
6705
6518
|
}
|
|
6706
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
6519
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
|
|
6707
6520
|
}
|
|
6708
6521
|
/**
|
|
6709
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.
|
|
@@ -7580,7 +7393,7 @@ var RecordsClient = class {
|
|
|
7580
7393
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
|
|
7581
7394
|
}
|
|
7582
7395
|
/**
|
|
7583
|
-
* 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.
|
|
7584
7397
|
*
|
|
7585
7398
|
* @param {Vectros.ListRecordsRequest} request
|
|
7586
7399
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -7590,8 +7403,6 @@ var RecordsClient = class {
|
|
|
7590
7403
|
* type: "intake_form",
|
|
7591
7404
|
* folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
7592
7405
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
7593
|
-
* orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
7594
|
-
* clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
7595
7406
|
* scope: "group:eng-team",
|
|
7596
7407
|
* startFrom: "550e8400-e29b-41d4-a716-446655440000"
|
|
7597
7408
|
* })
|
|
@@ -7600,24 +7411,11 @@ var RecordsClient = class {
|
|
|
7600
7411
|
return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
|
|
7601
7412
|
}
|
|
7602
7413
|
async __listRecords(request = {}, requestOptions) {
|
|
7603
|
-
const {
|
|
7604
|
-
type: type_,
|
|
7605
|
-
folderId,
|
|
7606
|
-
userId,
|
|
7607
|
-
orgId,
|
|
7608
|
-
clientId,
|
|
7609
|
-
scope,
|
|
7610
|
-
startFrom,
|
|
7611
|
-
limit,
|
|
7612
|
-
includePayload,
|
|
7613
|
-
recent
|
|
7614
|
-
} = request;
|
|
7414
|
+
const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
|
|
7615
7415
|
const _queryParams = {
|
|
7616
7416
|
type: type_,
|
|
7617
7417
|
folderId,
|
|
7618
7418
|
userId,
|
|
7619
|
-
orgId,
|
|
7620
|
-
clientId,
|
|
7621
7419
|
scope,
|
|
7622
7420
|
startFrom,
|
|
7623
7421
|
limit,
|
|
@@ -7917,7 +7715,7 @@ var RecordsClient = class {
|
|
|
7917
7715
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
|
|
7918
7716
|
}
|
|
7919
7717
|
/**
|
|
7920
|
-
* 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.
|
|
7921
7719
|
*
|
|
7922
7720
|
* @param {Vectros.PatchRecordRequest} request
|
|
7923
7721
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8243,7 +8041,7 @@ var SchemasClient = class {
|
|
|
8243
8041
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
8244
8042
|
}
|
|
8245
8043
|
/**
|
|
8246
|
-
* 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.
|
|
8247
8045
|
*
|
|
8248
8046
|
* @param {Vectros.ListSchemasRequest} request
|
|
8249
8047
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8251,7 +8049,7 @@ var SchemasClient = class {
|
|
|
8251
8049
|
* @example
|
|
8252
8050
|
* await client.schemas.listSchemas({
|
|
8253
8051
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
8254
|
-
*
|
|
8052
|
+
* scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
8255
8053
|
* surface: "document",
|
|
8256
8054
|
* recordType: "intake_form",
|
|
8257
8055
|
* startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
|
|
@@ -8261,10 +8059,10 @@ var SchemasClient = class {
|
|
|
8261
8059
|
return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
|
|
8262
8060
|
}
|
|
8263
8061
|
async __listSchemas(request = {}, requestOptions) {
|
|
8264
|
-
const { userId,
|
|
8062
|
+
const { userId, scope, surface, recordType, startFrom, limit } = request;
|
|
8265
8063
|
const _queryParams = {
|
|
8266
8064
|
userId,
|
|
8267
|
-
|
|
8065
|
+
scope,
|
|
8268
8066
|
surface,
|
|
8269
8067
|
recordType,
|
|
8270
8068
|
startFrom,
|
|
@@ -8710,12 +8508,12 @@ var VectrosClient = class {
|
|
|
8710
8508
|
get auth() {
|
|
8711
8509
|
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
8712
8510
|
}
|
|
8713
|
-
get identity() {
|
|
8714
|
-
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
8715
|
-
}
|
|
8716
8511
|
get documents() {
|
|
8717
8512
|
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
8718
8513
|
}
|
|
8514
|
+
get identity() {
|
|
8515
|
+
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
8516
|
+
}
|
|
8719
8517
|
get compliance() {
|
|
8720
8518
|
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
8721
8519
|
}
|
|
@@ -8813,8 +8611,8 @@ function warnOnSuboptimalKey(key, log) {
|
|
|
8813
8611
|
|
|
8814
8612
|
// src/build-info.ts
|
|
8815
8613
|
var BUILD_INFO = {
|
|
8816
|
-
mcpServer: true ? "0.
|
|
8817
|
-
sdk: true ? "0.
|
|
8614
|
+
mcpServer: true ? "0.10.0" : "dev",
|
|
8615
|
+
sdk: true ? "0.35.0" : "dev"
|
|
8818
8616
|
};
|
|
8819
8617
|
function formatBuildInfo() {
|
|
8820
8618
|
return `vectros-mcp-server ${BUILD_INFO.mcpServer} (sdk ${BUILD_INFO.sdk})`;
|
|
@@ -9102,10 +8900,8 @@ var inputSchema = {
|
|
|
9102
8900
|
),
|
|
9103
8901
|
// Ownership.
|
|
9104
8902
|
userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9105
|
-
orgId: import_zod.z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
|
|
9106
|
-
clientId: import_zod.z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
|
|
9107
8903
|
scope: import_zod.z.string().optional().describe(
|
|
9108
|
-
'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
8904
|
+
'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.'
|
|
9109
8905
|
),
|
|
9110
8906
|
// Date window.
|
|
9111
8907
|
createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
|
|
@@ -9124,7 +8920,7 @@ var inputSchema = {
|
|
|
9124
8920
|
var hybridSearch = ({ client, log }) => ({
|
|
9125
8921
|
name: "hybrid_search",
|
|
9126
8922
|
title: "Hybrid search",
|
|
9127
|
-
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/
|
|
8923
|
+
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\".",
|
|
9128
8924
|
inputSchema,
|
|
9129
8925
|
handler: async (args) => {
|
|
9130
8926
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
@@ -9142,8 +8938,6 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9142
8938
|
typeName: args.typeName,
|
|
9143
8939
|
filters: args.filters,
|
|
9144
8940
|
userId: args.userId,
|
|
9145
|
-
orgId: args.orgId,
|
|
9146
|
-
clientId: args.clientId,
|
|
9147
8941
|
scope: args.scope,
|
|
9148
8942
|
createdAfter: args.createdAfter,
|
|
9149
8943
|
createdBefore: args.createdBefore,
|
|
@@ -9228,10 +9022,8 @@ var inputSchema2 = {
|
|
|
9228
9022
|
),
|
|
9229
9023
|
// List-mode args:
|
|
9230
9024
|
userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9231
|
-
orgId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this org."),
|
|
9232
|
-
clientId: import_zod2.z.string().optional().describe("List mode: scope to records associated with this client."),
|
|
9233
9025
|
scope: import_zod2.z.string().optional().describe(
|
|
9234
|
-
'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
9026
|
+
'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.'
|
|
9235
9027
|
),
|
|
9236
9028
|
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."),
|
|
9237
9029
|
limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
|
|
@@ -9241,7 +9033,7 @@ var inputSchema2 = {
|
|
|
9241
9033
|
var recordQuery = ({ client, log }) => ({
|
|
9242
9034
|
name: "record_query",
|
|
9243
9035
|
title: "Record query (list or lookup)",
|
|
9244
|
-
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
|
|
9036
|
+
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.",
|
|
9245
9037
|
inputSchema: inputSchema2,
|
|
9246
9038
|
handler: async (args) => {
|
|
9247
9039
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
@@ -9295,8 +9087,6 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9295
9087
|
page = await client.records.listRecords({
|
|
9296
9088
|
type,
|
|
9297
9089
|
userId: args.userId,
|
|
9298
|
-
orgId: args.orgId,
|
|
9299
|
-
clientId: args.clientId,
|
|
9300
9090
|
scope: args.scope,
|
|
9301
9091
|
startFrom,
|
|
9302
9092
|
limit
|
|
@@ -9431,10 +9221,8 @@ var inputSchema4 = {
|
|
|
9431
9221
|
status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
9432
9222
|
folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
|
|
9433
9223
|
userId: import_zod4.z.string().optional().describe("Owning user id."),
|
|
9434
|
-
orgId: import_zod4.z.string().optional().describe("Owning organization id."),
|
|
9435
|
-
clientId: import_zod4.z.string().optional().describe("Associated client id."),
|
|
9436
9224
|
scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
|
|
9437
|
-
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). 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.
|
|
9225
|
+
'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.'
|
|
9438
9226
|
)
|
|
9439
9227
|
};
|
|
9440
9228
|
var recordCreate = ({ client, log }) => ({
|
|
@@ -9454,8 +9242,6 @@ var recordCreate = ({ client, log }) => ({
|
|
|
9454
9242
|
status: args.status,
|
|
9455
9243
|
folderId: args.folderId,
|
|
9456
9244
|
userId: args.userId,
|
|
9457
|
-
orgId: args.orgId,
|
|
9458
|
-
clientId: args.clientId,
|
|
9459
9245
|
scopes: args.scopes
|
|
9460
9246
|
}
|
|
9461
9247
|
});
|
|
@@ -9559,10 +9345,8 @@ var inputSchema7 = {
|
|
|
9559
9345
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
9560
9346
|
// whole-tenant corpus.
|
|
9561
9347
|
userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
9562
|
-
orgId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
|
|
9563
|
-
clientId: import_zod7.z.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
|
|
9564
9348
|
scope: import_zod7.z.string().optional().describe(
|
|
9565
|
-
'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
9349
|
+
'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.'
|
|
9566
9350
|
),
|
|
9567
9351
|
folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
9568
9352
|
rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
@@ -9590,8 +9374,6 @@ var ragAsk = ({ client, log }) => ({
|
|
|
9590
9374
|
mode: searchArg.mode ?? "HYBRID",
|
|
9591
9375
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
9592
9376
|
userId: searchArg.userId,
|
|
9593
|
-
orgId: searchArg.orgId,
|
|
9594
|
-
clientId: searchArg.clientId,
|
|
9595
9377
|
scope: searchArg.scope,
|
|
9596
9378
|
folderId: searchArg.folderId,
|
|
9597
9379
|
rootFolderId: searchArg.rootFolderId,
|
|
@@ -9737,32 +9519,32 @@ var inputSchema9 = {
|
|
|
9737
9519
|
userId: import_zod9.z.string().optional().describe(
|
|
9738
9520
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
9739
9521
|
),
|
|
9740
|
-
|
|
9741
|
-
|
|
9522
|
+
scope: import_zod9.z.string().optional().describe(
|
|
9523
|
+
'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.'
|
|
9742
9524
|
),
|
|
9743
|
-
surface: import_zod9.z.enum(["record", "document", "user", "
|
|
9744
|
-
"Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types.
|
|
9525
|
+
surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
9526
|
+
"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."
|
|
9745
9527
|
),
|
|
9746
9528
|
recordType: import_zod9.z.string().optional().describe(
|
|
9747
|
-
'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|
|
|
9529
|
+
'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.'
|
|
9748
9530
|
)
|
|
9749
9531
|
};
|
|
9750
9532
|
var listSchemas = ({ client, log }) => ({
|
|
9751
9533
|
name: "list_schemas",
|
|
9752
9534
|
title: "List record schemas",
|
|
9753
|
-
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/
|
|
9535
|
+
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.',
|
|
9754
9536
|
inputSchema: inputSchema9,
|
|
9755
9537
|
handler: async (args) => {
|
|
9756
9538
|
const userId = args.userId;
|
|
9757
|
-
const
|
|
9539
|
+
const scope = args.scope;
|
|
9758
9540
|
const surface = args.surface;
|
|
9759
9541
|
const recordType = args.recordType;
|
|
9760
9542
|
try {
|
|
9761
9543
|
const schemas = await drainPages(
|
|
9762
|
-
(startFrom) => client.schemas.listSchemas({ userId,
|
|
9544
|
+
(startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
|
|
9763
9545
|
);
|
|
9764
9546
|
log.debug(
|
|
9765
|
-
{ tool: "list_schemas", userId,
|
|
9547
|
+
{ tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
|
|
9766
9548
|
"list_schemas ok"
|
|
9767
9549
|
);
|
|
9768
9550
|
return {
|
|
@@ -9887,10 +9669,8 @@ var inputSchema11 = {
|
|
|
9887
9669
|
// List-mode args:
|
|
9888
9670
|
folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
9889
9671
|
userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
9890
|
-
orgId: import_zod11.z.string().optional().describe("List mode: scope to documents belonging to this org."),
|
|
9891
|
-
clientId: import_zod11.z.string().optional().describe("List mode: scope to documents associated with this client."),
|
|
9892
9672
|
scope: import_zod11.z.string().optional().describe(
|
|
9893
|
-
'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
9673
|
+
'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.'
|
|
9894
9674
|
),
|
|
9895
9675
|
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."),
|
|
9896
9676
|
limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
@@ -9900,7 +9680,7 @@ var inputSchema11 = {
|
|
|
9900
9680
|
var documentQuery = ({ client, log }) => ({
|
|
9901
9681
|
name: "document_query",
|
|
9902
9682
|
title: "Document query (list or lookup)",
|
|
9903
|
-
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`/`
|
|
9683
|
+
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.",
|
|
9904
9684
|
inputSchema: inputSchema11,
|
|
9905
9685
|
handler: async (args) => {
|
|
9906
9686
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
@@ -9960,8 +9740,6 @@ var documentQuery = ({ client, log }) => ({
|
|
|
9960
9740
|
page = await client.documents.listDocuments({
|
|
9961
9741
|
folderId: args.folderId,
|
|
9962
9742
|
userId: args.userId,
|
|
9963
|
-
orgId: args.orgId,
|
|
9964
|
-
clientId: args.clientId,
|
|
9965
9743
|
scope: args.scope,
|
|
9966
9744
|
startFrom,
|
|
9967
9745
|
limit
|
|
@@ -10002,8 +9780,9 @@ var inputSchema12 = {
|
|
|
10002
9780
|
"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."
|
|
10003
9781
|
),
|
|
10004
9782
|
userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
10005
|
-
|
|
10006
|
-
|
|
9783
|
+
scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
|
|
9784
|
+
'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).'
|
|
9785
|
+
),
|
|
10007
9786
|
expectedVersion: import_zod12.z.number().int().optional().describe(
|
|
10008
9787
|
"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."
|
|
10009
9788
|
)
|
|
@@ -10023,8 +9802,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10023
9802
|
const folderId = args.folderId;
|
|
10024
9803
|
const status = args.status;
|
|
10025
9804
|
const userId = args.userId;
|
|
10026
|
-
const
|
|
10027
|
-
const clientId = args.clientId;
|
|
9805
|
+
const scopes = args.scopes;
|
|
10028
9806
|
const expectedVersion = args.expectedVersion;
|
|
10029
9807
|
try {
|
|
10030
9808
|
const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
|
|
@@ -10036,8 +9814,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10036
9814
|
if (folderId !== void 0) body.folderId = folderId;
|
|
10037
9815
|
if (status !== void 0) body.status = status;
|
|
10038
9816
|
if (userId !== void 0) body.userId = userId;
|
|
10039
|
-
if (
|
|
10040
|
-
if (clientId !== void 0) body.clientId = clientId;
|
|
9817
|
+
if (scopes !== void 0) body.scopes = scopes;
|
|
10041
9818
|
if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
|
|
10042
9819
|
const updated = await client.documents.patchDocument({
|
|
10043
9820
|
id: resolved.id,
|
|
@@ -10087,8 +9864,9 @@ var inputSchema14 = {
|
|
|
10087
9864
|
id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
10088
9865
|
parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
10089
9866
|
userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
10090
|
-
|
|
10091
|
-
|
|
9867
|
+
scope: import_zod14.z.string().optional().describe(
|
|
9868
|
+
'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.'
|
|
9869
|
+
),
|
|
10092
9870
|
startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
10093
9871
|
limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
10094
9872
|
`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\`.`
|
|
@@ -10097,7 +9875,7 @@ var inputSchema14 = {
|
|
|
10097
9875
|
var folderQuery = ({ client, log }) => ({
|
|
10098
9876
|
name: "folder_query",
|
|
10099
9877
|
title: "Folder query (list or get)",
|
|
10100
|
-
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
|
|
9878
|
+
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.",
|
|
10101
9879
|
inputSchema: inputSchema14,
|
|
10102
9880
|
handler: async (args) => {
|
|
10103
9881
|
const id = args.id;
|
|
@@ -10111,8 +9889,7 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10111
9889
|
const page = await client.folders.listFolders({
|
|
10112
9890
|
parentFolderId: args.parentId,
|
|
10113
9891
|
userId: args.userId,
|
|
10114
|
-
|
|
10115
|
-
clientId: args.clientId,
|
|
9892
|
+
scope: args.scope,
|
|
10116
9893
|
startFrom: args.startFrom,
|
|
10117
9894
|
limit
|
|
10118
9895
|
});
|
|
@@ -10136,10 +9913,8 @@ var inputSchema15 = {
|
|
|
10136
9913
|
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."),
|
|
10137
9914
|
slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
|
|
10138
9915
|
userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
|
|
10139
|
-
orgId: import_zod15.z.string().optional().describe("Owning org (Vectros UUID)."),
|
|
10140
|
-
clientId: import_zod15.z.string().optional().describe("Associated client (Vectros UUID)."),
|
|
10141
9916
|
scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
|
10142
|
-
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). 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.
|
|
9917
|
+
'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.'
|
|
10143
9918
|
)
|
|
10144
9919
|
};
|
|
10145
9920
|
var folderCreate = ({ client, log }) => ({
|
|
@@ -10156,8 +9931,6 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10156
9931
|
parentFolderId: args.parentId,
|
|
10157
9932
|
slug: args.slug,
|
|
10158
9933
|
userId: args.userId,
|
|
10159
|
-
orgId: args.orgId,
|
|
10160
|
-
clientId: args.clientId,
|
|
10161
9934
|
scopes: args.scopes
|
|
10162
9935
|
}
|
|
10163
9936
|
});
|
|
@@ -10178,8 +9951,9 @@ var inputSchema16 = {
|
|
|
10178
9951
|
name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
10179
9952
|
description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
|
|
10180
9953
|
userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
10181
|
-
|
|
10182
|
-
|
|
9954
|
+
scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
|
|
9955
|
+
'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).'
|
|
9956
|
+
),
|
|
10183
9957
|
expectedVersion: import_zod16.z.number().int().optional().describe(
|
|
10184
9958
|
"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."
|
|
10185
9959
|
)
|
|
@@ -10194,16 +9968,14 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10194
9968
|
const name = args.name;
|
|
10195
9969
|
const description = args.description;
|
|
10196
9970
|
const userId = args.userId;
|
|
10197
|
-
const
|
|
10198
|
-
const clientId = args.clientId;
|
|
9971
|
+
const scopes = args.scopes;
|
|
10199
9972
|
const expectedVersion = args.expectedVersion;
|
|
10200
9973
|
try {
|
|
10201
9974
|
const body = {};
|
|
10202
9975
|
if (name !== void 0) body.name = name;
|
|
10203
9976
|
if (description !== void 0) body.description = description;
|
|
10204
9977
|
if (userId !== void 0) body.userId = userId;
|
|
10205
|
-
if (
|
|
10206
|
-
if (clientId !== void 0) body.clientId = clientId;
|
|
9978
|
+
if (scopes !== void 0) body.scopes = scopes;
|
|
10207
9979
|
if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
|
|
10208
9980
|
const updated = await client.folders.patchFolder({ id, body });
|
|
10209
9981
|
log.debug({ tool: "folder_update", id }, "folder_update ok");
|
|
@@ -10369,10 +10141,8 @@ var inputSchema19 = {
|
|
|
10369
10141
|
// Common (both modes):
|
|
10370
10142
|
folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
10371
10143
|
userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
|
|
10372
|
-
orgId: import_zod18.z.string().optional().describe("Owning org ID. Optional."),
|
|
10373
|
-
clientId: import_zod18.z.string().optional().describe("Owning client ID. Optional."),
|
|
10374
10144
|
scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
|
|
10375
|
-
"TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). 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.
|
|
10145
|
+
"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."
|
|
10376
10146
|
)
|
|
10377
10147
|
};
|
|
10378
10148
|
var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
@@ -10420,9 +10190,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10420
10190
|
payload: args.payload,
|
|
10421
10191
|
schemaId,
|
|
10422
10192
|
externalId: args.externalId,
|
|
10423
|
-
userId: args.userId
|
|
10424
|
-
orgId: args.orgId,
|
|
10425
|
-
clientId: args.clientId
|
|
10193
|
+
userId: args.userId
|
|
10426
10194
|
};
|
|
10427
10195
|
try {
|
|
10428
10196
|
if (text) {
|
|
@@ -10529,7 +10297,9 @@ var import_zod19 = require("zod");
|
|
|
10529
10297
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
10530
10298
|
var MCP_MAX_LIMIT5 = 100;
|
|
10531
10299
|
var inputSchema20 = {
|
|
10532
|
-
kind: import_zod19.z.
|
|
10300
|
+
kind: import_zod19.z.string().describe(
|
|
10301
|
+
'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
|
|
10302
|
+
),
|
|
10533
10303
|
externalId: import_zod19.z.string().optional().describe(
|
|
10534
10304
|
"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."
|
|
10535
10305
|
),
|
|
@@ -10548,11 +10318,12 @@ var inputSchema20 = {
|
|
|
10548
10318
|
};
|
|
10549
10319
|
var lookupPrincipal = ({ client, log }) => ({
|
|
10550
10320
|
name: "lookup_principal",
|
|
10551
|
-
title: "Look up a user
|
|
10552
|
-
description: "Resolve a user,
|
|
10321
|
+
title: "Look up a user identity or a namespaced identity entity",
|
|
10322
|
+
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.",
|
|
10553
10323
|
inputSchema: inputSchema20,
|
|
10554
10324
|
handler: async (args) => {
|
|
10555
10325
|
const kind = args.kind;
|
|
10326
|
+
const isUser = kind === "user";
|
|
10556
10327
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
|
|
10557
10328
|
const externalId = args.externalId;
|
|
10558
10329
|
const type = args.type;
|
|
@@ -10566,13 +10337,7 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10566
10337
|
try {
|
|
10567
10338
|
let page;
|
|
10568
10339
|
if (externalId !== void 0) {
|
|
10569
|
-
|
|
10570
|
-
page = await client.identity.listUsers({ externalId, limit });
|
|
10571
|
-
} else if (kind === "org") {
|
|
10572
|
-
page = await client.identity.listOrgs({ externalId, limit });
|
|
10573
|
-
} else {
|
|
10574
|
-
page = await client.identity.listClients({ externalId, limit });
|
|
10575
|
-
}
|
|
10340
|
+
page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
|
|
10576
10341
|
log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
|
|
10577
10342
|
} else if (field !== void 0) {
|
|
10578
10343
|
const hasEquality = value !== void 0;
|
|
@@ -10601,13 +10366,7 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10601
10366
|
);
|
|
10602
10367
|
}
|
|
10603
10368
|
const req = { type, field, value, from, to, prefix, order, startFrom, limit };
|
|
10604
|
-
|
|
10605
|
-
page = await client.identity.lookupUsers(req);
|
|
10606
|
-
} else if (kind === "org") {
|
|
10607
|
-
page = await client.identity.lookupOrgs(req);
|
|
10608
|
-
} else {
|
|
10609
|
-
page = await client.identity.lookupClients(req);
|
|
10610
|
-
}
|
|
10369
|
+
page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
|
|
10611
10370
|
log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
|
|
10612
10371
|
} else {
|
|
10613
10372
|
return toolError(
|
|
@@ -11063,6 +10822,133 @@ function parseToolsEnv(value) {
|
|
|
11063
10822
|
return requested;
|
|
11064
10823
|
}
|
|
11065
10824
|
|
|
10825
|
+
// src/resolve-key.ts
|
|
10826
|
+
var import_node_child_process = require("child_process");
|
|
10827
|
+
var import_node_fs = require("fs");
|
|
10828
|
+
var import_node_path2 = __toESM(require("path"));
|
|
10829
|
+
var HELPER_COMMAND = "vectros";
|
|
10830
|
+
var HELPER_TIMEOUT_MS = 1e4;
|
|
10831
|
+
var HELPER_MAX_BUFFER = 64 * 1024;
|
|
10832
|
+
var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
|
|
10833
|
+
var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
|
|
10834
|
+
var DETAIL_MAX_CHARS = 200;
|
|
10835
|
+
async function resolveApiKey(deps = {}) {
|
|
10836
|
+
const env = deps.env ?? process.env;
|
|
10837
|
+
const envKey = env.VECTROS_API_KEY;
|
|
10838
|
+
if (envKey && envKey.trim().length > 0) {
|
|
10839
|
+
return { key: envKey.trim(), source: "env" };
|
|
10840
|
+
}
|
|
10841
|
+
const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
|
|
10842
|
+
if (alias !== void 0 && !ALIAS_RE.test(alias)) {
|
|
10843
|
+
return {
|
|
10844
|
+
source: "none",
|
|
10845
|
+
reason: "bad-alias",
|
|
10846
|
+
detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
|
|
10847
|
+
};
|
|
10848
|
+
}
|
|
10849
|
+
const runHelper = deps.runHelper ?? defaultRunHelper;
|
|
10850
|
+
const outcome = await runHelper({ alias, env });
|
|
10851
|
+
switch (outcome.status) {
|
|
10852
|
+
case "ok":
|
|
10853
|
+
return { key: outcome.secret, source: "keyring", alias };
|
|
10854
|
+
case "cli-absent":
|
|
10855
|
+
return { source: "none", reason: "cli-absent", alias };
|
|
10856
|
+
// Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
|
|
10857
|
+
// seam, so redacting only inside the default implementation would leave any
|
|
10858
|
+
// other implementation's text to reach the fatal log raw. Belongs at the sink.
|
|
10859
|
+
case "no-usable-key":
|
|
10860
|
+
return {
|
|
10861
|
+
source: "none",
|
|
10862
|
+
reason: "no-usable-key",
|
|
10863
|
+
alias,
|
|
10864
|
+
detail: outcome.detail ? redactDetail(outcome.detail) : void 0
|
|
10865
|
+
};
|
|
10866
|
+
case "error":
|
|
10867
|
+
return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
|
|
10868
|
+
}
|
|
10869
|
+
}
|
|
10870
|
+
function noKeyMessage(resolved) {
|
|
10871
|
+
const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
|
|
10872
|
+
switch (resolved.reason) {
|
|
10873
|
+
case "cli-absent":
|
|
10874
|
+
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>\`.`;
|
|
10875
|
+
case "no-usable-key":
|
|
10876
|
+
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}.`;
|
|
10877
|
+
case "bad-alias":
|
|
10878
|
+
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}.`;
|
|
10879
|
+
case "helper-failed":
|
|
10880
|
+
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.`;
|
|
10881
|
+
default:
|
|
10882
|
+
return `no API key: ${setEnv}.`;
|
|
10883
|
+
}
|
|
10884
|
+
}
|
|
10885
|
+
function keyringNotice(resolved) {
|
|
10886
|
+
if (resolved.source !== "keyring") return void 0;
|
|
10887
|
+
if (resolved.alias !== void 0) {
|
|
10888
|
+
return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
|
|
10889
|
+
}
|
|
10890
|
+
return {
|
|
10891
|
+
level: "warn",
|
|
10892
|
+
alias: "(active)",
|
|
10893
|
+
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."
|
|
10894
|
+
};
|
|
10895
|
+
}
|
|
10896
|
+
function redactDetail(message) {
|
|
10897
|
+
const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
|
|
10898
|
+
return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
|
|
10899
|
+
}
|
|
10900
|
+
function resolveCommandPath(command, env, platform = process.platform) {
|
|
10901
|
+
const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
|
|
10902
|
+
if (!pathVar) return void 0;
|
|
10903
|
+
const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
|
|
10904
|
+
for (const rawDir of pathVar.split(import_node_path2.default.delimiter)) {
|
|
10905
|
+
const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
|
|
10906
|
+
if (!dir || !import_node_path2.default.isAbsolute(dir)) continue;
|
|
10907
|
+
for (const ext of exts) {
|
|
10908
|
+
const candidate = import_node_path2.default.join(dir, command + ext);
|
|
10909
|
+
try {
|
|
10910
|
+
if ((0, import_node_fs.statSync)(candidate).isFile()) return candidate;
|
|
10911
|
+
} catch {
|
|
10912
|
+
}
|
|
10913
|
+
}
|
|
10914
|
+
}
|
|
10915
|
+
return void 0;
|
|
10916
|
+
}
|
|
10917
|
+
function mapExecResult(err, stdout, stderr = "") {
|
|
10918
|
+
if (!err) {
|
|
10919
|
+
const secret = stdout.trim();
|
|
10920
|
+
return secret ? { status: "ok", secret } : { status: "no-usable-key" };
|
|
10921
|
+
}
|
|
10922
|
+
const code = err.code;
|
|
10923
|
+
if (code === "ENOENT") return { status: "cli-absent" };
|
|
10924
|
+
const detail = redactDetail(stderr.trim() || err.message);
|
|
10925
|
+
if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
|
|
10926
|
+
return { status: "error", detail };
|
|
10927
|
+
}
|
|
10928
|
+
function defaultRunHelper({ alias, env }, deps = {}) {
|
|
10929
|
+
const platform = deps.platform ?? process.platform;
|
|
10930
|
+
const exec = deps.execFileImpl ?? import_node_child_process.execFile;
|
|
10931
|
+
const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
|
|
10932
|
+
if (!resolved) return Promise.resolve({ status: "cli-absent" });
|
|
10933
|
+
const isWindows = platform === "win32";
|
|
10934
|
+
const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
|
|
10935
|
+
const file = isWindows ? `"${resolved}"` : resolved;
|
|
10936
|
+
return new Promise((resolve2) => {
|
|
10937
|
+
exec(
|
|
10938
|
+
file,
|
|
10939
|
+
args,
|
|
10940
|
+
{
|
|
10941
|
+
env,
|
|
10942
|
+
timeout: HELPER_TIMEOUT_MS,
|
|
10943
|
+
maxBuffer: HELPER_MAX_BUFFER,
|
|
10944
|
+
windowsHide: true,
|
|
10945
|
+
shell: isWindows
|
|
10946
|
+
},
|
|
10947
|
+
(err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
|
|
10948
|
+
);
|
|
10949
|
+
});
|
|
10950
|
+
}
|
|
10951
|
+
|
|
11066
10952
|
// src/cli.ts
|
|
11067
10953
|
async function main() {
|
|
11068
10954
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
@@ -11071,7 +10957,14 @@ async function main() {
|
|
|
11071
10957
|
process.exit(0);
|
|
11072
10958
|
}
|
|
11073
10959
|
const log = createLogger2();
|
|
11074
|
-
const
|
|
10960
|
+
const resolved = await resolveApiKey();
|
|
10961
|
+
const apiKey = resolved.key;
|
|
10962
|
+
const notice = keyringNotice(resolved);
|
|
10963
|
+
if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
|
|
10964
|
+
if (!apiKey) {
|
|
10965
|
+
log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
|
|
10966
|
+
process.exit(1);
|
|
10967
|
+
}
|
|
11075
10968
|
const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
|
|
11076
10969
|
if (apiBaseUrl !== void 0) {
|
|
11077
10970
|
try {
|