@extrahorizon/javascript-sdk 8.9.0-dev-121-e732d56 → 8.9.0-dev-135-f1c216a

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/index.cjs.js +170 -85
  3. package/build/index.mjs +169 -86
  4. package/build/types/client.d.ts +6 -0
  5. package/build/types/constants.d.ts +1 -0
  6. package/build/types/errors.d.ts +11 -0
  7. package/build/types/mockType.d.ts +39 -0
  8. package/build/types/services/auth/applications/types.d.ts +3 -3
  9. package/build/types/services/auth/oauth1/types.d.ts +2 -2
  10. package/build/types/services/auth/oauth2/types.d.ts +2 -2
  11. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +1 -1
  12. package/build/types/services/auth/oidc/providers/types.d.ts +1 -1
  13. package/build/types/services/data/types.d.ts +5 -5
  14. package/build/types/services/dispatchers/dispatchers/types.d.ts +1 -1
  15. package/build/types/services/events/types.d.ts +4 -4
  16. package/build/types/services/files/types.d.ts +2 -2
  17. package/build/types/services/localizations/types.d.ts +2 -2
  18. package/build/types/services/logs/access/types.d.ts +2 -2
  19. package/build/types/services/mails/types.d.ts +22 -14
  20. package/build/types/services/notifications/types.d.ts +4 -4
  21. package/build/types/services/payments/types.d.ts +4 -4
  22. package/build/types/services/profiles/types.d.ts +2 -2
  23. package/build/types/services/tasks/apiRequests/logs/types.d.ts +1 -1
  24. package/build/types/services/tasks/apiRequests/types.d.ts +1 -1
  25. package/build/types/services/tasks/logs/types.d.ts +1 -1
  26. package/build/types/services/tasks/schedules/types.d.ts +1 -1
  27. package/build/types/services/tasks/types.d.ts +2 -2
  28. package/build/types/services/templates/types.d.ts +57 -22
  29. package/build/types/services/templatesV2/health.d.ts +9 -0
  30. package/build/types/services/templatesV2/index.d.ts +4 -0
  31. package/build/types/services/templatesV2/templatesV2.d.ts +5 -0
  32. package/build/types/services/templatesV2/types.d.ts +145 -0
  33. package/build/types/services/types.d.ts +4 -1
  34. package/build/types/services/users/activationRequests/types.d.ts +3 -3
  35. package/build/types/services/users/forgotPasswordRequests/types.d.ts +3 -3
  36. package/build/types/services/users/types.d.ts +27 -9
  37. package/build/types/version.d.ts +1 -1
  38. package/package.json +2 -2
@@ -0,0 +1,145 @@
1
+ import { ObjectId, LanguageCode, TimeZone, PagedResult, AffectedRecords, OptionsWithRql, OptionsBase } from '../types';
2
+ export interface TemplateV2 extends TemplateV2Creation {
3
+ id: ObjectId;
4
+ creationTimestamp: Date;
5
+ updateTimestamp: Date;
6
+ }
7
+ export interface TemplateV2Creation {
8
+ name: string;
9
+ description?: string;
10
+ properties?: Record<string, TemplateV2TypeConfiguration>;
11
+ outputs: Record<string, string>;
12
+ }
13
+ export declare type TemplateV2TypeConfiguration = TemplateV2ObjectConfiguration | TemplateV2ArrayConfiguration | TemplateV2StringConfiguration | TemplateV2NumberConfiguration | TemplateV2BooleanConfiguration;
14
+ export interface TemplateV2ObjectConfiguration {
15
+ type: 'object';
16
+ properties: Record<string, TemplateV2TypeConfiguration>;
17
+ }
18
+ export interface TemplateV2ArrayConfiguration {
19
+ type: 'array';
20
+ items: TemplateV2TypeConfiguration;
21
+ }
22
+ export interface TemplateV2StringConfiguration {
23
+ type: 'string';
24
+ }
25
+ export interface TemplateV2NumberConfiguration {
26
+ type: 'number';
27
+ }
28
+ export interface TemplateV2BooleanConfiguration {
29
+ type: 'boolean';
30
+ }
31
+ export interface TemplateV2ResolveIn<T extends Record<string, any>> {
32
+ /**
33
+ * If not present (or empty) we will first check the configured language in the users-service. If that is not present it will default to 'EN'
34
+ */
35
+ language?: LanguageCode;
36
+ /**
37
+ * If not present (or empty) we will first check the configured time_zone in the users-service. If that is not present it will default to 'UTC'
38
+ */
39
+ timeZone?: TimeZone;
40
+ data?: T;
41
+ }
42
+ export interface TemplatesV2ErrorInfo {
43
+ /**
44
+ * The template outputs key in the request body that resulted in an error
45
+ */
46
+ output: string;
47
+ /**
48
+ * Error message describing the syntax error
49
+ */
50
+ message: string;
51
+ }
52
+ export interface TemplatesV2Service {
53
+ /**
54
+ * Get all templates the service has to offer
55
+ *
56
+ * Permission | Scope | Effect
57
+ * - | - | -
58
+ * `VIEW_TEMPLATES` | `global` | **Required** for this endpoint
59
+ * @param rql Add filters to the requested list.
60
+ * @returns PagedResult<TemplateV2>
61
+ */
62
+ find(options?: OptionsWithRql): Promise<PagedResult<TemplateV2>>;
63
+ /**
64
+ * Request a list of all templates
65
+ *
66
+ * Do not pass in a rql with limit operator!
67
+ *
68
+ * Permission | Scope | Effect
69
+ * - | - | -
70
+ * `VIEW_TEMPLATES` | `global` | **Required** for this endpoint
71
+ * @param rql Add filters to the requested list.
72
+ * @returns TemplateV2[]
73
+ */
74
+ findAll(options?: OptionsWithRql): Promise<TemplateV2[]>;
75
+ /**
76
+ * Find By Id
77
+ * @param id the Id to search for
78
+ * @returns the first element found
79
+ */
80
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<TemplateV2 | undefined>;
81
+ /**
82
+ * Find By Name
83
+ * @param name the name to search for
84
+ * @returns the first element found
85
+ */
86
+ findByName(name: string, options?: OptionsWithRql): Promise<TemplateV2 | undefined>;
87
+ /**
88
+ * Find First
89
+ * @returns the first element found
90
+ */
91
+ findFirst(options?: OptionsWithRql): Promise<TemplateV2 | undefined>;
92
+ /**
93
+ * Create a new template
94
+ *
95
+ * Permission | Scope | Effect
96
+ * - | - | -
97
+ * `CREATE_TEMPLATES` | `global` | **Required** for this endpoint
98
+ * @param requestBody TemplateIn
99
+ * @returns TemplateV2
100
+ * @throws {ResourceAlreadyExistsError}
101
+ * @throws {TemplateSyntaxError}
102
+ */
103
+ create(requestBody: TemplateV2Creation, options?: OptionsBase): Promise<TemplateV2>;
104
+ /**
105
+ * Update an existing template
106
+ *
107
+ * Permission | Scope | Effect
108
+ * - | - | -
109
+ * `UPDATE_TEMPLATES` | `global` | **Required** for this endpoint
110
+ * @param templateIdOrName Id or Name of the targeted template
111
+ * @param requestBody TemplateIn
112
+ * @returns TemplateV2
113
+ * @throws {ResourceAlreadyExistsError}
114
+ * @throws {TemplateSyntaxError}
115
+ * @throws {ResourceUnknownError}
116
+ */
117
+ update(templateIdOrName: string, requestBody: Partial<TemplateV2Creation>, options?: OptionsBase): Promise<AffectedRecords>;
118
+ /**
119
+ * Delete a template
120
+ *
121
+ * Permission | Scope | Effect
122
+ * - | - | -
123
+ * `DELETE_TEMPLATES` | `global` | **Required** for this endpoint
124
+ * @param templateIdOrName Id or Name of the targeted template
125
+ * @returns AffectedRecords
126
+ * @throws {ResourceUnknownError}
127
+ */
128
+ remove(templateIdOrName: string, options?: OptionsBase): Promise<AffectedRecords>;
129
+ /**
130
+ * Resolves a template and presents the result as a json response
131
+ * Permission is **required** for this endpoint
132
+ * Permission | Scope | Effect
133
+ * - | - | -
134
+ * `RESOLVE_TEMPLATES` | `global` | Resolve any template
135
+ * `RESOLVE_TEMPLATES:{TEMPLATE_NAME}` | `global` | Resolve the specified template
136
+ *
137
+ * @param templateIdOrName Id or Name of the targeted template
138
+ * @param requestBody CreateFile
139
+ * @returns TemplateV2ResolveOut
140
+ * @throws {TemplateResolvingError}
141
+ * @throws {TemplateFillingError}
142
+ * @throws {ResourceUnknownError}
143
+ */
144
+ resolve<InputData = Record<string, any>, Outputs = Record<string, string>>(templateIdOrName: string, requestBody: TemplateV2ResolveIn<InputData>, options?: OptionsBase): Promise<Outputs>;
145
+ }
@@ -31,7 +31,10 @@ export declare enum Results {
31
31
  Success = 200
32
32
  }
33
33
  /**
34
- * Supported timezones from [Java.time.zoneId](https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#of-java.lang.String-)
34
+ * IANA time zone identifier (e.g. "Europe/Brussels").
35
+ * We aim to stay aligned with the official IANA time zone database.
36
+ * In practice, supported values closely match those returned by Intl.supportedValuesOf('timeZone') in JavaScript.
37
+ * For an overview of IANA time zones, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
35
38
  */
36
39
  export declare type TimeZone = string;
37
40
  export declare type MailAddress = string;
@@ -15,7 +15,7 @@ export interface ActivationRequestsService {
15
15
  * - | - | -
16
16
  * `VIEW_ACTIVATION_REQUESTS` | global | **Required** for this endpoint
17
17
  */
18
- findFirst(options?: OptionsWithRql): Promise<ActivationRequest>;
18
+ findFirst(options?: OptionsWithRql): Promise<ActivationRequest | undefined>;
19
19
  /**
20
20
  * Find an activation request by its id
21
21
  *
@@ -23,7 +23,7 @@ export interface ActivationRequestsService {
23
23
  * - | - | -
24
24
  * `VIEW_ACTIVATION_REQUESTS` | global | **Required** for this endpoint
25
25
  */
26
- findById(id: string, options?: OptionsWithRql): Promise<ActivationRequest>;
26
+ findById(id: string, options?: OptionsWithRql): Promise<ActivationRequest | undefined>;
27
27
  /**
28
28
  * Find an activation request for a user id
29
29
  *
@@ -31,7 +31,7 @@ export interface ActivationRequestsService {
31
31
  * - | - | -
32
32
  * `VIEW_ACTIVATION_REQUESTS` | global | **Required** for this endpoint
33
33
  */
34
- findByUserId(userId: string, options?: OptionsWithRql): Promise<ActivationRequest>;
34
+ findByUserId(userId: string, options?: OptionsWithRql): Promise<ActivationRequest | undefined>;
35
35
  /**
36
36
  * Remove an activation request
37
37
  *
@@ -15,7 +15,7 @@ export interface ForgotPasswordRequestsService {
15
15
  * - | - | -
16
16
  * `VIEW_FORGOT_PASSWORD_REQUESTS` | global | **Required** for this endpoint
17
17
  */
18
- findFirst(options?: OptionsWithRql): Promise<ForgotPasswordRequest>;
18
+ findFirst(options?: OptionsWithRql): Promise<ForgotPasswordRequest | undefined>;
19
19
  /**
20
20
  * Find a forgot password request by its id
21
21
  *
@@ -23,7 +23,7 @@ export interface ForgotPasswordRequestsService {
23
23
  * - | - | -
24
24
  * `VIEW_FORGOT_PASSWORD_REQUESTS` | global | **Required** for this endpoint
25
25
  */
26
- findById(id: string, options?: OptionsWithRql): Promise<ForgotPasswordRequest>;
26
+ findById(id: string, options?: OptionsWithRql): Promise<ForgotPasswordRequest | undefined>;
27
27
  /**
28
28
  * Find a forgot password request for a user id
29
29
  *
@@ -31,7 +31,7 @@ export interface ForgotPasswordRequestsService {
31
31
  * - | - | -
32
32
  * `VIEW_FORGOT_PASSWORD_REQUESTS` | global | **Required** for this endpoint
33
33
  */
34
- findByUserId(userId: string, options?: OptionsWithRql): Promise<ForgotPasswordRequest>;
34
+ findByUserId(userId: string, options?: OptionsWithRql): Promise<ForgotPasswordRequest | undefined>;
35
35
  /**
36
36
  * Remove a forgot password request
37
37
  *
@@ -207,6 +207,7 @@ export declare enum GlobalPermissionName {
207
207
  REMOVE_ROLE_PERMISSION = "REMOVE_ROLE_PERMISSION",
208
208
  REMOVE_STAFF = "REMOVE_STAFF",
209
209
  RESET_FAILED_LOGIN_ATTEMPTS = "RESET_FAILED_LOGIN_ATTEMPTS",
210
+ RESOLVE_TEMPLATES = "RESOLVE_TEMPLATES",
210
211
  SEND_MAILS = "SEND_MAILS",
211
212
  SYNC_PROFILE_GROUPS = "SYNC_PROFILE_GROUPS",
212
213
  TRANSFER_PERIOD = "TRANSFER_PERIOD",
@@ -459,7 +460,7 @@ export interface UsersGlobalRolesService {
459
460
  * - | - | -
460
461
  * `VIEW_ROLE` | `global` | **Required** for this endpoint
461
462
  */
462
- findFirst(options?: OptionsWithRql): Promise<Role>;
463
+ findFirst(options?: OptionsWithRql): Promise<Role | undefined>;
463
464
  /**
464
465
  * Returns the first role with a specific id
465
466
  *
@@ -467,7 +468,7 @@ export interface UsersGlobalRolesService {
467
468
  * - | - | -
468
469
  * `VIEW_ROLE` | `global` | **Required** for this endpoint
469
470
  */
470
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Role>;
471
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Role | undefined>;
471
472
  /**
472
473
  * Returns the first role with a specific name
473
474
  *
@@ -475,7 +476,7 @@ export interface UsersGlobalRolesService {
475
476
  * - | - | -
476
477
  * `VIEW_ROLE` | `global` | **Required** for this endpoint
477
478
  */
478
- findByName(name: string, options?: OptionsWithRql): Promise<Role>;
479
+ findByName(name: string, options?: OptionsWithRql): Promise<Role | undefined>;
479
480
  /**
480
481
  * @deprecated Use `find` instead
481
482
  *
@@ -591,7 +592,7 @@ export interface UsersGroupRolesService {
591
592
  * none | `staff enlistment` | View the roles for the group
592
593
  * `VIEW_GROUP` | `global` | View any group its roles
593
594
  */
594
- findFirst(groupId: ObjectId, options?: OptionsWithRql): Promise<GroupRole>;
595
+ findFirst(groupId: ObjectId, options?: OptionsWithRql): Promise<GroupRole | undefined>;
595
596
  /**
596
597
  * Finds a group role by its id
597
598
  *
@@ -600,7 +601,7 @@ export interface UsersGroupRolesService {
600
601
  * none | `staff enlistment` | View the roles for the group
601
602
  * `VIEW_GROUP` | `global` | View any group its roles
602
603
  */
603
- findById(groupId: ObjectId, roleId: ObjectId, options?: OptionsWithRql): Promise<GroupRole>;
604
+ findById(groupId: ObjectId, roleId: ObjectId, options?: OptionsWithRql): Promise<GroupRole | undefined>;
604
605
  /**
605
606
  * Returns the first group role found by a specific name
606
607
  *
@@ -609,7 +610,7 @@ export interface UsersGroupRolesService {
609
610
  * none | `staff enlistment` | View the roles for the group
610
611
  * `VIEW_GROUP` | `global` | View any group its roles
611
612
  */
612
- findByName(groupId: ObjectId, roleName: string, options?: OptionsWithRql): Promise<GroupRole>;
613
+ findByName(groupId: ObjectId, roleName: string, options?: OptionsWithRql): Promise<GroupRole | undefined>;
613
614
  /**
614
615
  * @deprecated Use `find` instead
615
616
  *
@@ -815,9 +816,26 @@ export interface UsersService {
815
816
  * @returns User[]
816
817
  */
817
818
  findAllIterator(options?: OptionsWithRql): FindAllIterator<User>;
818
- findFirst(options?: {
819
- rql?: RQLString;
820
- }): Promise<User>;
819
+ /**
820
+ * Find the first user matching the rql query
821
+ *
822
+ * Permission | Scope | Effect
823
+ * - | - | -
824
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
825
+ * none | `staff enlistment` | See a limited set of fields of all patients and staff members (of the groups where you are enlisted as staff member)
826
+ * `VIEW_USER` | `global` | See all fields of all users
827
+ */
828
+ findFirst(options?: OptionsWithRql): Promise<User | undefined>;
829
+ /**
830
+ * Find a user by their email address
831
+ *
832
+ * Permission | Scope | Effect
833
+ * - | - | -
834
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
835
+ * none | `staff enlistment` | See a limited set of fields of all patients and staff members (of the groups where you are enlisted as staff member)
836
+ * `VIEW_USER` | `global` | See all fields of all users
837
+ */
838
+ findByEmail(email: string, options?: OptionsWithRql): Promise<User | undefined>;
821
839
  /**
822
840
  * @deprecated
823
841
  * Delete a list of users
@@ -1 +1 @@
1
- export declare const version = "8.9.0-dev-121-e732d56";
1
+ export declare const version = "8.9.0-dev-135-f1c216a";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.9.0-dev-121-e732d56",
3
+ "version": "8.9.0-dev-135-f1c216a",
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",
@@ -26,7 +26,7 @@
26
26
  "prepare": "yarn build && yarn lint",
27
27
  "test": "jest",
28
28
  "test:e2e": "jest tests/e2e",
29
- "lint": "eslint src --ext .ts"
29
+ "lint": "eslint src/** tests/** --ext .ts"
30
30
  },
31
31
  "files": [
32
32
  "build"