@extrahorizon/javascript-sdk 8.4.1-dev-65-8ee48f9 → 8.4.1-dev-67-8947251

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,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Fixed
11
+ - Corrected `functioName` field to `functionName` in the `TransitionActionTask` type
12
+
13
+ ### Added
14
+ - `exh.data.documents.unlinkAllUsers` and `unlinkAllGroups` methods to unlink all users or groups from a document
15
+ - Added `priority` field to the `TransitionActionTask` type
16
+ - Added `TransitionActionTask` to the `AfterActions`
17
+
10
18
  ### Changed
11
19
  - RQL `contains` and `excludes` now have their different variations better separated in the type definitions
20
+ - `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
21
+ - Thanks to `tran-simon` for the pointing out the initially incorrect `unlinkUsers` type definition!
22
+
23
+ ### Deprecated
24
+ - `exh.data.documents.unlinkUsers` usage with an object is deprecated in favor of an array of ids directly or `unlinkAllUsers` for unlinking all users
25
+ - `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
26
 
13
27
  ## [8.4.1]
14
28
 
@@ -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-67-8947251';
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-67-8947251';
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;
@@ -133,7 +133,8 @@ export interface TransitionActionRemoveItems {
133
133
  }
134
134
  export interface TransitionActionTask {
135
135
  type: 'task';
136
- functioName: string;
136
+ functionName: string;
137
+ priority?: number;
137
138
  data: Record<string, unknown>;
138
139
  }
139
140
  export interface TransitionActionLinkCreator {
@@ -159,11 +160,12 @@ export interface TransitionActionMeasurementReviewedNotification {
159
160
  type: 'measurementReviewedNotification';
160
161
  }
161
162
  export declare type TransitionAction = TransitionActionSet | TransitionActionUnset | TransitionActionAddItems | TransitionActionRemoveItems | TransitionActionTask | TransitionActionLinkCreator | TransitionActionLinkEnlistedGroups | TransitionActionLinkUserFromData | TransitionActionLinkGroupFromData | TransitionActionDelay | TransitionActionMeasurementReviewedNotification;
162
- export interface TransitionAfterAction {
163
+ export interface TransitionActionNotifyAlgoQueueManager {
163
164
  type: 'notifyAlgoQueueManager';
164
165
  id: string;
165
166
  version: string;
166
167
  }
168
+ export declare type TransitionAfterAction = TransitionActionNotifyAlgoQueueManager | TransitionActionTask;
167
169
  export interface CreationTransition {
168
170
  toStatus: string;
169
171
  type: CreationTransitionType;
@@ -563,6 +565,8 @@ export interface DataDocumentsService {
563
565
  groupIds: Array<ObjectId>;
564
566
  }, options?: OptionsBase): Promise<AffectedRecords>;
565
567
  /**
568
+ * @deprecated Use `unlinkGroups(schemaIdOrName, documentId, groupIds)` or `unlinkAllGroups(schemaIdOrName, documentId)` instead.
569
+ *
566
570
  * Unlink groups from a document
567
571
  *
568
572
  * Unlink the specified groups from a document
@@ -582,6 +586,26 @@ export interface DataDocumentsService {
582
586
  unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
583
587
  groupIds?: Array<ObjectId>;
584
588
  }, options?: OptionsBase): Promise<AffectedRecords>;
589
+ /**
590
+ * Unlink groups from a document
591
+ *
592
+ * Unlink the specified groups from a document
593
+ *
594
+ * Specifying an **empty** `groupIds` array will have **no effect** on the document.
595
+ *
596
+ * Permission | Scope | Effect
597
+ * - | - | -
598
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
599
+ */
600
+ unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, groupIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
601
+ /**
602
+ * Unlink all groups from a document
603
+ *
604
+ * Permission | Scope | Effect
605
+ * - | - | -
606
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
607
+ */
608
+ unlinkAllGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
585
609
  /**
586
610
  * Link users to a document
587
611
  *
@@ -601,6 +625,8 @@ export interface DataDocumentsService {
601
625
  userIds: Array<ObjectId>;
602
626
  }, options?: OptionsBase): Promise<AffectedRecords>;
603
627
  /**
628
+ * @deprecated Use `unlinkUsers(schemaIdOrName, documentId, userIds)` or `unlinkAllUsers(schemaIdOrName, documentId)` instead.
629
+ *
604
630
  * Unlink users from a document
605
631
  *
606
632
  * Unlink the specified users from a document.
@@ -622,6 +648,30 @@ export interface DataDocumentsService {
622
648
  unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: {
623
649
  userIds?: Array<ObjectId>;
624
650
  }, options?: OptionsBase): Promise<AffectedRecords>;
651
+ /**
652
+ * Unlink users from a document
653
+ *
654
+ * Unlink the specified users from a document.
655
+ *
656
+ * Specifying an **empty** `userIds` array will have **no effect** on the document.
657
+ *
658
+ * Permission | Scope | Effect
659
+ * - | - | -
660
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
661
+ *
662
+ * 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.
663
+ */
664
+ unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, userIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
665
+ /**
666
+ * Unlink all users from a document
667
+ *
668
+ * Permission | Scope | Effect
669
+ * - | - | -
670
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
671
+ *
672
+ * 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.
673
+ */
674
+ unlinkAllUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
625
675
  }
626
676
  export interface DataIndexesService {
627
677
  /**
@@ -1 +1 @@
1
- export declare const version = "8.4.1-dev-65-8ee48f9";
1
+ export declare const version = "8.4.1-dev-67-8947251";
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-67-8947251",
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",