@extrahorizon/javascript-sdk 8.5.0-dev-75-2eadab9 → 8.5.0-dev-77-cdf0205

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
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
  - Corrected `functioName` field to `functionName` in the `TransitionActionTask` type
12
12
  - `exh.templates.findFirst`, `findById` and `findByName` now correctly state `undefined` can be returned
13
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.
14
15
 
15
16
  ### Added
16
17
  - Added `exh.data.documents.unlinkAllUsers` and `unlinkAllGroups` methods to unlink all users or groups from a document
@@ -5375,7 +5375,7 @@ const logsService = (httpWithAuth) => {
5375
5375
  };
5376
5376
  };
5377
5377
 
5378
- const version = '8.5.0-dev-75-2eadab9';
5378
+ const version = '8.5.0-dev-77-cdf0205';
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-75-2eadab9';
5348
+ const version = '8.5.0-dev-77-cdf0205';
5349
5349
 
5350
5350
  /**
5351
5351
  * Create ExtraHorizon client.
@@ -196,11 +196,12 @@ export interface CreationTransition {
196
196
  }
197
197
  export declare type StatusData = Record<string, string>;
198
198
  export declare type TransitionInput = CreationTransition & {
199
- id?: ObjectId;
200
- name: string;
199
+ name?: string;
201
200
  fromStatuses: string[];
202
201
  };
203
- export declare type Transition = TransitionInput & Required<Pick<TransitionInput, 'id'>>;
202
+ export declare type Transition = TransitionInput & {
203
+ id: ObjectId;
204
+ };
204
205
  export interface Schema {
205
206
  id: ObjectId;
206
207
  name: string;
@@ -383,13 +384,31 @@ export interface DataDocumentsService {
383
384
  */
384
385
  assertNonLockedState(schemaIdOrName: ObjectId | string, documentId: ObjectId, tries: number, retryTimeInMs: number, options?: OptionsBase): Promise<boolean>;
385
386
  /**
386
- * Create a document
387
+ * # Create a document
387
388
  *
388
- * 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
389
392
  * - | - | -
390
- * none | | Everyone can use this endpoint
391
- *
392
- * `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
393
412
  * @param schemaIdOrName The id or name of the targeted schema.
394
413
  * @param requestBody
395
414
  * @returns {Document} document
@@ -399,119 +418,267 @@ export interface DataDocumentsService {
399
418
  gzip?: boolean;
400
419
  }): Promise<Document<OutputData, CustomStatus>>;
401
420
  /**
402
- * Request a list of documents
403
- *
404
- * ReadMode on schema is set to 'default' (or the property is not set at all on the schema):
421
+ * # Request a list of documents
405
422
  *
406
- * 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
407
426
  * - | - | -
408
- * none | | See your own documents
409
- * none | `staff enlistment` | See the documents belonging to the group (and your own documents)
410
- * `VIEW_DOCUMENTS` | `global` | See any document
411
- *
412
- * ReadMode on schema is set to 'allUsers':
413
- *
414
- * Permission | Scope | Effect
415
- * - | - | -
416
- * none | | See any document
417
- *
418
- * ReadMode on schema is set to 'enlistedInLinkedGroups':
419
- *
420
- * Permission | Scope | Effect
421
- * - | - | -
422
- * none | `patient enlistment` | See the documents belonging to the group
423
- * none | `staff enlistment` | See the documents belonging to the group
424
- * `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
425
459
  * @param schemaIdOrName The id or name of the targeted schema.
426
460
  * @returns PagedResultWithPager<Document>
427
461
  */
428
462
  find<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<PagedResultWithPager<Document<CustomData, CustomStatus>>>;
429
463
  /**
430
- * Request a list of all documents
464
+ * # Request a list of all documents
431
465
  *
432
466
  * Do not pass in an rql with limit operator!
433
467
  *
434
- * ReadMode on schema is set to 'default' (or the property is not set at all on the schema):
435
- *
436
- * 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
437
471
  * - | - | -
438
- * none | | See your own documents
439
- * none | `staff enlistment` | See the documents belonging to the group (and your own documents)
440
- * `VIEW_DOCUMENTS` | `global` | See any document
441
- *
442
- * ReadMode on schema is set to 'allUsers':
443
- *
444
- * Permission | Scope | Effect
445
- * - | - | -
446
- * none | | See any document
447
- *
448
- * ReadMode on schema is set to 'enlistedInLinkedGroups':
449
- *
450
- * Permission | Scope | Effect
451
- * - | - | -
452
- * none | `patient enlistment` | See the documents belonging to the group
453
- * none | `staff enlistment` | See the documents belonging to the group
454
- * `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
455
504
  * @param schemaIdOrName The id or name of the targeted schema.
456
505
  * @returns Document[]
457
506
  */
458
507
  findAll<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus>[]>;
459
508
  /**
460
- * Request a list of all documents and return a generator
461
- *
462
- * ReadMode on schema is set to 'default' (or the property is not set at all on the schema):
509
+ * # Request a list of all documents and return a generator
463
510
  *
464
- * Permission | Scope | Effect
465
- * - | - | -
466
- * none | | See your own documents
467
- * none | `staff enlistment` | See the documents belonging to the group (and your own documents)
468
- * `VIEW_DOCUMENTS` | `global` | See any document
469
- *
470
- * ReadMode on schema is set to 'allUsers':
471
- *
472
- * Permission | Scope | Effect
473
- * - | - | -
474
- * none | | See any document
475
- *
476
- * ReadMode on schema is set to 'enlistedInLinkedGroups':
477
- *
478
- * 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
479
514
  * - | - | -
480
- * none | `patient enlistment` | See the documents belonging to the group
481
- * none | `staff enlistment` | See the documents belonging to the group
482
- * `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
483
547
  * @param schemaIdOrName The id or name of the targeted schema.
484
548
  * @returns Document[]
485
549
  */
486
550
  findAllIterator<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): FindAllIterator<Document<CustomData, CustomStatus>>;
487
551
  /**
488
- * Shortcut method to find a document by id
489
- *
490
- * Same Permissions as the find() method
552
+ * # Find a document by id
491
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
492
590
  * @param schemaIdOrName The id or name of the targeted schema.
493
591
  * @param documentId the Id to search for
494
592
  * @returns {Document} document
495
593
  */
496
594
  findById<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus> | undefined>;
497
595
  /**
498
- * Returns the first document that is found with the applied filter
596
+ * # Find the first document that matches the applied filter
499
597
  *
500
- * 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
501
634
  * @param schemaIdOrName The id or name of the targeted schema.
502
635
  * @returns {Document} document
503
636
  */
504
637
  findFirst<CustomData = null, CustomStatus = null>(schemaIdOrName: ObjectId | string, options?: OptionsWithRql): Promise<Document<CustomData, CustomStatus> | undefined>;
505
638
  /**
506
- * Update a document
639
+ * # Update a document
507
640
  *
508
- * **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>
509
644
  *
510
- * 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
511
648
  * - | - | -
512
- * none | | Update your own documents
513
- * none | `staff enlistment` | Update all the documents belonging to the group
514
- * `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
515
682
  * @param schemaIdOrName The id or name of the targeted schema.
516
683
  * @param documentId The id of the targeted document.
517
684
  * @param requestBody Record<string, any>
@@ -519,36 +686,87 @@ export interface DataDocumentsService {
519
686
  */
520
687
  update<UpdateData = Record<string, any>>(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: UpdateData, options?: OptionsWithRql): Promise<AffectedRecords>;
521
688
  /**
522
- * Delete a document
523
- *
524
- * DeleteMode on schema is set to 'permissionRequired':
525
- *
526
- * Permission | Scope | Effect
527
- * - | - | -
528
- * `DELETE_DOCUMENTS` | `global` | **Required** for this endpoint
529
- *
530
- * DeleteMode on schema is set to 'linkedUsersOnly':
689
+ * # Delete a document
531
690
  *
532
- * 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
533
694
  * - | - | -
534
- * none | | Delete the document if the userId is linked to the document
535
- * none | `staff enlistment` | Delete the document if the groupId is linked
536
- * `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
537
725
  * @param schemaIdOrName The id or name of the targeted schema.
538
726
  * @param documentId The id of the targeted document.
539
727
  * @returns AffectedRecords
540
728
  */
541
729
  remove(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
542
730
  /**
543
- * Delete fields from a document
544
- *
545
- * Delete the specified fields from the selected document.
731
+ * # Delete the specified fields from the selected document.
546
732
  *
547
- * 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
548
736
  * - | - | -
549
- * none | | Update your own documents
550
- * none | `staff enlistment` | Update all the documents belonging to the group
551
- * `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
552
770
  * @param schemaIdOrName The id or name of the targeted schema.
553
771
  * @param documentId The id of the targeted document.
554
772
  * @param requestBody list of fields
@@ -558,26 +776,55 @@ export interface DataDocumentsService {
558
776
  fields: Array<string>;
559
777
  }, options?: OptionsWithRql): Promise<AffectedRecords>;
560
778
  /**
561
- * Transition a document
779
+ * # Transition a document
562
780
  *
563
781
  * Start a transition manually for the selected document where the conditions of a manual transition are met.
564
782
  *
565
- * Either the `id` or the `name` of a transition must be provided.
566
- * If both are provided, they must match the same transition, otherwise a `ResourceUnknownError` will be thrown.
783
+ * Note: the `id` or `name` in the requestBody are the `id` or `name` of the transition.
567
784
  *
568
- * If `name` is provided, multiple transitions could match.
569
- * In this case, the first matching transition will be triggered:
570
- * - The first transition with a `fromStatuses` matching the current status of the document
571
- * - And all the transition its `conditions` are met
572
- *
573
- * 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
574
788
  * - | - | -
575
- * none | | Update your own documents
576
- * none | `staff enlistment` | Update all the documents belonging to the group
577
- * `UPDATE_DOCUMENTS` | `global` | Transition all the documents
578
- * `TRANSITION_DOCUMENTS` | `global` | Transition all the documents
579
- * `TRANSITION_DOCUMENTS:{SCHEMA_NAME}` | `global` | Transition all the documents of the specified schema
580
- * `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
581
828
  * @param schemaIdOrName The id or name of the targeted schema.
582
829
  * @param documentId The id of the targeted document.
583
830
  * @param requestBody
@@ -587,13 +834,16 @@ export interface DataDocumentsService {
587
834
  */
588
835
  transition(schemaIdOrName: ObjectId | string, documentId: ObjectId, requestBody: TransitionDocumentInput, options?: OptionsWithRql): Promise<AffectedRecords>;
589
836
  /**
590
- * Link groups to a document
837
+ * # Link groups to a document
591
838
  *
592
839
  * Link the specified groups to a document.
593
840
  *
594
841
  * Permission | Scope | Effect
595
842
  * - | - | -
596
- * `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
597
847
  * @param schemaIdOrName The id or name of the targeted schema.
598
848
  * @param documentId The id of the targeted document.
599
849
  * @param requestBody list of groupIds
@@ -605,7 +855,7 @@ export interface DataDocumentsService {
605
855
  /**
606
856
  * @deprecated Use `unlinkGroups(schemaIdOrName, documentId, groupIds)` or `unlinkAllGroups(schemaIdOrName, documentId)` instead.
607
857
  *
608
- * Unlink groups from a document
858
+ * # Unlink groups from a document
609
859
  *
610
860
  * Unlink the specified groups from a document
611
861
  *
@@ -615,7 +865,10 @@ export interface DataDocumentsService {
615
865
  *
616
866
  * Permission | Scope | Effect
617
867
  * - | - | -
618
- * `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
619
872
  * @param schemaIdOrName The id or name of the targeted schema.
620
873
  * @param documentId The id of the targeted document.
621
874
  * @param requestBody list of groupIds
@@ -625,7 +878,7 @@ export interface DataDocumentsService {
625
878
  groupIds?: Array<ObjectId>;
626
879
  }, options?: OptionsBase): Promise<AffectedRecords>;
627
880
  /**
628
- * Unlink groups from a document
881
+ * # Unlink groups from a document
629
882
  *
630
883
  * Unlink the specified groups from a document
631
884
  *
@@ -633,27 +886,43 @@ export interface DataDocumentsService {
633
886
  *
634
887
  * Permission | Scope | Effect
635
888
  * - | - | -
636
- * `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
637
897
  */
638
898
  unlinkGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, groupIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
639
899
  /**
640
- * Unlink all groups from a document
900
+ * # Unlink all groups from a document
641
901
  *
642
902
  * Permission | Scope | Effect
643
903
  * - | - | -
644
- * `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
645
911
  */
646
912
  unlinkAllGroups(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
647
913
  /**
648
- * Link users to a document
914
+ * # Link users to a document
649
915
  *
650
916
  * Link the specified users to a document.
651
917
  *
652
918
  * Permission | Scope | Effect
653
919
  * - | - | -
654
- * `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
655
922
  *
656
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
657
926
  * @param schemaIdOrName The id or name of the targeted schema.
658
927
  * @param documentId The id of the targeted document.
659
928
  * @param requestBody list of userIds
@@ -665,7 +934,7 @@ export interface DataDocumentsService {
665
934
  /**
666
935
  * @deprecated Use `unlinkUsers(schemaIdOrName, documentId, userIds)` or `unlinkAllUsers(schemaIdOrName, documentId)` instead.
667
936
  *
668
- * Unlink users from a document
937
+ * # Unlink users from a document
669
938
  *
670
939
  * Unlink the specified users from a document.
671
940
  *
@@ -675,9 +944,12 @@ export interface DataDocumentsService {
675
944
  *
676
945
  * Permission | Scope | Effect
677
946
  * - | - | -
678
- * `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
679
949
  *
680
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
681
953
  * @param schemaIdOrName The id or name of the targeted schema.
682
954
  * @param documentId The id of the targeted document.
683
955
  * @param requestBody list of userIds
@@ -687,7 +959,7 @@ export interface DataDocumentsService {
687
959
  userIds?: Array<ObjectId>;
688
960
  }, options?: OptionsBase): Promise<AffectedRecords>;
689
961
  /**
690
- * Unlink users from a document
962
+ * # Unlink users from a document
691
963
  *
692
964
  * Unlink the specified users from a document.
693
965
  *
@@ -695,19 +967,34 @@ export interface DataDocumentsService {
695
967
  *
696
968
  * Permission | Scope | Effect
697
969
  * - | - | -
698
- * `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
699
972
  *
700
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
701
981
  */
702
982
  unlinkUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, userIds: Array<ObjectId>, options?: OptionsBase): Promise<AffectedRecords>;
703
983
  /**
704
- * Unlink all users from a document
984
+ * # Unlink all users from a document
705
985
  *
706
986
  * Permission | Scope | Effect
707
987
  * - | - | -
708
- * `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
709
990
  *
710
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
711
998
  */
712
999
  unlinkAllUsers(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
713
1000
  }
@@ -1 +1 @@
1
- export declare const version = "8.5.0-dev-75-2eadab9";
1
+ export declare const version = "8.5.0-dev-77-cdf0205";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.5.0-dev-75-2eadab9",
3
+ "version": "8.5.0-dev-77-cdf0205",
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",