@extrahorizon/javascript-sdk 8.4.1-dev-65-8ee48f9 → 8.4.1-dev-66-34d7111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,8 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+ - `exh.data.documents.unlinkAllUsers` and `unlinkAllGroups` methods to unlink all users or groups from a document
12
+
10
13
  ### Changed
11
14
  - RQL `contains` and `excludes` now have their different variations better separated in the type definitions
15
+ - `exh.data.documents.unlinkUsers` and `unlinkGroups` now also accept an array of user or group ids directly rather than nested in a request body object
16
+ - Thanks to `tran-simon` for the pointing out the initially incorrect `unlinkUsers` type definition!
17
+
18
+ ### Deprecated
19
+ - `exh.data.documents.unlinkUsers` usage with an object is deprecated in favor of an array of ids directly or `unlinkAllUsers` for unlinking all users
20
+ - `exh.data.documents.unlinkGroups` usage with an object is deprecated in favor of an array of ids directly or `unlinkAllGroups` for unlinking all groups
12
21
 
13
22
  ## [8.4.1]
14
23
 
@@ -3603,15 +3603,23 @@ var documents = (client, httpAuth) => {
3603
3603
  async linkGroups(schemaIdOrName, documentId, requestBody, options) {
3604
3604
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/linkGroups`, requestBody, options)).data;
3605
3605
  },
3606
- async unlinkGroups(schemaIdOrName, documentId, requestBody, options) {
3606
+ async unlinkGroups(schemaIdOrName, documentId, data, options) {
3607
+ const requestBody = Array.isArray(data) ? { groupIds: data } : data;
3607
3608
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/unlinkGroups`, requestBody, options)).data;
3608
3609
  },
3610
+ async unlinkAllGroups(schemaIdOrName, documentId, options) {
3611
+ return await this.unlinkGroups(schemaIdOrName, documentId, {}, options); // Empty object to remove all groups
3612
+ },
3609
3613
  async linkUsers(schemaIdOrName, documentId, requestBody, options) {
3610
3614
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/linkUsers`, requestBody, options)).data;
3611
3615
  },
3612
- async unlinkUsers(schemaIdOrName, documentId, requestBody, options) {
3616
+ async unlinkUsers(schemaIdOrName, documentId, data, options) {
3617
+ const requestBody = Array.isArray(data) ? { userIds: data } : data;
3613
3618
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/unlinkUsers`, requestBody, options)).data;
3614
3619
  },
3620
+ async unlinkAllUsers(schemaIdOrName, documentId, options) {
3621
+ return await this.unlinkUsers(schemaIdOrName, documentId, {}, options); // Empty object to remove all users
3622
+ },
3615
3623
  };
3616
3624
  };
3617
3625
 
@@ -5368,7 +5376,7 @@ const logsService = (httpWithAuth) => {
5368
5376
  };
5369
5377
  };
5370
5378
 
5371
- const version = '8.4.1-dev-65-8ee48f9';
5379
+ const version = '8.4.1-dev-66-34d7111';
5372
5380
 
5373
5381
  /**
5374
5382
  * Create ExtraHorizon client.
package/build/index.mjs CHANGED
@@ -3573,15 +3573,23 @@ var documents = (client, httpAuth) => {
3573
3573
  async linkGroups(schemaIdOrName, documentId, requestBody, options) {
3574
3574
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/linkGroups`, requestBody, options)).data;
3575
3575
  },
3576
- async unlinkGroups(schemaIdOrName, documentId, requestBody, options) {
3576
+ async unlinkGroups(schemaIdOrName, documentId, data, options) {
3577
+ const requestBody = Array.isArray(data) ? { groupIds: data } : data;
3577
3578
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/unlinkGroups`, requestBody, options)).data;
3578
3579
  },
3580
+ async unlinkAllGroups(schemaIdOrName, documentId, options) {
3581
+ return await this.unlinkGroups(schemaIdOrName, documentId, {}, options); // Empty object to remove all groups
3582
+ },
3579
3583
  async linkUsers(schemaIdOrName, documentId, requestBody, options) {
3580
3584
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/linkUsers`, requestBody, options)).data;
3581
3585
  },
3582
- async unlinkUsers(schemaIdOrName, documentId, requestBody, options) {
3586
+ async unlinkUsers(schemaIdOrName, documentId, data, options) {
3587
+ const requestBody = Array.isArray(data) ? { userIds: data } : data;
3583
3588
  return (await client.post(httpAuth, `/${schemaIdOrName}/documents/${documentId}/unlinkUsers`, requestBody, options)).data;
3584
3589
  },
3590
+ async unlinkAllUsers(schemaIdOrName, documentId, options) {
3591
+ return await this.unlinkUsers(schemaIdOrName, documentId, {}, options); // Empty object to remove all users
3592
+ },
3585
3593
  };
3586
3594
  };
3587
3595
 
@@ -5338,7 +5346,7 @@ const logsService = (httpWithAuth) => {
5338
5346
  };
5339
5347
  };
5340
5348
 
5341
- const version = '8.4.1-dev-65-8ee48f9';
5349
+ const version = '8.4.1-dev-66-34d7111';
5342
5350
 
5343
5351
  /**
5344
5352
  * Create ExtraHorizon client.
@@ -132,8 +132,10 @@ export declare type MockClientOAuth1<MockFn> = {
132
132
  transition: MockFn;
133
133
  linkGroups: MockFn;
134
134
  unlinkGroups: MockFn;
135
+ unlinkAllGroups: MockFn;
135
136
  linkUsers: MockFn;
136
137
  unlinkUsers: MockFn;
138
+ unlinkAllUsers: MockFn;
137
139
  };
138
140
  transitions: {
139
141
  updateCreation: MockFn;
@@ -661,8 +663,10 @@ export declare type MockClientOAuth2<MockFn> = {
661
663
  transition: MockFn;
662
664
  linkGroups: MockFn;
663
665
  unlinkGroups: MockFn;
666
+ unlinkAllGroups: MockFn;
664
667
  linkUsers: MockFn;
665
668
  unlinkUsers: MockFn;
669
+ unlinkAllUsers: MockFn;
666
670
  };
667
671
  transitions: {
668
672
  updateCreation: MockFn;
@@ -1190,8 +1194,10 @@ export declare type MockClientProxy<MockFn> = {
1190
1194
  transition: MockFn;
1191
1195
  linkGroups: MockFn;
1192
1196
  unlinkGroups: MockFn;
1197
+ unlinkAllGroups: MockFn;
1193
1198
  linkUsers: MockFn;
1194
1199
  unlinkUsers: MockFn;
1200
+ unlinkAllUsers: MockFn;
1195
1201
  };
1196
1202
  transitions: {
1197
1203
  updateCreation: MockFn;
@@ -563,6 +563,8 @@ export interface DataDocumentsService {
563
563
  groupIds: Array<ObjectId>;
564
564
  }, options?: OptionsBase): Promise<AffectedRecords>;
565
565
  /**
566
+ * @deprecated Use `unlinkGroups(schemaIdOrName, documentId, groupIds)` or `unlinkAllGroups(schemaIdOrName, documentId)` instead.
567
+ *
566
568
  * Unlink groups from a document
567
569
  *
568
570
  * Unlink the specified groups from a document
@@ -582,6 +584,26 @@ export interface DataDocumentsService {
582
584
  unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
583
585
  groupIds?: Array<ObjectId>;
584
586
  }, options?: OptionsBase): Promise<AffectedRecords>;
587
+ /**
588
+ * Unlink groups from a document
589
+ *
590
+ * Unlink the specified groups from a document
591
+ *
592
+ * Specifying an **empty** `groupIds` array will have **no effect** on the document.
593
+ *
594
+ * Permission | Scope | Effect
595
+ * - | - | -
596
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
597
+ */
598
+ unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, groupIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
599
+ /**
600
+ * Unlink all groups from a document
601
+ *
602
+ * Permission | Scope | Effect
603
+ * - | - | -
604
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
605
+ */
606
+ unlinkAllGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
585
607
  /**
586
608
  * Link users to a document
587
609
  *
@@ -601,6 +623,8 @@ export interface DataDocumentsService {
601
623
  userIds: Array<ObjectId>;
602
624
  }, options?: OptionsBase): Promise<AffectedRecords>;
603
625
  /**
626
+ * @deprecated Use `unlinkUsers(schemaIdOrName, documentId, userIds)` or `unlinkAllUsers(schemaIdOrName, documentId)` instead.
627
+ *
604
628
  * Unlink users from a document
605
629
  *
606
630
  * Unlink the specified users from a document.
@@ -622,6 +646,30 @@ export interface DataDocumentsService {
622
646
  unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
623
647
  userIds?: Array<ObjectId>;
624
648
  }, options?: OptionsBase): Promise<AffectedRecords>;
649
+ /**
650
+ * Unlink users from a document
651
+ *
652
+ * Unlink the specified users from a document.
653
+ *
654
+ * Specifying an **empty** `userIds` array will have **no effect** on the document.
655
+ *
656
+ * Permission | Scope | Effect
657
+ * - | - | -
658
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
659
+ *
660
+ * Note: When GroupSyncMode.LINKED_USERS_PATIENT_ENLISTMENT is set for a document, all the groups where the specified user is enlisted as patient will also be removed from the document.
661
+ */
662
+ unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, userIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
663
+ /**
664
+ * Unlink all users from a document
665
+ *
666
+ * Permission | Scope | Effect
667
+ * - | - | -
668
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
669
+ *
670
+ * Note: When GroupSyncMode.LINKED_USERS_PATIENT_ENLISTMENT is set for a document, all the groups where the specified user is enlisted as patient will also be removed from the document.
671
+ */
672
+ unlinkAllUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
625
673
  }
626
674
  export interface DataIndexesService {
627
675
  /**
@@ -1 +1 @@
1
- export declare const version = "8.4.1-dev-65-8ee48f9";
1
+ export declare const version = "8.4.1-dev-66-34d7111";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.4.1-dev-65-8ee48f9",
3
+ "version": "8.4.1-dev-66-34d7111",
4
4
  "description": "This package serves as a JavaScript wrapper around all Extra Horizon cloud services.",
5
5
  "main": "build/index.cjs.js",
6
6
  "types": "build/types/index.d.ts",