@extrahorizon/javascript-sdk 8.9.0-dev-121-e732d56 → 8.9.0-feat-134-c0f5b9d

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 +7 -0
  2. package/build/index.cjs.js +198 -62
  3. package/build/index.mjs +197 -63
  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 +60 -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/functions/types.d.ts +145 -1
  26. package/build/types/services/tasks/logs/types.d.ts +1 -1
  27. package/build/types/services/tasks/schedules/types.d.ts +1 -1
  28. package/build/types/services/tasks/types.d.ts +2 -2
  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
@@ -1,6 +1,82 @@
1
- import { OptionsBase } from '../../types';
1
+ import { OptionsBase, type AffectedRecords, type PagedResult } from '../../types';
2
2
  import { Task } from '../types';
3
3
  export interface FunctionsService {
4
+ /**
5
+ * View a list of functions.
6
+ *
7
+ * Although this endpoint is a paged-like endpoint, it will return all functions in a single page.
8
+ * RQL is not supported for this endpoint, and any RQL provided will be ignored.
9
+ *
10
+ * Permission | Scope | Effect
11
+ * - | - | -
12
+ * `VIEW_TASK_FUNCTIONS` | `global` | **Required** for this endpoint
13
+ */
14
+ find(options?: OptionsBase): Promise<PagedResult<FunctionBase>>;
15
+ /**
16
+ * View a list of functions.
17
+ *
18
+ * Although this endpoint is a paged-like endpoint, it will return all functions in a single page.
19
+ * RQL is not supported for this endpoint, and any RQL provided will be ignored.
20
+ *
21
+ * Permission | Scope | Effect
22
+ * - | - | -
23
+ * `VIEW_TASK_FUNCTIONS` | `global` | **Required** for this endpoint
24
+ */
25
+ create(body: FunctionCreation, options?: OptionsBase): Promise<FunctionDetails>;
26
+ /**
27
+ * View details of a function by its name.
28
+ *
29
+ * Permission | Scope | Effect
30
+ * - | - | -
31
+ * `VIEW_TASK_FUNCTION_DETAILS` | `global` | **Required** for this endpoint
32
+ *
33
+ * @throws {ResourceUnknownError} When no function with the specified name is found
34
+ */
35
+ getByName(name: string, options?: OptionsBase): Promise<FunctionDetails>;
36
+ /**
37
+ * Update a function by its name.
38
+ *
39
+ * Permission | Scope | Effect
40
+ * - | - | -
41
+ * `UPDATE_TASK_FUNCTION` | `global` | **Required** for this endpoint
42
+ *
43
+ * @throws {ResourceUnknownError} When no function with the specified name is found
44
+ */
45
+ update(name: string, body: Partial<FunctionCreation>, options?: OptionsBase): Promise<AffectedRecords>;
46
+ /**
47
+ * Delete a function by its name.
48
+ *
49
+ * Permission | Scope | Effect
50
+ * - | - | -
51
+ * `DELETE_TASK_FUNCTION` | `global` | **Required** for this endpoint
52
+ *
53
+ * @throws {ResourceUnknownError} When no function with the specified name is found
54
+ */
55
+ delete(name: string, options?: OptionsBase): Promise<AffectedRecords>;
56
+ /**
57
+ * Enable a function by its name.
58
+ *
59
+ * Does nothing if the function is already enabled.
60
+ *
61
+ * Permission | Scope | Effect
62
+ * - | - | -
63
+ * `UPDATE_TASK_FUNCTION` | `global` | **Required** for this endpoint
64
+ *
65
+ * @throws {ResourceUnknownError} When no function with the specified name is found
66
+ */
67
+ enable(name: string, options?: OptionsBase): Promise<AffectedRecords>;
68
+ /**
69
+ * Disable a function by its name.
70
+ *
71
+ * Does nothing if the function is already disabled.
72
+ *
73
+ * Permission | Scope | Effect
74
+ * - | - | -
75
+ * `UPDATE_TASK_FUNCTION` | `global` | **Required** for this endpoint
76
+ *
77
+ * @throws {ResourceUnknownError} When no function with the specified name is found
78
+ */
79
+ disable(name: string, options?: OptionsBase): Promise<AffectedRecords>;
4
80
  /**
5
81
  * ## Execute a Function directly
6
82
  *
@@ -21,6 +97,74 @@ export interface FunctionsService {
21
97
  */
22
98
  execute<T = any, U = any>(functionName: string, data?: U, options?: OptionsBase): Promise<DirectExecutionResponse<T, U>>;
23
99
  }
100
+ export interface FunctionBase {
101
+ /** The name of the Function */
102
+ name: string;
103
+ /** A description of the Function */
104
+ description: string;
105
+ /** The timestamp when the Function was last updated */
106
+ updateTimestamp: Date;
107
+ }
108
+ export interface FunctionCreation {
109
+ /** The name of the Function, this serves as the unique identifier amongst all Functions */
110
+ name: string;
111
+ /** A description of the Function */
112
+ description?: string;
113
+ /** Base64 Encoded binary value of the compressed (.zip) function code */
114
+ code: string;
115
+ /** Entry point for execution of the function, e.g. `index.handler` */
116
+ entryPoint: string;
117
+ /**
118
+ * The runtime environment for the Function, e.g. `nodejs24.x`
119
+ * The supported runtimes can be found in the [task service documentation](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/functions#runtime)
120
+ */
121
+ runtime: string;
122
+ /**
123
+ * Maximum execution time (seconds) of the function.
124
+ * Should be between 3 and 300 seconds, defaults to 30 seconds if not provided.
125
+ */
126
+ timeLimit?: number;
127
+ /**
128
+ * Memory limit (MB) for the function.
129
+ * Should be between 128 and 10240, defaults to 128 if not provided.
130
+ */
131
+ memoryLimit?: number;
132
+ /** Environment variables to be made available to the function during execution */
133
+ environmentVariables?: {
134
+ [key: string]: {
135
+ value: string;
136
+ };
137
+ };
138
+ /** Options related to the execution of the function, such as permission an priority */
139
+ executionOptions?: {
140
+ /** Defines access for executing the function directly or for invoking it as an API function. */
141
+ permissionMode?: FunctionPermissionMode;
142
+ /** The default priority assigned to all tasks created for this function, unless a priority is specified for a task explicitly */
143
+ defaultPriority?: number;
144
+ };
145
+ /** The policy that determines system behavior after the execution of a Function fails. */
146
+ retryPolicy?: {
147
+ /**
148
+ * The retry policy is disabled by default, If this field is set to true, the retry policy becomes active.
149
+ * If active the policy will retry a maximum of 3 times, with an increasing timeout of 2, 5 and 10 seconds respectively.
150
+ */
151
+ enabled: boolean;
152
+ /** A list of error names that should trigger a retry. If not specified, the default is to retry on all errors. */
153
+ errorsToRetry: string[];
154
+ };
155
+ }
156
+ export declare type FunctionDetails = Omit<FunctionCreation, 'code'> & FunctionBase & {
157
+ /** Indicates whether the function is enabled or disabled for execution/invocation. Enabled by default. */
158
+ enabled: boolean;
159
+ };
160
+ export declare enum FunctionPermissionMode {
161
+ /** To execute this function directly the user needs the EXECUTE_TASK_FUNCTION permission */
162
+ PERMISSION_REQUIRED = "permissionRequired",
163
+ /** Every logged in user can execute this function directly */
164
+ ALL_USERS = "allUsers",
165
+ /** The function can be executed even by unauthenticated requests */
166
+ PUBLIC = "public"
167
+ }
24
168
  export interface DirectExecutionResponse<T, U> extends Task<U> {
25
169
  /** The result of the Function execution, this may be user defined */
26
170
  result: T;
@@ -20,7 +20,7 @@ export interface LogsService {
20
20
  * @param taskId {@link string} The id of the targeted task
21
21
  * @param options {@link OptionsWithRql} - Additional options for the request
22
22
  * @returns The first element of the queried task logs {@link LogLine} */
23
- findFirst(taskId: ObjectId, options?: OptionsWithRql): Promise<LogLine>;
23
+ findFirst(taskId: ObjectId, options?: OptionsWithRql): Promise<LogLine | undefined>;
24
24
  }
25
25
  export interface LogLine {
26
26
  message: string;
@@ -61,7 +61,7 @@ export interface SchedulesService {
61
61
  * @param options {@link OptionsWithRql} - Add filters to the requested list
62
62
  * @returns The first element of the queried Schedules {@link Schedule}
63
63
  */
64
- findFirst<T>(options?: OptionsWithRql): Promise<Schedule<T>>;
64
+ findFirst<T>(options?: OptionsWithRql): Promise<Schedule<T> | undefined>;
65
65
  }
66
66
  export interface ScheduleCreation<T = Record<string, any>> {
67
67
  /** The period in seconds, for which the function defined will execute recurrently */
@@ -51,7 +51,7 @@ export interface TasksService {
51
51
  * @param rql an optional rql string
52
52
  * @returns the first element found
53
53
  */
54
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Task>;
54
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Task | undefined>;
55
55
  /**
56
56
  * Request a list of all tasks
57
57
  *
@@ -79,7 +79,7 @@ export interface TasksService {
79
79
  * @param rql an optional rql string
80
80
  * @returns the first element found
81
81
  */
82
- findFirst(options?: OptionsWithRql): Promise<Task>;
82
+ findFirst(options?: OptionsWithRql): Promise<Task | undefined>;
83
83
  /**
84
84
  * Create a task
85
85
  *
@@ -0,0 +1,9 @@
1
+ import type { HttpInstance } from '../../types';
2
+ declare const _default: (client: any, http: HttpInstance) => {
3
+ /**
4
+ * Perform a health check
5
+ * @returns {boolean} success
6
+ */
7
+ health(): Promise<boolean>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import health from './health';
3
+ import { TemplatesV2Service } from './types';
4
+ export declare const templatesV2Service: (httpWithAuth: AuthHttpClient) => ReturnType<typeof health> & TemplatesV2Service;
@@ -0,0 +1,5 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import { TemplatesV2Service } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: AuthHttpClient) => TemplatesV2Service;
5
+ export default _default;
@@ -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-feat-134-c0f5b9d";
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-feat-134-c0f5b9d",
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"