epicenter-libs 3.34.2 → 3.35.1

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 (40) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +61 -86
  3. package/dist/browser/epicenter.js +1589 -228
  4. package/dist/browser/epicenter.js.map +1 -1
  5. package/dist/cjs/epicenter.js +1512 -144
  6. package/dist/cjs/epicenter.js.map +1 -1
  7. package/dist/epicenter.js +1595 -227
  8. package/dist/epicenter.js.map +1 -1
  9. package/dist/epicenter.min.js +1 -1
  10. package/dist/epicenter.min.js.map +1 -1
  11. package/dist/module/epicenter.js +1506 -145
  12. package/dist/module/epicenter.js.map +1 -1
  13. package/dist/types/adapters/docket.d.ts +80 -0
  14. package/dist/types/adapters/encyclopedia.d.ts +86 -0
  15. package/dist/types/adapters/file.d.ts +201 -0
  16. package/dist/types/adapters/git.d.ts +171 -0
  17. package/dist/types/adapters/index.d.ts +8 -1
  18. package/dist/types/adapters/pipeline.d.ts +88 -0
  19. package/dist/types/adapters/powerpoint.d.ts +130 -0
  20. package/dist/types/adapters/registration.d.ts +270 -0
  21. package/dist/types/adapters/task.d.ts +99 -37
  22. package/dist/types/epicenter.d.ts +2 -2
  23. package/dist/types/types.d.ts +6 -1
  24. package/dist/types/utils/router.d.ts +1 -0
  25. package/package.json +12 -7
  26. package/src/adapters/authentication.ts +2 -1
  27. package/src/adapters/cometd.ts +7 -2
  28. package/src/adapters/docket.ts +109 -0
  29. package/src/adapters/encyclopedia.ts +128 -0
  30. package/src/adapters/file.ts +332 -0
  31. package/src/adapters/git.ts +278 -0
  32. package/src/adapters/index.ts +14 -0
  33. package/src/adapters/pipeline.ts +145 -0
  34. package/src/adapters/powerpoint.ts +238 -0
  35. package/src/adapters/registration.ts +413 -0
  36. package/src/adapters/task.ts +170 -47
  37. package/src/epicenter.ts +10 -3
  38. package/src/globals.d.ts +6 -0
  39. package/src/types.ts +61 -0
  40. package/src/utils/router.ts +1 -0
@@ -0,0 +1,130 @@
1
+ import type { RoutingOptions } from '../utils/router';
2
+ export type TemplateDirectory = 'DATA' | 'MODEL';
3
+ export interface NDataPoint {
4
+ n?: number | null;
5
+ }
6
+ export interface XYDataPoint {
7
+ x?: number | null;
8
+ y?: number | null;
9
+ }
10
+ export interface BarSeriesShadow {
11
+ objectType: 'bar';
12
+ name?: string;
13
+ data?: NDataPoint[] | null;
14
+ }
15
+ export interface AreaSeriesShadow {
16
+ objectType: 'area';
17
+ name?: string;
18
+ data?: NDataPoint[] | null;
19
+ }
20
+ export interface LineSeriesShadow {
21
+ objectType: 'line';
22
+ name?: string;
23
+ data?: NDataPoint[] | null;
24
+ }
25
+ export interface PieSeriesShadow {
26
+ objectType: 'pie';
27
+ name?: string;
28
+ data?: NDataPoint[] | null;
29
+ }
30
+ export interface ScatterSeriesShadow {
31
+ objectType: 'scatter';
32
+ name?: string;
33
+ data?: XYDataPoint[] | null;
34
+ }
35
+ export interface YSeriesShadow {
36
+ objectType: 'y';
37
+ name?: string;
38
+ data?: number[] | null;
39
+ }
40
+ export interface XYSeriesShadow {
41
+ objectType: 'xy';
42
+ name?: string;
43
+ data?: XYDataPoint[] | null;
44
+ }
45
+ export type SeriesShadow = BarSeriesShadow | AreaSeriesShadow | LineSeriesShadow | PieSeriesShadow | ScatterSeriesShadow | YSeriesShadow | XYSeriesShadow;
46
+ export interface ChartShadow {
47
+ name?: string;
48
+ categories?: unknown[] | null;
49
+ series?: SeriesShadow[] | null;
50
+ }
51
+ export interface TableShadow {
52
+ name?: string;
53
+ header?: unknown;
54
+ data?: unknown[] | null;
55
+ }
56
+ export interface PictureShadow {
57
+ name?: string;
58
+ data?: BinaryData;
59
+ }
60
+ export interface BinaryData {
61
+ encoding: 'HEX' | 'BASE_64';
62
+ data: unknown;
63
+ encryption?: 'AES' | null;
64
+ name?: string | null;
65
+ content_type?: string | null;
66
+ contentType?: unknown;
67
+ }
68
+ export interface EnvironmentShadow {
69
+ parameters?: Record<string, unknown> | null;
70
+ charts?: ChartShadow[] | null;
71
+ tables?: TableShadow[] | null;
72
+ pictures?: PictureShadow[] | null;
73
+ }
74
+ export interface SlideShadow {
75
+ /** Slide number (1-based) */
76
+ number?: number;
77
+ environment?: EnvironmentShadow;
78
+ }
79
+ export interface DocumentShadow {
80
+ output?: string;
81
+ environment?: EnvironmentShadow;
82
+ slides?: SlideShadow[] | null;
83
+ }
84
+ /**
85
+ * Generates a PowerPoint file from a template and returns it as binary data (JSON-encoded)
86
+ * Base URL: PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/powerpoint/{TEMPLATE_DIRECTORY}/{TEMPLATE_PATH}`
87
+ *
88
+ * @example
89
+ * import { powerpointAdapter } from 'epicenter-libs';
90
+ * const binaryData = await powerpointAdapter.generate('MODEL', 'en-US-debrief-template.pptx', {
91
+ * output: 'debrief-slides.pptx',
92
+ * environment: {},
93
+ * slides: [
94
+ * {
95
+ * number: 1,
96
+ * environment: {
97
+ * tables: [{ name: 'Leaderboard', data: [['Rank', 'Name', 'Score']] }],
98
+ * },
99
+ * },
100
+ * ],
101
+ * });
102
+ *
103
+ * @param templateDirectory Directory where the template is stored: 'DATA' or 'MODEL'
104
+ * @param templatePath Path to the template file within the directory
105
+ * @param document Document shadow defining the output filename, environment, and slides
106
+ * @param [optionals] Optional arguments; pass network call options overrides here.
107
+ * @returns promise that resolves to the generated PowerPoint as BinaryData
108
+ */
109
+ export declare function generate(templateDirectory: TemplateDirectory, templatePath: string, document: DocumentShadow, optionals?: RoutingOptions): Promise<BinaryData>;
110
+ /**
111
+ * Generates a PowerPoint file from a template and returns it as a streaming response.
112
+ * Useful for downloading the generated file directly.
113
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/powerpoint/{TEMPLATE_DIRECTORY}/{TEMPLATE_PATH}`
114
+ *
115
+ * @example
116
+ * import { powerpointAdapter } from 'epicenter-libs';
117
+ * const response = await powerpointAdapter.stream('MODEL', 'en-US-debrief-template.pptx', {
118
+ * output: 'debrief-slides.pptx',
119
+ * environment: {},
120
+ * slides: [],
121
+ * });
122
+ * const blob = await response.blob();
123
+ *
124
+ * @param templateDirectory Directory where the template is stored: 'DATA' or 'MODEL'
125
+ * @param templatePath Path to the template file within the directory
126
+ * @param document Document shadow defining the output filename, environment, and slides
127
+ * @param [optionals] Optional arguments; pass network call options overrides here.
128
+ * @returns promise that resolves to the raw Response for streaming/blob handling
129
+ */
130
+ export declare function stream(templateDirectory: TemplateDirectory, templatePath: string, document: DocumentShadow, optionals?: RoutingOptions): Promise<Response>;
@@ -0,0 +1,270 @@
1
+ import type { RoutingOptions } from '../utils/router';
2
+ export interface RegistrationInfo {
3
+ projectShortName?: string | null;
4
+ groupName?: string | null;
5
+ accountShortName?: string | null;
6
+ accountName?: string | null;
7
+ familyName?: string | null;
8
+ givenName?: string | null;
9
+ projectName?: string | null;
10
+ email?: string | null;
11
+ groupKey?: string | null;
12
+ }
13
+ export interface TeamRegistrationInfo {
14
+ accountShortName?: string | null;
15
+ accountName?: string | null;
16
+ familyName?: string | null;
17
+ givenName?: string | null;
18
+ email?: string | null;
19
+ }
20
+ export type WhoAmIObjectType = 'system' | 'dashboard' | 'account' | 'admin' | 'user' | 'anonymous';
21
+ export interface WhoAmI {
22
+ objectType: WhoAmIObjectType;
23
+ sessionKey?: string | null;
24
+ timeoutMinutes?: number | null;
25
+ token?: string | null;
26
+ expires?: boolean | null;
27
+ [key: string]: unknown;
28
+ }
29
+ export interface RegistrationResult {
30
+ whoAmI: WhoAmI;
31
+ redirectUrl?: string | null;
32
+ }
33
+ export type TeamRole = 'OWNER' | 'AUTHOR' | 'SUPPORT' | 'ASSOCIATE';
34
+ /**
35
+ * Currently the API only supports `SAML`. This type is intentionally narrow so that adding new
36
+ * protocols on the backend requires an explicit type update here.
37
+ */
38
+ export type SsoProtocol = 'SAML';
39
+ /**
40
+ * Gets registration info for a self-registration token.
41
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/self/{token}`
42
+ *
43
+ * @example
44
+ * import { registrationAdapter } from 'epicenter-libs';
45
+ * const info = await registrationAdapter.getSelfRegistrationInfo('my-token');
46
+ *
47
+ * @param token Self-registration token
48
+ * @param [optionals] Optional arguments; pass network call options overrides here.
49
+ * @returns promise that resolves to registration info
50
+ */
51
+ export declare function getSelfRegistrationInfo(token: string, optionals?: RoutingOptions): Promise<RegistrationInfo>;
52
+ /**
53
+ * Completes a self-registration using a token.
54
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/self/{token}`
55
+ *
56
+ * @example
57
+ * import { registrationAdapter } from 'epicenter-libs';
58
+ * const result = await registrationAdapter.completeSelfRegistration('my-token', 'secret123', {
59
+ * displayName: 'John Doe',
60
+ * handle: 'johnd',
61
+ * });
62
+ *
63
+ * @param token Self-registration token
64
+ * @param password Password for the new account
65
+ * @param [optionals] Optional arguments; pass network call options overrides here.
66
+ * @param [optionals.displayName] Display name for the new user
67
+ * @param [optionals.givenName] Given name for the new user
68
+ * @param [optionals.familyName] Family name for the new user
69
+ * @param [optionals.handle] Handle for the new user
70
+ * @returns promise that resolves to the registration result including session info
71
+ */
72
+ export declare function completeSelfRegistration(token: string, password: string, optionals?: {
73
+ displayName?: string;
74
+ givenName?: string;
75
+ familyName?: string;
76
+ handle?: string;
77
+ } & RoutingOptions): Promise<RegistrationResult>;
78
+ /**
79
+ * Sends a self-registration invite email to a user. Pass an `Accept-Language` header via
80
+ * `optionals.headers` to localize the email.
81
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/self/{groupKey}`
82
+ *
83
+ * @example
84
+ * import { registrationAdapter } from 'epicenter-libs';
85
+ * await registrationAdapter.sendSelfRegistrationInvite('group-key', 'user@example.com', {
86
+ * linkDestination: 'DASHBOARD',
87
+ * redirectUrl: 'https://app.example.com',
88
+ * headers: { 'Accept-Language': 'fr-FR' },
89
+ * });
90
+ *
91
+ * @param groupKey Group key to register the user into
92
+ * @param email Email address of the user to invite
93
+ * @param [optionals] Optional arguments; pass network call options overrides here.
94
+ * @param [optionals.linkDestination] Destination for the registration link ('DASHBOARD' or 'MANAGER')
95
+ * @param [optionals.modality] Registration modality
96
+ * @param [optionals.redirectUrl] URL to redirect to after registration
97
+ * @param [optionals.subject] Subject line for the invite email
98
+ * @param [optionals.givenName] Pre-populate given name in the registration form
99
+ * @param [optionals.familyName] Pre-populate family name in the registration form
100
+ * @param [optionals.linkUrl] Custom URL to use for the registration link
101
+ * @param [optionals.confirmation] Whether to send a confirmation email
102
+ * @returns promise that resolves to undefined if successful
103
+ */
104
+ export declare function sendSelfRegistrationInvite(groupKey: string, email: string, optionals?: {
105
+ linkDestination?: 'DASHBOARD' | 'MANAGER';
106
+ modality?: 'NONE' | 'HBP' | 'ICC' | 'SSO';
107
+ redirectUrl?: string;
108
+ subject?: string;
109
+ givenName?: string;
110
+ familyName?: string;
111
+ linkUrl?: string;
112
+ confirmation?: boolean;
113
+ } & RoutingOptions): Promise<void>;
114
+ /**
115
+ * Gets registration info for an invite token.
116
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/invite/{token}`
117
+ *
118
+ * @example
119
+ * import { registrationAdapter } from 'epicenter-libs';
120
+ * const info = await registrationAdapter.getInviteRegistrationInfo('invite-token');
121
+ *
122
+ * @param token Invite registration token
123
+ * @param [optionals] Optional arguments; pass network call options overrides here.
124
+ * @returns promise that resolves to registration info
125
+ */
126
+ export declare function getInviteRegistrationInfo(token: string, optionals?: RoutingOptions): Promise<RegistrationInfo>;
127
+ /**
128
+ * Completes an invite registration using a token.
129
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/invite/{token}`
130
+ *
131
+ * @example
132
+ * import { registrationAdapter } from 'epicenter-libs';
133
+ * const result = await registrationAdapter.completeInviteRegistration('invite-token', 'pass456', {
134
+ * displayName: 'Jane Doe',
135
+ * });
136
+ *
137
+ * @param token Invite registration token
138
+ * @param password Password for the new account
139
+ * @param [optionals] Optional arguments; pass network call options overrides here.
140
+ * @param [optionals.displayName] Display name for the new user
141
+ * @param [optionals.givenName] Given name for the new user
142
+ * @param [optionals.familyName] Family name for the new user
143
+ * @param [optionals.handle] Handle for the new user
144
+ * @returns promise that resolves to the registration result including session info
145
+ */
146
+ export declare function completeInviteRegistration(token: string, password: string, optionals?: {
147
+ displayName?: string;
148
+ givenName?: string;
149
+ familyName?: string;
150
+ handle?: string;
151
+ } & RoutingOptions): Promise<RegistrationResult>;
152
+ /**
153
+ * Sends an invite registration email to a user. Pass an `Accept-Language` header via
154
+ * `optionals.headers` to localize the email.
155
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/invite/{groupKey}`
156
+ *
157
+ * @example
158
+ * import { registrationAdapter } from 'epicenter-libs';
159
+ * await registrationAdapter.sendInvite('group-key', 'invited@example.com', {
160
+ * givenName: 'New',
161
+ * familyName: 'User',
162
+ * redirectUrl: 'https://app.example.com',
163
+ * });
164
+ *
165
+ * @param groupKey Group key to invite the user into
166
+ * @param email Email address of the user to invite
167
+ * @param [optionals] Optional arguments; pass network call options overrides here.
168
+ * @param [optionals.linkDestination] Destination for the registration link ('DASHBOARD' or 'MANAGER')
169
+ * @param [optionals.modality] Registration modality
170
+ * @param [optionals.redirectUrl] URL to redirect to after registration
171
+ * @param [optionals.subject] Subject line for the invite email
172
+ * @param [optionals.givenName] Pre-populate given name in the registration form
173
+ * @param [optionals.familyName] Pre-populate family name in the registration form
174
+ * @param [optionals.linkUrl] Custom URL to use for the registration link
175
+ * @param [optionals.confirmation] Whether to send a confirmation email
176
+ * @returns promise that resolves to undefined if successful
177
+ */
178
+ export declare function sendInvite(groupKey: string, email: string, optionals?: {
179
+ linkDestination?: 'DASHBOARD' | 'MANAGER';
180
+ modality?: 'NONE' | 'HBP' | 'ICC' | 'SSO';
181
+ redirectUrl?: string;
182
+ subject?: string;
183
+ givenName?: string;
184
+ familyName?: string;
185
+ linkUrl?: string;
186
+ confirmation?: boolean;
187
+ } & RoutingOptions): Promise<void>;
188
+ /**
189
+ * Gets registration info for a team invite token.
190
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/team/{token}`
191
+ *
192
+ * @example
193
+ * import { registrationAdapter } from 'epicenter-libs';
194
+ * const info = await registrationAdapter.getTeamRegistrationInfo('team-token');
195
+ *
196
+ * @param token Team invite token
197
+ * @param [optionals] Optional arguments; pass network call options overrides here.
198
+ * @returns promise that resolves to team registration info
199
+ */
200
+ export declare function getTeamRegistrationInfo(token: string, optionals?: RoutingOptions): Promise<TeamRegistrationInfo>;
201
+ /**
202
+ * Sends a team invite email. Pass an `Accept-Language` header via `optionals.headers` to
203
+ * localize the email.
204
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/team`
205
+ *
206
+ * @example
207
+ * import { registrationAdapter } from 'epicenter-libs';
208
+ * await registrationAdapter.sendTeamInvite(
209
+ * 'Jane Author',
210
+ * 'AUTHOR',
211
+ * 'https://app.example.com',
212
+ * 'newteammate@example.com',
213
+ * { subject: 'Welcome to the team!' },
214
+ * );
215
+ *
216
+ * @param invitingAuthor Name or identifier of the person sending the invite
217
+ * @param role Role to assign to the invited user
218
+ * @param redirectUrl URL to redirect to after accepting the invite
219
+ * @param email Email address of the user to invite
220
+ * @param [optionals] Optional arguments; pass network call options overrides here.
221
+ * @param [optionals.subject] Subject line for the invite email
222
+ * @param [optionals.givenName] Pre-populate given name for the invited user
223
+ * @param [optionals.familyName] Pre-populate family name for the invited user
224
+ * @returns promise that resolves to undefined if successful
225
+ */
226
+ export declare function sendTeamInvite(invitingAuthor: string, role: TeamRole, redirectUrl: string, email: string, optionals?: {
227
+ subject?: string;
228
+ givenName?: string;
229
+ familyName?: string;
230
+ } & RoutingOptions): Promise<void>;
231
+ /**
232
+ * @deprecated Use getSsoAdminRegistration or getSsoUserRegistration instead.
233
+ * Gets SSO registration info for a given SSO protocol.
234
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/sso/{ssoProtocol}`
235
+ *
236
+ * @example
237
+ * import { registrationAdapter } from 'epicenter-libs';
238
+ * const info = await registrationAdapter.getSsoRegistration('SAML');
239
+ *
240
+ * @param ssoProtocol The SSO protocol (e.g. 'SAML')
241
+ * @param [optionals] Optional arguments; pass network call options overrides here.
242
+ * @returns promise that resolves to SSO registration data
243
+ */
244
+ export declare function getSsoRegistration(ssoProtocol: SsoProtocol, optionals?: RoutingOptions): Promise<unknown>;
245
+ /**
246
+ * Gets admin SSO registration info for a given SSO protocol.
247
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/sso/admin/{ssoProtocol}`
248
+ *
249
+ * @example
250
+ * import { registrationAdapter } from 'epicenter-libs';
251
+ * const info = await registrationAdapter.getSsoAdminRegistration('SAML');
252
+ *
253
+ * @param ssoProtocol The SSO protocol (e.g. 'SAML')
254
+ * @param [optionals] Optional arguments; pass network call options overrides here.
255
+ * @returns promise that resolves to SSO admin registration data
256
+ */
257
+ export declare function getSsoAdminRegistration(ssoProtocol: SsoProtocol, optionals?: RoutingOptions): Promise<unknown>;
258
+ /**
259
+ * Gets user SSO registration info for a given SSO protocol.
260
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/sso/user/{ssoProtocol}`
261
+ *
262
+ * @example
263
+ * import { registrationAdapter } from 'epicenter-libs';
264
+ * const info = await registrationAdapter.getSsoUserRegistration('SAML');
265
+ *
266
+ * @param ssoProtocol The SSO protocol (e.g. 'SAML')
267
+ * @param [optionals] Optional arguments; pass network call options overrides here.
268
+ * @returns promise that resolves to SSO user registration data
269
+ */
270
+ export declare function getSsoUserRegistration(ssoProtocol: SsoProtocol, optionals?: RoutingOptions): Promise<unknown>;
@@ -1,12 +1,18 @@
1
- import type { RoutingOptions } from '../utils/router';
2
- import type { GenericScope, Address } from '../utils/constants';
1
+ import type { Address, GenericScope, GenericSearchOptions } from '../utils/constants';
2
+ import type { Page, RoutingOptions } from '../utils/router';
3
3
  export declare enum RETRY_POLICY {
4
4
  DO_NOTHING = "DO_NOTHING",// If the task fails, do nothing (this is the default)
5
- RESCHEDULE = "RESCHEDULE",// If the task fails retry at the next scheduled time point
6
5
  FIRE_ON_FAIL_SAFE = "FIRE_ON_FAIL_SAFE"
7
6
  }
8
7
  export type TaskPayloadBody = Record<string, unknown>;
9
8
  export type TaskPayloadHeaders = Record<string, string>;
9
+ export type TaskHttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
10
+ export type TaskRetryPolicyReadOutView = 'do_nothing' | 'fire_on_fail_safe';
11
+ export type TaskStatusReadOutView = 'initialized' | 'triggered' | 'succeeded' | 'failed' | 'cancelled' | 'terminated';
12
+ export type TaskAddressReadOutView = Partial<Address>;
13
+ export interface TaskScopeReadOutView extends GenericScope {
14
+ userKey?: string;
15
+ }
10
16
  export interface StatusReadOutView {
11
17
  code?: string;
12
18
  message?: string;
@@ -32,10 +38,12 @@ export interface OffsetTaskTriggerCreateInView {
32
38
  export type TaskTriggerCreateInView = CronTaskTriggerCreateInView | DateTaskTriggerCreateInView | OffsetTaskTriggerCreateInView;
33
39
  export interface HttpTaskPayloadCreateInView<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders> {
34
40
  objectType: 'http';
35
- method: string;
41
+ method: TaskHttpMethod;
36
42
  url: string;
43
+ target?: 'APPLICATION' | 'PROXY';
37
44
  body: B;
38
45
  headers?: H;
46
+ timeoutSeconds?: number;
39
47
  }
40
48
  export interface GroupStatusTaskPayloadCreateInView {
41
49
  objectType: 'groupStatus';
@@ -43,12 +51,18 @@ export interface GroupStatusTaskPayloadCreateInView {
43
51
  status: StatusCreateInView;
44
52
  }
45
53
  export type TaskPayloadCreateInView<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders> = HttpTaskPayloadCreateInView<B, H> | GroupStatusTaskPayloadCreateInView;
54
+ export type HttpTaskPayloadCreateInput<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders> = Omit<HttpTaskPayloadCreateInView<B, H>, 'objectType'> & {
55
+ objectType?: 'http';
56
+ };
57
+ export type TaskPayloadCreateInput<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders> = HttpTaskPayloadCreateInput<B, H> | GroupStatusTaskPayloadCreateInView;
46
58
  export interface HttpTaskPayloadReadOutView<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders> {
47
59
  objectType: 'http';
48
- method?: string;
60
+ method?: TaskHttpMethod;
49
61
  url?: string;
62
+ target?: 'application' | 'proxy';
50
63
  body?: B;
51
64
  headers?: H;
65
+ timeoutSeconds?: number;
52
66
  }
53
67
  export interface GroupStatusTaskPayloadReadOutView {
54
68
  objectType: 'groupStatus';
@@ -59,20 +73,34 @@ export type TaskPayloadReadOutView<B extends object = TaskPayloadBody, H extends
59
73
  export interface TaskReadOutView<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders> {
60
74
  taskKey?: string;
61
75
  name?: string;
62
- status?: string;
76
+ status?: TaskStatusReadOutView;
63
77
  cron?: string;
64
78
  mutationKey?: string;
65
79
  failures?: number;
66
80
  successes?: number;
67
- address?: Address;
81
+ address?: TaskAddressReadOutView;
68
82
  payload?: TaskPayloadReadOutView<B, H>;
69
- scope?: GenericScope;
70
- retryPolicy?: string;
83
+ scope?: TaskScopeReadOutView;
84
+ retryPolicy?: TaskRetryPolicyReadOutView;
71
85
  failSafeTermination?: string;
72
86
  ttlSeconds?: number;
73
87
  }
88
+ export interface TaskHistoryReadOutView {
89
+ result?: string;
90
+ execution?: number;
91
+ response?: number;
92
+ success?: boolean;
93
+ taskId?: number;
94
+ }
95
+ export interface TaskPageOptions {
96
+ first?: number;
97
+ max?: number;
98
+ }
99
+ export interface TaskScopePageOptions extends TaskPageOptions {
100
+ sort?: string[];
101
+ }
74
102
  /**
75
- * Creates a task; requires support level authentication
103
+ * Creates a task; requires facilitator (or higher) privileges
76
104
  * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task`
77
105
  *
78
106
  * @example
@@ -84,7 +112,9 @@ export interface TaskReadOutView<B extends object = TaskPayloadBody, H extends o
84
112
  * const name = 'task-1-send-emails';
85
113
  * const payload = {
86
114
  * method: 'POST',
87
- * url: 'https://forio.com/app/forio-dev/test-project/send-out-emails',
115
+ * url: '/send-out-emails',
116
+ * target: 'PROXY', // fire at the project's proxy server; omit to fire at the app
117
+ * body: {},
88
118
  * };
89
119
  * const trigger = {
90
120
  * value: '0 7 15 * * ?', // triggers on day 15 7am of each month
@@ -97,11 +127,13 @@ export interface TaskReadOutView<B extends object = TaskPayloadBody, H extends o
97
127
  * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
98
128
  * @param [scope.userKey] Key associated with the user
99
129
  * @param name Name of the task
100
- * @param payload An HTTP task object that will be executed when the task is triggered
101
- * @param payload.method Type of method to use with the HTTP request (e.g., 'GET', 'POST', 'PATCH')
102
- * @param payload.url The URL the HTTP request will be sent to
103
- * @param [payload.body] The body of the HTTP request
104
- * @param [payload.headers] Headers to send along with the HTTP request
130
+ * @param payload An HTTP request or group-status change to execute when the task is triggered
131
+ * @param payload.method Type of method to use with the HTTP request (e.g., 'GET', 'POST')
132
+ * @param payload.url Relative URL the HTTP request will be sent to; the task runner builds the full URL as `{host}{targetPath}/{account}/{project}{url}`
133
+ * @param [payload.target] Where the task fires: 'APPLICATION' (the project app, `/app`, the default) or 'PROXY' (the project's proxy server, `/proxy`)
134
+ * @param payload.body The JSON body of the HTTP request
135
+ * @param [payload.headers] Headers to send along with the HTTP request; must be non-empty when provided — omit rather than pass an empty object
136
+ * @param [payload.timeoutSeconds] Request timeout in seconds (1–30)
105
137
  * @param trigger Object that determines when to run the task (cron, offset, or date)
106
138
  * @param [trigger.value] For cron: cron expression (e.g., '0 7 * * * ?'). For date: ISO-8601 date-time string
107
139
  * @param [trigger.objectType] Type of trigger: 'cron', 'offset', or 'date'
@@ -112,24 +144,19 @@ export interface TaskReadOutView<B extends object = TaskPayloadBody, H extends o
112
144
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
113
145
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
114
146
  * @param [optionals.retryPolicy] Specifies what to do should the task fail; see RETRY_POLICY
115
- * @param [optionals.failSafeTermination] The ISO-8601 date-time when the task will be deleted regardless of any triggers; defaults to null
116
- * @param [optionals.ttlSeconds] Max life expectancy of the task; used to determine if retrying the task is necessary
147
+ * @param [optionals.failSafeTermination] ISO-8601 deadline after which the task terminates; the server defaults and caps this at one year from creation
148
+ * @param [optionals.ttlSeconds] Execution fail-safe window in seconds; the server applies its configured minimum
117
149
  * @returns promise that resolves to the task object including the taskKey
118
150
  */
119
151
  export declare function create<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders>(scope: {
120
152
  userKey?: string;
121
- } & GenericScope, name: string, payload: {
122
- method: string;
123
- url: string;
124
- body?: B;
125
- headers?: H;
126
- }, trigger: TaskTriggerCreateInView, optionals?: {
153
+ } & GenericScope, name: string, payload: TaskPayloadCreateInput<B, H>, trigger: TaskTriggerCreateInView, optionals?: {
127
154
  retryPolicy?: keyof typeof RETRY_POLICY;
128
- failSafeTermination?: number;
155
+ failSafeTermination?: string;
129
156
  ttlSeconds?: number;
130
157
  } & RoutingOptions): Promise<TaskReadOutView<B, H>>;
131
158
  /**
132
- * Deletes a task (changes status to cancelled); requires support level authentication
159
+ * Deletes a task (changes status to cancelled); requires facilitator (or higher) privileges
133
160
  * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/{TASK_KEY}`
134
161
  *
135
162
  * @example
@@ -138,14 +165,14 @@ export declare function create<B extends object = TaskPayloadBody, H extends obj
138
165
  * await taskAdapter.destroy(taskKey);
139
166
  *
140
167
  * @param taskKey Unique key associated with a task
141
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
168
+ * @param [optionals] Optional arguments; pass network call options overrides here.
142
169
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
143
170
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
144
171
  * @returns promise that resolves to undefined when successful
145
172
  */
146
173
  export declare function destroy(taskKey: string, optionals?: RoutingOptions): Promise<void>;
147
174
  /**
148
- * Gets a task by taskKey; requires support level authentication
175
+ * Gets a task by taskKey; requires facilitator (or higher) privileges
149
176
  * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/{TASK_KEY}`
150
177
  *
151
178
  * @example
@@ -154,14 +181,14 @@ export declare function destroy(taskKey: string, optionals?: RoutingOptions): Pr
154
181
  * const task = await taskAdapter.get(taskKey);
155
182
  *
156
183
  * @param taskKey Unique key associated with a task
157
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
184
+ * @param [optionals] Optional arguments; pass network call options overrides here.
158
185
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
159
186
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
160
187
  * @returns promise that resolves to the task object
161
188
  */
162
189
  export declare function get<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders>(taskKey: string, optionals?: RoutingOptions): Promise<TaskReadOutView<B, H>>;
163
190
  /**
164
- * Gets the history (100 most recent times it has triggered) of a task by taskKey; requires support level authentication
191
+ * Gets the history (100 most recent times it has triggered) of a task by taskKey; requires facilitator (or higher) privileges
165
192
  * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/history/{TASK_KEY}`
166
193
  *
167
194
  * @example
@@ -170,14 +197,16 @@ export declare function get<B extends object = TaskPayloadBody, H extends object
170
197
  * const history = await taskAdapter.getHistory(taskKey);
171
198
  *
172
199
  * @param taskKey Unique key associated with a task
173
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
200
+ * @param [optionals] Pagination and network options
201
+ * @param [optionals.first] Zero-based index of the first history record; defaults to 0
202
+ * @param [optionals.max] Maximum history records to return; defaults to 100 and cannot exceed 100
174
203
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
175
204
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
176
- * @returns promise that resolves to an array of task history objects
205
+ * @returns promise that resolves to a page of task history objects
177
206
  */
178
- export declare function getHistory<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders>(taskKey: string, optionals?: RoutingOptions): Promise<TaskReadOutView<B, H>[]>;
207
+ export declare function getHistory(taskKey: string, optionals?: TaskPageOptions & RoutingOptions): Promise<Page<TaskHistoryReadOutView>>;
179
208
  /**
180
- * Gets most recent 100 tasks related to the selected scope; requires support level authentication
209
+ * Gets most recent 100 tasks related to the selected scope; requires facilitator (or higher) privileges
181
210
  * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/in/{SCOPE_BOUNDARY}/{SCOPE_KEY}` or GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/in/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{USER_KEY}`
182
211
  *
183
212
  * Note: Will retrieve all tasks that were CREATED in the specified scope. If something was created with episode scope, it will not be retrievable through group scoping.
@@ -194,11 +223,44 @@ export declare function getHistory<B extends object = TaskPayloadBody, H extends
194
223
  * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
195
224
  * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
196
225
  * @param [scope.userKey] Key associated with the user; will retrieve tasks in the scope that were made by the specified user
197
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
226
+ * @param [optionals] Pagination, sorting, and network options
227
+ * @param [optionals.sort] Task fields to sort by
228
+ * @param [optionals.first] Zero-based index of the first task; defaults to 0
229
+ * @param [optionals.max] Maximum tasks to return; defaults to 100 and cannot exceed 100
198
230
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
199
231
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
200
- * @returns promise that resolves to an array of task objects
232
+ * @returns promise that resolves to a page of task objects
201
233
  */
202
234
  export declare function getTaskIn<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders>(scope: {
203
235
  userKey?: string;
204
- } & GenericScope, optionals?: RoutingOptions): Promise<TaskReadOutView<B, H>[]>;
236
+ } & GenericScope, optionals?: TaskScopePageOptions & RoutingOptions): Promise<Page<TaskReadOutView<B, H>>>;
237
+ /**
238
+ * Queries for tasks
239
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/search`
240
+ *
241
+ * No authentication is required; results use facilitator-level row visibility.
242
+ * Filterable/sortable fields include
243
+ * `task.taskKey`, `task.name`, `task.status`, `task.scopeBoundary`, `task.scopeKey`,
244
+ * `task.userKey`, `task.groupName`, `task.episodeName`, `task.nextExecution`,
245
+ * `task.failSafeExecution`, and `task.created`.
246
+ *
247
+ * @example
248
+ * import { taskAdapter } from 'epicenter-libs';
249
+ * const page = await taskAdapter.query({
250
+ * filter: [
251
+ * 'task.scopeKey=0000017dd3bf540e5ada5b1e058f08f20461', // tasks scoped to this group
252
+ * 'task.status=INITIALIZED', // that have not yet fired
253
+ * ],
254
+ * sort: ['-task.created'], // newest first
255
+ * max: 10, // page should only include the first 10 items
256
+ * });
257
+ *
258
+ * @param searchOptions Search options for the query
259
+ * @param [searchOptions.filter] Filters for searching
260
+ * @param [searchOptions.sort] Sorting criteria
261
+ * @param [searchOptions.first] The starting index of the page returned
262
+ * @param [searchOptions.max] The number of entries per page
263
+ * @param [optionals] Optional arguments; pass network call options overrides here.
264
+ * @returns promise that resolves to a page of tasks
265
+ */
266
+ export declare function query<B extends object = TaskPayloadBody, H extends object = TaskPayloadHeaders>(searchOptions: GenericSearchOptions, optionals?: RoutingOptions): Promise<Page<TaskReadOutView<B, H>>>;