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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/index.cjs.js +170 -85
  3. package/build/index.mjs +169 -86
  4. package/build/types/client.d.ts +6 -0
  5. package/build/types/constants.d.ts +1 -0
  6. package/build/types/errors.d.ts +11 -0
  7. package/build/types/mockType.d.ts +39 -0
  8. package/build/types/services/auth/applications/types.d.ts +3 -3
  9. package/build/types/services/auth/oauth1/types.d.ts +2 -2
  10. package/build/types/services/auth/oauth2/types.d.ts +2 -2
  11. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +1 -1
  12. package/build/types/services/auth/oidc/providers/types.d.ts +1 -1
  13. package/build/types/services/data/types.d.ts +5 -5
  14. package/build/types/services/dispatchers/dispatchers/types.d.ts +1 -1
  15. package/build/types/services/events/types.d.ts +4 -4
  16. package/build/types/services/files/types.d.ts +2 -2
  17. package/build/types/services/localizations/types.d.ts +2 -2
  18. package/build/types/services/logs/access/types.d.ts +2 -2
  19. package/build/types/services/mails/types.d.ts +22 -14
  20. package/build/types/services/notifications/types.d.ts +4 -4
  21. package/build/types/services/payments/types.d.ts +4 -4
  22. package/build/types/services/profiles/types.d.ts +2 -2
  23. package/build/types/services/tasks/apiRequests/logs/types.d.ts +1 -1
  24. package/build/types/services/tasks/apiRequests/types.d.ts +1 -1
  25. package/build/types/services/tasks/logs/types.d.ts +1 -1
  26. package/build/types/services/tasks/schedules/types.d.ts +1 -1
  27. package/build/types/services/tasks/types.d.ts +2 -2
  28. package/build/types/services/templates/types.d.ts +57 -22
  29. package/build/types/services/templatesV2/health.d.ts +9 -0
  30. package/build/types/services/templatesV2/index.d.ts +4 -0
  31. package/build/types/services/templatesV2/templatesV2.d.ts +5 -0
  32. package/build/types/services/templatesV2/types.d.ts +145 -0
  33. package/build/types/services/types.d.ts +4 -1
  34. package/build/types/services/users/activationRequests/types.d.ts +3 -3
  35. package/build/types/services/users/forgotPasswordRequests/types.d.ts +3 -3
  36. package/build/types/services/users/types.d.ts +27 -9
  37. package/build/types/version.d.ts +1 -1
  38. package/package.json +2 -2
@@ -8,6 +8,7 @@ export declare type MockClientOAuth1<MockFn> = {
8
8
  findAll: MockFn;
9
9
  findAllIterator: MockFn;
10
10
  findFirst: MockFn;
11
+ findByEmail: MockFn;
11
12
  removeUsers: MockFn;
12
13
  patients: MockFn;
13
14
  staff: MockFn;
@@ -221,6 +222,18 @@ export declare type MockClientOAuth1<MockFn> = {
221
222
  resolveAsJson: MockFn;
222
223
  resolveAsJsonUsingCode: MockFn;
223
224
  };
225
+ templatesV2: {
226
+ health: MockFn;
227
+ create: MockFn;
228
+ update: MockFn;
229
+ remove: MockFn;
230
+ resolve: MockFn;
231
+ find: MockFn;
232
+ findAll: MockFn;
233
+ findById: MockFn;
234
+ findByName: MockFn;
235
+ findFirst: MockFn;
236
+ };
224
237
  mails: {
225
238
  health: MockFn;
226
239
  find: MockFn;
@@ -561,6 +574,7 @@ export declare type MockClientOAuth2<MockFn> = {
561
574
  findAll: MockFn;
562
575
  findAllIterator: MockFn;
563
576
  findFirst: MockFn;
577
+ findByEmail: MockFn;
564
578
  removeUsers: MockFn;
565
579
  patients: MockFn;
566
580
  staff: MockFn;
@@ -774,6 +788,18 @@ export declare type MockClientOAuth2<MockFn> = {
774
788
  resolveAsJson: MockFn;
775
789
  resolveAsJsonUsingCode: MockFn;
776
790
  };
791
+ templatesV2: {
792
+ health: MockFn;
793
+ create: MockFn;
794
+ update: MockFn;
795
+ remove: MockFn;
796
+ resolve: MockFn;
797
+ find: MockFn;
798
+ findAll: MockFn;
799
+ findById: MockFn;
800
+ findByName: MockFn;
801
+ findFirst: MockFn;
802
+ };
777
803
  mails: {
778
804
  health: MockFn;
779
805
  find: MockFn;
@@ -1114,6 +1140,7 @@ export declare type MockClientProxy<MockFn> = {
1114
1140
  findAll: MockFn;
1115
1141
  findAllIterator: MockFn;
1116
1142
  findFirst: MockFn;
1143
+ findByEmail: MockFn;
1117
1144
  removeUsers: MockFn;
1118
1145
  patients: MockFn;
1119
1146
  staff: MockFn;
@@ -1327,6 +1354,18 @@ export declare type MockClientProxy<MockFn> = {
1327
1354
  resolveAsJson: MockFn;
1328
1355
  resolveAsJsonUsingCode: MockFn;
1329
1356
  };
1357
+ templatesV2: {
1358
+ health: MockFn;
1359
+ create: MockFn;
1360
+ update: MockFn;
1361
+ remove: MockFn;
1362
+ resolve: MockFn;
1363
+ find: MockFn;
1364
+ findAll: MockFn;
1365
+ findById: MockFn;
1366
+ findByName: MockFn;
1367
+ findFirst: MockFn;
1368
+ };
1330
1369
  mails: {
1331
1370
  health: MockFn;
1332
1371
  find: MockFn;
@@ -48,7 +48,7 @@ export interface AuthApplicationsService {
48
48
  *
49
49
  * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
50
50
  * */
51
- findFirst(options?: OptionsWithRql): Promise<OAuth1Application | OAuth2Application>;
51
+ findFirst(options?: OptionsWithRql): Promise<(OAuth1Application | OAuth2Application) | undefined>;
52
52
  /**
53
53
  * ## Get an application by its id
54
54
  * Gets the application currently registered in the cluster by its id.
@@ -65,7 +65,7 @@ export interface AuthApplicationsService {
65
65
  *
66
66
  * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
67
67
  * */
68
- findById(id: ObjectId, options?: OptionsWithRql): Promise<OAuth1Application | OAuth2Application>;
68
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<(OAuth1Application | OAuth2Application) | undefined>;
69
69
  /**
70
70
  * ## Get an application by its name
71
71
  * Gets the application currently registered in the cluster by its name.
@@ -82,7 +82,7 @@ export interface AuthApplicationsService {
82
82
  *
83
83
  * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
84
84
  * */
85
- findByName(name: string, options?: OptionsWithRql): Promise<OAuth1Application | OAuth2Application>;
85
+ findByName(name: string, options?: OptionsWithRql): Promise<(OAuth1Application | OAuth2Application) | undefined>;
86
86
  /**
87
87
  * @deprecated Use `find` instead
88
88
  *
@@ -62,7 +62,7 @@ export interface AuthOauth1TokenService {
62
62
  * none | | Can only see a list of OAuth1 tokens for this account
63
63
  * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
64
64
  */
65
- findFirst(options?: OptionsWithRql): Promise<OAuth1Token>;
65
+ findFirst(options?: OptionsWithRql): Promise<OAuth1Token | undefined>;
66
66
  /**
67
67
  * Get an oAuth1 token by its id
68
68
  *
@@ -71,7 +71,7 @@ export interface AuthOauth1TokenService {
71
71
  * none | | Can only see a list of OAuth1 tokens for this account
72
72
  * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
73
73
  */
74
- findById(id: string, options?: OptionsWithRql): Promise<OAuth1Token>;
74
+ findById(id: string, options?: OptionsWithRql): Promise<OAuth1Token | undefined>;
75
75
  /**
76
76
  * Remove a token
77
77
  *
@@ -51,7 +51,7 @@ export interface AuthOauth2TokenService {
51
51
  * none | | Can only see a list of OAuth2 tokens for this account
52
52
  * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 tokens for any account
53
53
  */
54
- findFirst(options?: OptionsWithRql): Promise<OAuth2Token>;
54
+ findFirst(options?: OptionsWithRql): Promise<OAuth2Token | undefined>;
55
55
  /**
56
56
  * Get an oAuth2 token by its id
57
57
  *
@@ -60,7 +60,7 @@ export interface AuthOauth2TokenService {
60
60
  * none | | Can only see a list of OAuth2 tokens for this account
61
61
  * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 tokens for any account
62
62
  */
63
- findById(id: string, options?: OptionsWithRql): Promise<OAuth2Token>;
63
+ findById(id: string, options?: OptionsWithRql): Promise<OAuth2Token | undefined>;
64
64
  /**
65
65
  * Remove an oAuth2 token
66
66
  *
@@ -37,7 +37,7 @@ export interface LoginAttemptsService {
37
37
  * @param options {@link OptionsWithRql} - Add filters to the requested list
38
38
  * @returns The first element of the queried login attempts {@link LoginAttempt}
39
39
  */
40
- findFirst(options?: OptionsWithRql): Promise<LoginAttempt>;
40
+ findFirst(options?: OptionsWithRql): Promise<LoginAttempt | undefined>;
41
41
  }
42
42
  export declare enum LoginAttemptStatus {
43
43
  SUCCESS = "success",
@@ -54,7 +54,7 @@ export interface OidcProviderService {
54
54
  * @returns The first element of the queried providers {@link OidcProvider}
55
55
  * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
56
56
  */
57
- findFirst(options?: OptionsWithRql): Promise<OidcProvider>;
57
+ findFirst(options?: OptionsWithRql): Promise<OidcProvider | undefined>;
58
58
  /**
59
59
  * ## Update an OpenID Connect provider
60
60
  * ### You can use this function to update an existing OpenId Connect Provider. Fields left undefined will not be updated.
@@ -329,14 +329,14 @@ export interface DataCommentsService {
329
329
  * @param documentId The id of the targeted document.
330
330
  * @returns the first element found
331
331
  */
332
- findById(id: ObjectId, schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Comment>;
332
+ findById(id: ObjectId, schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Comment | undefined>;
333
333
  /**
334
334
  * Find First
335
335
  * @param schemaIdOrName The id or name of the targeted schema.
336
336
  * @param documentId The id of the targeted document.
337
337
  * @returns the first element found
338
338
  */
339
- findFirst(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Comment>;
339
+ findFirst(schemaIdOrName: ObjectId | string, documentId: ObjectId, options?: OptionsWithRql): Promise<Comment | undefined>;
340
340
  /**
341
341
  * Update a comment
342
342
  *
@@ -1345,18 +1345,18 @@ export interface DataSchemasService {
1345
1345
  * @param id the Id to search for
1346
1346
  * @returns the first element found
1347
1347
  */
1348
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Schema>;
1348
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Schema | undefined>;
1349
1349
  /**
1350
1350
  * Find By Name
1351
1351
  * @param name the name to search for
1352
1352
  * @returns the first element found
1353
1353
  */
1354
- findByName(name: string, options?: OptionsWithRql): Promise<Schema>;
1354
+ findByName(name: string, options?: OptionsWithRql): Promise<Schema | undefined>;
1355
1355
  /**
1356
1356
  * Find First
1357
1357
  * @returns the first element found
1358
1358
  */
1359
- findFirst(options?: OptionsWithRql): Promise<Schema>;
1359
+ findFirst(options?: OptionsWithRql): Promise<Schema | undefined>;
1360
1360
  /**
1361
1361
  * Update a schema
1362
1362
  *
@@ -52,7 +52,7 @@ export interface DispatchersService {
52
52
  * @param options {@link OptionsWithRql} - Add filters to the requested list
53
53
  * @returns The first element of the queried Dispatchers {@link Dispatcher}
54
54
  */
55
- findFirst(options?: OptionsWithRql): Promise<Dispatcher>;
55
+ findFirst(options?: OptionsWithRql): Promise<Dispatcher | undefined>;
56
56
  /**
57
57
  * ## Create a Dispatcher
58
58
  *
@@ -42,13 +42,13 @@ export interface EventsService {
42
42
  * @param rql an optional rql string
43
43
  * @returns the first element found
44
44
  */
45
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Event>;
45
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Event | undefined>;
46
46
  /**
47
47
  * Find First
48
48
  * @param rql an optional rql string
49
49
  * @returns the first element found
50
50
  */
51
- findFirst(options?: OptionsWithRql): Promise<Event>;
51
+ findFirst(options?: OptionsWithRql): Promise<Event | undefined>;
52
52
  /**
53
53
  * Creates an event
54
54
  *
@@ -80,13 +80,13 @@ export interface SubscriptionsService {
80
80
  * @param rql an optional rql string
81
81
  * @returns the first element found
82
82
  */
83
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Subscription>;
83
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Subscription | undefined>;
84
84
  /**
85
85
  * Find First
86
86
  * @param rql an optional rql string
87
87
  * @returns the first element found
88
88
  */
89
- findFirst(options?: OptionsWithRql): Promise<Subscription>;
89
+ findFirst(options?: OptionsWithRql): Promise<Subscription | undefined>;
90
90
  /**
91
91
  * @deprecated Should not be used, services manage subscriptions themselves
92
92
  *
@@ -55,13 +55,13 @@ export interface FilesService {
55
55
  * @param rql an optional rql string
56
56
  * @returns the first element found
57
57
  */
58
- findByName(name: string, options?: OptionsWithRql): Promise<FileDetails>;
58
+ findByName(name: string, options?: OptionsWithRql): Promise<FileDetails | undefined>;
59
59
  /**
60
60
  * Find First
61
61
  * @param rql an optional rql string
62
62
  * @returns the first element found
63
63
  */
64
- findFirst(options?: OptionsWithRql): Promise<FileDetails>;
64
+ findFirst(options?: OptionsWithRql): Promise<FileDetails | undefined>;
65
65
  /**
66
66
  * ## Add a new file from a plain text source
67
67
  *
@@ -92,13 +92,13 @@ export interface LocalizationsService {
92
92
  * @param rql an optional rql string
93
93
  * @returns the first element found
94
94
  */
95
- findByKey(key: string, options?: OptionsWithRql): Promise<Localization>;
95
+ findByKey(key: string, options?: OptionsWithRql): Promise<Localization | undefined>;
96
96
  /**
97
97
  * Find First
98
98
  * @param rql an optional rql string
99
99
  * @returns the first element found
100
100
  */
101
- findFirst(options?: OptionsWithRql): Promise<Localization>;
101
+ findFirst(options?: OptionsWithRql): Promise<Localization | undefined>;
102
102
  /**
103
103
  * Create new localizations
104
104
  *
@@ -17,11 +17,11 @@ export interface LogsAccessService {
17
17
  * @param options {@link OptionsWithRql} - Add filters to the requested list
18
18
  * @returns The first element of the queried access logs {@link AccessLog}
19
19
  */
20
- findFirst(options?: OptionsWithRql): Promise<AccessLog>;
20
+ findFirst(options?: OptionsWithRql): Promise<AccessLog | undefined>;
21
21
  }
22
22
  export interface AccessLog {
23
23
  /** The time of request receival */
24
- timestamp: string;
24
+ timestamp: Date;
25
25
  /** The status code of the response for the request */
26
26
  httpStatus: number;
27
27
  /** The duration of the request in seconds */
@@ -1,27 +1,31 @@
1
- import { ObjectId, LanguageCode, MailAddress, MailAddressList, MailRecipients, AffectedRecords, PagedResult, OptionsBase, OptionsWithRql } from '../types';
1
+ import { ObjectId, LanguageCode, MailAddress, MailAddressList, MailRecipients, AffectedRecords, PagedResult, OptionsBase, OptionsWithRql, TimeZone } from '../types';
2
2
  export interface Mail {
3
- id?: ObjectId;
3
+ id: ObjectId;
4
4
  creatorId?: ObjectId;
5
5
  awsMessageId?: ObjectId;
6
- subject?: string;
7
- recipients?: MailRecipients;
6
+ subject: string;
7
+ recipients: MailRecipients;
8
8
  templateId?: ObjectId;
9
+ templateName?: string;
9
10
  replyTo?: MailAddressList;
10
- from?: MailAddress;
11
+ from: MailAddress;
11
12
  body?: string;
12
13
  language?: LanguageCode;
14
+ timeZone?: TimeZone;
13
15
  content?: Record<string, any>;
14
- views?: number;
15
- creationTimestamp?: Date;
16
- updateTimestamp?: Date;
16
+ views: number;
17
+ creationTimestamp: Date;
18
+ updateTimestamp: Date;
17
19
  }
18
20
  export declare type PlainMailCreation = {
19
21
  subject: string;
20
22
  body: string;
21
23
  } & CommonMailCreationProperties;
22
24
  export declare type TemplateBasedMailCreation = {
23
- templateId: ObjectId;
25
+ templateId?: ObjectId;
26
+ templateName?: string;
24
27
  language?: LanguageCode;
28
+ timeZone?: TimeZone;
25
29
  content: Record<string, any>;
26
30
  } & CommonMailCreationProperties;
27
31
  export interface CommonMailCreationProperties {
@@ -42,9 +46,9 @@ export interface Attachment {
42
46
  type?: string;
43
47
  }
44
48
  export interface QueuedMail {
45
- id?: ObjectId;
46
- status?: QueuedMailStatus;
47
- from?: string;
49
+ id: ObjectId;
50
+ status: QueuedMailStatus;
51
+ from: string;
48
52
  to?: MailAddressList;
49
53
  cc?: MailAddressList;
50
54
  bcc?: MailAddressList;
@@ -57,14 +61,18 @@ export interface QueuedMail {
57
61
  textEncoding?: string;
58
62
  templateData?: {
59
63
  templateId?: ObjectId;
64
+ templateName?: string;
60
65
  credentials?: {
61
66
  serviceId?: ObjectId;
62
67
  applicationId?: ObjectId;
63
68
  userId?: ObjectId;
64
69
  };
65
70
  language?: LanguageCode;
71
+ timeZone?: string;
66
72
  content?: Record<string, any>;
67
73
  };
74
+ creationTimestamp: Date;
75
+ updateTimestamp: Date;
68
76
  }
69
77
  export interface QueuedMailAttachment {
70
78
  filename?: string;
@@ -98,13 +106,13 @@ export interface MailsService {
98
106
  * @param rql an optional rql string
99
107
  * @returns the first element found
100
108
  */
101
- findById: (id: ObjectId, options?: OptionsWithRql) => Promise<Mail>;
109
+ findById: (id: ObjectId, options?: OptionsWithRql) => Promise<Mail | undefined>;
102
110
  /**
103
111
  * Find First
104
112
  * @param rql an optional rql string
105
113
  * @returns the first element found
106
114
  */
107
- findFirst(options?: OptionsWithRql): Promise<Mail>;
115
+ findFirst(options?: OptionsWithRql): Promise<Mail | undefined>;
108
116
  /**
109
117
  * Send a mail
110
118
  *
@@ -142,13 +142,13 @@ export interface NotificationsService {
142
142
  * @param rql an optional rql string
143
143
  * @returns the first element found
144
144
  */
145
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Notification>;
145
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Notification | undefined>;
146
146
  /**
147
147
  * Find First
148
148
  * @param rql an optional rql string
149
149
  * @returns the first element found
150
150
  */
151
- findFirst(options?: OptionsWithRql): Promise<Notification>;
151
+ findFirst(options?: OptionsWithRql): Promise<Notification | undefined>;
152
152
  /**
153
153
  * Delete notification(s)
154
154
  *
@@ -197,13 +197,13 @@ export interface NotificationSettingsServices {
197
197
  * @param rql an optional rql string
198
198
  * @returns the first element found
199
199
  */
200
- findById(id: ObjectId, options?: OptionsWithRql): Promise<NotificationSettings>;
200
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<NotificationSettings | undefined>;
201
201
  /**
202
202
  * Find First
203
203
  * @param rql an optional rql string
204
204
  * @returns the first element found
205
205
  */
206
- findFirst(options?: OptionsWithRql): Promise<NotificationSettings>;
206
+ findFirst(options?: OptionsWithRql): Promise<NotificationSettings | undefined>;
207
207
  /**
208
208
  * Update the notification settings for a user
209
209
  *
@@ -585,13 +585,13 @@ export interface PaymentsOrdersService {
585
585
  * @param rql an optional rql string
586
586
  * @returns the first element found
587
587
  */
588
- findById(id: ObjectId, options?: OptionsWithRql): Promise<OrderSchema>;
588
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<OrderSchema | undefined>;
589
589
  /**
590
590
  * Find First
591
591
  * @param rql an optional rql string
592
592
  * @returns the first element found
593
593
  */
594
- findFirst(options?: OptionsWithRql): Promise<OrderSchema>;
594
+ findFirst(options?: OptionsWithRql): Promise<OrderSchema | undefined>;
595
595
  /**
596
596
  * Create an order
597
597
  * @param requestBody
@@ -684,13 +684,13 @@ export interface PaymentsProductsService {
684
684
  * @param rql an optional rql string
685
685
  * @returns the first element found
686
686
  */
687
- findById(id: ObjectId, options?: OptionsWithRql): Promise<ProductSchema>;
687
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<ProductSchema | undefined>;
688
688
  /**
689
689
  * Find First
690
690
  * @param rql an optional rql string
691
691
  * @returns the first element found
692
692
  */
693
- findFirst(options?: OptionsWithRql): Promise<ProductSchema>;
693
+ findFirst(options?: OptionsWithRql): Promise<ProductSchema | undefined>;
694
694
  /**
695
695
  * Add Tags to a Product
696
696
  *
@@ -300,13 +300,13 @@ export interface ProfilesService {
300
300
  * @param rql an optional rql string
301
301
  * @returns the first element found
302
302
  */
303
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Profile>;
303
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Profile | undefined>;
304
304
  /**
305
305
  * Find First
306
306
  * @param rql an optional rql string
307
307
  * @returns the first element found
308
308
  */
309
- findFirst(options?: OptionsWithRql): Promise<Profile>;
309
+ findFirst(options?: OptionsWithRql): Promise<Profile | undefined>;
310
310
  /**
311
311
  * Create a new profile
312
312
  *
@@ -21,5 +21,5 @@ export interface ApiRequestLogsService {
21
21
  * @param apiRequestId {@link string} The id of the targeted API Request
22
22
  * @param options {@link OptionsWithRql} - Additional options for the request
23
23
  * @returns The first element of the queried API Request logs {@link LogLine} */
24
- findFirst(apiRequestId: ObjectId, options?: OptionsWithRql): Promise<LogLine>;
24
+ findFirst(apiRequestId: ObjectId, options?: OptionsWithRql): Promise<LogLine | undefined>;
25
25
  }
@@ -39,7 +39,7 @@ export interface ApiRequestService {
39
39
  * @param options {@link OptionsWithRql} - Add filters to the requested list
40
40
  * @returns The first element of the queried API Requests {@link ApiRequest}
41
41
  */
42
- findFirst(options?: OptionsWithRql): Promise<ApiRequest>;
42
+ findFirst(options?: OptionsWithRql): Promise<ApiRequest | undefined>;
43
43
  logs: ApiRequestLogsService;
44
44
  }
45
45
  export interface ApiRequest {
@@ -20,7 +20,7 @@ export interface LogsService {
20
20
  * @param taskId {@link string} The id of the targeted task
21
21
  * @param options {@link OptionsWithRql} - Additional options for the request
22
22
  * @returns The first element of the queried task logs {@link LogLine} */
23
- findFirst(taskId: ObjectId, options?: OptionsWithRql): Promise<LogLine>;
23
+ findFirst(taskId: ObjectId, options?: OptionsWithRql): Promise<LogLine | undefined>;
24
24
  }
25
25
  export interface LogLine {
26
26
  message: string;
@@ -61,7 +61,7 @@ export interface SchedulesService {
61
61
  * @param options {@link OptionsWithRql} - Add filters to the requested list
62
62
  * @returns The first element of the queried Schedules {@link Schedule}
63
63
  */
64
- findFirst<T>(options?: OptionsWithRql): Promise<Schedule<T>>;
64
+ findFirst<T>(options?: OptionsWithRql): Promise<Schedule<T> | undefined>;
65
65
  }
66
66
  export interface ScheduleCreation<T = Record<string, any>> {
67
67
  /** The period in seconds, for which the function defined will execute recurrently */
@@ -51,7 +51,7 @@ export interface TasksService {
51
51
  * @param rql an optional rql string
52
52
  * @returns the first element found
53
53
  */
54
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Task>;
54
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Task | undefined>;
55
55
  /**
56
56
  * Request a list of all tasks
57
57
  *
@@ -79,7 +79,7 @@ export interface TasksService {
79
79
  * @param rql an optional rql string
80
80
  * @returns the first element found
81
81
  */
82
- findFirst(options?: OptionsWithRql): Promise<Task>;
82
+ findFirst(options?: OptionsWithRql): Promise<Task | undefined>;
83
83
  /**
84
84
  * Create a task
85
85
  *
@@ -1,15 +1,14 @@
1
1
  /// <reference types="node" />
2
2
  import { FindAllIterator } from '../../services/helpers';
3
- import { TypeConfiguration } from '../data/types';
4
3
  import { ObjectId, LanguageCode, TimeZone, PagedResult, AffectedRecords, OptionsWithRql, OptionsBase } from '../types';
5
4
  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;
5
+ id: ObjectId;
6
+ name: string;
7
+ description: string;
8
+ schema: TemplateObjectConfiguration;
9
+ fields: Record<string, string>;
10
+ creationTimestamp: Date;
11
+ updateTimestamp: Date;
13
12
  }
14
13
  export interface TemplateIn {
15
14
  name: string;
@@ -17,25 +16,60 @@ export interface TemplateIn {
17
16
  schema: TemplateObjectConfiguration;
18
17
  fields: Record<string, string>;
19
18
  }
19
+ export declare type TemplateTypeConfiguration = TemplateObjectConfiguration | TemplateArrayConfiguration | TemplateStringConfiguration | TemplateNumberConfiguration | TemplateBooleanConfiguration | TemplateObjectIdConfiguration | TemplateDateConfiguration;
20
20
  export interface TemplateObjectConfiguration {
21
- type?: 'object';
22
- options?: Array<ObjectOption>;
23
- fields?: Record<string, TypeConfiguration>;
21
+ type: 'object';
22
+ fields?: Record<string, TemplateTypeConfiguration>;
23
+ options?: TemplateObjectOption[];
24
+ }
25
+ export interface TemplateArrayConfiguration {
26
+ type: 'array';
27
+ options?: TemplateArrayOption[];
28
+ }
29
+ export interface TemplateStringConfiguration {
30
+ type: 'string';
31
+ options?: TemplateStringOption[];
32
+ }
33
+ export interface TemplateNumberConfiguration {
34
+ type: 'number';
35
+ options?: TemplateNumberOption[];
24
36
  }
25
- export declare type ObjectOption = ObjectMinBytesOption | ObjectMaxBytesOption;
26
- export interface ObjectMinBytesOption {
27
- type?: ObjectMinBytesOptionType;
28
- value: number;
37
+ export interface TemplateBooleanConfiguration {
38
+ type: 'boolean';
29
39
  }
30
- export declare enum ObjectMinBytesOptionType {
31
- MIN_BYTES = "min_bytes"
40
+ export interface TemplateObjectIdConfiguration {
41
+ type: 'object_id';
32
42
  }
33
- export interface ObjectMaxBytesOption {
34
- type?: ObjectMaxBytesOptionType;
35
- value: number;
43
+ export interface TemplateDateConfiguration {
44
+ type: 'date';
45
+ options?: TemplateDateOption[];
36
46
  }
37
- export declare enum ObjectMaxBytesOptionType {
38
- MAX_BYTES = "max_bytes"
47
+ export declare type TemplateObjectOption = TemplateObjectMinBytesOption | TemplateObjectMaxBytesOption;
48
+ export declare type TemplateObjectMinBytesOption = TemplateTypeOption<'min_bytes', number>;
49
+ export declare type TemplateObjectMaxBytesOption = TemplateTypeOption<'max_bytes', number>;
50
+ export declare type TemplateNumberOption = TemplateNumberInOption | TemplateNumberMaxOption | TemplateNumberMaxSizeOption | TemplateNumberMinOption | TemplateNumberMinSizeOption | TemplateNumberSizeOption;
51
+ export declare type TemplateNumberInOption = TemplateTypeOption<'in', number[]>;
52
+ export declare type TemplateNumberMaxOption = TemplateTypeOption<'max', number>;
53
+ export declare type TemplateNumberMaxSizeOption = TemplateTypeOption<'max_size', number>;
54
+ export declare type TemplateNumberMinOption = TemplateTypeOption<'min', number>;
55
+ export declare type TemplateNumberMinSizeOption = TemplateTypeOption<'min_size', number>;
56
+ export declare type TemplateNumberSizeOption = TemplateTypeOption<'size', number>;
57
+ export declare type TemplateArrayOption = TemplateArrayMaxSizeOption | TemplateArrayMinSizeOption | TemplateArraySizeOption;
58
+ export declare type TemplateArrayMaxSizeOption = TemplateTypeOption<'max_size', number>;
59
+ export declare type TemplateArrayMinSizeOption = TemplateTypeOption<'min_size', number>;
60
+ export declare type TemplateArraySizeOption = TemplateTypeOption<'size', number>;
61
+ export declare type TemplateStringOption = TemplateStringInOption | TemplateStringMaxSizeOption | TemplateStringMinSizeOption | TemplateStringRegexOption | TemplateStringSizeOption;
62
+ export declare type TemplateStringInOption = TemplateTypeOption<'in', string[]>;
63
+ export declare type TemplateStringRegexOption = TemplateTypeOption<'regex', string>;
64
+ export declare type TemplateStringMaxSizeOption = TemplateTypeOption<'max_size', number>;
65
+ export declare type TemplateStringMinSizeOption = TemplateTypeOption<'min_size', number>;
66
+ export declare type TemplateStringSizeOption = TemplateTypeOption<'size', number>;
67
+ export declare type TemplateDateOption = TemplateDateMaxOption | TemplateDateMinOption;
68
+ export declare type TemplateDateMaxOption = TemplateTypeOption<'max', number>;
69
+ export declare type TemplateDateMinOption = TemplateTypeOption<'min', number>;
70
+ interface TemplateTypeOption<T, V> {
71
+ type: T;
72
+ value: V;
39
73
  }
40
74
  export interface CreateFile {
41
75
  /**
@@ -197,3 +231,4 @@ export interface TemplatesService {
197
231
  */
198
232
  resolveAsJsonUsingCode(templateId: string, localizationCode: string, requestBody: CreateFile, options?: OptionsBase): Promise<Record<string, string>>;
199
233
  }
234
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { HttpInstance } from '../../types';
2
+ declare const _default: (client: any, http: HttpInstance) => {
3
+ /**
4
+ * Perform a health check
5
+ * @returns {boolean} success
6
+ */
7
+ health(): Promise<boolean>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import health from './health';
3
+ import { TemplatesV2Service } from './types';
4
+ export declare const templatesV2Service: (httpWithAuth: AuthHttpClient) => ReturnType<typeof health> & TemplatesV2Service;
@@ -0,0 +1,5 @@
1
+ import { AuthHttpClient } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import { TemplatesV2Service } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: AuthHttpClient) => TemplatesV2Service;
5
+ export default _default;