@extrahorizon/javascript-sdk 8.2.0-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/CHANGELOG.md +1161 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -0
  4. package/build/index.cjs.js +1 -0
  5. package/build/index.mjs +1 -0
  6. package/build/types/btoa.d.ts +6 -0
  7. package/build/types/client.d.ts +136 -0
  8. package/build/types/constants.d.ts +15 -0
  9. package/build/types/errorHandler.d.ts +2 -0
  10. package/build/types/errors.d.ts +332 -0
  11. package/build/types/http/client.d.ts +2 -0
  12. package/build/types/http/index.d.ts +4 -0
  13. package/build/types/http/interceptors.d.ts +9 -0
  14. package/build/types/http/oAuth1Signature.d.ts +14 -0
  15. package/build/types/http/oauth1.d.ts +3 -0
  16. package/build/types/http/oauth2.d.ts +3 -0
  17. package/build/types/http/proxy.d.ts +3 -0
  18. package/build/types/http/types.d.ts +331 -0
  19. package/build/types/http/utils.d.ts +21 -0
  20. package/build/types/index.d.ts +9 -0
  21. package/build/types/mock.d.ts +43 -0
  22. package/build/types/mockType.d.ts +1511 -0
  23. package/build/types/parseStoredCredentials.d.ts +11 -0
  24. package/build/types/rql/index.d.ts +16 -0
  25. package/build/types/rql/parser.d.ts +1 -0
  26. package/build/types/rql/types.d.ts +168 -0
  27. package/build/types/services/auth/applications/index.d.ts +5 -0
  28. package/build/types/services/auth/applications/types.d.ts +190 -0
  29. package/build/types/services/auth/index.d.ts +3 -0
  30. package/build/types/services/auth/oauth1/index.d.ts +5 -0
  31. package/build/types/services/auth/oauth1/types.d.ts +63 -0
  32. package/build/types/services/auth/oauth2/index.d.ts +5 -0
  33. package/build/types/services/auth/oauth2/types.d.ts +52 -0
  34. package/build/types/services/auth/oidc/index.d.ts +5 -0
  35. package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  36. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  37. package/build/types/services/auth/oidc/providers/index.d.ts +5 -0
  38. package/build/types/services/auth/oidc/providers/types.d.ts +144 -0
  39. package/build/types/services/auth/oidc/types.d.ts +40 -0
  40. package/build/types/services/auth/types.d.ts +39 -0
  41. package/build/types/services/auth/users/index.d.ts +5 -0
  42. package/build/types/services/auth/users/types.d.ts +121 -0
  43. package/build/types/services/configurations/general.d.ts +5 -0
  44. package/build/types/services/configurations/groups.d.ts +5 -0
  45. package/build/types/services/configurations/index.d.ts +10 -0
  46. package/build/types/services/configurations/patients.d.ts +5 -0
  47. package/build/types/services/configurations/staff.d.ts +5 -0
  48. package/build/types/services/configurations/types.d.ts +222 -0
  49. package/build/types/services/configurations/users.d.ts +5 -0
  50. package/build/types/services/data/comments.d.ts +5 -0
  51. package/build/types/services/data/documents.d.ts +5 -0
  52. package/build/types/services/data/index.d.ts +13 -0
  53. package/build/types/services/data/indexes.d.ts +5 -0
  54. package/build/types/services/data/infrastructure.d.ts +10 -0
  55. package/build/types/services/data/json-schema.d.ts +121 -0
  56. package/build/types/services/data/properties.d.ts +5 -0
  57. package/build/types/services/data/schemas.d.ts +5 -0
  58. package/build/types/services/data/statuses.d.ts +5 -0
  59. package/build/types/services/data/transitions.d.ts +5 -0
  60. package/build/types/services/data/types.d.ts +899 -0
  61. package/build/types/services/dispatchers/actions/index.d.ts +5 -0
  62. package/build/types/services/dispatchers/actions/types.d.ts +78 -0
  63. package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -0
  64. package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -0
  65. package/build/types/services/dispatchers/index.d.ts +7 -0
  66. package/build/types/services/dispatchers/types.d.ts +2 -0
  67. package/build/types/services/events/events.d.ts +5 -0
  68. package/build/types/services/events/health.d.ts +9 -0
  69. package/build/types/services/events/index.d.ts +6 -0
  70. package/build/types/services/events/subscriptions.d.ts +5 -0
  71. package/build/types/services/events/types.d.ts +90 -0
  72. package/build/types/services/files/files.d.ts +5 -0
  73. package/build/types/services/files/formHelpers.d.ts +3 -0
  74. package/build/types/services/files/index.d.ts +6 -0
  75. package/build/types/services/files/settings/index.d.ts +5 -0
  76. package/build/types/services/files/settings/types.d.ts +38 -0
  77. package/build/types/services/files/tokens.d.ts +5 -0
  78. package/build/types/services/files/types.d.ts +185 -0
  79. package/build/types/services/helpers.d.ts +7 -0
  80. package/build/types/services/http-client.d.ts +22 -0
  81. package/build/types/services/index.d.ts +15 -0
  82. package/build/types/services/localizations/countries.d.ts +5 -0
  83. package/build/types/services/localizations/health.d.ts +9 -0
  84. package/build/types/services/localizations/index.d.ts +4 -0
  85. package/build/types/services/localizations/languages.d.ts +5 -0
  86. package/build/types/services/localizations/localizations.d.ts +5 -0
  87. package/build/types/services/localizations/types.d.ts +145 -0
  88. package/build/types/services/logs/access/index.d.ts +5 -0
  89. package/build/types/services/logs/access/types.d.ts +41 -0
  90. package/build/types/services/logs/index.d.ts +3 -0
  91. package/build/types/services/logs/types.d.ts +4 -0
  92. package/build/types/services/mails/index.d.ts +3 -0
  93. package/build/types/services/mails/mails.d.ts +5 -0
  94. package/build/types/services/mails/types.d.ts +141 -0
  95. package/build/types/services/notifications/health.d.ts +9 -0
  96. package/build/types/services/notifications/index.d.ts +7 -0
  97. package/build/types/services/notifications/notifications.d.ts +5 -0
  98. package/build/types/services/notifications/settings.d.ts +5 -0
  99. package/build/types/services/notifications/types.d.ts +222 -0
  100. package/build/types/services/payments/appStore.d.ts +5 -0
  101. package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/types/services/payments/health.d.ts +9 -0
  103. package/build/types/services/payments/index.d.ts +15 -0
  104. package/build/types/services/payments/orders.d.ts +5 -0
  105. package/build/types/services/payments/playStore.d.ts +5 -0
  106. package/build/types/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/types/services/payments/products.d.ts +5 -0
  109. package/build/types/services/payments/stripe.d.ts +5 -0
  110. package/build/types/services/payments/subscriptions.d.ts +5 -0
  111. package/build/types/services/payments/types.d.ts +1189 -0
  112. package/build/types/services/profiles/groups.d.ts +5 -0
  113. package/build/types/services/profiles/health.d.ts +9 -0
  114. package/build/types/services/profiles/index.d.ts +9 -0
  115. package/build/types/services/profiles/logs.d.ts +5 -0
  116. package/build/types/services/profiles/profiles.d.ts +5 -0
  117. package/build/types/services/profiles/types.d.ts +369 -0
  118. package/build/types/services/tasks/api/index.d.ts +5 -0
  119. package/build/types/services/tasks/api/types.d.ts +146 -0
  120. package/build/types/services/tasks/apiRequests/index.d.ts +5 -0
  121. package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -0
  122. package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -0
  123. package/build/types/services/tasks/apiRequests/types.d.ts +83 -0
  124. package/build/types/services/tasks/functions/index.d.ts +5 -0
  125. package/build/types/services/tasks/functions/types.d.ts +27 -0
  126. package/build/types/services/tasks/index.d.ts +15 -0
  127. package/build/types/services/tasks/logs/index.d.ts +5 -0
  128. package/build/types/services/tasks/logs/types.d.ts +28 -0
  129. package/build/types/services/tasks/schedules/index.d.ts +5 -0
  130. package/build/types/services/tasks/schedules/types.d.ts +88 -0
  131. package/build/types/services/tasks/tasks.d.ts +5 -0
  132. package/build/types/services/tasks/types.d.ts +107 -0
  133. package/build/types/services/templates/index.d.ts +3 -0
  134. package/build/types/services/templates/templates.d.ts +5 -0
  135. package/build/types/services/templates/types.d.ts +202 -0
  136. package/build/types/services/types.d.ts +77 -0
  137. package/build/types/services/users/activationRequests/index.d.ts +4 -0
  138. package/build/types/services/users/activationRequests/types.d.ts +70 -0
  139. package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -0
  140. package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -0
  141. package/build/types/services/users/globalRoles.d.ts +5 -0
  142. package/build/types/services/users/groupRoles.d.ts +5 -0
  143. package/build/types/services/users/health.d.ts +9 -0
  144. package/build/types/services/users/index.d.ts +16 -0
  145. package/build/types/services/users/settings/index.d.ts +4 -0
  146. package/build/types/services/users/settings/types.d.ts +47 -0
  147. package/build/types/services/users/types.d.ts +1055 -0
  148. package/build/types/services/users/users.d.ts +5 -0
  149. package/build/types/sha1.d.ts +11 -0
  150. package/build/types/types.d.ts +102 -0
  151. package/build/types/utils.d.ts +4 -0
  152. package/build/types/version.d.ts +1 -0
  153. package/package.json +57 -0
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { ActionsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => ActionsService;
5
+ export default _default;
@@ -0,0 +1,78 @@
1
+ import { AffectedRecords, MailRecipients, ObjectId, OptionsBase } from '../../types';
2
+ export interface ActionsService {
3
+ /**
4
+ * ## Create an Action for a Dispatcher
5
+ *
6
+ * **Global Permissions:**
7
+ * - `UPDATE_DISPATCHERS` - Allows a user to update Dispatchers
8
+ *
9
+ * @param dispatcherId {@link ObjectId} The id of the Dispatcher to be updated
10
+ * @param requestBody The data used to create the Action {@link ActionCreation}
11
+ * @param options - Additional options for the request
12
+ * @returns The created Action {@link Action}
13
+ */
14
+ create(dispatcherId: ObjectId, requestBody: ActionCreation, options?: OptionsBase): Promise<Action>;
15
+ /**
16
+ * ## Update an Action of a Dispatcher
17
+ *
18
+ * **Global Permissions:**
19
+ * - `UPDATE_DISPATCHERS` - Allows a user to update Dispatchers
20
+ *
21
+ * @param dispatcherId {@link ObjectId} The id of the Dispatcher to be updated
22
+ * @param actionId {@link ObjectId} The id of the Action to be updated
23
+ * @param requestBody The data used to update the Action {@link ActionUpdate}
24
+ * @param options - Additional options for the request
25
+ * @returns An affected records response {@link AffectedRecords}
26
+ */
27
+ update(dispatcherId: ObjectId, actionId: ObjectId, requestBody: ActionUpdate, options?: OptionsBase): Promise<AffectedRecords>;
28
+ /**
29
+ * ## Remove an Action from a Dispatcher
30
+ *
31
+ * **Global Permissions:**
32
+ * - `UPDATE_DISPATCHERS` - Allows a user to update Dispatchers
33
+ *
34
+ * @param dispatcherId {@link ObjectId} The id of the Dispatcher to remove an Action from
35
+ * @param actionId {@link ObjectId} The id of the Action to be removed
36
+ * @param options - Additional options for the request
37
+ * @returns An affected records response {@link AffectedRecords}
38
+ */
39
+ remove(dispatcherId: ObjectId, actionId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
40
+ }
41
+ export declare enum ActionType {
42
+ MAIL = "mail",
43
+ TASK = "task"
44
+ }
45
+ export interface ActionBase {
46
+ id: ObjectId;
47
+ /** The unique name of the dispatcher */
48
+ name?: string;
49
+ /** A description of the dispatcher */
50
+ description?: string;
51
+ }
52
+ export interface MailAction extends ActionBase {
53
+ /** The type of Action the Dispatcher will execute */
54
+ type?: ActionType.MAIL;
55
+ /** The recipients list of the mail, including to, cc and bcc */
56
+ recipients?: MailRecipients;
57
+ /** The id of the mail template to be consumed */
58
+ templateId?: ObjectId;
59
+ }
60
+ export interface TaskAction extends ActionBase {
61
+ /** The type of Action the Dispatcher will execute */
62
+ type?: ActionType.TASK;
63
+ /** The name of the Function to be executed as a task */
64
+ functionName?: string;
65
+ /** The data to be sent to the Function, the type may be specified by the user */
66
+ data?: Record<string, string>;
67
+ /** A list of string identifiers that can be attached to a task */
68
+ tags?: Array<string>;
69
+ /** The start timestamp of the task */
70
+ startTimestamp?: Date;
71
+ }
72
+ export declare type Action = MailAction | TaskAction;
73
+ export declare type MailActionCreation = Omit<MailAction, 'id'>;
74
+ export declare type TaskActionCreation = Omit<TaskAction, 'id'>;
75
+ export declare type ActionCreation = MailActionCreation | TaskActionCreation;
76
+ export declare type MailActionUpdate = Partial<Omit<MailAction, 'id' | 'type'>>;
77
+ export declare type TaskActionUpdate = Partial<Omit<TaskAction, 'id' | 'type'>>;
78
+ export declare type ActionUpdate = MailActionUpdate | TaskActionUpdate;
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { DispatchersService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => DispatchersService;
5
+ export default _default;
@@ -0,0 +1,111 @@
1
+ import { FindAllIterator } from '../../helpers';
2
+ import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult } from '../../types';
3
+ import { Action, ActionCreation } from '../actions/types';
4
+ export interface DispatchersService {
5
+ /**
6
+ * ## Retrieve a paged list of Dispatchers
7
+ *
8
+ * **Global Permissions:**
9
+ * - `VIEW_DISPATCHERS` - Allows a user to view Dispatchers
10
+ *
11
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
12
+ * @returns A paged list of Dispatchers {@link PagedResultWithPager PagedResultWithPager<Dispatcher>}
13
+ */
14
+ find(options?: OptionsWithRql): Promise<PagedResult<Dispatcher>>;
15
+ /**
16
+ * ## Retrieve a list of all Dispatchers
17
+ *
18
+ * **Global Permissions:**
19
+ * - `VIEW_DISPATCHERS` - Allows a user to view Dispatchers
20
+ *
21
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
22
+ * @returns An array of Dispatchers {@link Dispatcher Dispatcher[]}
23
+ */
24
+ findAll(options?: OptionsWithRql): Promise<Dispatcher[]>;
25
+ /**
26
+ * ## Retrieve a paged list of Dispatchers
27
+ *
28
+ * **Global Permissions:**
29
+ * - `VIEW_DISPATCHERS` - Allows a user to view Dispatchers
30
+ *
31
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
32
+ * @returns An iterator for the queried Dispatchers {@link FindAllIterator FindAllIterator<Dispatcher>}
33
+ */
34
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<Dispatcher>;
35
+ /**
36
+ * ## Retrieve a Dispatcher by id
37
+ *
38
+ * **Global Permissions:**
39
+ * - `VIEW_DISPATCHERS` - Allows a user to view Dispatchers
40
+ *
41
+ * @param id {@link ObjectId} - The id of the targeted Dispatcher
42
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
43
+ * @returns The first element of the queried Dispatchers {@link Dispatcher}
44
+ */
45
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Dispatcher>;
46
+ /**
47
+ * ## Retrieve the first queried Dispatcher
48
+ *
49
+ * **Global Permissions:**
50
+ * - `VIEW_DISPATCHERS` - Allows a user to view Dispatchers
51
+ *
52
+ * @param options {@link OptionsWithRql} - Add filters to the requested list
53
+ * @returns The first element of the queried Dispatchers {@link Dispatcher}
54
+ */
55
+ findFirst(options?: OptionsWithRql): Promise<Dispatcher>;
56
+ /**
57
+ * ## Create a Dispatcher
58
+ *
59
+ * **Global Permissions:**
60
+ * - `CREATE_DISPATCHERS` - Allows a user to create Dispatchers
61
+ *
62
+ * @param requestBody {@link DispatcherCreation} - The data used to create the Dispatcher
63
+ * @param options {@link OptionsBase} - Additional options for the request
64
+ * @returns The created Dispatcher {@link Dispatcher}
65
+ */
66
+ create(requestBody: DispatcherCreation, options?: OptionsBase): Promise<Dispatcher>;
67
+ /**
68
+ * ## Update a Dispatcher
69
+ *
70
+ * **Global Permissions:**
71
+ * - `UPDATE_DISPATCHERS` - Allows a user to update Dispatchers
72
+ *
73
+ * @param dispatcherId {@link ObjectId} - The id of the Dispatcher to be updated
74
+ * @param requestBody {@link DispatcherUpdate} - The data used to update the Dispatcher
75
+ * @param options {@link OptionsBase} - Additional options for the request
76
+ * @returns An affected records response {@link AffectedRecords}
77
+ */
78
+ update(dispatcherId: ObjectId, requestBody: DispatcherUpdate, options?: OptionsBase): Promise<AffectedRecords>;
79
+ /**
80
+ * ## Delete a Dispatcher
81
+ *
82
+ * **Global Permissions:**
83
+ * - `DELETE_DISPATCHERS` - Allows a user to delete Dispatchers
84
+ *
85
+ * @param dispatcherId {@link ObjectId} - The id of the Dispatcher to be deleted
86
+ * @param options {@link OptionsBase} - Additional options for the request
87
+ * @returns An affected records response {@link AffectedRecords}
88
+ */
89
+ remove(dispatcherId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
90
+ }
91
+ export interface Dispatcher {
92
+ id: ObjectId;
93
+ /** The unique name of the dispatcher */
94
+ name?: string;
95
+ /** A description of the dispatcher */
96
+ description?: string;
97
+ /** The type of event the Dispatcher will respond to e.g 'user_deleted' */
98
+ eventType: string;
99
+ /** The actions the Dispatcher shall execute */
100
+ actions: Array<Action>;
101
+ /** A list of string identifiers that can be attached to a Dispatcher */
102
+ tags?: Array<string>;
103
+ /** The creation timestamp of the Dispatcher */
104
+ creationTimestamp: Date;
105
+ /** The update timestamp of the Dispatcher */
106
+ updateTimestamp: Date;
107
+ }
108
+ export declare type DispatcherCreation = Omit<Dispatcher, 'id' | 'creationTimestamp' | 'updateTimestamp' | 'actions'> & {
109
+ actions: ActionCreation[];
110
+ };
111
+ export declare type DispatcherUpdate = Partial<Omit<Dispatcher, 'id' | 'actions' | 'creationTimestamp' | 'updateTimestamp'>>;
@@ -0,0 +1,7 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import actions from './actions';
3
+ import { ActionsService } from './actions/types';
4
+ import { DispatchersService } from './dispatchers/types';
5
+ export declare const dispatchersService: (httpWithAuth: HttpInstance) => DispatchersService & {
6
+ actions: ActionsService;
7
+ };
@@ -0,0 +1,2 @@
1
+ export * from './actions/types';
2
+ export * from './dispatchers/types';
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { EventsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => EventsService;
5
+ export default _default;
@@ -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,6 @@
1
+ import type { EventsService, HttpInstance, SubscriptionsService } from '../../types';
2
+ import health from './health';
3
+ import subscriptions from './subscriptions';
4
+ export declare const eventsService: (httpWithAuth: HttpInstance) => ReturnType<typeof health> & EventsService & {
5
+ subscriptions: SubscriptionsService;
6
+ };
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { SubscriptionsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => SubscriptionsService;
5
+ export default _default;
@@ -0,0 +1,90 @@
1
+ import { Entity, ObjectId, OptionsBase, OptionsWithRql, PagedResult, Timestamps } from '../types';
2
+ export interface CreateEvent {
3
+ type: string;
4
+ content?: Record<string, any>;
5
+ }
6
+ export declare type Event = CreateEvent & Entity & Timestamps;
7
+ export interface CreateSubscription {
8
+ service: Service;
9
+ eventTypes: Array<string>;
10
+ }
11
+ export declare type Subscription = CreateSubscription & Entity & Timestamps;
12
+ export interface Service {
13
+ name: string;
14
+ version: Version;
15
+ }
16
+ export interface Version {
17
+ major: number;
18
+ minor: number;
19
+ patch: number;
20
+ }
21
+ export interface EventsService {
22
+ /**
23
+ * Returns a list of events
24
+ *
25
+ * Permission | Scope | Effect
26
+ * - | - | -
27
+ * `VIEW_EVENTS` | `global` | **Required** for this endpoint
28
+ * @param rql Add filters to the requested list.
29
+ * @returns PagedResult<Event>
30
+ */
31
+ find(options?: OptionsWithRql): Promise<PagedResult<Event>>;
32
+ /**
33
+ * Find By Id
34
+ * @param id the Id to search for
35
+ * @param rql an optional rql string
36
+ * @returns the first element found
37
+ */
38
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Event>;
39
+ /**
40
+ * Find First
41
+ * @param rql an optional rql string
42
+ * @returns the first element found
43
+ */
44
+ findFirst(options?: OptionsWithRql): Promise<Event>;
45
+ /**
46
+ * Creates an event
47
+ *
48
+ * Permission | Scope | Effect
49
+ * - | - | -
50
+ * `CREATE_EVENTS` | `global` | **Required** for this endpoint
51
+ * @param requestBody
52
+ * @returns Event
53
+ */
54
+ create(requestBody: CreateEvent, options?: OptionsBase): Promise<Event>;
55
+ }
56
+ export interface SubscriptionsService {
57
+ /**
58
+ * Returns a list of event subscriptions
59
+ *
60
+ * Permission | Scope | Effect
61
+ * - | - | -
62
+ * `VIEW_SUBSCRIPTIONS` | `global` | **Required** for this endpoint
63
+ * @param rql Add filters to the requested list.
64
+ * @returns PagedResult<Subscription>
65
+ */
66
+ find(options?: OptionsWithRql): Promise<PagedResult<Subscription>>;
67
+ /**
68
+ * Find By Id
69
+ * @param id the Id to search for
70
+ * @param rql an optional rql string
71
+ * @returns the first element found
72
+ */
73
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Subscription>;
74
+ /**
75
+ * Find First
76
+ * @param rql an optional rql string
77
+ * @returns the first element found
78
+ */
79
+ findFirst(options?: OptionsWithRql): Promise<Subscription>;
80
+ /**
81
+ * Creates an event subscription
82
+ *
83
+ * Permission | Scope | Effect
84
+ * - | - | -
85
+ * `CREATE_SUBSCRIPTIONS` | `global` | **Required** for this endpoint
86
+ * @param requestBody
87
+ * @returns Subscription
88
+ */
89
+ create(requestBody: CreateSubscription, options?: OptionsBase): Promise<Subscription>;
90
+ }
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { FilesService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => FilesService;
5
+ export default _default;
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ export declare function createCustomFormData(value: string, boundary: string): Buffer;
3
+ export declare function generateBoundary(): string;
@@ -0,0 +1,6 @@
1
+ import type { FileSettingsService, FilesService, HttpInstance } from '../../types';
2
+ import settings from './settings';
3
+ import { FileTokensService } from './types';
4
+ export declare const filesService: (httpWithAuth: HttpInstance) => FilesService & FileTokensService & {
5
+ settings: FileSettingsService;
6
+ };
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../http/types';
2
+ import { HttpClient } from '../../http-client';
3
+ import { FileSettingsService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => FileSettingsService;
5
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import { AffectedRecords, OptionsBase } from '../../types';
2
+ export interface FileSettingsService {
3
+ /**
4
+ * ## Retrieve the File Service settings
5
+ *
6
+ * ** Global Permissions: **
7
+ * - `VIEW_FILE_SERVICE_SETTINGS` - **Required** for this endpoint
8
+ *
9
+ * @param options {@link OptionsBase} - Additional options for the request
10
+ * @returns {@link FileServiceSettings} - The File Service settings
11
+ */
12
+ get(options?: OptionsBase): Promise<FileServiceSettings>;
13
+ /**
14
+ * ## Update the File Service settings
15
+ *
16
+ * ** Global Permissions: **
17
+ * - `UPDATE_FILE_SERVICE_SETTINGS` - **Required** for this endpoint
18
+ *
19
+ * @param data {@link FileServiceSettingsUpdate} - The File Service settings to be updated
20
+ * @param options {@link OptionsBase} - Additional options for the request
21
+ * @returns {@link AffectedRecords } - A response detailing the number of records affected by the request
22
+ */
23
+ update(data: Partial<FileServiceSettingsUpdate>, options?: OptionsBase): Promise<AffectedRecords>;
24
+ }
25
+ export interface FileServiceSettingsUpdate {
26
+ disableForceDownloadForMimeTypes: string[];
27
+ }
28
+ export interface FileServiceSettings {
29
+ /**
30
+ * All files will have a Content-Disposition header with the Attachment value when fetched, unless their MIME type matches a type in this array exactly.
31
+ *
32
+ * The Attachment value ensures files are downloaded rather than displayed directly in the browser, enhancing protection against potential XSS vulnerabilities.
33
+ *
34
+ * The value *\/\* can be used to allow any file to be displayed by browsers, use at your own discretion.
35
+ */
36
+ disableForceDownloadForMimeTypes: string[];
37
+ updateTimestamp: Date;
38
+ }
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { FileTokensService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => FileTokensService;
5
+ export default _default;
@@ -0,0 +1,185 @@
1
+ /// <reference types="node" />
2
+ import { ReadStream } from 'fs';
3
+ import type { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult } from '../types';
4
+ import { FileUploadOptions } from '../types';
5
+ export * from './settings/types';
6
+ /**
7
+ * The combination of a uuid and id that is used to retrieve the file and decide an access level for the request
8
+ */
9
+ export declare type Token = string;
10
+ export declare enum TokenPermission {
11
+ FULL = "full",
12
+ READ = "read"
13
+ }
14
+ export interface TokenObject {
15
+ token: Token;
16
+ accessLevel: TokenPermission;
17
+ }
18
+ export interface FileDetails {
19
+ tokens: Array<TokenObject>;
20
+ creatorId: ObjectId;
21
+ creationTimestamp: Date;
22
+ updateTimestamp: Date;
23
+ name: string;
24
+ mimetype: string;
25
+ size: number;
26
+ tags?: Array<string>;
27
+ }
28
+ export interface CreateTokenRequest {
29
+ accessLevel?: TokenPermission;
30
+ }
31
+ /**
32
+ * As defined by React Native:
33
+ * https://github.com/facebook/react-native/blob/v0.72.4/packages/react-native/Libraries/Network/FormData.js#L13
34
+ */
35
+ export declare type ReactNativeFile = {
36
+ uri: string;
37
+ name?: string;
38
+ type?: string;
39
+ };
40
+ export declare type FileDataTypes = Blob | string | Buffer | ReadStream | ReactNativeFile;
41
+ export interface FilesService {
42
+ /**
43
+ * List all files
44
+ *
45
+ * Permission | Scope | Effect
46
+ * - | - | -
47
+ * `VIEW_FILES` | `global` | **Required** for this endpoint
48
+ * @param rql Add filters to the requested list.
49
+ * @returns PagedResult<FileDetails>
50
+ */
51
+ find(options?: OptionsWithRql): Promise<PagedResult<FileDetails>>;
52
+ /**
53
+ * Find By Name
54
+ * @param name the name to search for
55
+ * @param rql an optional rql string
56
+ * @returns the first element found
57
+ */
58
+ findByName(name: string, options?: OptionsWithRql): Promise<FileDetails>;
59
+ /**
60
+ * Find First
61
+ * @param rql an optional rql string
62
+ * @returns the first element found
63
+ */
64
+ findFirst(options?: OptionsWithRql): Promise<FileDetails>;
65
+ /**
66
+ * ## Add a new file from a plain text source
67
+ *
68
+ * **Default Permissions:**
69
+ * Everyone can use this endpoint
70
+ * @param text {@link string} - The text to upload as a file
71
+ * @param options {@link FileUploadOptions} - Additional options for the request
72
+ * @returns {@link FileDetails} - The persisted metadata after file creation {@link FileDetails}
73
+ * @throws {FileTooLargeError} - An error if the uploaded file exceeds the maximum file size
74
+ */
75
+ createFromText(text: string, options?: FileUploadOptions): Promise<FileDetails>;
76
+ /**
77
+ * ## Add a new file
78
+ *
79
+ * Based on the platform `fileData` accepts different types:
80
+ * - Web browsers: `Blob` or `File`
81
+ * - Node.js: `string`, `Buffer` or `ReadStream`
82
+ * - React Native: `{ uri: string, name?: string, type?: string }`
83
+ *
84
+ * **Default Permissions:**
85
+ * Everyone can use this endpoint
86
+ * @param fileName {@link string} - The name of the file to upload
87
+ * @param fileData {@link FileDataTypes} - The data used for file creation
88
+ * @param options {@link FileUploadOptions} - Additional options for the request
89
+ * @throws {FileTooLargeError} - An error if the uploaded file exceeds the maximum file size
90
+ * @returns {@link FileDetails} - The persisted metadata after file creation
91
+ */
92
+ create(fileName: string, fileData: FileDataTypes, options?: FileUploadOptions & {
93
+ tags?: string[];
94
+ }): Promise<FileDetails>;
95
+ /**
96
+ * Delete a file
97
+ *
98
+ * AccessLevel | Effect
99
+ * - | -
100
+ * `full` | **Required** to be able to delete the file
101
+ * @param token
102
+ * @returns AffectedRecords
103
+ * @throws {InvalidTokenError}
104
+ * @throws {UnauthorizedTokenError}
105
+ */
106
+ remove(token: Token, options?: OptionsBase): Promise<AffectedRecords>;
107
+ /**
108
+ * Retrieve a file from the object store
109
+ *
110
+ * Returns an `ArrayBuffer` in web browsers and React Native, a `Buffer` in Node.js
111
+ *
112
+ * Permission | Scope | Effect
113
+ * - | - | -
114
+ * none | | Everyone can use this endpoint
115
+ * @param token
116
+ * @returns Buffer
117
+ * @throws {InvalidTokenError}
118
+ * @throws {UnauthorizedTokenError}
119
+ */
120
+ retrieve(token: Token, options?: OptionsBase): Promise<Buffer>;
121
+ /**
122
+ * Retrieve a file stream from the object store
123
+ *
124
+ * Currently only supported in Node.js
125
+ *
126
+ * Permission | Scope | Effect
127
+ * - | - | -
128
+ * none | | Everyone can use this endpoint
129
+ * @param token
130
+ * @returns data as ReadStream
131
+ * @throws {InvalidTokenError}
132
+ * @throws {UnauthorizedTokenError}
133
+ */
134
+ retrieveStream(token: Token, options?: OptionsBase): Promise<{
135
+ data: ReadStream;
136
+ }>;
137
+ /**
138
+ * Get file details
139
+ *
140
+ * Permission | Scope | Effect
141
+ * - | - | -
142
+ * none | | Everyone can use this endpoint
143
+ *
144
+ * AccessLevel | Effect
145
+ * - | -
146
+ * `full` | **Required** to return file metadata with all tokens.
147
+ * `read` | **Required** to return name, size, mimetype.
148
+ * @param token
149
+ * @returns FileDetails
150
+ * @throws {InvalidTokenError}
151
+ * @throws {UnauthorizedTokenError}
152
+ */
153
+ getDetails(token: Token, options?: OptionsBase): Promise<FileDetails>;
154
+ }
155
+ export interface FileTokensService {
156
+ /**
157
+ * Delete a token
158
+ *
159
+ * Permission | Scope | Effect
160
+ * - | - | -
161
+ * none | | Everyone can use this endpoint
162
+ *
163
+ * @param token
164
+ * @param tokenToAccess The token that should be deleted
165
+ * @returns void
166
+ * @throws {InvalidTokenError}
167
+ * @throws {UnauthorizedTokenError}
168
+ * @throws {TokenNotDeleteableError}
169
+ */
170
+ deleteToken(token: Token, tokenToAccess: Token, options?: OptionsBase): Promise<void>;
171
+ /**
172
+ * Generate a token for a file
173
+ *
174
+ * Permission | Scope | Effect
175
+ * - | - | -
176
+ * none | | Everyone can use this endpoint
177
+ *
178
+ * @param token
179
+ * @param requestBody
180
+ * @returns TokenObject Success
181
+ * @throws {InvalidTokenError}
182
+ * @throws {UnauthorizedTokenError}
183
+ */
184
+ generateToken(token: Token, requestBody: CreateTokenRequest, options?: OptionsBase): Promise<TokenObject>;
185
+ }
@@ -0,0 +1,7 @@
1
+ import { HttpInstance, HttpRequestConfig } from '../http/types';
2
+ import { OptionsWithRql, PagedResult, PagedResultWithPager } from './types';
3
+ export declare type FindAllIterator<T> = AsyncGenerator<PagedResult<T>, Record<string, never>, void>;
4
+ export declare function findAllIterator<T>(find: (options: OptionsWithRql) => PagedResult<T> | Promise<PagedResult<T>>, options: OptionsWithRql): FindAllIterator<T>;
5
+ export declare function findAllGeneric<T>(find: (options: OptionsWithRql) => PagedResult<T> | Promise<PagedResult<T>>, options: OptionsWithRql, level?: number): Promise<T[]>;
6
+ export declare function addPagersFn<T>(find: (options: OptionsWithRql) => PagedResult<T> | Promise<PagedResult<T>>, options: OptionsWithRql, pagedResult: PagedResult<T>): PagedResultWithPager<T>;
7
+ export declare function setCustomKeysConfigurationInRequestConfig(httpInstance: HttpInstance, requestOptions?: HttpRequestConfig): HttpRequestConfig;
@@ -0,0 +1,22 @@
1
+ import { HttpInstance, HttpRequestConfig } from '../http/types';
2
+ interface HttpClientOptions {
3
+ basePath: string;
4
+ transformRequestData?(args: Record<string, unknown>, options?: HttpRequestConfig): Record<string, unknown>;
5
+ }
6
+ interface Options {
7
+ gzip?: boolean;
8
+ }
9
+ interface GetOptions {
10
+ shouldRetry?: boolean;
11
+ }
12
+ declare const httpClient: ({ basePath, transformRequestData, }: HttpClientOptions) => {
13
+ get: (axios: HttpInstance, url: string, { shouldRetry, ...config }?: HttpRequestConfig & GetOptions) => Promise<import("axios").AxiosResponse<any, any>>;
14
+ put: (axios: HttpInstance, url: string, data: any, config?: HttpRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
15
+ post: (axios: HttpInstance, url: string, data: any, config?: HttpRequestConfig, options?: Options) => Promise<import("axios").AxiosResponse<any, any>>;
16
+ delete: (axios: HttpInstance, url: string, config?: HttpRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
17
+ patch: (axios: HttpInstance, url: string, data: any, config?: HttpRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
18
+ options: (axios: HttpInstance, url: string) => Promise<import("axios").AxiosResponse<any, any>>;
19
+ head: (axios: HttpInstance, url: string) => Promise<import("axios").AxiosResponse<any, any>>;
20
+ };
21
+ export default httpClient;
22
+ export declare type HttpClient = ReturnType<typeof httpClient>;
@@ -0,0 +1,15 @@
1
+ export * from './auth';
2
+ export * from './data';
3
+ export * from './files';
4
+ export * from './tasks';
5
+ export * from './users';
6
+ export * from './configurations';
7
+ export * from './templates';
8
+ export * from './mails';
9
+ export * from './dispatchers';
10
+ export * from './payments';
11
+ export * from './localizations';
12
+ export * from './profiles';
13
+ export * from './notifications';
14
+ export * from './events';
15
+ export * from './logs';
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import { HttpClient } from '../http-client';
3
+ import type { CountriesService } from './types';
4
+ declare const _default: (client: HttpClient, httpAuth: HttpInstance) => CountriesService;
5
+ export default _default;
@@ -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;