@extrahorizon/javascript-sdk 8.10.0-dev-159-0e9a0f1 → 8.10.0-dev-161-c1dd6ca

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 (156) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/build/btoa.d.ts +6 -0
  3. package/build/client.d.ts +147 -0
  4. package/build/constants.d.ts +17 -0
  5. package/build/errorHandler.d.ts +1 -0
  6. package/build/errors.d.ts +361 -0
  7. package/build/http/client.d.ts +2 -0
  8. package/build/http/index.d.ts +4 -0
  9. package/build/http/interceptors.d.ts +9 -0
  10. package/build/http/oAuth1Signature.d.ts +18 -0
  11. package/build/http/oauth1.d.ts +3 -0
  12. package/build/http/oauth2.d.ts +3 -0
  13. package/build/http/proxy.d.ts +3 -0
  14. package/build/http/types.d.ts +331 -0
  15. package/build/http/utils.d.ts +21 -0
  16. package/build/index.cjs.js +1 -1
  17. package/build/index.d.ts +9 -0
  18. package/build/index.mjs +1 -1
  19. package/build/mock.d.ts +43 -0
  20. package/build/mockType.d.ts +1721 -0
  21. package/build/parseStoredCredentials.d.ts +11 -0
  22. package/build/rql/index.d.ts +16 -0
  23. package/build/rql/parser.d.ts +1 -0
  24. package/build/rql/types.d.ts +174 -0
  25. package/build/services/auth/applications/index.d.ts +5 -0
  26. package/build/services/auth/applications/types.d.ts +260 -0
  27. package/build/services/auth/index.d.ts +3 -0
  28. package/build/services/auth/oauth1/index.d.ts +5 -0
  29. package/build/services/auth/oauth1/types.d.ts +102 -0
  30. package/build/services/auth/oauth2/index.d.ts +5 -0
  31. package/build/services/auth/oauth2/types.d.ts +100 -0
  32. package/build/services/auth/oidc/index.d.ts +5 -0
  33. package/build/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  34. package/build/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  35. package/build/services/auth/oidc/providers/index.d.ts +5 -0
  36. package/build/services/auth/oidc/providers/types.d.ts +148 -0
  37. package/build/services/auth/oidc/types.d.ts +40 -0
  38. package/build/services/auth/types.d.ts +39 -0
  39. package/build/services/auth/users/index.d.ts +5 -0
  40. package/build/services/auth/users/types.d.ts +121 -0
  41. package/build/services/configurations/general.d.ts +5 -0
  42. package/build/services/configurations/groups.d.ts +5 -0
  43. package/build/services/configurations/index.d.ts +10 -0
  44. package/build/services/configurations/patients.d.ts +5 -0
  45. package/build/services/configurations/staff.d.ts +5 -0
  46. package/build/services/configurations/types.d.ts +222 -0
  47. package/build/services/configurations/users.d.ts +5 -0
  48. package/build/services/data/comments.d.ts +5 -0
  49. package/build/services/data/documents.d.ts +5 -0
  50. package/build/services/data/index.d.ts +13 -0
  51. package/build/services/data/indexes.d.ts +5 -0
  52. package/build/services/data/infrastructure.d.ts +10 -0
  53. package/build/services/data/json-schema.d.ts +121 -0
  54. package/build/services/data/properties.d.ts +5 -0
  55. package/build/services/data/schemas.d.ts +5 -0
  56. package/build/services/data/statuses.d.ts +5 -0
  57. package/build/services/data/transitions.d.ts +5 -0
  58. package/build/services/data/types.d.ts +1500 -0
  59. package/build/services/dispatchers/actions/index.d.ts +5 -0
  60. package/build/services/dispatchers/actions/types.d.ts +78 -0
  61. package/build/services/dispatchers/dispatchers/index.d.ts +5 -0
  62. package/build/services/dispatchers/dispatchers/types.d.ts +111 -0
  63. package/build/services/dispatchers/index.d.ts +7 -0
  64. package/build/services/dispatchers/types.d.ts +2 -0
  65. package/build/services/events/events.d.ts +5 -0
  66. package/build/services/events/index.d.ts +5 -0
  67. package/build/services/events/subscriptions.d.ts +5 -0
  68. package/build/services/events/types.d.ts +107 -0
  69. package/build/services/files/files.d.ts +5 -0
  70. package/build/services/files/formHelpers.d.ts +3 -0
  71. package/build/services/files/index.d.ts +6 -0
  72. package/build/services/files/settings/index.d.ts +5 -0
  73. package/build/services/files/settings/types.d.ts +38 -0
  74. package/build/services/files/tokens.d.ts +5 -0
  75. package/build/services/files/types.d.ts +185 -0
  76. package/build/services/helpers.d.ts +7 -0
  77. package/build/services/http-client.d.ts +22 -0
  78. package/build/services/index.d.ts +16 -0
  79. package/build/services/localizations/countries.d.ts +5 -0
  80. package/build/services/localizations/index.d.ts +3 -0
  81. package/build/services/localizations/languages.d.ts +5 -0
  82. package/build/services/localizations/localizations.d.ts +5 -0
  83. package/build/services/localizations/types.d.ts +150 -0
  84. package/build/services/logs/access/index.d.ts +5 -0
  85. package/build/services/logs/access/types.d.ts +41 -0
  86. package/build/services/logs/index.d.ts +3 -0
  87. package/build/services/logs/types.d.ts +4 -0
  88. package/build/services/mails/index.d.ts +3 -0
  89. package/build/services/mails/mails.d.ts +5 -0
  90. package/build/services/mails/types.d.ts +149 -0
  91. package/build/services/notifications/index.d.ts +6 -0
  92. package/build/services/notifications/notifications.d.ts +5 -0
  93. package/build/services/notifications/settings.d.ts +5 -0
  94. package/build/services/notifications/types.d.ts +235 -0
  95. package/build/services/notificationsV2/index.d.ts +6 -0
  96. package/build/services/notificationsV2/notificationsV2.d.ts +5 -0
  97. package/build/services/notificationsV2/types.d.ts +166 -0
  98. package/build/services/notificationsV2/userSettings/index.d.ts +5 -0
  99. package/build/services/notificationsV2/userSettings/types.d.ts +138 -0
  100. package/build/services/payments/appStore.d.ts +5 -0
  101. package/build/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/services/payments/health.d.ts +9 -0
  103. package/build/services/payments/index.d.ts +15 -0
  104. package/build/services/payments/orders.d.ts +5 -0
  105. package/build/services/payments/playStore.d.ts +5 -0
  106. package/build/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/services/payments/products.d.ts +5 -0
  109. package/build/services/payments/stripe.d.ts +5 -0
  110. package/build/services/payments/subscriptions.d.ts +5 -0
  111. package/build/services/payments/types.d.ts +1198 -0
  112. package/build/services/profiles/groups.d.ts +5 -0
  113. package/build/services/profiles/index.d.ts +8 -0
  114. package/build/services/profiles/logs.d.ts +5 -0
  115. package/build/services/profiles/profiles.d.ts +5 -0
  116. package/build/services/profiles/types.d.ts +375 -0
  117. package/build/services/tasks/api/index.d.ts +5 -0
  118. package/build/services/tasks/api/types.d.ts +146 -0
  119. package/build/services/tasks/apiRequests/index.d.ts +5 -0
  120. package/build/services/tasks/apiRequests/logs/index.d.ts +5 -0
  121. package/build/services/tasks/apiRequests/logs/types.d.ts +25 -0
  122. package/build/services/tasks/apiRequests/types.d.ts +83 -0
  123. package/build/services/tasks/functions/index.d.ts +5 -0
  124. package/build/services/tasks/functions/types.d.ts +171 -0
  125. package/build/services/tasks/index.d.ts +15 -0
  126. package/build/services/tasks/logs/index.d.ts +5 -0
  127. package/build/services/tasks/logs/types.d.ts +28 -0
  128. package/build/services/tasks/schedules/index.d.ts +5 -0
  129. package/build/services/tasks/schedules/types.d.ts +92 -0
  130. package/build/services/tasks/tasks.d.ts +5 -0
  131. package/build/services/tasks/types.d.ts +118 -0
  132. package/build/services/templates/index.d.ts +3 -0
  133. package/build/services/templates/templates.d.ts +5 -0
  134. package/build/services/templates/types.d.ts +237 -0
  135. package/build/services/templatesV2/index.d.ts +3 -0
  136. package/build/services/templatesV2/templatesV2.d.ts +5 -0
  137. package/build/services/templatesV2/types.d.ts +156 -0
  138. package/build/services/types.d.ts +103 -0
  139. package/build/services/users/activationRequests/index.d.ts +4 -0
  140. package/build/services/users/activationRequests/types.d.ts +70 -0
  141. package/build/services/users/forgotPasswordRequests/index.d.ts +4 -0
  142. package/build/services/users/forgotPasswordRequests/types.d.ts +70 -0
  143. package/build/services/users/globalRoles.d.ts +5 -0
  144. package/build/services/users/groupRoles.d.ts +5 -0
  145. package/build/services/users/index.d.ts +14 -0
  146. package/build/services/users/settings/index.d.ts +4 -0
  147. package/build/services/users/settings/types.d.ts +47 -0
  148. package/build/services/users/types.d.ts +1278 -0
  149. package/build/services/users/users.d.ts +5 -0
  150. package/build/sha1.d.ts +11 -0
  151. package/build/types/services/users/types.d.ts +69 -25
  152. package/build/types/version.d.ts +1 -1
  153. package/build/types.d.ts +104 -0
  154. package/build/utils.d.ts +5 -0
  155. package/build/version.d.ts +1 -0
  156. package/package.json +3 -3
@@ -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,171 @@
1
+ import { OptionsBase, type AffectedRecords, type PagedResult } from '../../types';
2
+ import { Task } from '../types';
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
+ remove(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>;
80
+ /**
81
+ * ## Execute a Function directly
82
+ *
83
+ * A Function may be executed directly, the function will be executed synchronously and the response may be awaited by the caller.
84
+ *
85
+ * **Default Permissions:**
86
+ * - Any party may execute Functions with the `public` permission mode
87
+ * - Any authenticated user may execute Functions with the `allUsers` permission mode
88
+ *
89
+ * **Global Permissions:**
90
+ * - `EXECUTE_TASK_FUNCTION` - A user may execute all Functions
91
+ * - `EXECUTE_TASK_FUNCTION:{FUNCTION_NAME}` - A user may execute the Function specified by the FUNCTION_NAME
92
+ *
93
+ * @param functionName {@link string} - The functionName property serves as the unique identifier amongst all Functions
94
+ * @param data {@link U} - The data to be sent to the Function, the type may be specified by the user
95
+ * @param options {@link OptionsBase} - Additional options for the request
96
+ * @returns {@link DirectExecutionResponse} - The response returned from the Function, the response data and results may be user defined
97
+ */
98
+ execute<T = any, U = any>(functionName: string, data?: U, options?: OptionsBase): Promise<DirectExecutionResponse<T, U>>;
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
+ }
168
+ export interface DirectExecutionResponse<T, U> extends Task<U> {
169
+ /** The result of the Function execution, this may be user defined */
170
+ result: T;
171
+ }
@@ -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 | undefined>;
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,92 @@
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
+ remove(scheduleId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
24
+ /**
25
+ * @deprecated Use `remove` instead.
26
+ */
27
+ delete(scheduleId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
28
+ /**
29
+ * ## Retrieve a paged list of schedules
30
+ *
31
+ * **Global Permissions:**
32
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view schedules
33
+ *
34
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
35
+ * @returns A paged list of schedules {@link PagedResultWithPager PagedResultWithPager<Schedule>}
36
+ */
37
+ find<T>(options?: OptionsWithRql): Promise<PagedResultWithPager<Schedule<T>>>;
38
+ /**
39
+ * ## Retrieve a list of all Schedules
40
+ *
41
+ * **Global Permissions:**
42
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view schedules
43
+ *
44
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
45
+ * @returns An array of Schedules {@link Schedule Schedule[]}
46
+ * @throws {@link Error} Do not pass in limit operator with findAll
47
+ */
48
+ findAll<T>(options?: OptionsWithRql): Promise<Schedule<T>[]>;
49
+ /**
50
+ * ## Retrieve a paged list of Schedules
51
+ *
52
+ * **Global Permissions:**
53
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view Schedules
54
+ *
55
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
56
+ * @returns An iterator for the queried schedules {@link FindAllIterator FindAllIterator<Schedule>}
57
+ */
58
+ findAllIterator<T>(options?: OptionsWithRql): FindAllIterator<Schedule<T>>;
59
+ /**
60
+ * ## Retrieve the first queried Schedule
61
+ *
62
+ * **Global Permissions:**
63
+ * - `VIEW_TASK_SCHEDULES` - Allows a user to view Schedules
64
+ *
65
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
66
+ * @returns The first element of the queried Schedules {@link Schedule}
67
+ */
68
+ findFirst<T>(options?: OptionsWithRql): Promise<Schedule<T> | undefined>;
69
+ }
70
+ export interface ScheduleCreation<T = Record<string, any>> {
71
+ /** The period in seconds, for which the function defined will execute recurrently */
72
+ interval: number;
73
+ /** The functionName property serves as the unique identifier amongst all Functions */
74
+ functionName: string;
75
+ /** The data to be provided to the Function, the type may be user defined */
76
+ data?: T;
77
+ /** The priority of the schedule (Higher priorities shall execute first) */
78
+ priority?: number;
79
+ /** The timestamp at which the schedule will start executing */
80
+ startTimestamp?: Date;
81
+ }
82
+ export interface Schedule<T = Record<string, any>> extends ScheduleCreation<T> {
83
+ id: ObjectId;
84
+ /** The timestamp at which the schedule will start executing */
85
+ startTimestamp: Date;
86
+ /** The timestamp at which the schedule was last updated */
87
+ updateTimestamp: Date;
88
+ /** The timestamp at which the schedule was created */
89
+ creationTimestamp: Date;
90
+ /** The timestamp at which the schedule will next execute */
91
+ nextTimestamp: Date;
92
+ }
@@ -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,118 @@
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
+ RETRIED = "retried",
14
+ CANCELED = "canceled"
15
+ }
16
+ export interface Task<DataType = any> {
17
+ id?: ObjectId;
18
+ status?: TaskStatus;
19
+ statusChangedTimestamp?: Date;
20
+ /**
21
+ * AWS Lambda function name
22
+ */
23
+ functionName: string;
24
+ /**
25
+ * Data send to the function
26
+ */
27
+ data?: DataType;
28
+ startTimestamp?: Date;
29
+ tags?: Array<string>;
30
+ priority?: number;
31
+ creationTimestamp?: Date;
32
+ updateTimestamp?: Date;
33
+ /** The Extra Horizon document id for the application used to make the request */
34
+ createdByApplicationId?: ObjectId;
35
+ /** The Extra Horizon document id for the user who made the request */
36
+ createdByUserId?: ObjectId;
37
+ /** Set for tasks in the `retried` status */
38
+ retriedByTaskId?: ObjectId;
39
+ /** Set for tasks that are being retried for other tasks */
40
+ retryForTaskIds?: ObjectId[];
41
+ /** Set for tasks in the `failed` status */
42
+ error?: {
43
+ type: 'runtime' | 'invocation';
44
+ name?: string;
45
+ message: string;
46
+ };
47
+ }
48
+ export declare type TaskInput = Pick<Task, 'functionName' | 'data' | 'startTimestamp' | 'priority' | 'tags'>;
49
+ export interface TasksService {
50
+ /**
51
+ * View a list of tasks
52
+ *
53
+ * Permission | Scope | Effect
54
+ * - | - | -
55
+ * `VIEW_TASKS` | `gobal` | **Required** for this endpoint
56
+ * @returns PagedResult<Task>
57
+ */
58
+ find(options?: OptionsWithRql): Promise<PagedResult<Task>>;
59
+ /**
60
+ * Find By Id
61
+ * @param id the Id to search for
62
+ * @param rql an optional rql string
63
+ * @returns the first element found
64
+ */
65
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Task | undefined>;
66
+ /**
67
+ * Request a list of all tasks
68
+ *
69
+ * Do not pass in an rql with limit operator!
70
+ *
71
+ * Permission | Scope | Effect
72
+ * - | - | -
73
+ * `VIEW_TASKS` | `gobal` | **Required** for this endpoint
74
+ * @param rql Add filters to the requested list.
75
+ * @returns Task[]
76
+ */
77
+ findAll(options?: OptionsWithRql): Promise<Task[]>;
78
+ /**
79
+ * Request a list of all tasks
80
+ *
81
+ * Permission | Scope | Effect
82
+ * - | - | -
83
+ * `VIEW_TASKS` | `gobal` | **Required** for this endpoint
84
+ * @param rql Add filters to the requested list.
85
+ * @returns Task[]
86
+ */
87
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<Task>;
88
+ /**
89
+ * Find First
90
+ * @param rql an optional rql string
91
+ * @returns the first element found
92
+ */
93
+ findFirst(options?: OptionsWithRql): Promise<Task | undefined>;
94
+ /**
95
+ * Create a task
96
+ *
97
+ * Permission | Scope | Effect
98
+ * - | - | -
99
+ * `CREATE_TASKS` | `gobal` | **Required** for this endpoint
100
+ * @param requestBody
101
+ * @returns Task Success
102
+ */
103
+ create(requestBody: TaskInput, options?: OptionsBase): Promise<Task>;
104
+ /**
105
+ * Cancel a task
106
+ *
107
+ * The targeted task **MUST** be in the `new` status.
108
+ *
109
+ * Permission | Scope | Effect
110
+ * - | - | -
111
+ * `CANCEL_TASKS` | `gobal` | **Required** for this endpoint
112
+ * @param taskId The id of the targeted task
113
+ * @returns AffectedRecords
114
+ * @throws {IllegalStateException}
115
+ * @throws {ResourceUnknownException}
116
+ */
117
+ cancel(taskId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
118
+ }
@@ -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;