@extrahorizon/javascript-sdk 8.2.0-test

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 (153) hide show
  1. package/CHANGELOG.md +1161 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -0
  4. package/build/index.cjs.js +1 -0
  5. package/build/index.mjs +1 -0
  6. package/build/types/btoa.d.ts +6 -0
  7. package/build/types/client.d.ts +136 -0
  8. package/build/types/constants.d.ts +15 -0
  9. package/build/types/errorHandler.d.ts +2 -0
  10. package/build/types/errors.d.ts +332 -0
  11. package/build/types/http/client.d.ts +2 -0
  12. package/build/types/http/index.d.ts +4 -0
  13. package/build/types/http/interceptors.d.ts +9 -0
  14. package/build/types/http/oAuth1Signature.d.ts +14 -0
  15. package/build/types/http/oauth1.d.ts +3 -0
  16. package/build/types/http/oauth2.d.ts +3 -0
  17. package/build/types/http/proxy.d.ts +3 -0
  18. package/build/types/http/types.d.ts +331 -0
  19. package/build/types/http/utils.d.ts +21 -0
  20. package/build/types/index.d.ts +9 -0
  21. package/build/types/mock.d.ts +43 -0
  22. package/build/types/mockType.d.ts +1511 -0
  23. package/build/types/parseStoredCredentials.d.ts +11 -0
  24. package/build/types/rql/index.d.ts +16 -0
  25. package/build/types/rql/parser.d.ts +1 -0
  26. package/build/types/rql/types.d.ts +168 -0
  27. package/build/types/services/auth/applications/index.d.ts +5 -0
  28. package/build/types/services/auth/applications/types.d.ts +190 -0
  29. package/build/types/services/auth/index.d.ts +3 -0
  30. package/build/types/services/auth/oauth1/index.d.ts +5 -0
  31. package/build/types/services/auth/oauth1/types.d.ts +63 -0
  32. package/build/types/services/auth/oauth2/index.d.ts +5 -0
  33. package/build/types/services/auth/oauth2/types.d.ts +52 -0
  34. package/build/types/services/auth/oidc/index.d.ts +5 -0
  35. package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  36. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  37. package/build/types/services/auth/oidc/providers/index.d.ts +5 -0
  38. package/build/types/services/auth/oidc/providers/types.d.ts +144 -0
  39. package/build/types/services/auth/oidc/types.d.ts +40 -0
  40. package/build/types/services/auth/types.d.ts +39 -0
  41. package/build/types/services/auth/users/index.d.ts +5 -0
  42. package/build/types/services/auth/users/types.d.ts +121 -0
  43. package/build/types/services/configurations/general.d.ts +5 -0
  44. package/build/types/services/configurations/groups.d.ts +5 -0
  45. package/build/types/services/configurations/index.d.ts +10 -0
  46. package/build/types/services/configurations/patients.d.ts +5 -0
  47. package/build/types/services/configurations/staff.d.ts +5 -0
  48. package/build/types/services/configurations/types.d.ts +222 -0
  49. package/build/types/services/configurations/users.d.ts +5 -0
  50. package/build/types/services/data/comments.d.ts +5 -0
  51. package/build/types/services/data/documents.d.ts +5 -0
  52. package/build/types/services/data/index.d.ts +13 -0
  53. package/build/types/services/data/indexes.d.ts +5 -0
  54. package/build/types/services/data/infrastructure.d.ts +10 -0
  55. package/build/types/services/data/json-schema.d.ts +121 -0
  56. package/build/types/services/data/properties.d.ts +5 -0
  57. package/build/types/services/data/schemas.d.ts +5 -0
  58. package/build/types/services/data/statuses.d.ts +5 -0
  59. package/build/types/services/data/transitions.d.ts +5 -0
  60. package/build/types/services/data/types.d.ts +899 -0
  61. package/build/types/services/dispatchers/actions/index.d.ts +5 -0
  62. package/build/types/services/dispatchers/actions/types.d.ts +78 -0
  63. package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -0
  64. package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -0
  65. package/build/types/services/dispatchers/index.d.ts +7 -0
  66. package/build/types/services/dispatchers/types.d.ts +2 -0
  67. package/build/types/services/events/events.d.ts +5 -0
  68. package/build/types/services/events/health.d.ts +9 -0
  69. package/build/types/services/events/index.d.ts +6 -0
  70. package/build/types/services/events/subscriptions.d.ts +5 -0
  71. package/build/types/services/events/types.d.ts +90 -0
  72. package/build/types/services/files/files.d.ts +5 -0
  73. package/build/types/services/files/formHelpers.d.ts +3 -0
  74. package/build/types/services/files/index.d.ts +6 -0
  75. package/build/types/services/files/settings/index.d.ts +5 -0
  76. package/build/types/services/files/settings/types.d.ts +38 -0
  77. package/build/types/services/files/tokens.d.ts +5 -0
  78. package/build/types/services/files/types.d.ts +185 -0
  79. package/build/types/services/helpers.d.ts +7 -0
  80. package/build/types/services/http-client.d.ts +22 -0
  81. package/build/types/services/index.d.ts +15 -0
  82. package/build/types/services/localizations/countries.d.ts +5 -0
  83. package/build/types/services/localizations/health.d.ts +9 -0
  84. package/build/types/services/localizations/index.d.ts +4 -0
  85. package/build/types/services/localizations/languages.d.ts +5 -0
  86. package/build/types/services/localizations/localizations.d.ts +5 -0
  87. package/build/types/services/localizations/types.d.ts +145 -0
  88. package/build/types/services/logs/access/index.d.ts +5 -0
  89. package/build/types/services/logs/access/types.d.ts +41 -0
  90. package/build/types/services/logs/index.d.ts +3 -0
  91. package/build/types/services/logs/types.d.ts +4 -0
  92. package/build/types/services/mails/index.d.ts +3 -0
  93. package/build/types/services/mails/mails.d.ts +5 -0
  94. package/build/types/services/mails/types.d.ts +141 -0
  95. package/build/types/services/notifications/health.d.ts +9 -0
  96. package/build/types/services/notifications/index.d.ts +7 -0
  97. package/build/types/services/notifications/notifications.d.ts +5 -0
  98. package/build/types/services/notifications/settings.d.ts +5 -0
  99. package/build/types/services/notifications/types.d.ts +222 -0
  100. package/build/types/services/payments/appStore.d.ts +5 -0
  101. package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/types/services/payments/health.d.ts +9 -0
  103. package/build/types/services/payments/index.d.ts +15 -0
  104. package/build/types/services/payments/orders.d.ts +5 -0
  105. package/build/types/services/payments/playStore.d.ts +5 -0
  106. package/build/types/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/types/services/payments/products.d.ts +5 -0
  109. package/build/types/services/payments/stripe.d.ts +5 -0
  110. package/build/types/services/payments/subscriptions.d.ts +5 -0
  111. package/build/types/services/payments/types.d.ts +1189 -0
  112. package/build/types/services/profiles/groups.d.ts +5 -0
  113. package/build/types/services/profiles/health.d.ts +9 -0
  114. package/build/types/services/profiles/index.d.ts +9 -0
  115. package/build/types/services/profiles/logs.d.ts +5 -0
  116. package/build/types/services/profiles/profiles.d.ts +5 -0
  117. package/build/types/services/profiles/types.d.ts +369 -0
  118. package/build/types/services/tasks/api/index.d.ts +5 -0
  119. package/build/types/services/tasks/api/types.d.ts +146 -0
  120. package/build/types/services/tasks/apiRequests/index.d.ts +5 -0
  121. package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -0
  122. package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -0
  123. package/build/types/services/tasks/apiRequests/types.d.ts +83 -0
  124. package/build/types/services/tasks/functions/index.d.ts +5 -0
  125. package/build/types/services/tasks/functions/types.d.ts +27 -0
  126. package/build/types/services/tasks/index.d.ts +15 -0
  127. package/build/types/services/tasks/logs/index.d.ts +5 -0
  128. package/build/types/services/tasks/logs/types.d.ts +28 -0
  129. package/build/types/services/tasks/schedules/index.d.ts +5 -0
  130. package/build/types/services/tasks/schedules/types.d.ts +88 -0
  131. package/build/types/services/tasks/tasks.d.ts +5 -0
  132. package/build/types/services/tasks/types.d.ts +107 -0
  133. package/build/types/services/templates/index.d.ts +3 -0
  134. package/build/types/services/templates/templates.d.ts +5 -0
  135. package/build/types/services/templates/types.d.ts +202 -0
  136. package/build/types/services/types.d.ts +77 -0
  137. package/build/types/services/users/activationRequests/index.d.ts +4 -0
  138. package/build/types/services/users/activationRequests/types.d.ts +70 -0
  139. package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -0
  140. package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -0
  141. package/build/types/services/users/globalRoles.d.ts +5 -0
  142. package/build/types/services/users/groupRoles.d.ts +5 -0
  143. package/build/types/services/users/health.d.ts +9 -0
  144. package/build/types/services/users/index.d.ts +16 -0
  145. package/build/types/services/users/settings/index.d.ts +4 -0
  146. package/build/types/services/users/settings/types.d.ts +47 -0
  147. package/build/types/services/users/types.d.ts +1055 -0
  148. package/build/types/services/users/users.d.ts +5 -0
  149. package/build/types/sha1.d.ts +11 -0
  150. package/build/types/types.d.ts +102 -0
  151. package/build/types/utils.d.ts +4 -0
  152. package/build/types/version.d.ts +1 -0
  153. package/package.json +57 -0
@@ -0,0 +1,83 @@
1
+ import { FindAllIterator } from '../../helpers';
2
+ import { ObjectId, OptionsWithRql, PagedResultWithPager } from '../../types';
3
+ import { ApiFunctionRequestMethod } from '../api/types';
4
+ import { ApiRequestLogsService } from './logs/types';
5
+ export interface ApiRequestService {
6
+ /**
7
+ * ## Retrieve a paged list of API Requests
8
+ *
9
+ * **Global Permissions:**
10
+ * - `VIEW_API_FUNCTION_REQUESTS` - Allows a user to view API Requests
11
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
12
+ * @returns A paged list of API Requests {@link PagedResultWithPager PagedResultWithPager<ApiRequest>}
13
+ */
14
+ find(options?: OptionsWithRql): Promise<PagedResultWithPager<ApiRequest>>;
15
+ /**
16
+ * ## Retrieve a list of all API Requests
17
+ *
18
+ * **Global Permissions:**
19
+ * - `VIEW_API_FUNCTION_REQUESTS` - Allows a user to view API Requests
20
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
21
+ * @returns An array of API Requests {@link ApiRequest ApiRequest[]}
22
+ * @throws {@link Error} Do not pass in limit operator with findAll
23
+ */
24
+ findAll(options?: OptionsWithRql): Promise<ApiRequest[]>;
25
+ /**
26
+ * ## Retrieve a paged list of API Requests
27
+ *
28
+ * **Global Permissions:**
29
+ * - `VIEW_API_FUNCTION_REQUESTS` - Allows a user to view API Requests
30
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
31
+ * @returns An iterator for the queried API Requests {@link FindAllIterator FindAllIterator<ApiRequest>}
32
+ */
33
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<ApiRequest>;
34
+ /**
35
+ * ## Retrieve the first queried API Request
36
+ *
37
+ * **Global Permissions:**
38
+ * - `VIEW_API_FUNCTION_REQUESTS` - Allows a user to view API Requests
39
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
40
+ * @returns The first element of the queried API Requests {@link ApiRequest}
41
+ */
42
+ findFirst(options?: OptionsWithRql): Promise<ApiRequest>;
43
+ logs: ApiRequestLogsService;
44
+ }
45
+ export interface ApiRequest {
46
+ /** The Extra Horizon document id */
47
+ id: ObjectId;
48
+ /** The unique identifier amongst all Functions */
49
+ functionName: string;
50
+ /** The HTTP method used to target the API function. */
51
+ method: ApiFunctionRequestMethod;
52
+ /** The path portion of the URL that comes after the Function name. */
53
+ path: string;
54
+ /** The id of the user making the request */
55
+ userId?: ObjectId;
56
+ /** The application id of the oAuth application */
57
+ applicationId?: ObjectId;
58
+ /** The status code of the API Function's response or of a thrown error during its lifecycle */
59
+ statusCode: number;
60
+ /** The time the API Function was executed */
61
+ timestamp: Date;
62
+ /** The duration of the API Function execution in seconds */
63
+ duration: number;
64
+ /** An error thrown during the lifecycle of the API Function's execution */
65
+ error?: ApiRequestError;
66
+ }
67
+ export interface ApiRequestError {
68
+ /** The name of the caught error */
69
+ name: string;
70
+ /** The message of the caught error */
71
+ message: string;
72
+ /** The error type defines where the error occurred during the API Function lifecycle and can have one of the following values:
73
+ * - `invocation` - errors that occur before invocation of the API Function
74
+ * - `runtime` - errors that occur during the execution of the API Function
75
+ * - `response` - errors that occur during the response validation after the API Function has been executed
76
+ */
77
+ type: ApiRequestErrorType;
78
+ }
79
+ export declare enum ApiRequestErrorType {
80
+ INVOCATION = "invocation",
81
+ RUNTIME = "runtime",
82
+ RESPONSE = "response"
83
+ }
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { FunctionsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => FunctionsService;
5
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { OptionsBase } from '../../types';
2
+ import { Task } from '../types';
3
+ export interface FunctionsService {
4
+ /**
5
+ * ## Execute a Function directly
6
+ *
7
+ * A Function may be executed directly, the function will be executed synchronously and the response may be awaited by the caller.
8
+ *
9
+ * **Default Permissions:**
10
+ * - Any party may execute Functions with the `public` permission mode
11
+ * - Any authenticated user may execute Functions with the `allUsers` permission mode
12
+ *
13
+ * **Global Permissions:**
14
+ * - `EXECUTE_TASK_FUNCTION` - A user may execute all Functions
15
+ * - `EXECUTE_TASK_FUNCTION:{FUNCTION_NAME}` - A user may execute the Function specified by the FUNCTION_NAME
16
+ *
17
+ * @param functionName {@link string} - The functionName property serves as the unique identifier amongst all Functions
18
+ * @param data {@link U} - The data to be sent to the Function, the type may be specified by the user
19
+ * @param options {@link OptionsBase} - Additional options for the request
20
+ * @returns {@link DirectExecutionResponse} - The response returned from the Function, the response data and results may be user defined
21
+ */
22
+ execute<T = any, U = any>(functionName: string, data?: U, options?: OptionsBase): Promise<DirectExecutionResponse<T, U>>;
23
+ }
24
+ export interface DirectExecutionResponse<T, U> extends Task<U> {
25
+ /** The result of the Function execution, this may be user defined */
26
+ result: T;
27
+ }
@@ -0,0 +1,15 @@
1
+ import { ApiRequestService } from '../../types';
2
+ import type { ApiService, FunctionsService, HttpInstance, LogsService, SchedulesService } from '../../types';
3
+ import api from './api';
4
+ import apiRequests from './apiRequests';
5
+ import functions from './functions';
6
+ import logs from './logs';
7
+ import schedules from './schedules';
8
+ import { TasksService } from './types';
9
+ export declare const tasksService: (httpWithAuth: HttpInstance) => TasksService & {
10
+ schedules: SchedulesService;
11
+ functions: FunctionsService;
12
+ api: ApiService;
13
+ logs: LogsService;
14
+ apiRequests: ApiRequestService;
15
+ };
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { LogsService } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => LogsService;
5
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import { ObjectId, OptionsWithRql } from '../../types';
2
+ export interface LogsService {
3
+ /**
4
+ * ## Retrieve a list of logs for a task
5
+ *
6
+ * **Global Permissions:**
7
+ * - `VIEW_TASK_LOGS` - **Required** for this endpoint
8
+ *
9
+ * @param taskId {@link string} The id of the targeted task
10
+ * @param options {@link OptionsWithRql} - Additional options for the request
11
+ * @returns An array of task logs {@link LogLine LineLog[]}
12
+ */
13
+ find(taskId: ObjectId, options?: OptionsWithRql): Promise<LogLine[]>;
14
+ /**
15
+ * ## Retrieve the first queried task log
16
+ *
17
+ * **Global Permissions:**
18
+ * - `VIEW_TASK_LOGS` - **Required** for this endpoint
19
+ *
20
+ * @param taskId {@link string} The id of the targeted task
21
+ * @param options {@link OptionsWithRql} - Additional options for the request
22
+ * @returns The first element of the queried task logs {@link LogLine} */
23
+ findFirst(taskId: ObjectId, options?: OptionsWithRql): Promise<LogLine>;
24
+ }
25
+ export interface LogLine {
26
+ message: string;
27
+ timestamp: Date;
28
+ }
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { SchedulesService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => SchedulesService;
5
+ export default _default;
@@ -0,0 +1,88 @@
1
+ import { FindAllIterator } from '../../helpers';
2
+ import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResultWithPager } from '../../types';
3
+ export interface SchedulesService {
4
+ /**
5
+ * ## Create a new Schedule
6
+ *
7
+ * **Global Permissions:**
8
+ * - `CREATE_TASK_SCHEDULE` - Allows a user to create schedules
9
+ *
10
+ * @param schedule - The data used to create the schedule
11
+ * @param options - Additional options for the request
12
+ */
13
+ create<T>(schedule: ScheduleCreation<T>, options?: OptionsBase): Promise<Schedule<T>>;
14
+ /**
15
+ * ## Delete a Schedule
16
+ *
17
+ * **Global Permissions:**
18
+ * - `DELETE_TASK_SCHEDULE` - Allows a user to delete schedules
19
+ *
20
+ * @param scheduleId - The id of the schedule to delete
21
+ * @param options - Additional options for the request
22
+ */
23
+ delete(scheduleId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
24
+ /**
25
+ * ## Retrieve a paged list of schedules
26
+ *
27
+ * **Global Permissions:**
28
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view schedules
29
+ *
30
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
31
+ * @returns A paged list of schedules {@link PagedResultWithPager PagedResultWithPager<Schedule>}
32
+ */
33
+ find<T>(options?: OptionsWithRql): Promise<PagedResultWithPager<Schedule<T>>>;
34
+ /**
35
+ * ## Retrieve a list of all Schedules
36
+ *
37
+ * **Global Permissions:**
38
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view schedules
39
+ *
40
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
41
+ * @returns An array of Schedules {@link Schedule Schedule[]}
42
+ * @throws {@link Error} Do not pass in limit operator with findAll
43
+ */
44
+ findAll<T>(options?: OptionsWithRql): Promise<Schedule<T>[]>;
45
+ /**
46
+ * ## Retrieve a paged list of Schedules
47
+ *
48
+ * **Global Permissions:**
49
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view Schedules
50
+ *
51
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
52
+ * @returns An iterator for the queried schedules {@link FindAllIterator FindAllIterator<Schedule>}
53
+ */
54
+ findAllIterator<T>(options?: OptionsWithRql): FindAllIterator<Schedule<T>>;
55
+ /**
56
+ * ## Retrieve the first queried Schedule
57
+ *
58
+ * **Global Permissions:**
59
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view Schedules
60
+ *
61
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
62
+ * @returns The first element of the queried Schedules {@link Schedule}
63
+ */
64
+ findFirst<T>(options?: OptionsWithRql): Promise<Schedule<T>>;
65
+ }
66
+ export interface ScheduleCreation<T = Record<string, any>> {
67
+ /** The period in seconds, for which the function defined will execute recurrently */
68
+ interval: number;
69
+ /** The functionName property serves as the unique identifier amongst all Functions */
70
+ functionName: string;
71
+ /** The data to be provided to the Function, the type may be user defined */
72
+ data?: T;
73
+ /** The priority of the schedule (Higher priorities shall execute first) */
74
+ priority?: number;
75
+ /** The timestamp at which the schedule will start executing */
76
+ startTimestamp?: Date;
77
+ }
78
+ export interface Schedule<T = Record<string, any>> extends ScheduleCreation<T> {
79
+ id: ObjectId;
80
+ /** The timestamp at which the schedule will start executing */
81
+ startTimestamp: Date;
82
+ /** The timestamp at which the schedule was last updated */
83
+ updateTimestamp: Date;
84
+ /** The timestamp at which the schedule was created */
85
+ creationTimestamp: Date;
86
+ /** The timestamp at which the schedule will next execute */
87
+ nextTimestamp: Date;
88
+ }
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { TasksService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => TasksService;
5
+ export default _default;
@@ -0,0 +1,107 @@
1
+ import { FindAllIterator } from '../../services/helpers';
2
+ import type { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult } from '../types';
3
+ export * from './api/types';
4
+ export * from './apiRequests/types';
5
+ export * from './functions/types';
6
+ export * from './logs/types';
7
+ export * from './schedules/types';
8
+ export declare enum TaskStatus {
9
+ NEW = "new",
10
+ IN_PROGRESS = "inProgress",
11
+ COMPLETE = "complete",
12
+ FAILED = "failed",
13
+ CANCELED = "canceled"
14
+ }
15
+ export interface Task<DataType = any> {
16
+ id?: ObjectId;
17
+ status?: TaskStatus;
18
+ statusChangedTimestamp?: Date;
19
+ /**
20
+ * AWS Lambda function name
21
+ */
22
+ functionName: string;
23
+ /**
24
+ * Data send to the function
25
+ */
26
+ data?: DataType;
27
+ startTimestamp?: Date;
28
+ tags?: Array<string>;
29
+ priority?: number;
30
+ creationTimestamp?: Date;
31
+ updateTimestamp?: Date;
32
+ /** The Extra Horizon document id for the application used to make the request */
33
+ createdByApplicationId?: ObjectId;
34
+ /** The Extra Horizon document id for the user who made the request */
35
+ createdByUserId?: ObjectId;
36
+ }
37
+ export declare type TaskInput = Pick<Task, 'functionName' | 'data' | 'startTimestamp' | 'priority' | 'tags'>;
38
+ export interface TasksService {
39
+ /**
40
+ * View a list of tasks
41
+ *
42
+ * Permission | Scope | Effect
43
+ * - | - | -
44
+ * `VIEW_TASKS` | `gobal` | **Required** for this endpoint
45
+ * @returns PagedResult<Task>
46
+ */
47
+ find(options?: OptionsWithRql): Promise<PagedResult<Task>>;
48
+ /**
49
+ * Find By Id
50
+ * @param id the Id to search for
51
+ * @param rql an optional rql string
52
+ * @returns the first element found
53
+ */
54
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Task>;
55
+ /**
56
+ * Request a list of all tasks
57
+ *
58
+ * Do not pass in an rql with limit operator!
59
+ *
60
+ * Permission | Scope | Effect
61
+ * - | - | -
62
+ * `VIEW_TASKS` | `gobal` | **Required** for this endpoint
63
+ * @param rql Add filters to the requested list.
64
+ * @returns Task[]
65
+ */
66
+ findAll(options?: OptionsWithRql): Promise<Task[]>;
67
+ /**
68
+ * Request a list of all tasks
69
+ *
70
+ * Permission | Scope | Effect
71
+ * - | - | -
72
+ * `VIEW_TASKS` | `gobal` | **Required** for this endpoint
73
+ * @param rql Add filters to the requested list.
74
+ * @returns Task[]
75
+ */
76
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<Task>;
77
+ /**
78
+ * Find First
79
+ * @param rql an optional rql string
80
+ * @returns the first element found
81
+ */
82
+ findFirst(options?: OptionsWithRql): Promise<Task>;
83
+ /**
84
+ * Create a task
85
+ *
86
+ * Permission | Scope | Effect
87
+ * - | - | -
88
+ * `CREATE_TASKS` | `gobal` | **Required** for this endpoint
89
+ * @param requestBody
90
+ * @returns Task Success
91
+ */
92
+ create(requestBody: TaskInput, options?: OptionsBase): Promise<Task>;
93
+ /**
94
+ * Cancel a task
95
+ *
96
+ * The targeted task **MUST** be in the `new` status.
97
+ *
98
+ * Permission | Scope | Effect
99
+ * - | - | -
100
+ * `CANCEL_TASKS` | `gobal` | **Required** for this endpoint
101
+ * @param taskId The id of the targeted task
102
+ * @returns AffectedRecords
103
+ * @throws {IllegalStateException}
104
+ * @throws {ResourceUnknownException}
105
+ */
106
+ cancel(taskId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
107
+ }
@@ -0,0 +1,3 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { TemplatesService } from './types';
3
+ export declare const templatesService: (httpWithAuth: HttpInstance) => TemplatesService;
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { TemplatesService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => TemplatesService;
5
+ export default _default;
@@ -0,0 +1,202 @@
1
+ /// <reference types="node" />
2
+ import { FindAllIterator } from '../../services/helpers';
3
+ import { TypeConfiguration } from '../data/types';
4
+ import { ObjectId, LanguageCode, TimeZone, PagedResult, AffectedRecords, OptionsWithRql, OptionsBase } from '../types';
5
+ export interface TemplateOut {
6
+ id?: ObjectId;
7
+ name?: string;
8
+ description?: string;
9
+ schema?: TemplateObjectConfiguration;
10
+ fields?: Record<string, string>;
11
+ creationTimestamp?: Date;
12
+ updateTimestamp?: Date;
13
+ }
14
+ export interface TemplateIn {
15
+ name: string;
16
+ description: string;
17
+ schema: TemplateObjectConfiguration;
18
+ fields: Record<string, string>;
19
+ }
20
+ export interface TemplateObjectConfiguration {
21
+ type?: 'object';
22
+ options?: Array<ObjectOption>;
23
+ fields?: Record<string, TypeConfiguration>;
24
+ }
25
+ export declare type ObjectOption = ObjectMinBytesOption | ObjectMaxBytesOption;
26
+ export interface ObjectMinBytesOption {
27
+ type?: ObjectMinBytesOptionType;
28
+ value: number;
29
+ }
30
+ export declare enum ObjectMinBytesOptionType {
31
+ MIN_BYTES = "min_bytes"
32
+ }
33
+ export interface ObjectMaxBytesOption {
34
+ type?: ObjectMaxBytesOptionType;
35
+ value: number;
36
+ }
37
+ export declare enum ObjectMaxBytesOptionType {
38
+ MAX_BYTES = "max_bytes"
39
+ }
40
+ export interface CreateFile {
41
+ /**
42
+ * 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'
43
+ */
44
+ language?: LanguageCode;
45
+ /**
46
+ * 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 'Europe/Brussels'
47
+ */
48
+ timeZone?: TimeZone;
49
+ content: Record<string, any>;
50
+ }
51
+ export interface TemplatesService {
52
+ /**
53
+ * Perform a health check
54
+ * @returns {boolean} success
55
+ */
56
+ health(): Promise<boolean>;
57
+ /**
58
+ * Get all templates the service has to offer
59
+ *
60
+ * Permission | Scope | Effect
61
+ * - | - | -
62
+ * `VIEW_TEMPLATES` | `global` | **Required** for this endpoint
63
+ * @param rql Add filters to the requested list.
64
+ * @returns PagedResult<TemplateOut>
65
+ */
66
+ find(options?: OptionsWithRql): Promise<PagedResult<TemplateOut>>;
67
+ /**
68
+ * Request a list of all templates
69
+ *
70
+ * Do not pass in an rql with limit operator!
71
+ *
72
+ * Permission | Scope | Effect
73
+ * - | - | -
74
+ * `VIEW_TEMPLATES` | `global` | **Required** for this endpoint
75
+ * @param rql Add filters to the requested list.
76
+ * @returns TemplateOut[]
77
+ */
78
+ findAll(options?: OptionsWithRql): Promise<TemplateOut[]>;
79
+ /**
80
+ * Request a list of all templates
81
+ *
82
+ * Permission | Scope | Effect
83
+ * - | - | -
84
+ * `VIEW_TEMPLATES` | `global` | **Required** for this endpoint
85
+ * @param rql Add filters to the requested list.
86
+ * @returns TemplateOut[]
87
+ */
88
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<TemplateOut>;
89
+ /**
90
+ * Find By Id
91
+ * @param id the Id to search for
92
+ * @param rql an optional rql string
93
+ * @returns the first element found
94
+ */
95
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<TemplateOut>;
96
+ /**
97
+ * Find By Name
98
+ * @param name the name to search for
99
+ * @param rql an optional rql string
100
+ * @returns the first element found
101
+ */
102
+ findByName(name: string, options?: OptionsWithRql): Promise<TemplateOut>;
103
+ /**
104
+ * Find First
105
+ * @param rql an optional rql string
106
+ * @returns the first element found
107
+ */
108
+ findFirst(options?: OptionsWithRql): Promise<TemplateOut>;
109
+ /**
110
+ * Create a new template
111
+ *
112
+ * Permission | Scope | Effect
113
+ * - | - | -
114
+ * `CREATE_TEMPLATES` | `global` | **Required** for this endpoint
115
+ * @param requestBody TemplateIn
116
+ * @returns TemplateOut
117
+ */
118
+ create(requestBody: TemplateIn, options?: OptionsBase): Promise<TemplateOut>;
119
+ /**
120
+ * Update an existing template
121
+ *
122
+ * Permission | Scope | Effect
123
+ * - | - | -
124
+ * `UPDATE_TEMPLATES` | `global` | **Required** for this endpoint
125
+ * @param templateId Id of the targeted template
126
+ * @param requestBody TemplateIn
127
+ * @returns TemplateOut
128
+ * @throws {ResourceUnknownError}
129
+ */
130
+ update(templateId: string, requestBody: TemplateIn, options?: OptionsBase): Promise<TemplateOut>;
131
+ /**
132
+ * Delete a template
133
+ *
134
+ * Permission | Scope | Effect
135
+ * - | - | -
136
+ * `DELETE_TEMPLATES` | `global` | **Required** for this endpoint
137
+ * @param templateId Id of the targeted template
138
+ * @returns AffectedRecords
139
+ * @throws {ResourceUnknownError}
140
+ */
141
+ remove(templateId: string, options?: OptionsBase): Promise<AffectedRecords>;
142
+ /**
143
+ * Resolves a template and presents the result as a pdf file
144
+ *
145
+ * Permission | Scope | Effect
146
+ * - | - | -
147
+ * none | | Everyone can use this endpoint
148
+ * @param templateId Id of the targeted template
149
+ * @param requestBody The file data
150
+ * @returns Buffer
151
+ * @throws {LocalizationKeyMissingError}
152
+ * @throws {TemplateFillingError}
153
+ * @throws {ResourceUnknownError}
154
+ */
155
+ resolveAsPdf(templateId: string, requestBody: CreateFile, options?: OptionsBase): Promise<Buffer>;
156
+ /**
157
+ * @deprecated
158
+ * Resolves a template and presents the result as a pdf file
159
+ *
160
+ * Permission | Scope | Effect
161
+ * - | - | -
162
+ * none | | Everyone can use this endpoint
163
+ * @param templateId Id of the targeted template
164
+ * @param localizationCode Specifies the language the template must be resolved in
165
+ * @param requestBody The file data
166
+ * @returns Buffer
167
+ * @throws {LocalizationKeyMissingError}
168
+ * @throws {TemplateFillingError}
169
+ * @throws {ResourceUnknownError}
170
+ */
171
+ resolveAsPdfUsingCode(templateId: string, localizationCode: string, requestBody: CreateFile, options?: OptionsBase): Promise<Buffer>;
172
+ /**
173
+ * Resolves a template and presents the result as a json response
174
+ *
175
+ * Permission | Scope | Effect
176
+ * - | - | -
177
+ * none | | Everyone can use this endpoint
178
+ * @param templateId Id of the targeted template
179
+ * @param requestBody CreateFile
180
+ * @returns Record<string, string>
181
+ * @throws {LocalizationKeyMissingError}
182
+ * @throws {TemplateFillingError}
183
+ * @throws {ResourceUnknownError}
184
+ */
185
+ resolveAsJson(templateId: string, requestBody: CreateFile, options?: OptionsBase): Promise<Record<string, string>>;
186
+ /**
187
+ * @deprecated
188
+ * Resolves a template and presents the result as a json response
189
+ *
190
+ * Permission | Scope | Effect
191
+ * - | - | -
192
+ * none | | Everyone can use this endpoint
193
+ * @param templateId Id of the targeted template
194
+ * @param localizationCode Specifies the language the template must be resolved in
195
+ * @param requestBody CreateFile
196
+ * @returns Record<string, string>
197
+ * @throws {LocalizationKeyMissingError}
198
+ * @throws {TemplateFillingError}
199
+ * @throws {ResourceUnknownError}
200
+ */
201
+ resolveAsJsonUsingCode(templateId: string, localizationCode: string, requestBody: CreateFile, options?: OptionsBase): Promise<Record<string, string>>;
202
+ }
@@ -0,0 +1,77 @@
1
+ import { RQLString } from '../rql';
2
+ export declare type LanguageCode = string;
3
+ export declare type ObjectId = string;
4
+ export interface Entity {
5
+ id: ObjectId;
6
+ }
7
+ export interface Timestamps {
8
+ updateTimestamp: Date;
9
+ creationTimestamp: Date;
10
+ }
11
+ export interface ErrorResponse {
12
+ code?: number;
13
+ name?: string;
14
+ message?: string;
15
+ }
16
+ export interface PagedResult<T> {
17
+ page: {
18
+ total: number;
19
+ offset: number;
20
+ limit: number;
21
+ };
22
+ data: T[];
23
+ }
24
+ export interface AffectedRecords {
25
+ affectedRecords: number;
26
+ }
27
+ export interface ResultResponse {
28
+ status: number;
29
+ }
30
+ export declare enum Results {
31
+ Success = 200
32
+ }
33
+ /**
34
+ * Supported timezones from [Java.time.zoneId](https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#of-java.lang.String-)
35
+ */
36
+ export declare type TimeZone = string;
37
+ export declare type MailAddress = string;
38
+ export declare type MailAddressList = MailAddress[];
39
+ export interface MailRecipients {
40
+ to: MailAddressList;
41
+ cc?: MailAddressList;
42
+ bcc?: MailAddressList;
43
+ }
44
+ export declare type Headers = Record<string, string>;
45
+ export declare type OptionsBase = {
46
+ /** Added to all HTTP verbs */
47
+ headers?: Headers;
48
+ /** Only passed to the GET requests. Will retry 4 times on 500 errors */
49
+ shouldRetry?: boolean;
50
+ /**
51
+ * @deprecated this property is only meant to be used for backwards compatibility when upgrading to v8.0.0.
52
+ *
53
+ * Key names that are not chosen by Extra Horizon where also affected by the data normalization before v8.0.0.
54
+ * They were converted from camel case to snake case before sending the request and the other way around before
55
+ * providing the response.
56
+ *
57
+ * Also fields ending with the name timestamp not chosen by extra horizon in custom properties where automatically
58
+ * converted to dates. Even though they could be just booleans, strings or numbers. Dates provided in such fields will
59
+ * now be converted to strings while all other types will stay as they are.
60
+ *
61
+ * To enable this behaviour again, set to true.
62
+ */
63
+ normalizeCustomData?: boolean;
64
+ };
65
+ export declare type OptionsWithRql = OptionsBase & {
66
+ rql?: RQLString;
67
+ };
68
+ export interface FileUploadOptions extends OptionsBase {
69
+ onUploadProgress?: (progress: {
70
+ loaded: number;
71
+ total: number;
72
+ }) => void;
73
+ }
74
+ export declare type PagedResultWithPager<T> = PagedResult<T> & {
75
+ previous: () => Promise<PagedResultWithPager<T>>;
76
+ next: () => Promise<PagedResultWithPager<T>>;
77
+ };
@@ -0,0 +1,4 @@
1
+ import { HttpInstance } from '../../../types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { ActivationRequestsService } from './types';
4
+ export declare const activationRequestsService: (client: HttpClient, httpWithAuth: HttpInstance) => ActivationRequestsService;