@extrahorizon/javascript-sdk 8.5.0-dev-76-d4ca7d4 → 8.5.0-dev-78-7b06d51

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,27 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [8.5.0]
9
9
 
10
- ### Fixed
11
- - Corrected `functioName` field to `functionName` in the `TransitionActionTask` type
12
- - `exh.templates.findFirst`, `findById` and `findByName` now correctly state `undefined` can be returned
13
- - The `notifyAlgoQueueManager` transition action type no longer claims it has a `id` and `version` field
14
- - Transitions now correctly state `name` is optional and `id` is only a returned field.
15
-
16
10
  ### Added
17
- - Added `exh.data.documents.unlinkAllUsers` and `unlinkAllGroups` methods to unlink all users or groups from a document
18
- - Added `priority` field to the `TransitionActionTask` type
19
- - Added `TransitionActionTask` to the `AfterActions`
20
- - Added `TRANSITION_DOCUMENTS` permission to the `GlobalPermissionName` enum
21
- - Added `TRANSITION_DOCUMENTS` permission to the documentation of the transition document function
22
- - Added a `name` field to the `exh.data.documents.transition` body, allowing a transition to be triggered by its name rather then its id
11
+ - Data Service:
12
+ - Schema `createMode`, `readMode`, `updateMode` and `deleteMode` have been updated to accept multiple granular options, matching the revamped access mode changes in Data Service `1.4.0`
13
+ - Schema Transition Action `type: "task"` now supports the `priority` field
14
+ - Schema Transition `afterActions` now supports the `type: "task"` Action
15
+ - Access mode documentation has been revamped for the relevant `exh.data.documents.*` methods
16
+ - `exh.data.documents.transition` now accepts a `name` field the `requestBody`, allowing a Transition to be triggered by its `name`
17
+ - `exh.data.documents.unlinkAllUsers` and `unlinkAllGroups` methods added, to unlink all users or groups from a Document
18
+ - `TRANSITION_DOCUMENTS` has been added as a supported permission
23
19
 
24
20
  ### Changed
25
- - RQL `contains` and `excludes` now have their different variations better separated in the type definitions
26
- - `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
+ - `exh.data.documents.unlinkUsers` and `unlinkGroups` now also accept an array of user or group ids directly
27
22
  - Thanks to `tran-simon` for the pointing out the initially incorrect `unlinkUsers` type definition!
28
- - Data service schemas `createMode`, `readMode`, `updateMode` and `deleteMode` accepted values updated
29
- - Matching the access mode changes in Data Service 1.4.0
30
- - `readMode`, `updateMode` and `deleteMode` now also accept an array of relational modes
23
+ - The RQL `contains` and `excludes` methods type definitions have been improved
24
+
25
+ ### Fixed
26
+ - Data Service Schema Transition:
27
+ - Now correctly states `name` is optional and `id` is only a returned field.
28
+ - Action `type: "task"` now correctly types `functioName` as `functionName`
29
+ - Action `type: "notifyAlgoQueueManager"` no longer claims it has an `id` and `version` field
30
+ - `exh.templates.findFirst`, `findById` and `findByName` now correctly defines `undefined` as a return type
31
31
 
32
32
  ### Deprecated
33
33
  - `exh.data.documents.unlinkUsers` usage with an object is deprecated in favor of an array of ids directly or `unlinkAllUsers` for unlinking all users
@@ -5375,7 +5375,7 @@ const logsService = (httpWithAuth) => {
5375
5375
  };
5376
5376
  };
5377
5377
 
5378
- const version = '8.5.0-dev-76-d4ca7d4';
5378
+ const version = '8.5.0-dev-78-7b06d51';
5379
5379
 
5380
5380
  /**
5381
5381
  * Create ExtraHorizon client.
package/build/index.mjs CHANGED
@@ -5345,7 +5345,7 @@ const logsService = (httpWithAuth) => {
5345
5345
  };
5346
5346
  };
5347
5347
 
5348
- const version = '8.5.0-dev-76-d4ca7d4';
5348
+ const version = '8.5.0-dev-78-7b06d51';
5349
5349
 
5350
5350
  /**
5351
5351
  * Create ExtraHorizon client.
@@ -384,13 +384,31 @@ export interface DataDocumentsService {
384
384
  */
385
385
  assertNonLockedState(schemaIdOrName: ObjectId | string, documentId: ObjectId, tries: number, retryTimeInMs: number, options?: OptionsBase): Promise<boolean>;
386
386
  /**
387
- * Create a document
387
+ * # Create a document
388
388
  *
389
- * Permission | Scope | Effect
389
+ * ## Access via permissions
390
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
391
+ * Permission | Scopes | Effect
390
392
  * - | - | -
391
- * none | | Everyone can use this endpoint
392
- *
393
- * `CREATE_DOCUMENTS` | `global` | When the schema.createMode is set to permissionRequired then this permission is required to make a group
393
+ * `CREATE_DOCUMENTS` | `global` | Create a document for any schema
394
+ * `CREATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Create a document for the specified schema
395
+ * <br>
396
+ *
397
+ * ## General access mode values
398
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
399
+ * General createMode value | Description
400
+ * - | -
401
+ * `"permissionRequired"` | The permissions above apply
402
+ * `"allUsers"` | All users can create a document
403
+ * <br>
404
+ *
405
+ * ## Legacy access mode values
406
+ * Listed below are the deprecated values with their current equivalent
407
+ * Legacy createMode value | Description
408
+ * - | -
409
+ * `"default"` | Translates to the `"allUsers"` general access mode value
410
+ *
411
+ * # Interface
394
412
  * @param schemaIdOrName The id or name of the targeted schema.
395
413
  * @param requestBody
396
414
  * @returns {Document} document
@@ -400,119 +418,267 @@ export interface DataDocumentsService {
400
418
  gzip?: boolean;
401
419
  }): Promise<Document<OutputData, CustomStatus>>;
402
420
  /**
403
- * Request a list of documents
404
- *
405
- * ReadMode on schema is set to 'default' (or the property is not set at all on the schema):
421
+ * # Request a list of documents
406
422
  *
407
- * Permission | Scope | Effect
423
+ * ## Access via permissions
424
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
425
+ * Permission | Scopes | Effect
408
426
  * - | - | -
409
- * none | | See your own documents
410
- * none | `staff enlistment` | See the documents belonging to the group (and your own documents)
411
- * `VIEW_DOCUMENTS` | `global` | See any document
412
- *
413
- * ReadMode on schema is set to 'allUsers':
414
- *
415
- * Permission | Scope | Effect
416
- * - | - | -
417
- * none | | See any document
418
- *
419
- * ReadMode on schema is set to 'enlistedInLinkedGroups':
420
- *
421
- * Permission | Scope | Effect
422
- * - | - | -
423
- * none | `patient enlistment` | See the documents belonging to the group
424
- * none | `staff enlistment` | See the documents belonging to the group
425
- * `VIEW_DOCUMENTS` | `global` | See any document
427
+ * `VIEW_DOCUMENTS` | `global` | View any document
428
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
429
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
430
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
431
+ * <br>
432
+ *
433
+ * ## General access mode values
434
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
435
+ * General readMode value | Description
436
+ * - | -
437
+ * `"permissionRequired"` | The permissions above apply
438
+ * `"allUsers"` | All users can view any document of the specified schema
439
+ * <br>
440
+ *
441
+ * ## Relational access mode values
442
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
443
+ * Relational readMode value | Description
444
+ * - | -
445
+ * `["creator"]` | The user that created the document can view the document.
446
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
447
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
448
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
449
+ * <br>
450
+ *
451
+ * ## Legacy access mode values
452
+ * Listed below are the deprecated values with their current equivalent
453
+ * Legacy updateMode value | Description
454
+ * - | -
455
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
456
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
457
+ *
458
+ * # Interface
426
459
  * @param schemaIdOrName The id or name of the targeted schema.
427
460
  * @returns PagedResultWithPager<Document>
428
461
  */
429
462
  find<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<PagedResultWithPager<Document<CustomData, CustomStatus>>>;
430
463
  /**
431
- * Request a list of all documents
464
+ * # Request a list of all documents
432
465
  *
433
466
  * Do not pass in an rql with limit operator!
434
467
  *
435
- * ReadMode on schema is set to 'default' (or the property is not set at all on the schema):
436
- *
437
- * Permission | Scope | Effect
438
- * - | - | -
439
- * none | | See your own documents
440
- * none | `staff enlistment` | See the documents belonging to the group (and your own documents)
441
- * `VIEW_DOCUMENTS` | `global` | See any document
442
- *
443
- * ReadMode on schema is set to 'allUsers':
444
- *
445
- * Permission | Scope | Effect
446
- * - | - | -
447
- * none | | See any document
448
- *
449
- * ReadMode on schema is set to 'enlistedInLinkedGroups':
450
- *
451
- * Permission | Scope | Effect
468
+ * ## Access via permissions
469
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
470
+ * Permission | Scopes | Effect
452
471
  * - | - | -
453
- * none | `patient enlistment` | See the documents belonging to the group
454
- * none | `staff enlistment` | See the documents belonging to the group
455
- * `VIEW_DOCUMENTS` | `global` | See any document
472
+ * `VIEW_DOCUMENTS` | `global` | View any document
473
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
474
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
475
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
476
+ * <br>
477
+ *
478
+ * ## General access mode values
479
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
480
+ * General readMode value | Description
481
+ * - | -
482
+ * `"permissionRequired"` | The permissions above apply
483
+ * `"allUsers"` | All users can view any document of the specified schema
484
+ * <br>
485
+ *
486
+ * ## Relational access mode values
487
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
488
+ * Relational readMode value | Description
489
+ * - | -
490
+ * `["creator"]` | The user that created the document can view the document.
491
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
492
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
493
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
494
+ * <br>
495
+ *
496
+ * ## Legacy access mode values
497
+ * Listed below are the deprecated values with their current equivalent
498
+ * Legacy updateMode value | Description
499
+ * - | -
500
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
501
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
502
+ *
503
+ * # Interface
456
504
  * @param schemaIdOrName The id or name of the targeted schema.
457
505
  * @returns Document[]
458
506
  */
459
507
  findAll<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus>[]>;
460
508
  /**
461
- * Request a list of all documents and return a generator
509
+ * # Request a list of all documents and return a generator
462
510
  *
463
- * ReadMode on schema is set to 'default' (or the property is not set at all on the schema):
464
- *
465
- * Permission | Scope | Effect
511
+ * ## Access via permissions
512
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
513
+ * Permission | Scopes | Effect
466
514
  * - | - | -
467
- * none | | See your own documents
468
- * none | `staff enlistment` | See the documents belonging to the group (and your own documents)
469
- * `VIEW_DOCUMENTS` | `global` | See any document
470
- *
471
- * ReadMode on schema is set to 'allUsers':
472
- *
473
- * Permission | Scope | Effect
474
- * - | - | -
475
- * none | | See any document
476
- *
477
- * ReadMode on schema is set to 'enlistedInLinkedGroups':
478
- *
479
- * Permission | Scope | Effect
480
- * - | - | -
481
- * none | `patient enlistment` | See the documents belonging to the group
482
- * none | `staff enlistment` | See the documents belonging to the group
483
- * `VIEW_DOCUMENTS` | `global` | See any document
515
+ * `VIEW_DOCUMENTS` | `global` | View any document
516
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
517
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
518
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
519
+ * <br>
520
+ *
521
+ * ## General access mode values
522
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
523
+ * General readMode value | Description
524
+ * - | -
525
+ * `"permissionRequired"` | The permissions above apply
526
+ * `"allUsers"` | All users can view any document of the specified schema
527
+ * <br>
528
+ *
529
+ * ## Relational access mode values
530
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
531
+ * Relational readMode value | Description
532
+ * - | -
533
+ * `["creator"]` | The user that created the document can view the document.
534
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
535
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
536
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
537
+ * <br>
538
+ *
539
+ * ## Legacy access mode values
540
+ * Listed below are the deprecated values with their current equivalent
541
+ * Legacy updateMode value | Description
542
+ * - | -
543
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
544
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
545
+ *
546
+ * # Interface
484
547
  * @param schemaIdOrName The id or name of the targeted schema.
485
548
  * @returns Document[]
486
549
  */
487
550
  findAllIterator<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): FindAllIterator<Document<CustomData, CustomStatus>>;
488
551
  /**
489
- * Shortcut method to find a document by id
490
- *
491
- * Same Permissions as the find() method
552
+ * # Find a document by id
492
553
  *
554
+ * ## Access via permissions
555
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
556
+ * Permission | Scopes | Effect
557
+ * - | - | -
558
+ * `VIEW_DOCUMENTS` | `global` | View any document
559
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
560
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
561
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
562
+ * <br>
563
+
564
+ * ## General access mode values
565
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
566
+ * General readMode value | Description
567
+ * - | -
568
+ * `"permissionRequired"` | The permissions above apply
569
+ * `"allUsers"` | All users can view any document of the specified schema
570
+ * <br>
571
+
572
+ * ## Relational access mode values
573
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
574
+ * Relational readMode value | Description
575
+ * - | -
576
+ * `["creator"]` | The user that created the document can view the document.
577
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
578
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
579
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
580
+ * <br>
581
+ *
582
+ * ## Legacy access mode values
583
+ * Listed below are the deprecated values with their current equivalent
584
+ * Legacy updateMode value | Description
585
+ * - | -
586
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
587
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
588
+ *
589
+ * # Interface
493
590
  * @param schemaIdOrName The id or name of the targeted schema.
494
591
  * @param documentId the Id to search for
495
592
  * @returns {Document} document
496
593
  */
497
594
  findById<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus> | undefined>;
498
595
  /**
499
- * Returns the first document that is found with the applied filter
596
+ * # Find the first document that matches the applied filter
500
597
  *
501
- * Same Permissions as the find() method
598
+ * ## Access via permissions
599
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
600
+ * Permission | Scopes | Effect
601
+ * - | - | -
602
+ * `VIEW_DOCUMENTS` | `global` | View any document
603
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `global` | View any document of the specified schema
604
+ * `VIEW_DOCUMENTS` | `staff_enlistment` | View any document belonging to the group
605
+ * `VIEW_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | View any document of the specified schema belonging to the group
606
+ * <br>
607
+ *
608
+ * ## General access mode values
609
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
610
+ * General readMode value | Description
611
+ * - | -
612
+ * `"permissionRequired"` | The permissions above apply
613
+ * `"allUsers"` | All users can view any document of the specified schema
614
+ * <br>
615
+ *
616
+ * ## Relational access mode values
617
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
618
+ * Relational readMode value | Description
619
+ * - | -
620
+ * `["creator"]` | The user that created the document can view the document.
621
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can view the document.
622
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can view the document.
623
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can view the document.
624
+ * <br>
625
+ *
626
+ * ## Legacy access mode values
627
+ * Listed below are the deprecated values with their current equivalent
628
+ * Legacy updateMode value | Description
629
+ * - | -
630
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
631
+ * `"enlistedInLinkedGroups"` | Translates to `["linkedGroupPatients","linkedGroupStaff"]` relational access mode
632
+ *
633
+ * # Interface
502
634
  * @param schemaIdOrName The id or name of the targeted schema.
503
635
  * @returns {Document} document
504
636
  */
505
637
  findFirst<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus> | undefined>;
506
638
  /**
507
- * Update a document
639
+ * # Update a document
508
640
  *
509
- * **Partially** update the selected document. Use a `null` value to clear a field.
641
+ * **Partially** update the selected document, provide `null` as a value to clear a field.
642
+ * <br>
643
+ * <br>
510
644
  *
511
- * Permission | Scope | Effect
645
+ * ## Access via permissions
646
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
647
+ * Permission | Scopes | Effect
512
648
  * - | - | -
513
- * none | | Update your own documents
514
- * none | `staff enlistment` | Update all the documents belonging to the group
515
- * `UPDATE_DOCUMENTS` | `global` | Update all the documents
649
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
650
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
651
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
652
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
653
+ * <br>
654
+ *
655
+ * ## General access mode values
656
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
657
+ * General updateMode value | Description
658
+ * - | -
659
+ * `"permissionRequired"` | The permissions above apply
660
+ * <br>
661
+ *
662
+ * ## Relational access mode values
663
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
664
+ * Relational updateMode value | Description
665
+ * - | -
666
+ * `["creator"]` | The user that created the document can update the document.
667
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
668
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
669
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
670
+ * <br>
671
+ *
672
+ * ## Legacy access mode values
673
+ * Listed below are the deprecated values with their current equivalent
674
+ * Legacy updateMode value | Description
675
+ * - | -
676
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
677
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
678
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
679
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
680
+ *
681
+ * # Interface
516
682
  * @param schemaIdOrName The id or name of the targeted schema.
517
683
  * @param documentId The id of the targeted document.
518
684
  * @param requestBody Record<string, any>
@@ -520,36 +686,87 @@ export interface DataDocumentsService {
520
686
  */
521
687
  update<UpdateData = Record<string, any>>(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: UpdateData, options?: OptionsWithRql): Promise<AffectedRecords>;
522
688
  /**
523
- * Delete a document
524
- *
525
- * DeleteMode on schema is set to 'permissionRequired':
689
+ * # Delete a document
526
690
  *
527
- * Permission | Scope | Effect
691
+ * ## Access via permissions
692
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
693
+ * Permission | Scopes | Effect
528
694
  * - | - | -
529
- * `DELETE_DOCUMENTS` | `global` | **Required** for this endpoint
530
- *
531
- * DeleteMode on schema is set to 'linkedUsersOnly':
532
- *
533
- * Permission | Scope | Effect
534
- * - | - | -
535
- * none | | Delete the document if the userId is linked to the document
536
- * none | `staff enlistment` | Delete the document if the groupId is linked
537
- * `DELETE_DOCUMENTS` | `global` | Delete the document
695
+ * `DELETE_DOCUMENTS` | `global` | Delete any document
696
+ * `DELETE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Delete any document of the specified schema
697
+ * `DELETE_DOCUMENTS` | `staff_enlistment` | Delete any document belonging to the group
698
+ * `DELETE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Delete any document of the specified schema belonging to the group
699
+ * <br>
700
+ *
701
+ * ## General access mode values
702
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
703
+ * General deleteMode value | Description
704
+ * - | -
705
+ * `"permissionRequired"` | The permissions above apply
706
+ * <br>
707
+ *
708
+ * ## Relational access mode values
709
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
710
+ * Relational deleteMode value | Description
711
+ * - | -
712
+ * `["creator"]` | The user that created the document can delete the document.
713
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can delete the document.
714
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can delete the document.
715
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can delete the document.
716
+ * <br>
717
+ *
718
+ * ## Legacy access mode values
719
+ * Listed below are the deprecated values with their current equivalent
720
+ * Legacy deleteMode value | Description
721
+ * - | -
722
+ * `"linkedUsersOnly"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
723
+ *
724
+ * # Interface
538
725
  * @param schemaIdOrName The id or name of the targeted schema.
539
726
  * @param documentId The id of the targeted document.
540
727
  * @returns AffectedRecords
541
728
  */
542
729
  remove(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
543
730
  /**
544
- * Delete fields from a document
545
- *
546
- * Delete the specified fields from the selected document.
731
+ * # Delete the specified fields from the selected document.
547
732
  *
548
- * Permission | Scope | Effect
733
+ * ## Access via permissions
734
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
735
+ * Permission | Scopes | Effect
549
736
  * - | - | -
550
- * none | | Update your own documents
551
- * none | `staff enlistment` | Update all the documents belonging to the group
552
- * `UPDATE_DOCUMENTS` | `global` | Update all the documents
737
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
738
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
739
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
740
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
741
+ * <br>
742
+ *
743
+ * ## General access mode values
744
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
745
+ * General updateMode value | Description
746
+ * - | -
747
+ * `"permissionRequired"` | The permissions above apply
748
+ * <br>
749
+ *
750
+ * ## Relational access mode values
751
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
752
+ * Relational updateMode value | Description
753
+ * - | -
754
+ * `["creator"]` | The user that created the document can update the document.
755
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
756
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
757
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
758
+ * <br>
759
+ *
760
+ * ## Legacy access mode values
761
+ * Listed below are the deprecated values with their current equivalent
762
+ * Legacy updateMode value | Description
763
+ * - | -
764
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
765
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
766
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
767
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
768
+ *
769
+ * # Interface
553
770
  * @param schemaIdOrName The id or name of the targeted schema.
554
771
  * @param documentId The id of the targeted document.
555
772
  * @param requestBody list of fields
@@ -559,26 +776,55 @@ export interface DataDocumentsService {
559
776
  fields: Array<string>;
560
777
  }, options?: OptionsWithRql): Promise<AffectedRecords>;
561
778
  /**
562
- * Transition a document
779
+ * # Transition a document
563
780
  *
564
781
  * Start a transition manually for the selected document where the conditions of a manual transition are met.
565
782
  *
566
- * Either the `id` or the `name` of a transition must be provided.
567
- * If both are provided, they must match the same transition, otherwise a `ResourceUnknownError` will be thrown.
568
- *
569
- * If `name` is provided, multiple transitions could match.
570
- * In this case, the first matching transition will be triggered:
571
- * - The first transition with a `fromStatuses` matching the current status of the document
572
- * - And all the transition its `conditions` are met
783
+ * Note: the `id` or `name` in the requestBody are the `id` or `name` of the transition.
573
784
  *
574
- * Permission | Scope | Effect
785
+ * ## Access via permissions
786
+ * Regardless of how the access modes (described below) are set, a user is always able to perform an operation on a document if they are assigned a specific permission. This permission can come from a global role of the user or a staff enlistment role the user has in the group of the document.
787
+ * Permission | Scopes | Effect
575
788
  * - | - | -
576
- * none | | Update your own documents
577
- * none | `staff enlistment` | Update all the documents belonging to the group
578
- * `UPDATE_DOCUMENTS` | `global` | Transition all the documents
579
- * `TRANSITION_DOCUMENTS` | `global` | Transition all the documents
580
- * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}` | `global` | Transition all the documents of the specified schema
581
- * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}:{TRANSITION_NAME}` | `global` | Transition all the documents of the specified schema with the specified transition name
789
+ * `UPDATE_DOCUMENTS` | `global` | Update any document
790
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `global` | Update any document of the specified schema
791
+ * `UPDATE_DOCUMENTS` | `staff_enlistment` | Update any document belonging to the group
792
+ * `UPDATE_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Update any document of the specified schema belonging to the group
793
+ * `TRANSITION_DOCUMENTS` | `global` | Transition any document
794
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}` | `global` | Transition any document of the specified schema
795
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}:{TRANSITION_NAME}` | `global` | Transition any document of the specified schema with the specified transition name
796
+ * `TRANSITION_DOCUMENTS` | `staff_enlistment` | Transition any document belonging to the group
797
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}` | `staff_enlistment` | Transition any document of the specified schema belonging to the group
798
+ * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}:{TRANSITION_NAME}` | `staff_enlistment` | Transition any document of the specified schema belonging to the group with the specified transition name
799
+ * <br>
800
+ *
801
+ * ## General access mode values
802
+ * The general access mode values determine if a user requires permission to perform the action for the Schema. A general access mode value is provided as one of the following strings.
803
+ * General updateMode value | Description
804
+ * - | -
805
+ * `"permissionRequired"` | The permissions above apply
806
+ * <br>
807
+ *
808
+ * ## Relational access mode values
809
+ * Relational access mode values are supplied as an array. When multiple relational access mode values are supplied, a user adhering to any relation in this array is allowed to perform the action on the document.
810
+ * Relational updateMode value | Description
811
+ * - | -
812
+ * `["creator"]` | The user that created the document can update the document.
813
+ * `["linkedUsers"]` | All users where their user id is in the list of userIds of the document can update the document.
814
+ * `["linkedGroupPatients"]` | All users that have a patient enlistment in a group that is in the list of groupIds of the document can update the document.
815
+ * `["linkedGroupStaff"]` | All users that have a staff enlistment in a group that is in the list of groupIds of the document can update the document.
816
+ * <br>
817
+ *
818
+ * ## Legacy access mode values
819
+ * Listed below are the deprecated values with their current equivalent
820
+ * Legacy updateMode value | Description
821
+ * - | -
822
+ * `"default"` | Translates to `["linkedUsers","linkedGroupStaff"]` relational access mode
823
+ * `"creatorOnly"` | Translates to `["creator"]` relational access mode
824
+ * `"disabled"` | Translates to the `"permissionRequired"` general access mode value
825
+ * `"linkedGroupsStaffOnly"` | Translates to `["linkedGroupStaff"]` relational access mode
826
+ *
827
+ * # Interface
582
828
  * @param schemaIdOrName The id or name of the targeted schema.
583
829
  * @param documentId The id of the targeted document.
584
830
  * @param requestBody
@@ -588,13 +834,16 @@ export interface DataDocumentsService {
588
834
  */
589
835
  transition(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: TransitionDocumentInput, options?: OptionsWithRql): Promise<AffectedRecords>;
590
836
  /**
591
- * Link groups to a document
837
+ * # Link groups to a document
592
838
  *
593
839
  * Link the specified groups to a document.
594
840
  *
595
841
  * Permission | Scope | Effect
596
842
  * - | - | -
597
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
843
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Link groups to all documents
844
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Link groups to the documents of the specified schema
845
+ *
846
+ * # Interface
598
847
  * @param schemaIdOrName The id or name of the targeted schema.
599
848
  * @param documentId The id of the targeted document.
600
849
  * @param requestBody list of groupIds
@@ -606,7 +855,7 @@ export interface DataDocumentsService {
606
855
  /**
607
856
  * @deprecated Use `unlinkGroups(schemaIdOrName, documentId, groupIds)` or `unlinkAllGroups(schemaIdOrName, documentId)` instead.
608
857
  *
609
- * Unlink groups from a document
858
+ * # Unlink groups from a document
610
859
  *
611
860
  * Unlink the specified groups from a document
612
861
  *
@@ -616,7 +865,10 @@ export interface DataDocumentsService {
616
865
  *
617
866
  * Permission | Scope | Effect
618
867
  * - | - | -
619
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
868
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink groups for all documents
869
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink groups for the documents of the specified schema
870
+ *
871
+ * # Interface
620
872
  * @param schemaIdOrName The id or name of the targeted schema.
621
873
  * @param documentId The id of the targeted document.
622
874
  * @param requestBody list of groupIds
@@ -626,7 +878,7 @@ export interface DataDocumentsService {
626
878
  groupIds?: Array<ObjectId>;
627
879
  }, options?: OptionsBase): Promise<AffectedRecords>;
628
880
  /**
629
- * Unlink groups from a document
881
+ * # Unlink groups from a document
630
882
  *
631
883
  * Unlink the specified groups from a document
632
884
  *
@@ -634,27 +886,43 @@ export interface DataDocumentsService {
634
886
  *
635
887
  * Permission | Scope | Effect
636
888
  * - | - | -
637
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
889
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink groups for all documents
890
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink groups for the documents of the specified schema
891
+ *
892
+ * # Interface
893
+ * @param schemaIdOrName The id or name of the targeted schema.
894
+ * @param documentId The id of the targeted document.
895
+ * @param groupIds list of groupIds
896
+ * @returns AffectedRecords
638
897
  */
639
898
  unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, groupIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
640
899
  /**
641
- * Unlink all groups from a document
900
+ * # Unlink all groups from a document
642
901
  *
643
902
  * Permission | Scope | Effect
644
903
  * - | - | -
645
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
904
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink groups for all documents
905
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink groups for the documents of the specified schema
906
+ *
907
+ * # Interface
908
+ * @param schemaIdOrName The id or name of the targeted schema.
909
+ * @param documentId The id of the targeted document.
910
+ * @returns AffectedRecords
646
911
  */
647
912
  unlinkAllGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
648
913
  /**
649
- * Link users to a document
914
+ * # Link users to a document
650
915
  *
651
916
  * Link the specified users to a document.
652
917
  *
653
918
  * Permission | Scope | Effect
654
919
  * - | - | -
655
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
920
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Link users to all documents
921
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Link users to all documents of the specified schema
656
922
  *
657
923
  * 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 added to the document.
924
+ *
925
+ * # Interface
658
926
  * @param schemaIdOrName The id or name of the targeted schema.
659
927
  * @param documentId The id of the targeted document.
660
928
  * @param requestBody list of userIds
@@ -666,7 +934,7 @@ export interface DataDocumentsService {
666
934
  /**
667
935
  * @deprecated Use `unlinkUsers(schemaIdOrName, documentId, userIds)` or `unlinkAllUsers(schemaIdOrName, documentId)` instead.
668
936
  *
669
- * Unlink users from a document
937
+ * # Unlink users from a document
670
938
  *
671
939
  * Unlink the specified users from a document.
672
940
  *
@@ -676,9 +944,12 @@ export interface DataDocumentsService {
676
944
  *
677
945
  * Permission | Scope | Effect
678
946
  * - | - | -
679
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
947
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink users to all documents
948
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink users to all documents of the specified schema
680
949
  *
681
950
  * 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.
951
+ *
952
+ * # Interface
682
953
  * @param schemaIdOrName The id or name of the targeted schema.
683
954
  * @param documentId The id of the targeted document.
684
955
  * @param requestBody list of userIds
@@ -688,7 +959,7 @@ export interface DataDocumentsService {
688
959
  userIds?: Array<ObjectId>;
689
960
  }, options?: OptionsBase): Promise<AffectedRecords>;
690
961
  /**
691
- * Unlink users from a document
962
+ * # Unlink users from a document
692
963
  *
693
964
  * Unlink the specified users from a document.
694
965
  *
@@ -696,19 +967,34 @@ export interface DataDocumentsService {
696
967
  *
697
968
  * Permission | Scope | Effect
698
969
  * - | - | -
699
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
970
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink users to all documents
971
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink users to all documents of the specified schema
700
972
  *
701
973
  * 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.
974
+ *
975
+ * # Interface
976
+ * @param schemaIdOrName The id or name of the targeted schema.
977
+ * @param documentId The id of the targeted document.
978
+ * @param userIds list of userIds
979
+ * @param requestBody list of userIds
980
+ * @returns AffectedRecords
702
981
  */
703
982
  unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, userIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
704
983
  /**
705
- * Unlink all users from a document
984
+ * # Unlink all users from a document
706
985
  *
707
986
  * Permission | Scope | Effect
708
987
  * - | - | -
709
- * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | **Required** for this endpoint
988
+ * `UPDATE_ACCESS_TO_DOCUMENT` | `global` | Unlink users to all documents
989
+ * `UPDATE_ACCESS_TO_DOCUMENT:{SCHEMA_NAME}` | `global` | Unlink users to all documents of the specified schema
710
990
  *
711
991
  * 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.
992
+ *
993
+ * # Interface
994
+ * @param schemaIdOrName The id or name of the targeted schema.
995
+ * @param documentId The id of the targeted document.
996
+ * @param requestBody list of userIds
997
+ * @returns AffectedRecords
712
998
  */
713
999
  unlinkAllUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
714
1000
  }
@@ -1 +1 @@
1
- export declare const version = "8.5.0-dev-76-d4ca7d4";
1
+ export declare const version = "8.5.0-dev-78-7b06d51";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.5.0-dev-76-d4ca7d4",
3
+ "version": "8.5.0-dev-78-7b06d51",
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",