@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.js CHANGED
@@ -42,7 +42,7 @@ module.exports = __toCommonJS(index_exports);
42
42
  // src/server.ts
43
43
  var import_server = require("@modelcontextprotocol/sdk/server/index.js");
44
44
 
45
- // ../../node_modules/@vectros-ai/sdk/dist/index.mjs
45
+ // node_modules/@vectros-ai/sdk/dist/index.mjs
46
46
  var __defProp2 = Object.defineProperty;
47
47
  var __export2 = (target, all) => {
48
48
  for (var name in all)
@@ -57,7 +57,6 @@ __export2(api_exports, {
57
57
  BatchWriteRequest: () => BatchWriteRequest,
58
58
  BatchWriteResult: () => BatchWriteResult,
59
59
  ChatMessage: () => ChatMessage,
60
- ClientRequest: () => ClientRequest,
61
60
  ConflictError: () => ConflictError,
62
61
  ContentDeltaEvent: () => ContentDeltaEvent,
63
62
  ContentTooLargeError: () => ContentTooLargeError,
@@ -66,6 +65,7 @@ __export2(api_exports, {
66
65
  DocumentRequest: () => DocumentRequest,
67
66
  DocumentResponse: () => DocumentResponse,
68
67
  DoneEvent: () => DoneEvent,
68
+ EntityRequest: () => EntityRequest,
69
69
  ErasureCertificate: () => ErasureCertificate,
70
70
  ErasureRequest: () => ErasureRequest,
71
71
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -78,15 +78,13 @@ __export2(api_exports, {
78
78
  ForbiddenError: () => ForbiddenError,
79
79
  IdentityLookupRequest: () => IdentityLookupRequest,
80
80
  InternalServerError: () => InternalServerError,
81
- ListClientsRequestOrder: () => ListClientsRequestOrder,
82
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
81
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
83
82
  ListUsersRequestOrder: () => ListUsersRequestOrder,
84
83
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
85
84
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
86
85
  ModelDataVersionResponse: () => ModelDataVersionResponse,
87
86
  NotFoundError: () => NotFoundError,
88
87
  NotImplementedError: () => NotImplementedError,
89
- OrgRequest: () => OrgRequest,
90
88
  PaymentRequiredError: () => PaymentRequiredError,
91
89
  PingResponse: () => PingResponse,
92
90
  RagSearch: () => RagSearch,
@@ -327,11 +325,6 @@ var UnauthorizedError = class extends VectrosError {
327
325
  var auth_exports = {};
328
326
  var ErasureRequest;
329
327
  ((ErasureRequest2) => {
330
- ErasureRequest2.SubjectType = {
331
- User: "user",
332
- Client: "client",
333
- Org: "org"
334
- };
335
328
  ErasureRequest2.AuditDisposition = {
336
329
  RetainRedacted: "retain-redacted",
337
330
  Purge: "purge"
@@ -343,11 +336,6 @@ var ExportRequest;
343
336
  Tenant: "tenant",
344
337
  Subject: "subject"
345
338
  };
346
- ExportRequest2.SubjectType = {
347
- User: "user",
348
- Client: "client",
349
- Org: "org"
350
- };
351
339
  ExportRequest2.Format = {
352
340
  Ndjson: "ndjson"
353
341
  };
@@ -386,15 +374,10 @@ var LookupDocumentsRequestOrder = {
386
374
  var folders_exports = {};
387
375
  var identity_exports = {};
388
376
  __export2(identity_exports, {
389
- ListClientsRequestOrder: () => ListClientsRequestOrder,
390
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
377
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
391
378
  ListUsersRequestOrder: () => ListUsersRequestOrder
392
379
  });
393
- var ListClientsRequestOrder = {
394
- Asc: "asc",
395
- Desc: "desc"
396
- };
397
- var ListOrgsRequestOrder = {
380
+ var ListEntitiesRequestOrder = {
398
381
  Asc: "asc",
399
382
  Desc: "desc"
400
383
  };
@@ -493,13 +476,6 @@ var ChatMessage;
493
476
  Assistant: "assistant"
494
477
  };
495
478
  })(ChatMessage || (ChatMessage = {}));
496
- var ClientRequest;
497
- ((ClientRequest2) => {
498
- ClientRequest2.Status = {
499
- Active: "ACTIVE",
500
- Suspended: "SUSPENDED"
501
- };
502
- })(ClientRequest || (ClientRequest = {}));
503
479
  var ContentDeltaEvent;
504
480
  ((ContentDeltaEvent2) => {
505
481
  ContentDeltaEvent2.Event = {
@@ -554,6 +530,13 @@ var DoneEvent;
554
530
  Done: "done"
555
531
  };
556
532
  })(DoneEvent || (DoneEvent = {}));
533
+ var EntityRequest;
534
+ ((EntityRequest2) => {
535
+ EntityRequest2.Status = {
536
+ Active: "ACTIVE",
537
+ Suspended: "SUSPENDED"
538
+ };
539
+ })(EntityRequest || (EntityRequest = {}));
557
540
  var ErasureCertificate;
558
541
  ((ErasureCertificate2) => {
559
542
  ErasureCertificate2.AuditDisposition = {
@@ -569,11 +552,6 @@ var ErasureRequestResponse;
569
552
  Completed: "completed",
570
553
  Failed: "failed"
571
554
  };
572
- ErasureRequestResponse2.SubjectType = {
573
- User: "user",
574
- Client: "client",
575
- Org: "org"
576
- };
577
555
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
578
556
  var ErrorEvent;
579
557
  ((ErrorEvent2) => {
@@ -599,11 +577,6 @@ var ExportRequestResponse;
599
577
  Tenant: "tenant",
600
578
  Subject: "subject"
601
579
  };
602
- ExportRequestResponse2.SubjectType = {
603
- User: "user",
604
- Client: "client",
605
- Org: "org"
606
- };
607
580
  })(ExportRequestResponse || (ExportRequestResponse = {}));
608
581
  var FieldDef;
609
582
  ((FieldDef2) => {
@@ -617,13 +590,6 @@ var FieldDef;
617
590
  Object: "object",
618
591
  Reference: "reference"
619
592
  };
620
- FieldDef2.TargetSurface = {
621
- Record: "record",
622
- Document: "document",
623
- User: "user",
624
- Org: "org",
625
- Client: "client"
626
- };
627
593
  })(FieldDef || (FieldDef = {}));
628
594
  var IdentityLookupRequest;
629
595
  ((IdentityLookupRequest2) => {
@@ -640,13 +606,6 @@ var ModelDataVersionResponse;
640
606
  Delete: "DELETE"
641
607
  };
642
608
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
643
- var OrgRequest;
644
- ((OrgRequest2) => {
645
- OrgRequest2.Status = {
646
- Active: "ACTIVE",
647
- Suspended: "SUSPENDED"
648
- };
649
- })(OrgRequest || (OrgRequest = {}));
650
609
  var PingResponse;
651
610
  ((PingResponse2) => {
652
611
  PingResponse2.Environment = {
@@ -676,11 +635,6 @@ var RagSearch;
676
635
  })(RagSearch || (RagSearch = {}));
677
636
  var ReadAccessLogResponse;
678
637
  ((ReadAccessLogResponse2) => {
679
- ReadAccessLogResponse2.SubjectType = {
680
- User: "user",
681
- Client: "client",
682
- Org: "org"
683
- };
684
638
  ReadAccessLogResponse2.Action = {
685
639
  Read: "read",
686
640
  List: "list",
@@ -750,8 +704,7 @@ var SchemaRequest;
750
704
  Record: "record",
751
705
  Document: "document",
752
706
  User: "user",
753
- Org: "org",
754
- Client: "client"
707
+ Entity: "entity"
755
708
  };
756
709
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
757
710
  })(SchemaRequest || (SchemaRequest = {}));
@@ -774,8 +727,7 @@ var SchemaResponse;
774
727
  Record: "record",
775
728
  Document: "document",
776
729
  User: "user",
777
- Org: "org",
778
- Client: "client"
730
+ Entity: "entity"
779
731
  };
780
732
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
781
733
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2416,7 +2368,7 @@ var AuthClient = class {
2416
2368
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2417
2369
  }
2418
2370
  /**
2419
- * 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.
2371
+ * 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.
2420
2372
  *
2421
2373
  * @param {Vectros.GetAccessLogRequest} request
2422
2374
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2429,7 +2381,6 @@ var AuthClient = class {
2429
2381
  * subjectType: "user",
2430
2382
  * subjectId: "user_abc123",
2431
2383
  * contextId: "ctx_intake",
2432
- * clientId: "client_xyz789",
2433
2384
  * action: "read",
2434
2385
  * callerKeyId: "key_abc123",
2435
2386
  * resourceType: "intake_form",
@@ -2444,7 +2395,6 @@ var AuthClient = class {
2444
2395
  subjectType,
2445
2396
  subjectId,
2446
2397
  contextId,
2447
- clientId,
2448
2398
  from: from_,
2449
2399
  to,
2450
2400
  action,
@@ -2459,7 +2409,6 @@ var AuthClient = class {
2459
2409
  subjectType,
2460
2410
  subjectId,
2461
2411
  contextId,
2462
- clientId,
2463
2412
  from: from_,
2464
2413
  to,
2465
2414
  action,
@@ -2893,7 +2842,7 @@ var AuthClient = class {
2893
2842
  );
2894
2843
  }
2895
2844
  /**
2896
- * 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.
2845
+ * 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.
2897
2846
  *
2898
2847
  * @param {Vectros.CreateAccessProfileRequest} request
2899
2848
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4183,7 +4132,7 @@ var AuthClient = class {
4183
4132
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4184
4133
  * },
4185
4134
  * dataScope: {
4186
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4135
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4187
4136
  * }
4188
4137
  * },
4189
4138
  * expiresInSeconds: 3600
@@ -4633,7 +4582,7 @@ var DocumentsClient = class {
4633
4582
  this._options = normalizeClientOptionsWithAuth(options);
4634
4583
  }
4635
4584
  /**
4636
- * 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.
4585
+ * 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.
4637
4586
  *
4638
4587
  * @param {Vectros.ListDocumentsRequest} request
4639
4588
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4641,8 +4590,6 @@ var DocumentsClient = class {
4641
4590
  * @example
4642
4591
  * await client.documents.listDocuments({
4643
4592
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4644
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4645
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4646
4593
  * scope: "group:eng-team",
4647
4594
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4648
4595
  * startFrom: "doc_prev123"
@@ -4652,11 +4599,9 @@ var DocumentsClient = class {
4652
4599
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4653
4600
  }
4654
4601
  async __listDocuments(request = {}, requestOptions) {
4655
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4602
+ const { userId, scope, folderId, startFrom, limit } = request;
4656
4603
  const _queryParams = {
4657
4604
  userId,
4658
- orgId,
4659
- clientId,
4660
4605
  scope,
4661
4606
  folderId,
4662
4607
  startFrom,
@@ -5389,7 +5334,7 @@ var FoldersClient = class {
5389
5334
  this._options = normalizeClientOptionsWithAuth(options);
5390
5335
  }
5391
5336
  /**
5392
- * 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.
5337
+ * 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.
5393
5338
  *
5394
5339
  * @param {Vectros.ListFoldersRequest} request
5395
5340
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5397,9 +5342,8 @@ var FoldersClient = class {
5397
5342
  * @example
5398
5343
  * await client.folders.listFolders({
5399
5344
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5400
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5401
5345
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5402
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5346
+ * scope: "group:eng-team",
5403
5347
  * startFrom: "fld_prev123"
5404
5348
  * })
5405
5349
  */
@@ -5407,12 +5351,11 @@ var FoldersClient = class {
5407
5351
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5408
5352
  }
5409
5353
  async __listFolders(request = {}, requestOptions) {
5410
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5354
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5411
5355
  const _queryParams = {
5412
5356
  parentFolderId,
5413
- orgId,
5414
5357
  userId,
5415
- clientId,
5358
+ scope,
5416
5359
  startFrom,
5417
5360
  limit
5418
5361
  };
@@ -5698,7 +5641,7 @@ var FoldersClient = class {
5698
5641
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5699
5642
  }
5700
5643
  /**
5701
- * 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.
5644
+ * 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.
5702
5645
  *
5703
5646
  * @param {Vectros.PatchFolderRequest} request
5704
5647
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5831,54 +5774,48 @@ var IdentityClient = class {
5831
5774
  this._options = normalizeClientOptionsWithAuth(options);
5832
5775
  }
5833
5776
  /**
5834
- * 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.
5777
+ * 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.
5835
5778
  *
5836
- * @param {Vectros.ListClientsRequest} request
5779
+ * @param {Vectros.ListEntitiesRequest} request
5837
5780
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5838
5781
  *
5839
5782
  * @example
5840
- * await client.identity.listClients({
5841
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5842
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5843
- * externalId: "patient_789",
5844
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5845
- * type: "client_v1",
5846
- * field: "industry",
5847
- * value: "healthcare",
5848
- * prefix: "health"
5783
+ * await client.identity.listEntities({
5784
+ * namespace: "team"
5849
5785
  * })
5850
5786
  */
5851
- listClients(request = {}, requestOptions) {
5852
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5787
+ listEntities(request, requestOptions) {
5788
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5853
5789
  }
5854
- async __listClients(request = {}, requestOptions) {
5790
+ async __listEntities(request, requestOptions) {
5855
5791
  const {
5856
- orgId,
5792
+ namespace,
5857
5793
  userId,
5858
5794
  externalId,
5859
- startFrom,
5860
- limit,
5795
+ scope,
5861
5796
  type: type_,
5862
5797
  field,
5863
5798
  value,
5864
5799
  from: from_,
5865
5800
  to,
5866
5801
  prefix,
5867
- order
5802
+ order,
5803
+ startFrom,
5804
+ limit
5868
5805
  } = request;
5869
5806
  const _queryParams = {
5870
- orgId,
5871
5807
  userId,
5872
5808
  externalId,
5873
- startFrom,
5874
- limit,
5809
+ scope,
5875
5810
  type: type_,
5876
5811
  field,
5877
5812
  value,
5878
5813
  from: from_,
5879
5814
  to,
5880
5815
  prefix,
5881
- order: order != null ? order : void 0
5816
+ order: order != null ? order : void 0,
5817
+ startFrom,
5818
+ limit
5882
5819
  };
5883
5820
  const _authRequest = await this._options.authProvider.getAuthRequest();
5884
5821
  const _headers = mergeHeaders(
@@ -5889,7 +5826,7 @@ var IdentityClient = class {
5889
5826
  const _response = await fetcher({
5890
5827
  url: url_exports.join(
5891
5828
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5892
- "v1/clients"
5829
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5893
5830
  ),
5894
5831
  method: "GET",
5895
5832
  headers: _headers,
@@ -5910,12 +5847,12 @@ var IdentityClient = class {
5910
5847
  rawResponse: _response.rawResponse
5911
5848
  });
5912
5849
  }
5913
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5850
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5914
5851
  }
5915
5852
  /**
5916
- * 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.
5853
+ * 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.
5917
5854
  *
5918
- * @param {Vectros.CreateClientRequest} request
5855
+ * @param {Vectros.CreateEntityRequest} request
5919
5856
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5920
5857
  *
5921
5858
  * @throws {@link Vectros.BadRequestError}
@@ -5923,17 +5860,18 @@ var IdentityClient = class {
5923
5860
  * @throws {@link Vectros.TooManyRequestsError}
5924
5861
  *
5925
5862
  * @example
5926
- * await client.identity.createClient({
5863
+ * await client.identity.createEntity({
5864
+ * namespace: "team",
5927
5865
  * body: {
5928
- * externalId: "patient_789"
5866
+ * externalId: "team_eng_platform"
5929
5867
  * }
5930
5868
  * })
5931
5869
  */
5932
- createClient(request, requestOptions) {
5933
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5870
+ createEntity(request, requestOptions) {
5871
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5934
5872
  }
5935
- async __createClient(request, requestOptions) {
5936
- const { upsert, body: _body } = request;
5873
+ async __createEntity(request, requestOptions) {
5874
+ const { namespace, upsert, body: _body } = request;
5937
5875
  const _queryParams = {
5938
5876
  upsert
5939
5877
  };
@@ -5946,7 +5884,7 @@ var IdentityClient = class {
5946
5884
  const _response = await fetcher({
5947
5885
  url: url_exports.join(
5948
5886
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5949
- "v1/clients"
5887
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5950
5888
  ),
5951
5889
  method: "POST",
5952
5890
  headers: _headers,
@@ -5979,26 +5917,27 @@ var IdentityClient = class {
5979
5917
  });
5980
5918
  }
5981
5919
  }
5982
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5920
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5983
5921
  }
5984
5922
  /**
5985
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5923
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5986
5924
  *
5987
- * @param {Vectros.GetClientRequest} request
5925
+ * @param {Vectros.GetEntityRequest} request
5988
5926
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5989
5927
  *
5990
5928
  * @throws {@link Vectros.NotFoundError}
5991
5929
  *
5992
5930
  * @example
5993
- * await client.identity.getClient({
5994
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5931
+ * await client.identity.getEntity({
5932
+ * namespace: "team",
5933
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5995
5934
  * })
5996
5935
  */
5997
- getClient(request, requestOptions) {
5998
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5936
+ getEntity(request, requestOptions) {
5937
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5999
5938
  }
6000
- async __getClient(request, requestOptions) {
6001
- const { id } = request;
5939
+ async __getEntity(request, requestOptions) {
5940
+ const { namespace, id } = request;
6002
5941
  const _authRequest = await this._options.authProvider.getAuthRequest();
6003
5942
  const _headers = mergeHeaders(
6004
5943
  _authRequest.headers,
@@ -6008,7 +5947,7 @@ var IdentityClient = class {
6008
5947
  const _response = await fetcher({
6009
5948
  url: url_exports.join(
6010
5949
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6011
- `v1/clients/${url_exports.encodePathParam(id)}`
5950
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6012
5951
  ),
6013
5952
  method: "GET",
6014
5953
  headers: _headers,
@@ -6034,30 +5973,31 @@ var IdentityClient = class {
6034
5973
  });
6035
5974
  }
6036
5975
  }
6037
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5976
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
6038
5977
  }
6039
5978
  /**
6040
- * 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.
5979
+ * 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.
6041
5980
  *
6042
- * @param {Vectros.UpdateClientRequest} request
5981
+ * @param {Vectros.UpdateEntityRequest} request
6043
5982
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6044
5983
  *
6045
5984
  * @throws {@link Vectros.NotFoundError}
6046
5985
  * @throws {@link Vectros.TooManyRequestsError}
6047
5986
  *
6048
5987
  * @example
6049
- * await client.identity.updateClient({
5988
+ * await client.identity.updateEntity({
5989
+ * namespace: "team",
6050
5990
  * id: "id",
6051
5991
  * body: {
6052
- * externalId: "patient_789"
5992
+ * externalId: "team_eng_platform"
6053
5993
  * }
6054
5994
  * })
6055
5995
  */
6056
- updateClient(request, requestOptions) {
6057
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5996
+ updateEntity(request, requestOptions) {
5997
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6058
5998
  }
6059
- async __updateClient(request, requestOptions) {
6060
- const { id, body: _body } = request;
5999
+ async __updateEntity(request, requestOptions) {
6000
+ const { namespace, id, body: _body } = request;
6061
6001
  const _authRequest = await this._options.authProvider.getAuthRequest();
6062
6002
  const _headers = mergeHeaders(
6063
6003
  _authRequest.headers,
@@ -6067,7 +6007,7 @@ var IdentityClient = class {
6067
6007
  const _response = await fetcher({
6068
6008
  url: url_exports.join(
6069
6009
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6070
- `v1/clients/${url_exports.encodePathParam(id)}`
6010
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6071
6011
  ),
6072
6012
  method: "PUT",
6073
6013
  headers: _headers,
@@ -6098,27 +6038,28 @@ var IdentityClient = class {
6098
6038
  });
6099
6039
  }
6100
6040
  }
6101
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6041
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6102
6042
  }
6103
6043
  /**
6104
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6044
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6105
6045
  *
6106
- * @param {Vectros.DeleteClientRequest} request
6046
+ * @param {Vectros.DeleteEntityRequest} request
6107
6047
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6108
6048
  *
6109
6049
  * @throws {@link Vectros.NotFoundError}
6110
6050
  * @throws {@link Vectros.TooManyRequestsError}
6111
6051
  *
6112
6052
  * @example
6113
- * await client.identity.deleteClient({
6053
+ * await client.identity.deleteEntity({
6054
+ * namespace: "team",
6114
6055
  * id: "id"
6115
6056
  * })
6116
6057
  */
6117
- deleteClient(request, requestOptions) {
6118
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6058
+ deleteEntity(request, requestOptions) {
6059
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6119
6060
  }
6120
- async __deleteClient(request, requestOptions) {
6121
- const { id } = request;
6061
+ async __deleteEntity(request, requestOptions) {
6062
+ const { namespace, id } = request;
6122
6063
  const _authRequest = await this._options.authProvider.getAuthRequest();
6123
6064
  const _headers = mergeHeaders(
6124
6065
  _authRequest.headers,
@@ -6128,7 +6069,7 @@ var IdentityClient = class {
6128
6069
  const _response = await fetcher({
6129
6070
  url: url_exports.join(
6130
6071
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6131
- `v1/clients/${url_exports.encodePathParam(id)}`
6072
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6132
6073
  ),
6133
6074
  method: "DELETE",
6134
6075
  headers: _headers,
@@ -6156,27 +6097,36 @@ var IdentityClient = class {
6156
6097
  });
6157
6098
  }
6158
6099
  }
6159
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6100
+ return handleNonStatusCodeError(
6101
+ _response.error,
6102
+ _response.rawResponse,
6103
+ "DELETE",
6104
+ "/v1/entities/{namespace}/{id}"
6105
+ );
6160
6106
  }
6161
6107
  /**
6162
- * 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.
6108
+ * 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.
6163
6109
  *
6164
- * @param {Vectros.IdentityLookupRequest} request
6110
+ * @param {Vectros.LookupEntitiesRequest} request
6165
6111
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6166
6112
  *
6167
6113
  * @throws {@link Vectros.BadRequestError}
6168
6114
  * @throws {@link Vectros.TooManyRequestsError}
6169
6115
  *
6170
6116
  * @example
6171
- * await client.identity.lookupClients({
6172
- * type: "person_v1",
6173
- * field: "ssn"
6117
+ * await client.identity.lookupEntities({
6118
+ * namespace: "team",
6119
+ * body: {
6120
+ * type: "person_v1",
6121
+ * field: "ssn"
6122
+ * }
6174
6123
  * })
6175
6124
  */
6176
- lookupClients(request, requestOptions) {
6177
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6125
+ lookupEntities(request, requestOptions) {
6126
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6178
6127
  }
6179
- async __lookupClients(request, requestOptions) {
6128
+ async __lookupEntities(request, requestOptions) {
6129
+ const { namespace, body: _body } = request;
6180
6130
  const _authRequest = await this._options.authProvider.getAuthRequest();
6181
6131
  const _headers = mergeHeaders(
6182
6132
  _authRequest.headers,
@@ -6186,14 +6136,14 @@ var IdentityClient = class {
6186
6136
  const _response = await fetcher({
6187
6137
  url: url_exports.join(
6188
6138
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6189
- "v1/clients/lookup"
6139
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6190
6140
  ),
6191
6141
  method: "POST",
6192
6142
  headers: _headers,
6193
6143
  contentType: "application/json",
6194
6144
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6195
6145
  requestType: "json",
6196
- body: request,
6146
+ body: _body,
6197
6147
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6198
6148
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6199
6149
  abortSignal: requestOptions?.abortSignal,
@@ -6217,26 +6167,32 @@ var IdentityClient = class {
6217
6167
  });
6218
6168
  }
6219
6169
  }
6220
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6170
+ return handleNonStatusCodeError(
6171
+ _response.error,
6172
+ _response.rawResponse,
6173
+ "POST",
6174
+ "/v1/entities/{namespace}/lookup"
6175
+ );
6221
6176
  }
6222
6177
  /**
6223
- * 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.
6178
+ * 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.
6224
6179
  *
6225
- * @param {Vectros.GetClientVersionsRequest} request
6180
+ * @param {Vectros.GetEntityVersionsRequest} request
6226
6181
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6227
6182
  *
6228
6183
  * @throws {@link Vectros.NotFoundError}
6229
6184
  *
6230
6185
  * @example
6231
- * await client.identity.getClientVersions({
6186
+ * await client.identity.getEntityVersions({
6187
+ * namespace: "team",
6232
6188
  * id: "id"
6233
6189
  * })
6234
6190
  */
6235
- getClientVersions(request, requestOptions) {
6236
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6191
+ getEntityVersions(request, requestOptions) {
6192
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6237
6193
  }
6238
- async __getClientVersions(request, requestOptions) {
6239
- const { id, startFrom } = request;
6194
+ async __getEntityVersions(request, requestOptions) {
6195
+ const { namespace, id, startFrom } = request;
6240
6196
  const _queryParams = {
6241
6197
  startFrom
6242
6198
  };
@@ -6249,7 +6205,7 @@ var IdentityClient = class {
6249
6205
  const _response = await fetcher({
6250
6206
  url: url_exports.join(
6251
6207
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6252
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6208
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6253
6209
  ),
6254
6210
  method: "GET",
6255
6211
  headers: _headers,
@@ -6275,174 +6231,31 @@ var IdentityClient = class {
6275
6231
  });
6276
6232
  }
6277
6233
  }
6278
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6279
- }
6280
- /**
6281
- * 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.
6282
- *
6283
- * @param {Vectros.ListOrgsRequest} request
6284
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6285
- *
6286
- * @example
6287
- * await client.identity.listOrgs({
6288
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6289
- * externalId: "clinic_001",
6290
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6291
- * type: "org_v1",
6292
- * field: "region",
6293
- * value: "us-east",
6294
- * prefix: "us-"
6295
- * })
6296
- */
6297
- listOrgs(request = {}, requestOptions) {
6298
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6299
- }
6300
- async __listOrgs(request = {}, requestOptions) {
6301
- const {
6302
- userId,
6303
- externalId,
6304
- startFrom,
6305
- limit,
6306
- type: type_,
6307
- field,
6308
- value,
6309
- from: from_,
6310
- to,
6311
- prefix,
6312
- order
6313
- } = request;
6314
- const _queryParams = {
6315
- userId,
6316
- externalId,
6317
- startFrom,
6318
- limit,
6319
- type: type_,
6320
- field,
6321
- value,
6322
- from: from_,
6323
- to,
6324
- prefix,
6325
- order: order != null ? order : void 0
6326
- };
6327
- const _authRequest = await this._options.authProvider.getAuthRequest();
6328
- const _headers = mergeHeaders(
6329
- _authRequest.headers,
6330
- this._options?.headers,
6331
- requestOptions?.headers
6332
- );
6333
- const _response = await fetcher({
6334
- url: url_exports.join(
6335
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6336
- "v1/orgs"
6337
- ),
6338
- method: "GET",
6339
- headers: _headers,
6340
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6341
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6342
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6343
- abortSignal: requestOptions?.abortSignal,
6344
- fetchFn: this._options?.fetch,
6345
- logging: this._options.logging
6346
- });
6347
- if (_response.ok) {
6348
- return { data: _response.body, rawResponse: _response.rawResponse };
6349
- }
6350
- if (_response.error.reason === "status-code") {
6351
- throw new VectrosError({
6352
- statusCode: _response.error.statusCode,
6353
- body: _response.error.body,
6354
- rawResponse: _response.rawResponse
6355
- });
6356
- }
6357
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6358
- }
6359
- /**
6360
- * 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.
6361
- *
6362
- * @param {Vectros.CreateOrgRequest} request
6363
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6364
- *
6365
- * @throws {@link Vectros.BadRequestError}
6366
- * @throws {@link Vectros.ForbiddenError}
6367
- * @throws {@link Vectros.TooManyRequestsError}
6368
- *
6369
- * @example
6370
- * await client.identity.createOrg({
6371
- * body: {
6372
- * externalId: "clinic_001"
6373
- * }
6374
- * })
6375
- */
6376
- createOrg(request, requestOptions) {
6377
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6378
- }
6379
- async __createOrg(request, requestOptions) {
6380
- const { upsert, body: _body } = request;
6381
- const _queryParams = {
6382
- upsert
6383
- };
6384
- const _authRequest = await this._options.authProvider.getAuthRequest();
6385
- const _headers = mergeHeaders(
6386
- _authRequest.headers,
6387
- this._options?.headers,
6388
- requestOptions?.headers
6234
+ return handleNonStatusCodeError(
6235
+ _response.error,
6236
+ _response.rawResponse,
6237
+ "GET",
6238
+ "/v1/entities/{namespace}/{id}/versions"
6389
6239
  );
6390
- const _response = await fetcher({
6391
- url: url_exports.join(
6392
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6393
- "v1/orgs"
6394
- ),
6395
- method: "POST",
6396
- headers: _headers,
6397
- contentType: "application/json",
6398
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6399
- requestType: "json",
6400
- body: _body,
6401
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6402
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6403
- abortSignal: requestOptions?.abortSignal,
6404
- fetchFn: this._options?.fetch,
6405
- logging: this._options.logging
6406
- });
6407
- if (_response.ok) {
6408
- return { data: _response.body, rawResponse: _response.rawResponse };
6409
- }
6410
- if (_response.error.reason === "status-code") {
6411
- switch (_response.error.statusCode) {
6412
- case 400:
6413
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6414
- case 403:
6415
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6416
- case 429:
6417
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6418
- default:
6419
- throw new VectrosError({
6420
- statusCode: _response.error.statusCode,
6421
- body: _response.error.body,
6422
- rawResponse: _response.rawResponse
6423
- });
6424
- }
6425
- }
6426
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6427
6240
  }
6428
6241
  /**
6429
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6242
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6430
6243
  *
6431
- * @param {Vectros.GetOrgRequest} request
6244
+ * @param {Vectros.GetNamespaceRequest} request
6432
6245
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6433
6246
  *
6434
6247
  * @throws {@link Vectros.NotFoundError}
6435
6248
  *
6436
6249
  * @example
6437
- * await client.identity.getOrg({
6438
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6250
+ * await client.identity.getNamespace({
6251
+ * namespace: "team"
6439
6252
  * })
6440
6253
  */
6441
- getOrg(request, requestOptions) {
6442
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6254
+ getNamespace(request, requestOptions) {
6255
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6443
6256
  }
6444
- async __getOrg(request, requestOptions) {
6445
- const { id } = request;
6257
+ async __getNamespace(request, requestOptions) {
6258
+ const { namespace } = request;
6446
6259
  const _authRequest = await this._options.authProvider.getAuthRequest();
6447
6260
  const _headers = mergeHeaders(
6448
6261
  _authRequest.headers,
@@ -6452,7 +6265,7 @@ var IdentityClient = class {
6452
6265
  const _response = await fetcher({
6453
6266
  url: url_exports.join(
6454
6267
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6455
- `v1/orgs/${url_exports.encodePathParam(id)}`
6268
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6456
6269
  ),
6457
6270
  method: "GET",
6458
6271
  headers: _headers,
@@ -6478,30 +6291,31 @@ var IdentityClient = class {
6478
6291
  });
6479
6292
  }
6480
6293
  }
6481
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6294
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6482
6295
  }
6483
6296
  /**
6484
- * 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.
6297
+ * 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.
6485
6298
  *
6486
- * @param {Vectros.UpdateOrgRequest} request
6299
+ * @param {Vectros.UpdateNamespaceRequest} request
6487
6300
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6488
6301
  *
6302
+ * @throws {@link Vectros.ForbiddenError}
6489
6303
  * @throws {@link Vectros.NotFoundError}
6490
6304
  * @throws {@link Vectros.TooManyRequestsError}
6491
6305
  *
6492
6306
  * @example
6493
- * await client.identity.updateOrg({
6494
- * id: "id",
6307
+ * await client.identity.updateNamespace({
6308
+ * namespace: "team",
6495
6309
  * body: {
6496
- * externalId: "clinic_001"
6310
+ * namespace: "team"
6497
6311
  * }
6498
6312
  * })
6499
6313
  */
6500
- updateOrg(request, requestOptions) {
6501
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6314
+ updateNamespace(request, requestOptions) {
6315
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6502
6316
  }
6503
- async __updateOrg(request, requestOptions) {
6504
- const { id, body: _body } = request;
6317
+ async __updateNamespace(request, requestOptions) {
6318
+ const { namespace, body: _body } = request;
6505
6319
  const _authRequest = await this._options.authProvider.getAuthRequest();
6506
6320
  const _headers = mergeHeaders(
6507
6321
  _authRequest.headers,
@@ -6511,7 +6325,7 @@ var IdentityClient = class {
6511
6325
  const _response = await fetcher({
6512
6326
  url: url_exports.join(
6513
6327
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6514
- `v1/orgs/${url_exports.encodePathParam(id)}`
6328
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6515
6329
  ),
6516
6330
  method: "PUT",
6517
6331
  headers: _headers,
@@ -6530,6 +6344,8 @@ var IdentityClient = class {
6530
6344
  }
6531
6345
  if (_response.error.reason === "status-code") {
6532
6346
  switch (_response.error.statusCode) {
6347
+ case 403:
6348
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6533
6349
  case 404:
6534
6350
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6535
6351
  case 429:
@@ -6542,27 +6358,28 @@ var IdentityClient = class {
6542
6358
  });
6543
6359
  }
6544
6360
  }
6545
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6361
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6546
6362
  }
6547
6363
  /**
6548
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6364
+ * 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.
6549
6365
  *
6550
- * @param {Vectros.DeleteOrgRequest} request
6366
+ * @param {Vectros.DeleteNamespaceRequest} request
6551
6367
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6552
6368
  *
6369
+ * @throws {@link Vectros.ForbiddenError}
6553
6370
  * @throws {@link Vectros.NotFoundError}
6554
6371
  * @throws {@link Vectros.TooManyRequestsError}
6555
6372
  *
6556
6373
  * @example
6557
- * await client.identity.deleteOrg({
6558
- * id: "id"
6374
+ * await client.identity.deleteNamespace({
6375
+ * namespace: "team"
6559
6376
  * })
6560
6377
  */
6561
- deleteOrg(request, requestOptions) {
6562
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6378
+ deleteNamespace(request, requestOptions) {
6379
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6563
6380
  }
6564
- async __deleteOrg(request, requestOptions) {
6565
- const { id } = request;
6381
+ async __deleteNamespace(request, requestOptions) {
6382
+ const { namespace } = request;
6566
6383
  const _authRequest = await this._options.authProvider.getAuthRequest();
6567
6384
  const _headers = mergeHeaders(
6568
6385
  _authRequest.headers,
@@ -6572,7 +6389,7 @@ var IdentityClient = class {
6572
6389
  const _response = await fetcher({
6573
6390
  url: url_exports.join(
6574
6391
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6575
- `v1/orgs/${url_exports.encodePathParam(id)}`
6392
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6576
6393
  ),
6577
6394
  method: "DELETE",
6578
6395
  headers: _headers,
@@ -6588,6 +6405,8 @@ var IdentityClient = class {
6588
6405
  }
6589
6406
  if (_response.error.reason === "status-code") {
6590
6407
  switch (_response.error.statusCode) {
6408
+ case 403:
6409
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6591
6410
  case 404:
6592
6411
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6593
6412
  case 429:
@@ -6600,27 +6419,26 @@ var IdentityClient = class {
6600
6419
  });
6601
6420
  }
6602
6421
  }
6603
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6422
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6604
6423
  }
6605
6424
  /**
6606
- * 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.
6425
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6607
6426
  *
6608
- * @param {Vectros.IdentityLookupRequest} request
6427
+ * @param {Vectros.ListNamespacesRequest} request
6609
6428
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6610
6429
  *
6611
- * @throws {@link Vectros.BadRequestError}
6612
- * @throws {@link Vectros.TooManyRequestsError}
6613
- *
6614
6430
  * @example
6615
- * await client.identity.lookupOrgs({
6616
- * type: "person_v1",
6617
- * field: "ssn"
6618
- * })
6431
+ * await client.identity.listNamespaces()
6619
6432
  */
6620
- lookupOrgs(request, requestOptions) {
6621
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6433
+ listNamespaces(request = {}, requestOptions) {
6434
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6622
6435
  }
6623
- async __lookupOrgs(request, requestOptions) {
6436
+ async __listNamespaces(request = {}, requestOptions) {
6437
+ const { startFrom, limit } = request;
6438
+ const _queryParams = {
6439
+ startFrom,
6440
+ limit
6441
+ };
6624
6442
  const _authRequest = await this._options.authProvider.getAuthRequest();
6625
6443
  const _headers = mergeHeaders(
6626
6444
  _authRequest.headers,
@@ -6630,14 +6448,11 @@ var IdentityClient = class {
6630
6448
  const _response = await fetcher({
6631
6449
  url: url_exports.join(
6632
6450
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6633
- "v1/orgs/lookup"
6451
+ "v1/namespaces"
6634
6452
  ),
6635
- method: "POST",
6453
+ method: "GET",
6636
6454
  headers: _headers,
6637
- contentType: "application/json",
6638
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6639
- requestType: "json",
6640
- body: request,
6455
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6641
6456
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6642
6457
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6643
6458
  abortSignal: requestOptions?.abortSignal,
@@ -6648,42 +6463,33 @@ var IdentityClient = class {
6648
6463
  return { data: _response.body, rawResponse: _response.rawResponse };
6649
6464
  }
6650
6465
  if (_response.error.reason === "status-code") {
6651
- switch (_response.error.statusCode) {
6652
- case 400:
6653
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6654
- case 429:
6655
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6656
- default:
6657
- throw new VectrosError({
6658
- statusCode: _response.error.statusCode,
6659
- body: _response.error.body,
6660
- rawResponse: _response.rawResponse
6661
- });
6662
- }
6466
+ throw new VectrosError({
6467
+ statusCode: _response.error.statusCode,
6468
+ body: _response.error.body,
6469
+ rawResponse: _response.rawResponse
6470
+ });
6663
6471
  }
6664
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6472
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6665
6473
  }
6666
6474
  /**
6667
- * 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.
6475
+ * 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.
6668
6476
  *
6669
- * @param {Vectros.GetOrgVersionsRequest} request
6477
+ * @param {Vectros.NamespaceRequest} request
6670
6478
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6671
6479
  *
6672
- * @throws {@link Vectros.NotFoundError}
6480
+ * @throws {@link Vectros.BadRequestError}
6481
+ * @throws {@link Vectros.ForbiddenError}
6482
+ * @throws {@link Vectros.TooManyRequestsError}
6673
6483
  *
6674
6484
  * @example
6675
- * await client.identity.getOrgVersions({
6676
- * id: "id"
6485
+ * await client.identity.registerNamespace({
6486
+ * namespace: "team"
6677
6487
  * })
6678
6488
  */
6679
- getOrgVersions(request, requestOptions) {
6680
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6489
+ registerNamespace(request, requestOptions) {
6490
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6681
6491
  }
6682
- async __getOrgVersions(request, requestOptions) {
6683
- const { id, startFrom } = request;
6684
- const _queryParams = {
6685
- startFrom
6686
- };
6492
+ async __registerNamespace(request, requestOptions) {
6687
6493
  const _authRequest = await this._options.authProvider.getAuthRequest();
6688
6494
  const _headers = mergeHeaders(
6689
6495
  _authRequest.headers,
@@ -6693,11 +6499,14 @@ var IdentityClient = class {
6693
6499
  const _response = await fetcher({
6694
6500
  url: url_exports.join(
6695
6501
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6696
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6502
+ "v1/namespaces"
6697
6503
  ),
6698
- method: "GET",
6504
+ method: "POST",
6699
6505
  headers: _headers,
6700
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6506
+ contentType: "application/json",
6507
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6508
+ requestType: "json",
6509
+ body: request,
6701
6510
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6702
6511
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6703
6512
  abortSignal: requestOptions?.abortSignal,
@@ -6709,8 +6518,12 @@ var IdentityClient = class {
6709
6518
  }
6710
6519
  if (_response.error.reason === "status-code") {
6711
6520
  switch (_response.error.statusCode) {
6712
- case 404:
6713
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6521
+ case 400:
6522
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6523
+ case 403:
6524
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6525
+ case 429:
6526
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6714
6527
  default:
6715
6528
  throw new VectrosError({
6716
6529
  statusCode: _response.error.statusCode,
@@ -6719,7 +6532,7 @@ var IdentityClient = class {
6719
6532
  });
6720
6533
  }
6721
6534
  }
6722
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6535
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6723
6536
  }
6724
6537
  /**
6725
6538
  * 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.
@@ -7596,7 +7409,7 @@ var RecordsClient = class {
7596
7409
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7597
7410
  }
7598
7411
  /**
7599
- * 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.
7412
+ * 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.
7600
7413
  *
7601
7414
  * @param {Vectros.ListRecordsRequest} request
7602
7415
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7606,8 +7419,6 @@ var RecordsClient = class {
7606
7419
  * type: "intake_form",
7607
7420
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7608
7421
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7609
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7610
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7611
7422
  * scope: "group:eng-team",
7612
7423
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7613
7424
  * })
@@ -7616,24 +7427,11 @@ var RecordsClient = class {
7616
7427
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7617
7428
  }
7618
7429
  async __listRecords(request = {}, requestOptions) {
7619
- const {
7620
- type: type_,
7621
- folderId,
7622
- userId,
7623
- orgId,
7624
- clientId,
7625
- scope,
7626
- startFrom,
7627
- limit,
7628
- includePayload,
7629
- recent
7630
- } = request;
7430
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7631
7431
  const _queryParams = {
7632
7432
  type: type_,
7633
7433
  folderId,
7634
7434
  userId,
7635
- orgId,
7636
- clientId,
7637
7435
  scope,
7638
7436
  startFrom,
7639
7437
  limit,
@@ -7933,7 +7731,7 @@ var RecordsClient = class {
7933
7731
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7934
7732
  }
7935
7733
  /**
7936
- * 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.
7734
+ * 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.
7937
7735
  *
7938
7736
  * @param {Vectros.PatchRecordRequest} request
7939
7737
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8259,7 +8057,7 @@ var SchemasClient = class {
8259
8057
  this._options = normalizeClientOptionsWithAuth(options);
8260
8058
  }
8261
8059
  /**
8262
- * 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.
8060
+ * 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.
8263
8061
  *
8264
8062
  * @param {Vectros.ListSchemasRequest} request
8265
8063
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8267,7 +8065,7 @@ var SchemasClient = class {
8267
8065
  * @example
8268
8066
  * await client.schemas.listSchemas({
8269
8067
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8270
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8068
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8271
8069
  * surface: "document",
8272
8070
  * recordType: "intake_form",
8273
8071
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8277,10 +8075,10 @@ var SchemasClient = class {
8277
8075
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8278
8076
  }
8279
8077
  async __listSchemas(request = {}, requestOptions) {
8280
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8078
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8281
8079
  const _queryParams = {
8282
8080
  userId,
8283
- orgId,
8081
+ scope,
8284
8082
  surface,
8285
8083
  recordType,
8286
8084
  startFrom,
@@ -8726,12 +8524,12 @@ var VectrosClient = class {
8726
8524
  get auth() {
8727
8525
  return this._auth ?? (this._auth = new AuthClient(this._options));
8728
8526
  }
8729
- get identity() {
8730
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8731
- }
8732
8527
  get documents() {
8733
8528
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8734
8529
  }
8530
+ get identity() {
8531
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8532
+ }
8735
8533
  get compliance() {
8736
8534
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8737
8535
  }
@@ -8829,8 +8627,8 @@ function warnOnSuboptimalKey(key, log) {
8829
8627
 
8830
8628
  // src/build-info.ts
8831
8629
  var BUILD_INFO = {
8832
- mcpServer: true ? "0.9.0" : "dev",
8833
- sdk: true ? "0.34.0" : "dev"
8630
+ mcpServer: true ? "0.10.0" : "dev",
8631
+ sdk: true ? "0.35.0" : "dev"
8834
8632
  };
8835
8633
 
8836
8634
  // src/log.ts
@@ -9115,10 +8913,8 @@ var inputSchema = {
9115
8913
  ),
9116
8914
  // Ownership.
9117
8915
  userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9118
- orgId: import_zod.z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9119
- clientId: import_zod.z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9120
8916
  scope: import_zod.z.string().optional().describe(
9121
- '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.'
8917
+ '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.'
9122
8918
  ),
9123
8919
  // Date window.
9124
8920
  createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9137,7 +8933,7 @@ var inputSchema = {
9137
8933
  var hybridSearch = ({ client, log }) => ({
9138
8934
  name: "hybrid_search",
9139
8935
  title: "Hybrid search",
9140
- 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\".",
8936
+ 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\".",
9141
8937
  inputSchema,
9142
8938
  handler: async (args) => {
9143
8939
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9155,8 +8951,6 @@ var hybridSearch = ({ client, log }) => ({
9155
8951
  typeName: args.typeName,
9156
8952
  filters: args.filters,
9157
8953
  userId: args.userId,
9158
- orgId: args.orgId,
9159
- clientId: args.clientId,
9160
8954
  scope: args.scope,
9161
8955
  createdAfter: args.createdAfter,
9162
8956
  createdBefore: args.createdBefore,
@@ -9241,10 +9035,8 @@ var inputSchema2 = {
9241
9035
  ),
9242
9036
  // List-mode args:
9243
9037
  userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
9244
- orgId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this org."),
9245
- clientId: import_zod2.z.string().optional().describe("List mode: scope to records associated with this client."),
9246
9038
  scope: import_zod2.z.string().optional().describe(
9247
- '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.'
9039
+ '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.'
9248
9040
  ),
9249
9041
  startFrom: import_zod2.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9250
9042
  limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9254,7 +9046,7 @@ var inputSchema2 = {
9254
9046
  var recordQuery = ({ client, log }) => ({
9255
9047
  name: "record_query",
9256
9048
  title: "Record query (list or lookup)",
9257
- 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.",
9049
+ 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.",
9258
9050
  inputSchema: inputSchema2,
9259
9051
  handler: async (args) => {
9260
9052
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9308,8 +9100,6 @@ var recordQuery = ({ client, log }) => ({
9308
9100
  page = await client.records.listRecords({
9309
9101
  type,
9310
9102
  userId: args.userId,
9311
- orgId: args.orgId,
9312
- clientId: args.clientId,
9313
9103
  scope: args.scope,
9314
9104
  startFrom,
9315
9105
  limit
@@ -9444,10 +9234,8 @@ var inputSchema4 = {
9444
9234
  status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9445
9235
  folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
9446
9236
  userId: import_zod4.z.string().optional().describe("Owning user id."),
9447
- orgId: import_zod4.z.string().optional().describe("Owning organization id."),
9448
- clientId: import_zod4.z.string().optional().describe("Associated client id."),
9449
9237
  scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
9450
- '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.'
9238
+ '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.'
9451
9239
  )
9452
9240
  };
9453
9241
  var recordCreate = ({ client, log }) => ({
@@ -9467,8 +9255,6 @@ var recordCreate = ({ client, log }) => ({
9467
9255
  status: args.status,
9468
9256
  folderId: args.folderId,
9469
9257
  userId: args.userId,
9470
- orgId: args.orgId,
9471
- clientId: args.clientId,
9472
9258
  scopes: args.scopes
9473
9259
  }
9474
9260
  });
@@ -9572,10 +9358,8 @@ var inputSchema7 = {
9572
9358
  // answer on a specific owner / folder / type / metadata subset, not just the
9573
9359
  // whole-tenant corpus.
9574
9360
  userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9575
- orgId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9576
- clientId: import_zod7.z.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9577
9361
  scope: import_zod7.z.string().optional().describe(
9578
- '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.'
9362
+ '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.'
9579
9363
  ),
9580
9364
  folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
9581
9365
  rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9603,8 +9387,6 @@ var ragAsk = ({ client, log }) => ({
9603
9387
  mode: searchArg.mode ?? "HYBRID",
9604
9388
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9605
9389
  userId: searchArg.userId,
9606
- orgId: searchArg.orgId,
9607
- clientId: searchArg.clientId,
9608
9390
  scope: searchArg.scope,
9609
9391
  folderId: searchArg.folderId,
9610
9392
  rootFolderId: searchArg.rootFolderId,
@@ -9750,32 +9532,32 @@ var inputSchema9 = {
9750
9532
  userId: import_zod9.z.string().optional().describe(
9751
9533
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9752
9534
  ),
9753
- orgId: import_zod9.z.string().optional().describe(
9754
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9535
+ scope: import_zod9.z.string().optional().describe(
9536
+ '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.'
9755
9537
  ),
9756
- surface: import_zod9.z.enum(["record", "document", "user", "org", "client"]).optional().describe(
9757
- "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."
9538
+ surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
9539
+ "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."
9758
9540
  ),
9759
9541
  recordType: import_zod9.z.string().optional().describe(
9760
- '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.'
9542
+ '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.'
9761
9543
  )
9762
9544
  };
9763
9545
  var listSchemas = ({ client, log }) => ({
9764
9546
  name: "list_schemas",
9765
9547
  title: "List record schemas",
9766
- 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.',
9548
+ 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.',
9767
9549
  inputSchema: inputSchema9,
9768
9550
  handler: async (args) => {
9769
9551
  const userId = args.userId;
9770
- const orgId = args.orgId;
9552
+ const scope = args.scope;
9771
9553
  const surface = args.surface;
9772
9554
  const recordType = args.recordType;
9773
9555
  try {
9774
9556
  const schemas = await drainPages(
9775
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9557
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9776
9558
  );
9777
9559
  log.debug(
9778
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9560
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9779
9561
  "list_schemas ok"
9780
9562
  );
9781
9563
  return {
@@ -9900,10 +9682,8 @@ var inputSchema11 = {
9900
9682
  // List-mode args:
9901
9683
  folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9902
9684
  userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
9903
- orgId: import_zod11.z.string().optional().describe("List mode: scope to documents belonging to this org."),
9904
- clientId: import_zod11.z.string().optional().describe("List mode: scope to documents associated with this client."),
9905
9685
  scope: import_zod11.z.string().optional().describe(
9906
- '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.'
9686
+ '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.'
9907
9687
  ),
9908
9688
  startFrom: import_zod11.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9909
9689
  limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9913,7 +9693,7 @@ var inputSchema11 = {
9913
9693
  var documentQuery = ({ client, log }) => ({
9914
9694
  name: "document_query",
9915
9695
  title: "Document query (list or lookup)",
9916
- 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.",
9696
+ 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.",
9917
9697
  inputSchema: inputSchema11,
9918
9698
  handler: async (args) => {
9919
9699
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9973,8 +9753,6 @@ var documentQuery = ({ client, log }) => ({
9973
9753
  page = await client.documents.listDocuments({
9974
9754
  folderId: args.folderId,
9975
9755
  userId: args.userId,
9976
- orgId: args.orgId,
9977
- clientId: args.clientId,
9978
9756
  scope: args.scope,
9979
9757
  startFrom,
9980
9758
  limit
@@ -10015,8 +9793,9 @@ var inputSchema12 = {
10015
9793
  "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."
10016
9794
  ),
10017
9795
  userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10018
- orgId: import_zod12.z.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10019
- clientId: import_zod12.z.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9796
+ scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
9797
+ '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).'
9798
+ ),
10020
9799
  expectedVersion: import_zod12.z.number().int().optional().describe(
10021
9800
  "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."
10022
9801
  )
@@ -10036,8 +9815,7 @@ var documentUpdate = ({ client, log }) => ({
10036
9815
  const folderId = args.folderId;
10037
9816
  const status = args.status;
10038
9817
  const userId = args.userId;
10039
- const orgId = args.orgId;
10040
- const clientId = args.clientId;
9818
+ const scopes = args.scopes;
10041
9819
  const expectedVersion = args.expectedVersion;
10042
9820
  try {
10043
9821
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10049,8 +9827,7 @@ var documentUpdate = ({ client, log }) => ({
10049
9827
  if (folderId !== void 0) body.folderId = folderId;
10050
9828
  if (status !== void 0) body.status = status;
10051
9829
  if (userId !== void 0) body.userId = userId;
10052
- if (orgId !== void 0) body.orgId = orgId;
10053
- if (clientId !== void 0) body.clientId = clientId;
9830
+ if (scopes !== void 0) body.scopes = scopes;
10054
9831
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10055
9832
  const updated = await client.documents.patchDocument({
10056
9833
  id: resolved.id,
@@ -10100,8 +9877,9 @@ var inputSchema14 = {
10100
9877
  id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
10101
9878
  parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10102
9879
  userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
10103
- orgId: import_zod14.z.string().optional().describe("List mode: scope to folders belonging to this org."),
10104
- clientId: import_zod14.z.string().optional().describe("List mode: scope to folders associated with this client."),
9880
+ scope: import_zod14.z.string().optional().describe(
9881
+ '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.'
9882
+ ),
10105
9883
  startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10106
9884
  limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10107
9885
  `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\`.`
@@ -10110,7 +9888,7 @@ var inputSchema14 = {
10110
9888
  var folderQuery = ({ client, log }) => ({
10111
9889
  name: "folder_query",
10112
9890
  title: "Folder query (list or get)",
10113
- 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.",
9891
+ 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.",
10114
9892
  inputSchema: inputSchema14,
10115
9893
  handler: async (args) => {
10116
9894
  const id = args.id;
@@ -10124,8 +9902,7 @@ var folderQuery = ({ client, log }) => ({
10124
9902
  const page = await client.folders.listFolders({
10125
9903
  parentFolderId: args.parentId,
10126
9904
  userId: args.userId,
10127
- orgId: args.orgId,
10128
- clientId: args.clientId,
9905
+ scope: args.scope,
10129
9906
  startFrom: args.startFrom,
10130
9907
  limit
10131
9908
  });
@@ -10149,10 +9926,8 @@ var inputSchema15 = {
10149
9926
  parentId: import_zod15.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10150
9927
  slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10151
9928
  userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
10152
- orgId: import_zod15.z.string().optional().describe("Owning org (Vectros UUID)."),
10153
- clientId: import_zod15.z.string().optional().describe("Associated client (Vectros UUID)."),
10154
9929
  scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
10155
- '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.'
9930
+ '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.'
10156
9931
  )
10157
9932
  };
10158
9933
  var folderCreate = ({ client, log }) => ({
@@ -10169,8 +9944,6 @@ var folderCreate = ({ client, log }) => ({
10169
9944
  parentFolderId: args.parentId,
10170
9945
  slug: args.slug,
10171
9946
  userId: args.userId,
10172
- orgId: args.orgId,
10173
- clientId: args.clientId,
10174
9947
  scopes: args.scopes
10175
9948
  }
10176
9949
  });
@@ -10191,8 +9964,9 @@ var inputSchema16 = {
10191
9964
  name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
10192
9965
  description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
10193
9966
  userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10194
- orgId: import_zod16.z.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10195
- clientId: import_zod16.z.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9967
+ scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
9968
+ '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).'
9969
+ ),
10196
9970
  expectedVersion: import_zod16.z.number().int().optional().describe(
10197
9971
  "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."
10198
9972
  )
@@ -10207,16 +9981,14 @@ var folderUpdate = ({ client, log }) => ({
10207
9981
  const name = args.name;
10208
9982
  const description = args.description;
10209
9983
  const userId = args.userId;
10210
- const orgId = args.orgId;
10211
- const clientId = args.clientId;
9984
+ const scopes = args.scopes;
10212
9985
  const expectedVersion = args.expectedVersion;
10213
9986
  try {
10214
9987
  const body = {};
10215
9988
  if (name !== void 0) body.name = name;
10216
9989
  if (description !== void 0) body.description = description;
10217
9990
  if (userId !== void 0) body.userId = userId;
10218
- if (orgId !== void 0) body.orgId = orgId;
10219
- if (clientId !== void 0) body.clientId = clientId;
9991
+ if (scopes !== void 0) body.scopes = scopes;
10220
9992
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10221
9993
  const updated = await client.folders.patchFolder({ id, body });
10222
9994
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10382,10 +10154,8 @@ var inputSchema19 = {
10382
10154
  // Common (both modes):
10383
10155
  folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10384
10156
  userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
10385
- orgId: import_zod18.z.string().optional().describe("Owning org ID. Optional."),
10386
- clientId: import_zod18.z.string().optional().describe("Owning client ID. Optional."),
10387
10157
  scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
10388
- "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."
10158
+ "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."
10389
10159
  )
10390
10160
  };
10391
10161
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10433,9 +10203,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10433
10203
  payload: args.payload,
10434
10204
  schemaId,
10435
10205
  externalId: args.externalId,
10436
- userId: args.userId,
10437
- orgId: args.orgId,
10438
- clientId: args.clientId
10206
+ userId: args.userId
10439
10207
  };
10440
10208
  try {
10441
10209
  if (text) {
@@ -10542,7 +10310,9 @@ var import_zod19 = require("zod");
10542
10310
  var MCP_DEFAULT_LIMIT5 = 10;
10543
10311
  var MCP_MAX_LIMIT5 = 100;
10544
10312
  var inputSchema20 = {
10545
- kind: import_zod19.z.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10313
+ kind: import_zod19.z.string().describe(
10314
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10315
+ ),
10546
10316
  externalId: import_zod19.z.string().optional().describe(
10547
10317
  "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."
10548
10318
  ),
@@ -10561,11 +10331,12 @@ var inputSchema20 = {
10561
10331
  };
10562
10332
  var lookupPrincipal = ({ client, log }) => ({
10563
10333
  name: "lookup_principal",
10564
- title: "Look up a user / org / client identity",
10565
- 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.",
10334
+ title: "Look up a user identity or a namespaced identity entity",
10335
+ 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.",
10566
10336
  inputSchema: inputSchema20,
10567
10337
  handler: async (args) => {
10568
10338
  const kind = args.kind;
10339
+ const isUser = kind === "user";
10569
10340
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10570
10341
  const externalId = args.externalId;
10571
10342
  const type = args.type;
@@ -10579,13 +10350,7 @@ var lookupPrincipal = ({ client, log }) => ({
10579
10350
  try {
10580
10351
  let page;
10581
10352
  if (externalId !== void 0) {
10582
- if (kind === "user") {
10583
- page = await client.identity.listUsers({ externalId, limit });
10584
- } else if (kind === "org") {
10585
- page = await client.identity.listOrgs({ externalId, limit });
10586
- } else {
10587
- page = await client.identity.listClients({ externalId, limit });
10588
- }
10353
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10589
10354
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10590
10355
  } else if (field !== void 0) {
10591
10356
  const hasEquality = value !== void 0;
@@ -10614,13 +10379,7 @@ var lookupPrincipal = ({ client, log }) => ({
10614
10379
  );
10615
10380
  }
10616
10381
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10617
- if (kind === "user") {
10618
- page = await client.identity.lookupUsers(req);
10619
- } else if (kind === "org") {
10620
- page = await client.identity.lookupOrgs(req);
10621
- } else {
10622
- page = await client.identity.lookupClients(req);
10623
- }
10382
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10624
10383
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10625
10384
  } else {
10626
10385
  return toolError(