@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/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/server.ts
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
 
4
- // ../../node_modules/@vectros-ai/sdk/dist/index.mjs
4
+ // node_modules/@vectros-ai/sdk/dist/index.mjs
5
5
  var __defProp = Object.defineProperty;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
@@ -16,7 +16,6 @@ __export(api_exports, {
16
16
  BatchWriteRequest: () => BatchWriteRequest,
17
17
  BatchWriteResult: () => BatchWriteResult,
18
18
  ChatMessage: () => ChatMessage,
19
- ClientRequest: () => ClientRequest,
20
19
  ConflictError: () => ConflictError,
21
20
  ContentDeltaEvent: () => ContentDeltaEvent,
22
21
  ContentTooLargeError: () => ContentTooLargeError,
@@ -25,6 +24,7 @@ __export(api_exports, {
25
24
  DocumentRequest: () => DocumentRequest,
26
25
  DocumentResponse: () => DocumentResponse,
27
26
  DoneEvent: () => DoneEvent,
27
+ EntityRequest: () => EntityRequest,
28
28
  ErasureCertificate: () => ErasureCertificate,
29
29
  ErasureRequest: () => ErasureRequest,
30
30
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -37,15 +37,13 @@ __export(api_exports, {
37
37
  ForbiddenError: () => ForbiddenError,
38
38
  IdentityLookupRequest: () => IdentityLookupRequest,
39
39
  InternalServerError: () => InternalServerError,
40
- ListClientsRequestOrder: () => ListClientsRequestOrder,
41
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
40
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
42
41
  ListUsersRequestOrder: () => ListUsersRequestOrder,
43
42
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
44
43
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
45
44
  ModelDataVersionResponse: () => ModelDataVersionResponse,
46
45
  NotFoundError: () => NotFoundError,
47
46
  NotImplementedError: () => NotImplementedError,
48
- OrgRequest: () => OrgRequest,
49
47
  PaymentRequiredError: () => PaymentRequiredError,
50
48
  PingResponse: () => PingResponse,
51
49
  RagSearch: () => RagSearch,
@@ -286,11 +284,6 @@ var UnauthorizedError = class extends VectrosError {
286
284
  var auth_exports = {};
287
285
  var ErasureRequest;
288
286
  ((ErasureRequest2) => {
289
- ErasureRequest2.SubjectType = {
290
- User: "user",
291
- Client: "client",
292
- Org: "org"
293
- };
294
287
  ErasureRequest2.AuditDisposition = {
295
288
  RetainRedacted: "retain-redacted",
296
289
  Purge: "purge"
@@ -302,11 +295,6 @@ var ExportRequest;
302
295
  Tenant: "tenant",
303
296
  Subject: "subject"
304
297
  };
305
- ExportRequest2.SubjectType = {
306
- User: "user",
307
- Client: "client",
308
- Org: "org"
309
- };
310
298
  ExportRequest2.Format = {
311
299
  Ndjson: "ndjson"
312
300
  };
@@ -345,15 +333,10 @@ var LookupDocumentsRequestOrder = {
345
333
  var folders_exports = {};
346
334
  var identity_exports = {};
347
335
  __export(identity_exports, {
348
- ListClientsRequestOrder: () => ListClientsRequestOrder,
349
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
336
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
350
337
  ListUsersRequestOrder: () => ListUsersRequestOrder
351
338
  });
352
- var ListClientsRequestOrder = {
353
- Asc: "asc",
354
- Desc: "desc"
355
- };
356
- var ListOrgsRequestOrder = {
339
+ var ListEntitiesRequestOrder = {
357
340
  Asc: "asc",
358
341
  Desc: "desc"
359
342
  };
@@ -452,13 +435,6 @@ var ChatMessage;
452
435
  Assistant: "assistant"
453
436
  };
454
437
  })(ChatMessage || (ChatMessage = {}));
455
- var ClientRequest;
456
- ((ClientRequest2) => {
457
- ClientRequest2.Status = {
458
- Active: "ACTIVE",
459
- Suspended: "SUSPENDED"
460
- };
461
- })(ClientRequest || (ClientRequest = {}));
462
438
  var ContentDeltaEvent;
463
439
  ((ContentDeltaEvent2) => {
464
440
  ContentDeltaEvent2.Event = {
@@ -513,6 +489,13 @@ var DoneEvent;
513
489
  Done: "done"
514
490
  };
515
491
  })(DoneEvent || (DoneEvent = {}));
492
+ var EntityRequest;
493
+ ((EntityRequest2) => {
494
+ EntityRequest2.Status = {
495
+ Active: "ACTIVE",
496
+ Suspended: "SUSPENDED"
497
+ };
498
+ })(EntityRequest || (EntityRequest = {}));
516
499
  var ErasureCertificate;
517
500
  ((ErasureCertificate2) => {
518
501
  ErasureCertificate2.AuditDisposition = {
@@ -528,11 +511,6 @@ var ErasureRequestResponse;
528
511
  Completed: "completed",
529
512
  Failed: "failed"
530
513
  };
531
- ErasureRequestResponse2.SubjectType = {
532
- User: "user",
533
- Client: "client",
534
- Org: "org"
535
- };
536
514
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
537
515
  var ErrorEvent;
538
516
  ((ErrorEvent2) => {
@@ -558,11 +536,6 @@ var ExportRequestResponse;
558
536
  Tenant: "tenant",
559
537
  Subject: "subject"
560
538
  };
561
- ExportRequestResponse2.SubjectType = {
562
- User: "user",
563
- Client: "client",
564
- Org: "org"
565
- };
566
539
  })(ExportRequestResponse || (ExportRequestResponse = {}));
567
540
  var FieldDef;
568
541
  ((FieldDef2) => {
@@ -576,13 +549,6 @@ var FieldDef;
576
549
  Object: "object",
577
550
  Reference: "reference"
578
551
  };
579
- FieldDef2.TargetSurface = {
580
- Record: "record",
581
- Document: "document",
582
- User: "user",
583
- Org: "org",
584
- Client: "client"
585
- };
586
552
  })(FieldDef || (FieldDef = {}));
587
553
  var IdentityLookupRequest;
588
554
  ((IdentityLookupRequest2) => {
@@ -599,13 +565,6 @@ var ModelDataVersionResponse;
599
565
  Delete: "DELETE"
600
566
  };
601
567
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
602
- var OrgRequest;
603
- ((OrgRequest2) => {
604
- OrgRequest2.Status = {
605
- Active: "ACTIVE",
606
- Suspended: "SUSPENDED"
607
- };
608
- })(OrgRequest || (OrgRequest = {}));
609
568
  var PingResponse;
610
569
  ((PingResponse2) => {
611
570
  PingResponse2.Environment = {
@@ -635,11 +594,6 @@ var RagSearch;
635
594
  })(RagSearch || (RagSearch = {}));
636
595
  var ReadAccessLogResponse;
637
596
  ((ReadAccessLogResponse2) => {
638
- ReadAccessLogResponse2.SubjectType = {
639
- User: "user",
640
- Client: "client",
641
- Org: "org"
642
- };
643
597
  ReadAccessLogResponse2.Action = {
644
598
  Read: "read",
645
599
  List: "list",
@@ -709,8 +663,7 @@ var SchemaRequest;
709
663
  Record: "record",
710
664
  Document: "document",
711
665
  User: "user",
712
- Org: "org",
713
- Client: "client"
666
+ Entity: "entity"
714
667
  };
715
668
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
716
669
  })(SchemaRequest || (SchemaRequest = {}));
@@ -733,8 +686,7 @@ var SchemaResponse;
733
686
  Record: "record",
734
687
  Document: "document",
735
688
  User: "user",
736
- Org: "org",
737
- Client: "client"
689
+ Entity: "entity"
738
690
  };
739
691
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
740
692
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2375,7 +2327,7 @@ var AuthClient = class {
2375
2327
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2376
2328
  }
2377
2329
  /**
2378
- * 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`, plus optional `clientId`) 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.
2330
+ * 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.
2379
2331
  *
2380
2332
  * @param {Vectros.GetAccessLogRequest} request
2381
2333
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2388,7 +2340,6 @@ var AuthClient = class {
2388
2340
  * subjectType: "user",
2389
2341
  * subjectId: "user_abc123",
2390
2342
  * contextId: "ctx_intake",
2391
- * clientId: "client_xyz789",
2392
2343
  * action: "read",
2393
2344
  * callerKeyId: "key_abc123",
2394
2345
  * resourceType: "intake_form",
@@ -2403,7 +2354,6 @@ var AuthClient = class {
2403
2354
  subjectType,
2404
2355
  subjectId,
2405
2356
  contextId,
2406
- clientId,
2407
2357
  from: from_,
2408
2358
  to,
2409
2359
  action,
@@ -2418,7 +2368,6 @@ var AuthClient = class {
2418
2368
  subjectType,
2419
2369
  subjectId,
2420
2370
  contextId,
2421
- clientId,
2422
2371
  from: from_,
2423
2372
  to,
2424
2373
  action,
@@ -2852,7 +2801,7 @@ var AuthClient = class {
2852
2801
  );
2853
2802
  }
2854
2803
  /**
2855
- * 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` may set only `orgId` and `clientId`; 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.
2804
+ * 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.
2856
2805
  *
2857
2806
  * @param {Vectros.CreateAccessProfileRequest} request
2858
2807
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4142,7 +4091,7 @@ var AuthClient = class {
4142
4091
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4143
4092
  * },
4144
4093
  * dataScope: {
4145
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4094
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4146
4095
  * }
4147
4096
  * },
4148
4097
  * expiresInSeconds: 3600
@@ -4592,7 +4541,7 @@ var DocumentsClient = class {
4592
4541
  this._options = normalizeClientOptionsWithAuth(options);
4593
4542
  }
4594
4543
  /**
4595
- * Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId`, `orgId`, `clientId`, or `scope`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
4544
+ * 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.
4596
4545
  *
4597
4546
  * @param {Vectros.ListDocumentsRequest} request
4598
4547
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4600,8 +4549,6 @@ var DocumentsClient = class {
4600
4549
  * @example
4601
4550
  * await client.documents.listDocuments({
4602
4551
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4603
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4604
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4605
4552
  * scope: "group:eng-team",
4606
4553
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4607
4554
  * startFrom: "doc_prev123"
@@ -4611,11 +4558,9 @@ var DocumentsClient = class {
4611
4558
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4612
4559
  }
4613
4560
  async __listDocuments(request = {}, requestOptions) {
4614
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4561
+ const { userId, scope, folderId, startFrom, limit } = request;
4615
4562
  const _queryParams = {
4616
4563
  userId,
4617
- orgId,
4618
- clientId,
4619
4564
  scope,
4620
4565
  folderId,
4621
4566
  startFrom,
@@ -5348,7 +5293,7 @@ var FoldersClient = class {
5348
5293
  this._options = normalizeClientOptionsWithAuth(options);
5349
5294
  }
5350
5295
  /**
5351
- * 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`, `orgId`, or `clientId`. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `folders:r` scope.
5296
+ * 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.
5352
5297
  *
5353
5298
  * @param {Vectros.ListFoldersRequest} request
5354
5299
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5356,9 +5301,8 @@ var FoldersClient = class {
5356
5301
  * @example
5357
5302
  * await client.folders.listFolders({
5358
5303
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5359
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5360
5304
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5361
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5305
+ * scope: "group:eng-team",
5362
5306
  * startFrom: "fld_prev123"
5363
5307
  * })
5364
5308
  */
@@ -5366,12 +5310,11 @@ var FoldersClient = class {
5366
5310
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5367
5311
  }
5368
5312
  async __listFolders(request = {}, requestOptions) {
5369
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5313
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5370
5314
  const _queryParams = {
5371
5315
  parentFolderId,
5372
- orgId,
5373
5316
  userId,
5374
- clientId,
5317
+ scope,
5375
5318
  startFrom,
5376
5319
  limit
5377
5320
  };
@@ -5657,7 +5600,7 @@ var FoldersClient = class {
5657
5600
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5658
5601
  }
5659
5602
  /**
5660
- * Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `orgId`, `clientId`) 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.
5603
+ * 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.
5661
5604
  *
5662
5605
  * @param {Vectros.PatchFolderRequest} request
5663
5606
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5790,54 +5733,48 @@ var IdentityClient = class {
5790
5733
  this._options = normalizeClientOptionsWithAuth(options);
5791
5734
  }
5792
5735
  /**
5793
- * Returns a paginated list of clients in your account. Narrow the results with `orgId` or `userId`, or use `externalId` for an exact lookup by your own identifier. For schema-bound clients, you can also query by a schema-declared lookup field using `type`, `field`, and one lookup mode (`value` for equality, `from`/`to` for a range, or `prefix`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `clients:r` scope.
5736
+ * 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.
5794
5737
  *
5795
- * @param {Vectros.ListClientsRequest} request
5738
+ * @param {Vectros.ListEntitiesRequest} request
5796
5739
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5797
5740
  *
5798
5741
  * @example
5799
- * await client.identity.listClients({
5800
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5801
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5802
- * externalId: "patient_789",
5803
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5804
- * type: "client_v1",
5805
- * field: "industry",
5806
- * value: "healthcare",
5807
- * prefix: "health"
5742
+ * await client.identity.listEntities({
5743
+ * namespace: "team"
5808
5744
  * })
5809
5745
  */
5810
- listClients(request = {}, requestOptions) {
5811
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5746
+ listEntities(request, requestOptions) {
5747
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5812
5748
  }
5813
- async __listClients(request = {}, requestOptions) {
5749
+ async __listEntities(request, requestOptions) {
5814
5750
  const {
5815
- orgId,
5751
+ namespace,
5816
5752
  userId,
5817
5753
  externalId,
5818
- startFrom,
5819
- limit,
5754
+ scope,
5820
5755
  type: type_,
5821
5756
  field,
5822
5757
  value,
5823
5758
  from: from_,
5824
5759
  to,
5825
5760
  prefix,
5826
- order
5761
+ order,
5762
+ startFrom,
5763
+ limit
5827
5764
  } = request;
5828
5765
  const _queryParams = {
5829
- orgId,
5830
5766
  userId,
5831
5767
  externalId,
5832
- startFrom,
5833
- limit,
5768
+ scope,
5834
5769
  type: type_,
5835
5770
  field,
5836
5771
  value,
5837
5772
  from: from_,
5838
5773
  to,
5839
5774
  prefix,
5840
- order: order != null ? order : void 0
5775
+ order: order != null ? order : void 0,
5776
+ startFrom,
5777
+ limit
5841
5778
  };
5842
5779
  const _authRequest = await this._options.authProvider.getAuthRequest();
5843
5780
  const _headers = mergeHeaders(
@@ -5848,7 +5785,7 @@ var IdentityClient = class {
5848
5785
  const _response = await fetcher({
5849
5786
  url: url_exports.join(
5850
5787
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5851
- "v1/clients"
5788
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5852
5789
  ),
5853
5790
  method: "GET",
5854
5791
  headers: _headers,
@@ -5869,12 +5806,12 @@ var IdentityClient = class {
5869
5806
  rawResponse: _response.rawResponse
5870
5807
  });
5871
5808
  }
5872
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5809
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5873
5810
  }
5874
5811
  /**
5875
- * Creates a new client identity in your account. This call is idempotent on `externalId`: if a client with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing client was returned) tells the two apart. To overwrite an existing client's content instead of returning it unchanged, set `?upsert=true` (this also requires the `clients:u` scope). Requires the `clients:c` scope.
5812
+ * 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.
5876
5813
  *
5877
- * @param {Vectros.CreateClientRequest} request
5814
+ * @param {Vectros.CreateEntityRequest} request
5878
5815
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5879
5816
  *
5880
5817
  * @throws {@link Vectros.BadRequestError}
@@ -5882,17 +5819,18 @@ var IdentityClient = class {
5882
5819
  * @throws {@link Vectros.TooManyRequestsError}
5883
5820
  *
5884
5821
  * @example
5885
- * await client.identity.createClient({
5822
+ * await client.identity.createEntity({
5823
+ * namespace: "team",
5886
5824
  * body: {
5887
- * externalId: "patient_789"
5825
+ * externalId: "team_eng_platform"
5888
5826
  * }
5889
5827
  * })
5890
5828
  */
5891
- createClient(request, requestOptions) {
5892
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5829
+ createEntity(request, requestOptions) {
5830
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5893
5831
  }
5894
- async __createClient(request, requestOptions) {
5895
- const { upsert, body: _body } = request;
5832
+ async __createEntity(request, requestOptions) {
5833
+ const { namespace, upsert, body: _body } = request;
5896
5834
  const _queryParams = {
5897
5835
  upsert
5898
5836
  };
@@ -5905,7 +5843,7 @@ var IdentityClient = class {
5905
5843
  const _response = await fetcher({
5906
5844
  url: url_exports.join(
5907
5845
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5908
- "v1/clients"
5846
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5909
5847
  ),
5910
5848
  method: "POST",
5911
5849
  headers: _headers,
@@ -5938,26 +5876,27 @@ var IdentityClient = class {
5938
5876
  });
5939
5877
  }
5940
5878
  }
5941
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5879
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5942
5880
  }
5943
5881
  /**
5944
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5882
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5945
5883
  *
5946
- * @param {Vectros.GetClientRequest} request
5884
+ * @param {Vectros.GetEntityRequest} request
5947
5885
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5948
5886
  *
5949
5887
  * @throws {@link Vectros.NotFoundError}
5950
5888
  *
5951
5889
  * @example
5952
- * await client.identity.getClient({
5953
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5890
+ * await client.identity.getEntity({
5891
+ * namespace: "team",
5892
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5954
5893
  * })
5955
5894
  */
5956
- getClient(request, requestOptions) {
5957
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5895
+ getEntity(request, requestOptions) {
5896
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5958
5897
  }
5959
- async __getClient(request, requestOptions) {
5960
- const { id } = request;
5898
+ async __getEntity(request, requestOptions) {
5899
+ const { namespace, id } = request;
5961
5900
  const _authRequest = await this._options.authProvider.getAuthRequest();
5962
5901
  const _headers = mergeHeaders(
5963
5902
  _authRequest.headers,
@@ -5967,7 +5906,7 @@ var IdentityClient = class {
5967
5906
  const _response = await fetcher({
5968
5907
  url: url_exports.join(
5969
5908
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5970
- `v1/clients/${url_exports.encodePathParam(id)}`
5909
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
5971
5910
  ),
5972
5911
  method: "GET",
5973
5912
  headers: _headers,
@@ -5993,30 +5932,31 @@ var IdentityClient = class {
5993
5932
  });
5994
5933
  }
5995
5934
  }
5996
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5935
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
5997
5936
  }
5998
5937
  /**
5999
- * Updates mutable fields on an existing client. Omitted fields are preserved (a null does not clear a field); when `payload` is supplied it replaces the stored payload in full rather than being deep-merged. Requires the `clients:u` scope.
5938
+ * 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.
6000
5939
  *
6001
- * @param {Vectros.UpdateClientRequest} request
5940
+ * @param {Vectros.UpdateEntityRequest} request
6002
5941
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6003
5942
  *
6004
5943
  * @throws {@link Vectros.NotFoundError}
6005
5944
  * @throws {@link Vectros.TooManyRequestsError}
6006
5945
  *
6007
5946
  * @example
6008
- * await client.identity.updateClient({
5947
+ * await client.identity.updateEntity({
5948
+ * namespace: "team",
6009
5949
  * id: "id",
6010
5950
  * body: {
6011
- * externalId: "patient_789"
5951
+ * externalId: "team_eng_platform"
6012
5952
  * }
6013
5953
  * })
6014
5954
  */
6015
- updateClient(request, requestOptions) {
6016
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5955
+ updateEntity(request, requestOptions) {
5956
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6017
5957
  }
6018
- async __updateClient(request, requestOptions) {
6019
- const { id, body: _body } = request;
5958
+ async __updateEntity(request, requestOptions) {
5959
+ const { namespace, id, body: _body } = request;
6020
5960
  const _authRequest = await this._options.authProvider.getAuthRequest();
6021
5961
  const _headers = mergeHeaders(
6022
5962
  _authRequest.headers,
@@ -6026,7 +5966,7 @@ var IdentityClient = class {
6026
5966
  const _response = await fetcher({
6027
5967
  url: url_exports.join(
6028
5968
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6029
- `v1/clients/${url_exports.encodePathParam(id)}`
5969
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6030
5970
  ),
6031
5971
  method: "PUT",
6032
5972
  headers: _headers,
@@ -6057,27 +5997,28 @@ var IdentityClient = class {
6057
5997
  });
6058
5998
  }
6059
5999
  }
6060
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6000
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6061
6001
  }
6062
6002
  /**
6063
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6003
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6064
6004
  *
6065
- * @param {Vectros.DeleteClientRequest} request
6005
+ * @param {Vectros.DeleteEntityRequest} request
6066
6006
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6067
6007
  *
6068
6008
  * @throws {@link Vectros.NotFoundError}
6069
6009
  * @throws {@link Vectros.TooManyRequestsError}
6070
6010
  *
6071
6011
  * @example
6072
- * await client.identity.deleteClient({
6012
+ * await client.identity.deleteEntity({
6013
+ * namespace: "team",
6073
6014
  * id: "id"
6074
6015
  * })
6075
6016
  */
6076
- deleteClient(request, requestOptions) {
6077
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6017
+ deleteEntity(request, requestOptions) {
6018
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6078
6019
  }
6079
- async __deleteClient(request, requestOptions) {
6080
- const { id } = request;
6020
+ async __deleteEntity(request, requestOptions) {
6021
+ const { namespace, id } = request;
6081
6022
  const _authRequest = await this._options.authProvider.getAuthRequest();
6082
6023
  const _headers = mergeHeaders(
6083
6024
  _authRequest.headers,
@@ -6087,7 +6028,7 @@ var IdentityClient = class {
6087
6028
  const _response = await fetcher({
6088
6029
  url: url_exports.join(
6089
6030
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6090
- `v1/clients/${url_exports.encodePathParam(id)}`
6031
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6091
6032
  ),
6092
6033
  method: "DELETE",
6093
6034
  headers: _headers,
@@ -6115,27 +6056,36 @@ var IdentityClient = class {
6115
6056
  });
6116
6057
  }
6117
6058
  }
6118
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6059
+ return handleNonStatusCodeError(
6060
+ _response.error,
6061
+ _response.rawResponse,
6062
+ "DELETE",
6063
+ "/v1/entities/{namespace}/{id}"
6064
+ );
6119
6065
  }
6120
6066
  /**
6121
- * Body-based equivalent of the `type`/`field`/`value` lookup on `GET /v1/clients`. Use this when looking up by a sensitive (blind-indexed) field: the value travels in the request body rather than the URL. The `GET` list rejects a sensitive field's value and directs you here. The response is a `{data, nextCursor}` envelope. Requires the `clients:r` scope.
6067
+ * 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.
6122
6068
  *
6123
- * @param {Vectros.IdentityLookupRequest} request
6069
+ * @param {Vectros.LookupEntitiesRequest} request
6124
6070
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6125
6071
  *
6126
6072
  * @throws {@link Vectros.BadRequestError}
6127
6073
  * @throws {@link Vectros.TooManyRequestsError}
6128
6074
  *
6129
6075
  * @example
6130
- * await client.identity.lookupClients({
6131
- * type: "person_v1",
6132
- * field: "ssn"
6076
+ * await client.identity.lookupEntities({
6077
+ * namespace: "team",
6078
+ * body: {
6079
+ * type: "person_v1",
6080
+ * field: "ssn"
6081
+ * }
6133
6082
  * })
6134
6083
  */
6135
- lookupClients(request, requestOptions) {
6136
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6084
+ lookupEntities(request, requestOptions) {
6085
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6137
6086
  }
6138
- async __lookupClients(request, requestOptions) {
6087
+ async __lookupEntities(request, requestOptions) {
6088
+ const { namespace, body: _body } = request;
6139
6089
  const _authRequest = await this._options.authProvider.getAuthRequest();
6140
6090
  const _headers = mergeHeaders(
6141
6091
  _authRequest.headers,
@@ -6145,14 +6095,14 @@ var IdentityClient = class {
6145
6095
  const _response = await fetcher({
6146
6096
  url: url_exports.join(
6147
6097
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6148
- "v1/clients/lookup"
6098
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6149
6099
  ),
6150
6100
  method: "POST",
6151
6101
  headers: _headers,
6152
6102
  contentType: "application/json",
6153
6103
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6154
6104
  requestType: "json",
6155
- body: request,
6105
+ body: _body,
6156
6106
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6157
6107
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6158
6108
  abortSignal: requestOptions?.abortSignal,
@@ -6176,26 +6126,32 @@ var IdentityClient = class {
6176
6126
  });
6177
6127
  }
6178
6128
  }
6179
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6129
+ return handleNonStatusCodeError(
6130
+ _response.error,
6131
+ _response.rawResponse,
6132
+ "POST",
6133
+ "/v1/entities/{namespace}/lookup"
6134
+ );
6180
6135
  }
6181
6136
  /**
6182
- * Returns the audit trail of changes to a client, newest first. Identity auditing is always on, so this history is always available; sensitive field values are redacted in each version. The response is a `{data, nextCursor}` envelope. Requires the `clients:r` scope.
6137
+ * 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.
6183
6138
  *
6184
- * @param {Vectros.GetClientVersionsRequest} request
6139
+ * @param {Vectros.GetEntityVersionsRequest} request
6185
6140
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6186
6141
  *
6187
6142
  * @throws {@link Vectros.NotFoundError}
6188
6143
  *
6189
6144
  * @example
6190
- * await client.identity.getClientVersions({
6145
+ * await client.identity.getEntityVersions({
6146
+ * namespace: "team",
6191
6147
  * id: "id"
6192
6148
  * })
6193
6149
  */
6194
- getClientVersions(request, requestOptions) {
6195
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6150
+ getEntityVersions(request, requestOptions) {
6151
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6196
6152
  }
6197
- async __getClientVersions(request, requestOptions) {
6198
- const { id, startFrom } = request;
6153
+ async __getEntityVersions(request, requestOptions) {
6154
+ const { namespace, id, startFrom } = request;
6199
6155
  const _queryParams = {
6200
6156
  startFrom
6201
6157
  };
@@ -6208,7 +6164,7 @@ var IdentityClient = class {
6208
6164
  const _response = await fetcher({
6209
6165
  url: url_exports.join(
6210
6166
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6211
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6167
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6212
6168
  ),
6213
6169
  method: "GET",
6214
6170
  headers: _headers,
@@ -6234,174 +6190,31 @@ var IdentityClient = class {
6234
6190
  });
6235
6191
  }
6236
6192
  }
6237
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6238
- }
6239
- /**
6240
- * Returns a paginated list of organizations in your account. Filter by `userId` to return only the organizations owned by a specific user, or by `externalId` for an exact lookup using your own identifier. You can also query schema-declared lookup fields by supplying `type` and `field` together with one lookup mode (`value` for equality, `from`/`to` for a range, or `prefix`). Requires the `orgs:r` scope.
6241
- *
6242
- * @param {Vectros.ListOrgsRequest} request
6243
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6244
- *
6245
- * @example
6246
- * await client.identity.listOrgs({
6247
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6248
- * externalId: "clinic_001",
6249
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6250
- * type: "org_v1",
6251
- * field: "region",
6252
- * value: "us-east",
6253
- * prefix: "us-"
6254
- * })
6255
- */
6256
- listOrgs(request = {}, requestOptions) {
6257
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6258
- }
6259
- async __listOrgs(request = {}, requestOptions) {
6260
- const {
6261
- userId,
6262
- externalId,
6263
- startFrom,
6264
- limit,
6265
- type: type_,
6266
- field,
6267
- value,
6268
- from: from_,
6269
- to,
6270
- prefix,
6271
- order
6272
- } = request;
6273
- const _queryParams = {
6274
- userId,
6275
- externalId,
6276
- startFrom,
6277
- limit,
6278
- type: type_,
6279
- field,
6280
- value,
6281
- from: from_,
6282
- to,
6283
- prefix,
6284
- order: order != null ? order : void 0
6285
- };
6286
- const _authRequest = await this._options.authProvider.getAuthRequest();
6287
- const _headers = mergeHeaders(
6288
- _authRequest.headers,
6289
- this._options?.headers,
6290
- requestOptions?.headers
6291
- );
6292
- const _response = await fetcher({
6293
- url: url_exports.join(
6294
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6295
- "v1/orgs"
6296
- ),
6297
- method: "GET",
6298
- headers: _headers,
6299
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6300
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6301
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6302
- abortSignal: requestOptions?.abortSignal,
6303
- fetchFn: this._options?.fetch,
6304
- logging: this._options.logging
6305
- });
6306
- if (_response.ok) {
6307
- return { data: _response.body, rawResponse: _response.rawResponse };
6308
- }
6309
- if (_response.error.reason === "status-code") {
6310
- throw new VectrosError({
6311
- statusCode: _response.error.statusCode,
6312
- body: _response.error.body,
6313
- rawResponse: _response.rawResponse
6314
- });
6315
- }
6316
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6317
- }
6318
- /**
6319
- * Creates a new organization in your account. This call is idempotent on `externalId`: if an organization with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing organization was returned) tells the two apart. To overwrite an existing organization's content instead of returning it unchanged, set `?upsert=true` (this also requires the `orgs:u` scope). Requires the `orgs:c` scope.
6320
- *
6321
- * @param {Vectros.CreateOrgRequest} request
6322
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6323
- *
6324
- * @throws {@link Vectros.BadRequestError}
6325
- * @throws {@link Vectros.ForbiddenError}
6326
- * @throws {@link Vectros.TooManyRequestsError}
6327
- *
6328
- * @example
6329
- * await client.identity.createOrg({
6330
- * body: {
6331
- * externalId: "clinic_001"
6332
- * }
6333
- * })
6334
- */
6335
- createOrg(request, requestOptions) {
6336
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6337
- }
6338
- async __createOrg(request, requestOptions) {
6339
- const { upsert, body: _body } = request;
6340
- const _queryParams = {
6341
- upsert
6342
- };
6343
- const _authRequest = await this._options.authProvider.getAuthRequest();
6344
- const _headers = mergeHeaders(
6345
- _authRequest.headers,
6346
- this._options?.headers,
6347
- requestOptions?.headers
6193
+ return handleNonStatusCodeError(
6194
+ _response.error,
6195
+ _response.rawResponse,
6196
+ "GET",
6197
+ "/v1/entities/{namespace}/{id}/versions"
6348
6198
  );
6349
- const _response = await fetcher({
6350
- url: url_exports.join(
6351
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6352
- "v1/orgs"
6353
- ),
6354
- method: "POST",
6355
- headers: _headers,
6356
- contentType: "application/json",
6357
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6358
- requestType: "json",
6359
- body: _body,
6360
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6361
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6362
- abortSignal: requestOptions?.abortSignal,
6363
- fetchFn: this._options?.fetch,
6364
- logging: this._options.logging
6365
- });
6366
- if (_response.ok) {
6367
- return { data: _response.body, rawResponse: _response.rawResponse };
6368
- }
6369
- if (_response.error.reason === "status-code") {
6370
- switch (_response.error.statusCode) {
6371
- case 400:
6372
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6373
- case 403:
6374
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6375
- case 429:
6376
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6377
- default:
6378
- throw new VectrosError({
6379
- statusCode: _response.error.statusCode,
6380
- body: _response.error.body,
6381
- rawResponse: _response.rawResponse
6382
- });
6383
- }
6384
- }
6385
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6386
6199
  }
6387
6200
  /**
6388
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6201
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6389
6202
  *
6390
- * @param {Vectros.GetOrgRequest} request
6203
+ * @param {Vectros.GetNamespaceRequest} request
6391
6204
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6392
6205
  *
6393
6206
  * @throws {@link Vectros.NotFoundError}
6394
6207
  *
6395
6208
  * @example
6396
- * await client.identity.getOrg({
6397
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6209
+ * await client.identity.getNamespace({
6210
+ * namespace: "team"
6398
6211
  * })
6399
6212
  */
6400
- getOrg(request, requestOptions) {
6401
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6213
+ getNamespace(request, requestOptions) {
6214
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6402
6215
  }
6403
- async __getOrg(request, requestOptions) {
6404
- const { id } = request;
6216
+ async __getNamespace(request, requestOptions) {
6217
+ const { namespace } = request;
6405
6218
  const _authRequest = await this._options.authProvider.getAuthRequest();
6406
6219
  const _headers = mergeHeaders(
6407
6220
  _authRequest.headers,
@@ -6411,7 +6224,7 @@ var IdentityClient = class {
6411
6224
  const _response = await fetcher({
6412
6225
  url: url_exports.join(
6413
6226
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6414
- `v1/orgs/${url_exports.encodePathParam(id)}`
6227
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6415
6228
  ),
6416
6229
  method: "GET",
6417
6230
  headers: _headers,
@@ -6437,30 +6250,31 @@ var IdentityClient = class {
6437
6250
  });
6438
6251
  }
6439
6252
  }
6440
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6253
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6441
6254
  }
6442
6255
  /**
6443
- * Updates the mutable fields of an organization. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied rather than deep-merged. Requires the `orgs:u` scope.
6256
+ * 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.
6444
6257
  *
6445
- * @param {Vectros.UpdateOrgRequest} request
6258
+ * @param {Vectros.UpdateNamespaceRequest} request
6446
6259
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6447
6260
  *
6261
+ * @throws {@link Vectros.ForbiddenError}
6448
6262
  * @throws {@link Vectros.NotFoundError}
6449
6263
  * @throws {@link Vectros.TooManyRequestsError}
6450
6264
  *
6451
6265
  * @example
6452
- * await client.identity.updateOrg({
6453
- * id: "id",
6266
+ * await client.identity.updateNamespace({
6267
+ * namespace: "team",
6454
6268
  * body: {
6455
- * externalId: "clinic_001"
6269
+ * namespace: "team"
6456
6270
  * }
6457
6271
  * })
6458
6272
  */
6459
- updateOrg(request, requestOptions) {
6460
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6273
+ updateNamespace(request, requestOptions) {
6274
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6461
6275
  }
6462
- async __updateOrg(request, requestOptions) {
6463
- const { id, body: _body } = request;
6276
+ async __updateNamespace(request, requestOptions) {
6277
+ const { namespace, body: _body } = request;
6464
6278
  const _authRequest = await this._options.authProvider.getAuthRequest();
6465
6279
  const _headers = mergeHeaders(
6466
6280
  _authRequest.headers,
@@ -6470,7 +6284,7 @@ var IdentityClient = class {
6470
6284
  const _response = await fetcher({
6471
6285
  url: url_exports.join(
6472
6286
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6473
- `v1/orgs/${url_exports.encodePathParam(id)}`
6287
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6474
6288
  ),
6475
6289
  method: "PUT",
6476
6290
  headers: _headers,
@@ -6489,6 +6303,8 @@ var IdentityClient = class {
6489
6303
  }
6490
6304
  if (_response.error.reason === "status-code") {
6491
6305
  switch (_response.error.statusCode) {
6306
+ case 403:
6307
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6492
6308
  case 404:
6493
6309
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6494
6310
  case 429:
@@ -6501,27 +6317,28 @@ var IdentityClient = class {
6501
6317
  });
6502
6318
  }
6503
6319
  }
6504
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6320
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6505
6321
  }
6506
6322
  /**
6507
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6323
+ * 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.
6508
6324
  *
6509
- * @param {Vectros.DeleteOrgRequest} request
6325
+ * @param {Vectros.DeleteNamespaceRequest} request
6510
6326
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6511
6327
  *
6328
+ * @throws {@link Vectros.ForbiddenError}
6512
6329
  * @throws {@link Vectros.NotFoundError}
6513
6330
  * @throws {@link Vectros.TooManyRequestsError}
6514
6331
  *
6515
6332
  * @example
6516
- * await client.identity.deleteOrg({
6517
- * id: "id"
6333
+ * await client.identity.deleteNamespace({
6334
+ * namespace: "team"
6518
6335
  * })
6519
6336
  */
6520
- deleteOrg(request, requestOptions) {
6521
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6337
+ deleteNamespace(request, requestOptions) {
6338
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6522
6339
  }
6523
- async __deleteOrg(request, requestOptions) {
6524
- const { id } = request;
6340
+ async __deleteNamespace(request, requestOptions) {
6341
+ const { namespace } = request;
6525
6342
  const _authRequest = await this._options.authProvider.getAuthRequest();
6526
6343
  const _headers = mergeHeaders(
6527
6344
  _authRequest.headers,
@@ -6531,7 +6348,7 @@ var IdentityClient = class {
6531
6348
  const _response = await fetcher({
6532
6349
  url: url_exports.join(
6533
6350
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6534
- `v1/orgs/${url_exports.encodePathParam(id)}`
6351
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6535
6352
  ),
6536
6353
  method: "DELETE",
6537
6354
  headers: _headers,
@@ -6547,6 +6364,8 @@ var IdentityClient = class {
6547
6364
  }
6548
6365
  if (_response.error.reason === "status-code") {
6549
6366
  switch (_response.error.statusCode) {
6367
+ case 403:
6368
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6550
6369
  case 404:
6551
6370
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6552
6371
  case 429:
@@ -6559,27 +6378,26 @@ var IdentityClient = class {
6559
6378
  });
6560
6379
  }
6561
6380
  }
6562
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6381
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6563
6382
  }
6564
6383
  /**
6565
- * Looks up organizations by a schema-declared field value, with the search criteria sent in the request body instead of the URL. Use this when looking up by a sensitive field: the value travels in the body and is never exposed in the URL. This is the body-based equivalent of the `type`/`field`/`value` lookup on `GET /v1/orgs`, which rejects sensitive-field values and directs you here. Returns a `{data, nextCursor}` envelope. Requires the `orgs:r` scope.
6384
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6566
6385
  *
6567
- * @param {Vectros.IdentityLookupRequest} request
6386
+ * @param {Vectros.ListNamespacesRequest} request
6568
6387
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6569
6388
  *
6570
- * @throws {@link Vectros.BadRequestError}
6571
- * @throws {@link Vectros.TooManyRequestsError}
6572
- *
6573
6389
  * @example
6574
- * await client.identity.lookupOrgs({
6575
- * type: "person_v1",
6576
- * field: "ssn"
6577
- * })
6390
+ * await client.identity.listNamespaces()
6578
6391
  */
6579
- lookupOrgs(request, requestOptions) {
6580
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6392
+ listNamespaces(request = {}, requestOptions) {
6393
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6581
6394
  }
6582
- async __lookupOrgs(request, requestOptions) {
6395
+ async __listNamespaces(request = {}, requestOptions) {
6396
+ const { startFrom, limit } = request;
6397
+ const _queryParams = {
6398
+ startFrom,
6399
+ limit
6400
+ };
6583
6401
  const _authRequest = await this._options.authProvider.getAuthRequest();
6584
6402
  const _headers = mergeHeaders(
6585
6403
  _authRequest.headers,
@@ -6589,14 +6407,11 @@ var IdentityClient = class {
6589
6407
  const _response = await fetcher({
6590
6408
  url: url_exports.join(
6591
6409
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6592
- "v1/orgs/lookup"
6410
+ "v1/namespaces"
6593
6411
  ),
6594
- method: "POST",
6412
+ method: "GET",
6595
6413
  headers: _headers,
6596
- contentType: "application/json",
6597
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6598
- requestType: "json",
6599
- body: request,
6414
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6600
6415
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6601
6416
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6602
6417
  abortSignal: requestOptions?.abortSignal,
@@ -6607,42 +6422,33 @@ var IdentityClient = class {
6607
6422
  return { data: _response.body, rawResponse: _response.rawResponse };
6608
6423
  }
6609
6424
  if (_response.error.reason === "status-code") {
6610
- switch (_response.error.statusCode) {
6611
- case 400:
6612
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6613
- case 429:
6614
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6615
- default:
6616
- throw new VectrosError({
6617
- statusCode: _response.error.statusCode,
6618
- body: _response.error.body,
6619
- rawResponse: _response.rawResponse
6620
- });
6621
- }
6425
+ throw new VectrosError({
6426
+ statusCode: _response.error.statusCode,
6427
+ body: _response.error.body,
6428
+ rawResponse: _response.rawResponse
6429
+ });
6622
6430
  }
6623
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6431
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6624
6432
  }
6625
6433
  /**
6626
- * Returns the audit trail of changes made to an organization, newest first. Version history is always recorded for identity entities, and sensitive field values are redacted in the history. Requires the `orgs:r` scope.
6434
+ * 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.
6627
6435
  *
6628
- * @param {Vectros.GetOrgVersionsRequest} request
6436
+ * @param {Vectros.NamespaceRequest} request
6629
6437
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6630
6438
  *
6631
- * @throws {@link Vectros.NotFoundError}
6439
+ * @throws {@link Vectros.BadRequestError}
6440
+ * @throws {@link Vectros.ForbiddenError}
6441
+ * @throws {@link Vectros.TooManyRequestsError}
6632
6442
  *
6633
6443
  * @example
6634
- * await client.identity.getOrgVersions({
6635
- * id: "id"
6444
+ * await client.identity.registerNamespace({
6445
+ * namespace: "team"
6636
6446
  * })
6637
6447
  */
6638
- getOrgVersions(request, requestOptions) {
6639
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6448
+ registerNamespace(request, requestOptions) {
6449
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6640
6450
  }
6641
- async __getOrgVersions(request, requestOptions) {
6642
- const { id, startFrom } = request;
6643
- const _queryParams = {
6644
- startFrom
6645
- };
6451
+ async __registerNamespace(request, requestOptions) {
6646
6452
  const _authRequest = await this._options.authProvider.getAuthRequest();
6647
6453
  const _headers = mergeHeaders(
6648
6454
  _authRequest.headers,
@@ -6652,11 +6458,14 @@ var IdentityClient = class {
6652
6458
  const _response = await fetcher({
6653
6459
  url: url_exports.join(
6654
6460
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6655
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6461
+ "v1/namespaces"
6656
6462
  ),
6657
- method: "GET",
6463
+ method: "POST",
6658
6464
  headers: _headers,
6659
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6465
+ contentType: "application/json",
6466
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6467
+ requestType: "json",
6468
+ body: request,
6660
6469
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6661
6470
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6662
6471
  abortSignal: requestOptions?.abortSignal,
@@ -6668,8 +6477,12 @@ var IdentityClient = class {
6668
6477
  }
6669
6478
  if (_response.error.reason === "status-code") {
6670
6479
  switch (_response.error.statusCode) {
6671
- case 404:
6672
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6480
+ case 400:
6481
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6482
+ case 403:
6483
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6484
+ case 429:
6485
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6673
6486
  default:
6674
6487
  throw new VectrosError({
6675
6488
  statusCode: _response.error.statusCode,
@@ -6678,7 +6491,7 @@ var IdentityClient = class {
6678
6491
  });
6679
6492
  }
6680
6493
  }
6681
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6494
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6682
6495
  }
6683
6496
  /**
6684
6497
  * 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.
@@ -7555,7 +7368,7 @@ var RecordsClient = class {
7555
7368
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7556
7369
  }
7557
7370
  /**
7558
- * 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`, `orgId`, `clientId`, `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.
7371
+ * 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.
7559
7372
  *
7560
7373
  * @param {Vectros.ListRecordsRequest} request
7561
7374
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7565,8 +7378,6 @@ var RecordsClient = class {
7565
7378
  * type: "intake_form",
7566
7379
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7567
7380
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7568
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7569
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7570
7381
  * scope: "group:eng-team",
7571
7382
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7572
7383
  * })
@@ -7575,24 +7386,11 @@ var RecordsClient = class {
7575
7386
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7576
7387
  }
7577
7388
  async __listRecords(request = {}, requestOptions) {
7578
- const {
7579
- type: type_,
7580
- folderId,
7581
- userId,
7582
- orgId,
7583
- clientId,
7584
- scope,
7585
- startFrom,
7586
- limit,
7587
- includePayload,
7588
- recent
7589
- } = request;
7389
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7590
7390
  const _queryParams = {
7591
7391
  type: type_,
7592
7392
  folderId,
7593
7393
  userId,
7594
- orgId,
7595
- clientId,
7596
7394
  scope,
7597
7395
  startFrom,
7598
7396
  limit,
@@ -7892,7 +7690,7 @@ var RecordsClient = class {
7892
7690
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7893
7691
  }
7894
7692
  /**
7895
- * 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`, `orgId`, `clientId`) 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.
7693
+ * 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.
7896
7694
  *
7897
7695
  * @param {Vectros.PatchRecordRequest} request
7898
7696
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8218,7 +8016,7 @@ var SchemasClient = class {
8218
8016
  this._options = normalizeClientOptionsWithAuth(options);
8219
8017
  }
8220
8018
  /**
8221
- * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `orgId` 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, org, or client) 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.
8019
+ * 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.
8222
8020
  *
8223
8021
  * @param {Vectros.ListSchemasRequest} request
8224
8022
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8226,7 +8024,7 @@ var SchemasClient = class {
8226
8024
  * @example
8227
8025
  * await client.schemas.listSchemas({
8228
8026
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8229
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8027
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8230
8028
  * surface: "document",
8231
8029
  * recordType: "intake_form",
8232
8030
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8236,10 +8034,10 @@ var SchemasClient = class {
8236
8034
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8237
8035
  }
8238
8036
  async __listSchemas(request = {}, requestOptions) {
8239
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8037
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8240
8038
  const _queryParams = {
8241
8039
  userId,
8242
- orgId,
8040
+ scope,
8243
8041
  surface,
8244
8042
  recordType,
8245
8043
  startFrom,
@@ -8685,12 +8483,12 @@ var VectrosClient = class {
8685
8483
  get auth() {
8686
8484
  return this._auth ?? (this._auth = new AuthClient(this._options));
8687
8485
  }
8688
- get identity() {
8689
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8690
- }
8691
8486
  get documents() {
8692
8487
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8693
8488
  }
8489
+ get identity() {
8490
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8491
+ }
8694
8492
  get compliance() {
8695
8493
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8696
8494
  }
@@ -8793,8 +8591,8 @@ function warnOnSuboptimalKey(key, log) {
8793
8591
 
8794
8592
  // src/build-info.ts
8795
8593
  var BUILD_INFO = {
8796
- mcpServer: true ? "0.9.0" : "dev",
8797
- sdk: true ? "0.34.0" : "dev"
8594
+ mcpServer: true ? "0.10.0" : "dev",
8595
+ sdk: true ? "0.35.0" : "dev"
8798
8596
  };
8799
8597
 
8800
8598
  // src/log.ts
@@ -9079,10 +8877,8 @@ var inputSchema = {
9079
8877
  ),
9080
8878
  // Ownership.
9081
8879
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9082
- orgId: z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9083
- clientId: z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9084
8880
  scope: z.string().optional().describe(
9085
- 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
8881
+ '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.'
9086
8882
  ),
9087
8883
  // Date window.
9088
8884
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9101,7 +8897,7 @@ var inputSchema = {
9101
8897
  var hybridSearch = ({ client, log }) => ({
9102
8898
  name: "hybrid_search",
9103
8899
  title: "Hybrid search",
9104
- 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/orgId/clientId), 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\".",
8900
+ 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\".",
9105
8901
  inputSchema,
9106
8902
  handler: async (args) => {
9107
8903
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9119,8 +8915,6 @@ var hybridSearch = ({ client, log }) => ({
9119
8915
  typeName: args.typeName,
9120
8916
  filters: args.filters,
9121
8917
  userId: args.userId,
9122
- orgId: args.orgId,
9123
- clientId: args.clientId,
9124
8918
  scope: args.scope,
9125
8919
  createdAfter: args.createdAfter,
9126
8920
  createdBefore: args.createdBefore,
@@ -9205,10 +8999,8 @@ var inputSchema2 = {
9205
8999
  ),
9206
9000
  // List-mode args:
9207
9001
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9208
- orgId: z2.string().optional().describe("List mode: scope to records owned by this org."),
9209
- clientId: z2.string().optional().describe("List mode: scope to records associated with this client."),
9210
9002
  scope: z2.string().optional().describe(
9211
- 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9003
+ '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.'
9212
9004
  ),
9213
9005
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9214
9006
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9218,7 +9010,7 @@ var inputSchema2 = {
9218
9010
  var recordQuery = ({ client, log }) => ({
9219
9011
  name: "record_query",
9220
9012
  title: "Record query (list or lookup)",
9221
- 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`/`orgId`/`clientId`.\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.",
9013
+ 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.",
9222
9014
  inputSchema: inputSchema2,
9223
9015
  handler: async (args) => {
9224
9016
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9272,8 +9064,6 @@ var recordQuery = ({ client, log }) => ({
9272
9064
  page = await client.records.listRecords({
9273
9065
  type,
9274
9066
  userId: args.userId,
9275
- orgId: args.orgId,
9276
- clientId: args.clientId,
9277
9067
  scope: args.scope,
9278
9068
  startFrom,
9279
9069
  limit
@@ -9408,10 +9198,8 @@ var inputSchema4 = {
9408
9198
  status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9409
9199
  folderId: z4.string().optional().describe("Group this record into a folder."),
9410
9200
  userId: z4.string().optional().describe("Owning user id."),
9411
- orgId: z4.string().optional().describe("Owning organization id."),
9412
- clientId: z4.string().optional().describe("Associated client id."),
9413
9201
  scopes: z4.array(z4.string()).optional().describe(
9414
- '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. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9202
+ '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.'
9415
9203
  )
9416
9204
  };
9417
9205
  var recordCreate = ({ client, log }) => ({
@@ -9431,8 +9219,6 @@ var recordCreate = ({ client, log }) => ({
9431
9219
  status: args.status,
9432
9220
  folderId: args.folderId,
9433
9221
  userId: args.userId,
9434
- orgId: args.orgId,
9435
- clientId: args.clientId,
9436
9222
  scopes: args.scopes
9437
9223
  }
9438
9224
  });
@@ -9536,10 +9322,8 @@ var inputSchema7 = {
9536
9322
  // answer on a specific owner / folder / type / metadata subset, not just the
9537
9323
  // whole-tenant corpus.
9538
9324
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9539
- orgId: z7.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9540
- clientId: z7.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9541
9325
  scope: z7.string().optional().describe(
9542
- 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9326
+ '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.'
9543
9327
  ),
9544
9328
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9545
9329
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9567,8 +9351,6 @@ var ragAsk = ({ client, log }) => ({
9567
9351
  mode: searchArg.mode ?? "HYBRID",
9568
9352
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9569
9353
  userId: searchArg.userId,
9570
- orgId: searchArg.orgId,
9571
- clientId: searchArg.clientId,
9572
9354
  scope: searchArg.scope,
9573
9355
  folderId: searchArg.folderId,
9574
9356
  rootFolderId: searchArg.rootFolderId,
@@ -9714,32 +9496,32 @@ var inputSchema9 = {
9714
9496
  userId: z9.string().optional().describe(
9715
9497
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9716
9498
  ),
9717
- orgId: z9.string().optional().describe(
9718
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9499
+ scope: z9.string().optional().describe(
9500
+ '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.'
9719
9501
  ),
9720
- surface: z9.enum(["record", "document", "user", "org", "client"]).optional().describe(
9721
- "Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. The identity surfaces (user/org/client) are account-wide. Optional."
9502
+ surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9503
+ "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."
9722
9504
  ),
9723
9505
  recordType: z9.string().optional().describe(
9724
- '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|org|client` for an identity schema. Takes precedence over userId/orgId. Optional.'
9506
+ '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.'
9725
9507
  )
9726
9508
  };
9727
9509
  var listSchemas = ({ client, log }) => ({
9728
9510
  name: "list_schemas",
9729
9511
  title: "List record schemas",
9730
- 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/org/client \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`orgId`; default returns everything the credential can see.',
9512
+ 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.',
9731
9513
  inputSchema: inputSchema9,
9732
9514
  handler: async (args) => {
9733
9515
  const userId = args.userId;
9734
- const orgId = args.orgId;
9516
+ const scope = args.scope;
9735
9517
  const surface = args.surface;
9736
9518
  const recordType = args.recordType;
9737
9519
  try {
9738
9520
  const schemas = await drainPages(
9739
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9521
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9740
9522
  );
9741
9523
  log.debug(
9742
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9524
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9743
9525
  "list_schemas ok"
9744
9526
  );
9745
9527
  return {
@@ -9864,10 +9646,8 @@ var inputSchema11 = {
9864
9646
  // List-mode args:
9865
9647
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9866
9648
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9867
- orgId: z11.string().optional().describe("List mode: scope to documents belonging to this org."),
9868
- clientId: z11.string().optional().describe("List mode: scope to documents associated with this client."),
9869
9649
  scope: z11.string().optional().describe(
9870
- 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9650
+ '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.'
9871
9651
  ),
9872
9652
  startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9873
9653
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9877,7 +9657,7 @@ var inputSchema11 = {
9877
9657
  var documentQuery = ({ client, log }) => ({
9878
9658
  name: "document_query",
9879
9659
  title: "Document query (list or lookup)",
9880
- 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`/`orgId`/`clientId`/`scope`.\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.",
9660
+ 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.",
9881
9661
  inputSchema: inputSchema11,
9882
9662
  handler: async (args) => {
9883
9663
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9937,8 +9717,6 @@ var documentQuery = ({ client, log }) => ({
9937
9717
  page = await client.documents.listDocuments({
9938
9718
  folderId: args.folderId,
9939
9719
  userId: args.userId,
9940
- orgId: args.orgId,
9941
- clientId: args.clientId,
9942
9720
  scope: args.scope,
9943
9721
  startFrom,
9944
9722
  limit
@@ -9979,8 +9757,9 @@ var inputSchema12 = {
9979
9757
  "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."
9980
9758
  ),
9981
9759
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9982
- orgId: z12.string().optional().describe("Reassign the owning org (Vectros UUID)."),
9983
- clientId: z12.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9760
+ scopes: z12.array(z12.string()).optional().describe(
9761
+ '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).'
9762
+ ),
9984
9763
  expectedVersion: z12.number().int().optional().describe(
9985
9764
  "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."
9986
9765
  )
@@ -10000,8 +9779,7 @@ var documentUpdate = ({ client, log }) => ({
10000
9779
  const folderId = args.folderId;
10001
9780
  const status = args.status;
10002
9781
  const userId = args.userId;
10003
- const orgId = args.orgId;
10004
- const clientId = args.clientId;
9782
+ const scopes = args.scopes;
10005
9783
  const expectedVersion = args.expectedVersion;
10006
9784
  try {
10007
9785
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10013,8 +9791,7 @@ var documentUpdate = ({ client, log }) => ({
10013
9791
  if (folderId !== void 0) body.folderId = folderId;
10014
9792
  if (status !== void 0) body.status = status;
10015
9793
  if (userId !== void 0) body.userId = userId;
10016
- if (orgId !== void 0) body.orgId = orgId;
10017
- if (clientId !== void 0) body.clientId = clientId;
9794
+ if (scopes !== void 0) body.scopes = scopes;
10018
9795
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10019
9796
  const updated = await client.documents.patchDocument({
10020
9797
  id: resolved.id,
@@ -10064,8 +9841,9 @@ var inputSchema14 = {
10064
9841
  id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
10065
9842
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10066
9843
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10067
- orgId: z14.string().optional().describe("List mode: scope to folders belonging to this org."),
10068
- clientId: z14.string().optional().describe("List mode: scope to folders associated with this client."),
9844
+ scope: z14.string().optional().describe(
9845
+ '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.'
9846
+ ),
10069
9847
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10070
9848
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10071
9849
  `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\`.`
@@ -10074,7 +9852,7 @@ var inputSchema14 = {
10074
9852
  var folderQuery = ({ client, log }) => ({
10075
9853
  name: "folder_query",
10076
9854
  title: "Folder query (list or get)",
10077
- 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`/`orgId`/`clientId`.\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.",
9855
+ 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.",
10078
9856
  inputSchema: inputSchema14,
10079
9857
  handler: async (args) => {
10080
9858
  const id = args.id;
@@ -10088,8 +9866,7 @@ var folderQuery = ({ client, log }) => ({
10088
9866
  const page = await client.folders.listFolders({
10089
9867
  parentFolderId: args.parentId,
10090
9868
  userId: args.userId,
10091
- orgId: args.orgId,
10092
- clientId: args.clientId,
9869
+ scope: args.scope,
10093
9870
  startFrom: args.startFrom,
10094
9871
  limit
10095
9872
  });
@@ -10113,10 +9890,8 @@ var inputSchema15 = {
10113
9890
  parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10114
9891
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10115
9892
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10116
- orgId: z15.string().optional().describe("Owning org (Vectros UUID)."),
10117
- clientId: z15.string().optional().describe("Associated client (Vectros UUID)."),
10118
9893
  scopes: z15.array(z15.string()).optional().describe(
10119
- '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. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9894
+ '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.'
10120
9895
  )
10121
9896
  };
10122
9897
  var folderCreate = ({ client, log }) => ({
@@ -10133,8 +9908,6 @@ var folderCreate = ({ client, log }) => ({
10133
9908
  parentFolderId: args.parentId,
10134
9909
  slug: args.slug,
10135
9910
  userId: args.userId,
10136
- orgId: args.orgId,
10137
- clientId: args.clientId,
10138
9911
  scopes: args.scopes
10139
9912
  }
10140
9913
  });
@@ -10155,8 +9928,9 @@ var inputSchema16 = {
10155
9928
  name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10156
9929
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10157
9930
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10158
- orgId: z16.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10159
- clientId: z16.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9931
+ scopes: z16.array(z16.string()).optional().describe(
9932
+ '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).'
9933
+ ),
10160
9934
  expectedVersion: z16.number().int().optional().describe(
10161
9935
  "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."
10162
9936
  )
@@ -10171,16 +9945,14 @@ var folderUpdate = ({ client, log }) => ({
10171
9945
  const name = args.name;
10172
9946
  const description = args.description;
10173
9947
  const userId = args.userId;
10174
- const orgId = args.orgId;
10175
- const clientId = args.clientId;
9948
+ const scopes = args.scopes;
10176
9949
  const expectedVersion = args.expectedVersion;
10177
9950
  try {
10178
9951
  const body = {};
10179
9952
  if (name !== void 0) body.name = name;
10180
9953
  if (description !== void 0) body.description = description;
10181
9954
  if (userId !== void 0) body.userId = userId;
10182
- if (orgId !== void 0) body.orgId = orgId;
10183
- if (clientId !== void 0) body.clientId = clientId;
9955
+ if (scopes !== void 0) body.scopes = scopes;
10184
9956
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10185
9957
  const updated = await client.folders.patchFolder({ id, body });
10186
9958
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10346,10 +10118,8 @@ var inputSchema19 = {
10346
10118
  // Common (both modes):
10347
10119
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10348
10120
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10349
- orgId: z18.string().optional().describe("Owning org ID. Optional."),
10350
- clientId: z18.string().optional().describe("Owning client ID. Optional."),
10351
10121
  scopes: z18.array(z18.string()).optional().describe(
10352
- "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. `org:`/`client:` entries are equivalent to the orgId/clientId fields. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10122
+ "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."
10353
10123
  )
10354
10124
  };
10355
10125
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10397,9 +10167,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10397
10167
  payload: args.payload,
10398
10168
  schemaId,
10399
10169
  externalId: args.externalId,
10400
- userId: args.userId,
10401
- orgId: args.orgId,
10402
- clientId: args.clientId
10170
+ userId: args.userId
10403
10171
  };
10404
10172
  try {
10405
10173
  if (text) {
@@ -10506,7 +10274,9 @@ import { z as z19 } from "zod";
10506
10274
  var MCP_DEFAULT_LIMIT5 = 10;
10507
10275
  var MCP_MAX_LIMIT5 = 100;
10508
10276
  var inputSchema20 = {
10509
- kind: z19.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10277
+ kind: z19.string().describe(
10278
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10279
+ ),
10510
10280
  externalId: z19.string().optional().describe(
10511
10281
  "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."
10512
10282
  ),
@@ -10525,11 +10295,12 @@ var inputSchema20 = {
10525
10295
  };
10526
10296
  var lookupPrincipal = ({ client, log }) => ({
10527
10297
  name: "lookup_principal",
10528
- title: "Look up a user / org / client identity",
10529
- description: "Resolve a user, org, or client identity. 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.",
10298
+ title: "Look up a user identity or a namespaced identity entity",
10299
+ 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.",
10530
10300
  inputSchema: inputSchema20,
10531
10301
  handler: async (args) => {
10532
10302
  const kind = args.kind;
10303
+ const isUser = kind === "user";
10533
10304
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10534
10305
  const externalId = args.externalId;
10535
10306
  const type = args.type;
@@ -10543,13 +10314,7 @@ var lookupPrincipal = ({ client, log }) => ({
10543
10314
  try {
10544
10315
  let page;
10545
10316
  if (externalId !== void 0) {
10546
- if (kind === "user") {
10547
- page = await client.identity.listUsers({ externalId, limit });
10548
- } else if (kind === "org") {
10549
- page = await client.identity.listOrgs({ externalId, limit });
10550
- } else {
10551
- page = await client.identity.listClients({ externalId, limit });
10552
- }
10317
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10553
10318
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10554
10319
  } else if (field !== void 0) {
10555
10320
  const hasEquality = value !== void 0;
@@ -10578,13 +10343,7 @@ var lookupPrincipal = ({ client, log }) => ({
10578
10343
  );
10579
10344
  }
10580
10345
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10581
- if (kind === "user") {
10582
- page = await client.identity.lookupUsers(req);
10583
- } else if (kind === "org") {
10584
- page = await client.identity.lookupOrgs(req);
10585
- } else {
10586
- page = await client.identity.lookupClients(req);
10587
- }
10346
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10588
10347
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10589
10348
  } else {
10590
10349
  return toolError(