@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-http.js
CHANGED
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/server.ts
|
|
27
27
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// node_modules/@vectros-ai/sdk/dist/index.mjs
|
|
30
30
|
var __defProp2 = Object.defineProperty;
|
|
31
31
|
var __export = (target, all) => {
|
|
32
32
|
for (var name in all)
|
|
@@ -41,7 +41,6 @@ __export(api_exports, {
|
|
|
41
41
|
BatchWriteRequest: () => BatchWriteRequest,
|
|
42
42
|
BatchWriteResult: () => BatchWriteResult,
|
|
43
43
|
ChatMessage: () => ChatMessage,
|
|
44
|
-
ClientRequest: () => ClientRequest,
|
|
45
44
|
ConflictError: () => ConflictError,
|
|
46
45
|
ContentDeltaEvent: () => ContentDeltaEvent,
|
|
47
46
|
ContentTooLargeError: () => ContentTooLargeError,
|
|
@@ -50,6 +49,7 @@ __export(api_exports, {
|
|
|
50
49
|
DocumentRequest: () => DocumentRequest,
|
|
51
50
|
DocumentResponse: () => DocumentResponse,
|
|
52
51
|
DoneEvent: () => DoneEvent,
|
|
52
|
+
EntityRequest: () => EntityRequest,
|
|
53
53
|
ErasureCertificate: () => ErasureCertificate,
|
|
54
54
|
ErasureRequest: () => ErasureRequest,
|
|
55
55
|
ErasureRequestResponse: () => ErasureRequestResponse,
|
|
@@ -62,15 +62,13 @@ __export(api_exports, {
|
|
|
62
62
|
ForbiddenError: () => ForbiddenError,
|
|
63
63
|
IdentityLookupRequest: () => IdentityLookupRequest,
|
|
64
64
|
InternalServerError: () => InternalServerError,
|
|
65
|
-
|
|
66
|
-
ListOrgsRequestOrder: () => ListOrgsRequestOrder,
|
|
65
|
+
ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
|
|
67
66
|
ListUsersRequestOrder: () => ListUsersRequestOrder,
|
|
68
67
|
LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
|
|
69
68
|
LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
|
|
70
69
|
ModelDataVersionResponse: () => ModelDataVersionResponse,
|
|
71
70
|
NotFoundError: () => NotFoundError,
|
|
72
71
|
NotImplementedError: () => NotImplementedError,
|
|
73
|
-
OrgRequest: () => OrgRequest,
|
|
74
72
|
PaymentRequiredError: () => PaymentRequiredError,
|
|
75
73
|
PingResponse: () => PingResponse,
|
|
76
74
|
RagSearch: () => RagSearch,
|
|
@@ -311,11 +309,6 @@ var UnauthorizedError = class extends VectrosError {
|
|
|
311
309
|
var auth_exports = {};
|
|
312
310
|
var ErasureRequest;
|
|
313
311
|
((ErasureRequest2) => {
|
|
314
|
-
ErasureRequest2.SubjectType = {
|
|
315
|
-
User: "user",
|
|
316
|
-
Client: "client",
|
|
317
|
-
Org: "org"
|
|
318
|
-
};
|
|
319
312
|
ErasureRequest2.AuditDisposition = {
|
|
320
313
|
RetainRedacted: "retain-redacted",
|
|
321
314
|
Purge: "purge"
|
|
@@ -327,11 +320,6 @@ var ExportRequest;
|
|
|
327
320
|
Tenant: "tenant",
|
|
328
321
|
Subject: "subject"
|
|
329
322
|
};
|
|
330
|
-
ExportRequest2.SubjectType = {
|
|
331
|
-
User: "user",
|
|
332
|
-
Client: "client",
|
|
333
|
-
Org: "org"
|
|
334
|
-
};
|
|
335
323
|
ExportRequest2.Format = {
|
|
336
324
|
Ndjson: "ndjson"
|
|
337
325
|
};
|
|
@@ -370,15 +358,10 @@ var LookupDocumentsRequestOrder = {
|
|
|
370
358
|
var folders_exports = {};
|
|
371
359
|
var identity_exports = {};
|
|
372
360
|
__export(identity_exports, {
|
|
373
|
-
|
|
374
|
-
ListOrgsRequestOrder: () => ListOrgsRequestOrder,
|
|
361
|
+
ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
|
|
375
362
|
ListUsersRequestOrder: () => ListUsersRequestOrder
|
|
376
363
|
});
|
|
377
|
-
var
|
|
378
|
-
Asc: "asc",
|
|
379
|
-
Desc: "desc"
|
|
380
|
-
};
|
|
381
|
-
var ListOrgsRequestOrder = {
|
|
364
|
+
var ListEntitiesRequestOrder = {
|
|
382
365
|
Asc: "asc",
|
|
383
366
|
Desc: "desc"
|
|
384
367
|
};
|
|
@@ -477,13 +460,6 @@ var ChatMessage;
|
|
|
477
460
|
Assistant: "assistant"
|
|
478
461
|
};
|
|
479
462
|
})(ChatMessage || (ChatMessage = {}));
|
|
480
|
-
var ClientRequest;
|
|
481
|
-
((ClientRequest2) => {
|
|
482
|
-
ClientRequest2.Status = {
|
|
483
|
-
Active: "ACTIVE",
|
|
484
|
-
Suspended: "SUSPENDED"
|
|
485
|
-
};
|
|
486
|
-
})(ClientRequest || (ClientRequest = {}));
|
|
487
463
|
var ContentDeltaEvent;
|
|
488
464
|
((ContentDeltaEvent2) => {
|
|
489
465
|
ContentDeltaEvent2.Event = {
|
|
@@ -538,6 +514,13 @@ var DoneEvent;
|
|
|
538
514
|
Done: "done"
|
|
539
515
|
};
|
|
540
516
|
})(DoneEvent || (DoneEvent = {}));
|
|
517
|
+
var EntityRequest;
|
|
518
|
+
((EntityRequest2) => {
|
|
519
|
+
EntityRequest2.Status = {
|
|
520
|
+
Active: "ACTIVE",
|
|
521
|
+
Suspended: "SUSPENDED"
|
|
522
|
+
};
|
|
523
|
+
})(EntityRequest || (EntityRequest = {}));
|
|
541
524
|
var ErasureCertificate;
|
|
542
525
|
((ErasureCertificate2) => {
|
|
543
526
|
ErasureCertificate2.AuditDisposition = {
|
|
@@ -553,11 +536,6 @@ var ErasureRequestResponse;
|
|
|
553
536
|
Completed: "completed",
|
|
554
537
|
Failed: "failed"
|
|
555
538
|
};
|
|
556
|
-
ErasureRequestResponse2.SubjectType = {
|
|
557
|
-
User: "user",
|
|
558
|
-
Client: "client",
|
|
559
|
-
Org: "org"
|
|
560
|
-
};
|
|
561
539
|
})(ErasureRequestResponse || (ErasureRequestResponse = {}));
|
|
562
540
|
var ErrorEvent;
|
|
563
541
|
((ErrorEvent2) => {
|
|
@@ -583,11 +561,6 @@ var ExportRequestResponse;
|
|
|
583
561
|
Tenant: "tenant",
|
|
584
562
|
Subject: "subject"
|
|
585
563
|
};
|
|
586
|
-
ExportRequestResponse2.SubjectType = {
|
|
587
|
-
User: "user",
|
|
588
|
-
Client: "client",
|
|
589
|
-
Org: "org"
|
|
590
|
-
};
|
|
591
564
|
})(ExportRequestResponse || (ExportRequestResponse = {}));
|
|
592
565
|
var FieldDef;
|
|
593
566
|
((FieldDef2) => {
|
|
@@ -601,13 +574,6 @@ var FieldDef;
|
|
|
601
574
|
Object: "object",
|
|
602
575
|
Reference: "reference"
|
|
603
576
|
};
|
|
604
|
-
FieldDef2.TargetSurface = {
|
|
605
|
-
Record: "record",
|
|
606
|
-
Document: "document",
|
|
607
|
-
User: "user",
|
|
608
|
-
Org: "org",
|
|
609
|
-
Client: "client"
|
|
610
|
-
};
|
|
611
577
|
})(FieldDef || (FieldDef = {}));
|
|
612
578
|
var IdentityLookupRequest;
|
|
613
579
|
((IdentityLookupRequest2) => {
|
|
@@ -624,13 +590,6 @@ var ModelDataVersionResponse;
|
|
|
624
590
|
Delete: "DELETE"
|
|
625
591
|
};
|
|
626
592
|
})(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
|
|
627
|
-
var OrgRequest;
|
|
628
|
-
((OrgRequest2) => {
|
|
629
|
-
OrgRequest2.Status = {
|
|
630
|
-
Active: "ACTIVE",
|
|
631
|
-
Suspended: "SUSPENDED"
|
|
632
|
-
};
|
|
633
|
-
})(OrgRequest || (OrgRequest = {}));
|
|
634
593
|
var PingResponse;
|
|
635
594
|
((PingResponse2) => {
|
|
636
595
|
PingResponse2.Environment = {
|
|
@@ -660,11 +619,6 @@ var RagSearch;
|
|
|
660
619
|
})(RagSearch || (RagSearch = {}));
|
|
661
620
|
var ReadAccessLogResponse;
|
|
662
621
|
((ReadAccessLogResponse2) => {
|
|
663
|
-
ReadAccessLogResponse2.SubjectType = {
|
|
664
|
-
User: "user",
|
|
665
|
-
Client: "client",
|
|
666
|
-
Org: "org"
|
|
667
|
-
};
|
|
668
622
|
ReadAccessLogResponse2.Action = {
|
|
669
623
|
Read: "read",
|
|
670
624
|
List: "list",
|
|
@@ -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
|
|
|
8820
8618
|
// src/log.ts
|
|
@@ -9099,10 +8897,8 @@ var inputSchema = {
|
|
|
9099
8897
|
),
|
|
9100
8898
|
// Ownership.
|
|
9101
8899
|
userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9102
|
-
orgId: import_zod.z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
|
|
9103
|
-
clientId: import_zod.z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
|
|
9104
8900
|
scope: import_zod.z.string().optional().describe(
|
|
9105
|
-
'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
8901
|
+
'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9106
8902
|
),
|
|
9107
8903
|
// Date window.
|
|
9108
8904
|
createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
|
|
@@ -9121,7 +8917,7 @@ var inputSchema = {
|
|
|
9121
8917
|
var hybridSearch = ({ client, log }) => ({
|
|
9122
8918
|
name: "hybrid_search",
|
|
9123
8919
|
title: "Hybrid search",
|
|
9124
|
-
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/
|
|
8920
|
+
description: "Search your tenant's indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/scope), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller's scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:\"OR\".",
|
|
9125
8921
|
inputSchema,
|
|
9126
8922
|
handler: async (args) => {
|
|
9127
8923
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
@@ -9139,8 +8935,6 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9139
8935
|
typeName: args.typeName,
|
|
9140
8936
|
filters: args.filters,
|
|
9141
8937
|
userId: args.userId,
|
|
9142
|
-
orgId: args.orgId,
|
|
9143
|
-
clientId: args.clientId,
|
|
9144
8938
|
scope: args.scope,
|
|
9145
8939
|
createdAfter: args.createdAfter,
|
|
9146
8940
|
createdBefore: args.createdBefore,
|
|
@@ -9225,10 +9019,8 @@ var inputSchema2 = {
|
|
|
9225
9019
|
),
|
|
9226
9020
|
// List-mode args:
|
|
9227
9021
|
userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9228
|
-
orgId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this org."),
|
|
9229
|
-
clientId: import_zod2.z.string().optional().describe("List mode: scope to records associated with this client."),
|
|
9230
9022
|
scope: import_zod2.z.string().optional().describe(
|
|
9231
|
-
'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
9023
|
+
'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9232
9024
|
),
|
|
9233
9025
|
startFrom: import_zod2.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
9234
9026
|
limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
|
|
@@ -9238,7 +9030,7 @@ var inputSchema2 = {
|
|
|
9238
9030
|
var recordQuery = ({ client, log }) => ({
|
|
9239
9031
|
name: "record_query",
|
|
9240
9032
|
title: "Record query (list or lookup)",
|
|
9241
|
-
description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId
|
|
9033
|
+
description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
|
|
9242
9034
|
inputSchema: inputSchema2,
|
|
9243
9035
|
handler: async (args) => {
|
|
9244
9036
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
@@ -9292,8 +9084,6 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9292
9084
|
page = await client.records.listRecords({
|
|
9293
9085
|
type,
|
|
9294
9086
|
userId: args.userId,
|
|
9295
|
-
orgId: args.orgId,
|
|
9296
|
-
clientId: args.clientId,
|
|
9297
9087
|
scope: args.scope,
|
|
9298
9088
|
startFrom,
|
|
9299
9089
|
limit
|
|
@@ -9428,10 +9218,8 @@ var inputSchema4 = {
|
|
|
9428
9218
|
status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
9429
9219
|
folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
|
|
9430
9220
|
userId: import_zod4.z.string().optional().describe("Owning user id."),
|
|
9431
|
-
orgId: import_zod4.z.string().optional().describe("Owning organization id."),
|
|
9432
|
-
clientId: import_zod4.z.string().optional().describe("Associated client id."),
|
|
9433
9221
|
scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
|
|
9434
|
-
'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.
|
|
9222
|
+
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
|
|
9435
9223
|
)
|
|
9436
9224
|
};
|
|
9437
9225
|
var recordCreate = ({ client, log }) => ({
|
|
@@ -9451,8 +9239,6 @@ var recordCreate = ({ client, log }) => ({
|
|
|
9451
9239
|
status: args.status,
|
|
9452
9240
|
folderId: args.folderId,
|
|
9453
9241
|
userId: args.userId,
|
|
9454
|
-
orgId: args.orgId,
|
|
9455
|
-
clientId: args.clientId,
|
|
9456
9242
|
scopes: args.scopes
|
|
9457
9243
|
}
|
|
9458
9244
|
});
|
|
@@ -9556,10 +9342,8 @@ var inputSchema7 = {
|
|
|
9556
9342
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
9557
9343
|
// whole-tenant corpus.
|
|
9558
9344
|
userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
9559
|
-
orgId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
|
|
9560
|
-
clientId: import_zod7.z.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
|
|
9561
9345
|
scope: import_zod7.z.string().optional().describe(
|
|
9562
|
-
'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
9346
|
+
'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9563
9347
|
),
|
|
9564
9348
|
folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
9565
9349
|
rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
@@ -9587,8 +9371,6 @@ var ragAsk = ({ client, log }) => ({
|
|
|
9587
9371
|
mode: searchArg.mode ?? "HYBRID",
|
|
9588
9372
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
9589
9373
|
userId: searchArg.userId,
|
|
9590
|
-
orgId: searchArg.orgId,
|
|
9591
|
-
clientId: searchArg.clientId,
|
|
9592
9374
|
scope: searchArg.scope,
|
|
9593
9375
|
folderId: searchArg.folderId,
|
|
9594
9376
|
rootFolderId: searchArg.rootFolderId,
|
|
@@ -9734,32 +9516,32 @@ var inputSchema9 = {
|
|
|
9734
9516
|
userId: import_zod9.z.string().optional().describe(
|
|
9735
9517
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
9736
9518
|
),
|
|
9737
|
-
|
|
9738
|
-
|
|
9519
|
+
scope: import_zod9.z.string().optional().describe(
|
|
9520
|
+
'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces. Optional; default returns all schemas the credential can see.'
|
|
9739
9521
|
),
|
|
9740
|
-
surface: import_zod9.z.enum(["record", "document", "user", "
|
|
9741
|
-
"Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types.
|
|
9522
|
+
surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
9523
|
+
"Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. Identity entities in any namespace (org/client/one you registered) bind under the single `entity` surface; `user` and `entity` are account-wide. Optional."
|
|
9742
9524
|
),
|
|
9743
9525
|
recordType: import_zod9.z.string().optional().describe(
|
|
9744
|
-
'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|
|
|
9526
|
+
'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|entity` for an identity schema. Takes precedence over userId. Optional.'
|
|
9745
9527
|
)
|
|
9746
9528
|
};
|
|
9747
9529
|
var listSchemas = ({ client, log }) => ({
|
|
9748
9530
|
name: "list_schemas",
|
|
9749
9531
|
title: "List record schemas",
|
|
9750
|
-
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/
|
|
9532
|
+
description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/entity \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`scope`; default returns everything the credential can see.',
|
|
9751
9533
|
inputSchema: inputSchema9,
|
|
9752
9534
|
handler: async (args) => {
|
|
9753
9535
|
const userId = args.userId;
|
|
9754
|
-
const
|
|
9536
|
+
const scope = args.scope;
|
|
9755
9537
|
const surface = args.surface;
|
|
9756
9538
|
const recordType = args.recordType;
|
|
9757
9539
|
try {
|
|
9758
9540
|
const schemas = await drainPages(
|
|
9759
|
-
(startFrom) => client.schemas.listSchemas({ userId,
|
|
9541
|
+
(startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
|
|
9760
9542
|
);
|
|
9761
9543
|
log.debug(
|
|
9762
|
-
{ tool: "list_schemas", userId,
|
|
9544
|
+
{ tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
|
|
9763
9545
|
"list_schemas ok"
|
|
9764
9546
|
);
|
|
9765
9547
|
return {
|
|
@@ -9884,10 +9666,8 @@ var inputSchema11 = {
|
|
|
9884
9666
|
// List-mode args:
|
|
9885
9667
|
folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
9886
9668
|
userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
9887
|
-
orgId: import_zod11.z.string().optional().describe("List mode: scope to documents belonging to this org."),
|
|
9888
|
-
clientId: import_zod11.z.string().optional().describe("List mode: scope to documents associated with this client."),
|
|
9889
9669
|
scope: import_zod11.z.string().optional().describe(
|
|
9890
|
-
'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `
|
|
9670
|
+
'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9891
9671
|
),
|
|
9892
9672
|
startFrom: import_zod11.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
9893
9673
|
limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
@@ -9897,7 +9677,7 @@ var inputSchema11 = {
|
|
|
9897
9677
|
var documentQuery = ({ client, log }) => ({
|
|
9898
9678
|
name: "document_query",
|
|
9899
9679
|
title: "Document query (list or lookup)",
|
|
9900
|
-
description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`
|
|
9680
|
+
description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
|
|
9901
9681
|
inputSchema: inputSchema11,
|
|
9902
9682
|
handler: async (args) => {
|
|
9903
9683
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
@@ -9957,8 +9737,6 @@ var documentQuery = ({ client, log }) => ({
|
|
|
9957
9737
|
page = await client.documents.listDocuments({
|
|
9958
9738
|
folderId: args.folderId,
|
|
9959
9739
|
userId: args.userId,
|
|
9960
|
-
orgId: args.orgId,
|
|
9961
|
-
clientId: args.clientId,
|
|
9962
9740
|
scope: args.scope,
|
|
9963
9741
|
startFrom,
|
|
9964
9742
|
limit
|
|
@@ -9999,8 +9777,9 @@ var inputSchema12 = {
|
|
|
9999
9777
|
"Lifecycle status. `ARCHIVED` soft-retracts the document \u2014 it is pulled from search and recall but kept and recoverable; set it back to `ACTIVE` to re-index and restore it. The way to retire superseded content when the credential has no delete authority. Omit to leave unchanged."
|
|
10000
9778
|
),
|
|
10001
9779
|
userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
10002
|
-
|
|
10003
|
-
|
|
9780
|
+
scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
|
|
9781
|
+
'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
|
|
9782
|
+
),
|
|
10004
9783
|
expectedVersion: import_zod12.z.number().int().optional().describe(
|
|
10005
9784
|
"Optimistic concurrency: the version you last read. If the document changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
10006
9785
|
)
|
|
@@ -10020,8 +9799,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10020
9799
|
const folderId = args.folderId;
|
|
10021
9800
|
const status = args.status;
|
|
10022
9801
|
const userId = args.userId;
|
|
10023
|
-
const
|
|
10024
|
-
const clientId = args.clientId;
|
|
9802
|
+
const scopes = args.scopes;
|
|
10025
9803
|
const expectedVersion = args.expectedVersion;
|
|
10026
9804
|
try {
|
|
10027
9805
|
const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
|
|
@@ -10033,8 +9811,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10033
9811
|
if (folderId !== void 0) body.folderId = folderId;
|
|
10034
9812
|
if (status !== void 0) body.status = status;
|
|
10035
9813
|
if (userId !== void 0) body.userId = userId;
|
|
10036
|
-
if (
|
|
10037
|
-
if (clientId !== void 0) body.clientId = clientId;
|
|
9814
|
+
if (scopes !== void 0) body.scopes = scopes;
|
|
10038
9815
|
if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
|
|
10039
9816
|
const updated = await client.documents.patchDocument({
|
|
10040
9817
|
id: resolved.id,
|
|
@@ -10084,8 +9861,9 @@ var inputSchema14 = {
|
|
|
10084
9861
|
id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
10085
9862
|
parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
10086
9863
|
userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
10087
|
-
|
|
10088
|
-
|
|
9864
|
+
scope: import_zod14.z.string().optional().describe(
|
|
9865
|
+
'List mode: filter to folders carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9866
|
+
),
|
|
10089
9867
|
startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
10090
9868
|
limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
10091
9869
|
`List mode: max folders per page. Default 10; raise up to ${MCP_MAX_LIMIT4} (the folders API max) in one call when you can accept the larger page, or page with \`startFrom\`.`
|
|
@@ -10094,7 +9872,7 @@ var inputSchema14 = {
|
|
|
10094
9872
|
var folderQuery = ({ client, log }) => ({
|
|
10095
9873
|
name: "folder_query",
|
|
10096
9874
|
title: "Folder query (list or get)",
|
|
10097
|
-
description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId
|
|
9875
|
+
description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId` or `scope` (`namespace:value`).\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
|
|
10098
9876
|
inputSchema: inputSchema14,
|
|
10099
9877
|
handler: async (args) => {
|
|
10100
9878
|
const id = args.id;
|
|
@@ -10108,8 +9886,7 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10108
9886
|
const page = await client.folders.listFolders({
|
|
10109
9887
|
parentFolderId: args.parentId,
|
|
10110
9888
|
userId: args.userId,
|
|
10111
|
-
|
|
10112
|
-
clientId: args.clientId,
|
|
9889
|
+
scope: args.scope,
|
|
10113
9890
|
startFrom: args.startFrom,
|
|
10114
9891
|
limit
|
|
10115
9892
|
});
|
|
@@ -10133,10 +9910,8 @@ var inputSchema15 = {
|
|
|
10133
9910
|
parentId: import_zod15.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
|
|
10134
9911
|
slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
|
|
10135
9912
|
userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
|
|
10136
|
-
orgId: import_zod15.z.string().optional().describe("Owning org (Vectros UUID)."),
|
|
10137
|
-
clientId: import_zod15.z.string().optional().describe("Associated client (Vectros UUID)."),
|
|
10138
9913
|
scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
|
10139
|
-
'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.
|
|
9914
|
+
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
|
|
10140
9915
|
)
|
|
10141
9916
|
};
|
|
10142
9917
|
var folderCreate = ({ client, log }) => ({
|
|
@@ -10153,8 +9928,6 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10153
9928
|
parentFolderId: args.parentId,
|
|
10154
9929
|
slug: args.slug,
|
|
10155
9930
|
userId: args.userId,
|
|
10156
|
-
orgId: args.orgId,
|
|
10157
|
-
clientId: args.clientId,
|
|
10158
9931
|
scopes: args.scopes
|
|
10159
9932
|
}
|
|
10160
9933
|
});
|
|
@@ -10175,8 +9948,9 @@ var inputSchema16 = {
|
|
|
10175
9948
|
name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
10176
9949
|
description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
|
|
10177
9950
|
userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
10178
|
-
|
|
10179
|
-
|
|
9951
|
+
scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
|
|
9952
|
+
'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
|
|
9953
|
+
),
|
|
10180
9954
|
expectedVersion: import_zod16.z.number().int().optional().describe(
|
|
10181
9955
|
"Optimistic concurrency: the version you last read. If the folder changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
10182
9956
|
)
|
|
@@ -10191,16 +9965,14 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10191
9965
|
const name = args.name;
|
|
10192
9966
|
const description = args.description;
|
|
10193
9967
|
const userId = args.userId;
|
|
10194
|
-
const
|
|
10195
|
-
const clientId = args.clientId;
|
|
9968
|
+
const scopes = args.scopes;
|
|
10196
9969
|
const expectedVersion = args.expectedVersion;
|
|
10197
9970
|
try {
|
|
10198
9971
|
const body = {};
|
|
10199
9972
|
if (name !== void 0) body.name = name;
|
|
10200
9973
|
if (description !== void 0) body.description = description;
|
|
10201
9974
|
if (userId !== void 0) body.userId = userId;
|
|
10202
|
-
if (
|
|
10203
|
-
if (clientId !== void 0) body.clientId = clientId;
|
|
9975
|
+
if (scopes !== void 0) body.scopes = scopes;
|
|
10204
9976
|
if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
|
|
10205
9977
|
const updated = await client.folders.patchFolder({ id, body });
|
|
10206
9978
|
log.debug({ tool: "folder_update", id }, "folder_update ok");
|
|
@@ -10366,10 +10138,8 @@ var inputSchema19 = {
|
|
|
10366
10138
|
// Common (both modes):
|
|
10367
10139
|
folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
10368
10140
|
userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
|
|
10369
|
-
orgId: import_zod18.z.string().optional().describe("Owning org ID. Optional."),
|
|
10370
|
-
clientId: import_zod18.z.string().optional().describe("Owning client ID. Optional."),
|
|
10371
10141
|
scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
|
|
10372
|
-
"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.
|
|
10142
|
+
"TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
|
|
10373
10143
|
)
|
|
10374
10144
|
};
|
|
10375
10145
|
var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
@@ -10417,9 +10187,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10417
10187
|
payload: args.payload,
|
|
10418
10188
|
schemaId,
|
|
10419
10189
|
externalId: args.externalId,
|
|
10420
|
-
userId: args.userId
|
|
10421
|
-
orgId: args.orgId,
|
|
10422
|
-
clientId: args.clientId
|
|
10190
|
+
userId: args.userId
|
|
10423
10191
|
};
|
|
10424
10192
|
try {
|
|
10425
10193
|
if (text) {
|
|
@@ -10526,7 +10294,9 @@ var import_zod19 = require("zod");
|
|
|
10526
10294
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
10527
10295
|
var MCP_MAX_LIMIT5 = 100;
|
|
10528
10296
|
var inputSchema20 = {
|
|
10529
|
-
kind: import_zod19.z.
|
|
10297
|
+
kind: import_zod19.z.string().describe(
|
|
10298
|
+
'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
|
|
10299
|
+
),
|
|
10530
10300
|
externalId: import_zod19.z.string().optional().describe(
|
|
10531
10301
|
"Resolve mode: your own stable identifier for the principal. Returns the single matching principal (with its Vectros UUID), or an empty array if none. The fastest path to the UUID the ownership filters need. Takes precedence if both this and a `field` lookup are supplied."
|
|
10532
10302
|
),
|
|
@@ -10545,11 +10315,12 @@ var inputSchema20 = {
|
|
|
10545
10315
|
};
|
|
10546
10316
|
var lookupPrincipal = ({ client, log }) => ({
|
|
10547
10317
|
name: "lookup_principal",
|
|
10548
|
-
title: "Look up a user
|
|
10549
|
-
description: "Resolve a user,
|
|
10318
|
+
title: "Look up a user identity or a namespaced identity entity",
|
|
10319
|
+
description: "Resolve a user, or an identity entity in a namespace (org/client/one you registered). Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
|
|
10550
10320
|
inputSchema: inputSchema20,
|
|
10551
10321
|
handler: async (args) => {
|
|
10552
10322
|
const kind = args.kind;
|
|
10323
|
+
const isUser = kind === "user";
|
|
10553
10324
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
|
|
10554
10325
|
const externalId = args.externalId;
|
|
10555
10326
|
const type = args.type;
|
|
@@ -10563,13 +10334,7 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10563
10334
|
try {
|
|
10564
10335
|
let page;
|
|
10565
10336
|
if (externalId !== void 0) {
|
|
10566
|
-
|
|
10567
|
-
page = await client.identity.listUsers({ externalId, limit });
|
|
10568
|
-
} else if (kind === "org") {
|
|
10569
|
-
page = await client.identity.listOrgs({ externalId, limit });
|
|
10570
|
-
} else {
|
|
10571
|
-
page = await client.identity.listClients({ externalId, limit });
|
|
10572
|
-
}
|
|
10337
|
+
page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
|
|
10573
10338
|
log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
|
|
10574
10339
|
} else if (field !== void 0) {
|
|
10575
10340
|
const hasEquality = value !== void 0;
|
|
@@ -10598,13 +10363,7 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10598
10363
|
);
|
|
10599
10364
|
}
|
|
10600
10365
|
const req = { type, field, value, from, to, prefix, order, startFrom, limit };
|
|
10601
|
-
|
|
10602
|
-
page = await client.identity.lookupUsers(req);
|
|
10603
|
-
} else if (kind === "org") {
|
|
10604
|
-
page = await client.identity.lookupOrgs(req);
|
|
10605
|
-
} else {
|
|
10606
|
-
page = await client.identity.lookupClients(req);
|
|
10607
|
-
}
|
|
10366
|
+
page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
|
|
10608
10367
|
log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
|
|
10609
10368
|
} else {
|
|
10610
10369
|
return toolError(
|
|
@@ -11196,10 +10955,144 @@ function parseToolsEnv(value) {
|
|
|
11196
10955
|
return requested;
|
|
11197
10956
|
}
|
|
11198
10957
|
|
|
10958
|
+
// src/resolve-key.ts
|
|
10959
|
+
var import_node_child_process = require("child_process");
|
|
10960
|
+
var import_node_fs = require("fs");
|
|
10961
|
+
var import_node_path2 = __toESM(require("path"));
|
|
10962
|
+
var HELPER_COMMAND = "vectros";
|
|
10963
|
+
var HELPER_TIMEOUT_MS = 1e4;
|
|
10964
|
+
var HELPER_MAX_BUFFER = 64 * 1024;
|
|
10965
|
+
var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
|
|
10966
|
+
var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
|
|
10967
|
+
var DETAIL_MAX_CHARS = 200;
|
|
10968
|
+
async function resolveApiKey(deps = {}) {
|
|
10969
|
+
const env = deps.env ?? process.env;
|
|
10970
|
+
const envKey = env.VECTROS_API_KEY;
|
|
10971
|
+
if (envKey && envKey.trim().length > 0) {
|
|
10972
|
+
return { key: envKey.trim(), source: "env" };
|
|
10973
|
+
}
|
|
10974
|
+
const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
|
|
10975
|
+
if (alias !== void 0 && !ALIAS_RE.test(alias)) {
|
|
10976
|
+
return {
|
|
10977
|
+
source: "none",
|
|
10978
|
+
reason: "bad-alias",
|
|
10979
|
+
detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
|
|
10980
|
+
};
|
|
10981
|
+
}
|
|
10982
|
+
const runHelper = deps.runHelper ?? defaultRunHelper;
|
|
10983
|
+
const outcome = await runHelper({ alias, env });
|
|
10984
|
+
switch (outcome.status) {
|
|
10985
|
+
case "ok":
|
|
10986
|
+
return { key: outcome.secret, source: "keyring", alias };
|
|
10987
|
+
case "cli-absent":
|
|
10988
|
+
return { source: "none", reason: "cli-absent", alias };
|
|
10989
|
+
// Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
|
|
10990
|
+
// seam, so redacting only inside the default implementation would leave any
|
|
10991
|
+
// other implementation's text to reach the fatal log raw. Belongs at the sink.
|
|
10992
|
+
case "no-usable-key":
|
|
10993
|
+
return {
|
|
10994
|
+
source: "none",
|
|
10995
|
+
reason: "no-usable-key",
|
|
10996
|
+
alias,
|
|
10997
|
+
detail: outcome.detail ? redactDetail(outcome.detail) : void 0
|
|
10998
|
+
};
|
|
10999
|
+
case "error":
|
|
11000
|
+
return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
|
|
11001
|
+
}
|
|
11002
|
+
}
|
|
11003
|
+
function noKeyMessage(resolved) {
|
|
11004
|
+
const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
|
|
11005
|
+
switch (resolved.reason) {
|
|
11006
|
+
case "cli-absent":
|
|
11007
|
+
return `no API key: VECTROS_API_KEY is unset and the \`vectros\` CLI is not on PATH. Either ${setEnv}, or install @vectros-ai/cli and run \`vectros switch <alias>\`.`;
|
|
11008
|
+
case "no-usable-key":
|
|
11009
|
+
return `no API key: VECTROS_API_KEY is unset and \`vectros keyring show\` returned no key${resolved.detail ? ` \u2014 ${resolved.detail}` : ""}. Run \`vectros switch <alias>\` to pick an identity, \`vectros keyring doctor\` to inspect the keyring (CLI 0.10.0+), upgrade @vectros-ai/cli if it predates the keyring (0.9.0), or ${setEnv}.`;
|
|
11010
|
+
case "bad-alias":
|
|
11011
|
+
return `invalid VECTROS_KEYRING_ALIAS: ${resolved.detail ?? "not a valid keyring alias"} Run \`vectros keyring list\` to see the entry names, unset it to use the active identity, or ${setEnv}.`;
|
|
11012
|
+
case "helper-failed":
|
|
11013
|
+
return `no API key: VECTROS_API_KEY is unset and the \`vectros keyring show\` helper failed (${resolved.detail ?? "unknown error"}). Upgrade @vectros-ai/cli if it is an old build, or ${setEnv} to bypass the keyring.`;
|
|
11014
|
+
default:
|
|
11015
|
+
return `no API key: ${setEnv}.`;
|
|
11016
|
+
}
|
|
11017
|
+
}
|
|
11018
|
+
function keyringNotice(resolved) {
|
|
11019
|
+
if (resolved.source !== "keyring") return void 0;
|
|
11020
|
+
if (resolved.alias !== void 0) {
|
|
11021
|
+
return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
|
|
11022
|
+
}
|
|
11023
|
+
return {
|
|
11024
|
+
level: "warn",
|
|
11025
|
+
alias: "(active)",
|
|
11026
|
+
message: "resolved API key from the vectros CLI keyring: no entry was named, so this server is running as whatever identity `vectros switch` last made active. Set VECTROS_API_KEY, or VECTROS_KEYRING_ALIAS, to choose deliberately \u2014 `vectros keyring doctor` shows which entry is active and whether it holds a live key."
|
|
11027
|
+
};
|
|
11028
|
+
}
|
|
11029
|
+
function redactDetail(message) {
|
|
11030
|
+
const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
|
|
11031
|
+
return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
|
|
11032
|
+
}
|
|
11033
|
+
function resolveCommandPath(command, env, platform = process.platform) {
|
|
11034
|
+
const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
|
|
11035
|
+
if (!pathVar) return void 0;
|
|
11036
|
+
const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
|
|
11037
|
+
for (const rawDir of pathVar.split(import_node_path2.default.delimiter)) {
|
|
11038
|
+
const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
|
|
11039
|
+
if (!dir || !import_node_path2.default.isAbsolute(dir)) continue;
|
|
11040
|
+
for (const ext of exts) {
|
|
11041
|
+
const candidate = import_node_path2.default.join(dir, command + ext);
|
|
11042
|
+
try {
|
|
11043
|
+
if ((0, import_node_fs.statSync)(candidate).isFile()) return candidate;
|
|
11044
|
+
} catch {
|
|
11045
|
+
}
|
|
11046
|
+
}
|
|
11047
|
+
}
|
|
11048
|
+
return void 0;
|
|
11049
|
+
}
|
|
11050
|
+
function mapExecResult(err, stdout, stderr = "") {
|
|
11051
|
+
if (!err) {
|
|
11052
|
+
const secret = stdout.trim();
|
|
11053
|
+
return secret ? { status: "ok", secret } : { status: "no-usable-key" };
|
|
11054
|
+
}
|
|
11055
|
+
const code = err.code;
|
|
11056
|
+
if (code === "ENOENT") return { status: "cli-absent" };
|
|
11057
|
+
const detail = redactDetail(stderr.trim() || err.message);
|
|
11058
|
+
if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
|
|
11059
|
+
return { status: "error", detail };
|
|
11060
|
+
}
|
|
11061
|
+
function defaultRunHelper({ alias, env }, deps = {}) {
|
|
11062
|
+
const platform = deps.platform ?? process.platform;
|
|
11063
|
+
const exec = deps.execFileImpl ?? import_node_child_process.execFile;
|
|
11064
|
+
const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
|
|
11065
|
+
if (!resolved) return Promise.resolve({ status: "cli-absent" });
|
|
11066
|
+
const isWindows = platform === "win32";
|
|
11067
|
+
const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
|
|
11068
|
+
const file = isWindows ? `"${resolved}"` : resolved;
|
|
11069
|
+
return new Promise((resolve2) => {
|
|
11070
|
+
exec(
|
|
11071
|
+
file,
|
|
11072
|
+
args,
|
|
11073
|
+
{
|
|
11074
|
+
env,
|
|
11075
|
+
timeout: HELPER_TIMEOUT_MS,
|
|
11076
|
+
maxBuffer: HELPER_MAX_BUFFER,
|
|
11077
|
+
windowsHide: true,
|
|
11078
|
+
shell: isWindows
|
|
11079
|
+
},
|
|
11080
|
+
(err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
|
|
11081
|
+
);
|
|
11082
|
+
});
|
|
11083
|
+
}
|
|
11084
|
+
|
|
11199
11085
|
// src/cli-http.ts
|
|
11200
11086
|
async function main() {
|
|
11201
11087
|
const log = createLogger2();
|
|
11202
|
-
const
|
|
11088
|
+
const resolved = await resolveApiKey();
|
|
11089
|
+
const apiKey = resolved.key;
|
|
11090
|
+
const notice = keyringNotice(resolved);
|
|
11091
|
+
if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
|
|
11092
|
+
if (!apiKey) {
|
|
11093
|
+
log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
|
|
11094
|
+
process.exit(1);
|
|
11095
|
+
}
|
|
11203
11096
|
const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
|
|
11204
11097
|
if (apiBaseUrl !== void 0) {
|
|
11205
11098
|
try {
|