@extrahorizon/javascript-sdk 8.10.0-dev-160-0c77af1 → 8.10.0-dev-162-aab55c5

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 (155) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/btoa.d.ts +6 -0
  3. package/build/client.d.ts +147 -0
  4. package/build/constants.d.ts +17 -0
  5. package/build/errorHandler.d.ts +1 -0
  6. package/build/errors.d.ts +361 -0
  7. package/build/http/client.d.ts +2 -0
  8. package/build/http/index.d.ts +4 -0
  9. package/build/http/interceptors.d.ts +9 -0
  10. package/build/http/oAuth1Signature.d.ts +18 -0
  11. package/build/http/oauth1.d.ts +3 -0
  12. package/build/http/oauth2.d.ts +3 -0
  13. package/build/http/proxy.d.ts +3 -0
  14. package/build/http/types.d.ts +331 -0
  15. package/build/http/utils.d.ts +21 -0
  16. package/build/index.cjs.js +1 -1
  17. package/build/index.d.ts +9 -0
  18. package/build/index.mjs +1 -1
  19. package/build/mock.d.ts +43 -0
  20. package/build/mockType.d.ts +1721 -0
  21. package/build/parseStoredCredentials.d.ts +11 -0
  22. package/build/rql/index.d.ts +16 -0
  23. package/build/rql/parser.d.ts +1 -0
  24. package/build/rql/types.d.ts +174 -0
  25. package/build/services/auth/applications/index.d.ts +5 -0
  26. package/build/services/auth/applications/types.d.ts +260 -0
  27. package/build/services/auth/index.d.ts +3 -0
  28. package/build/services/auth/oauth1/index.d.ts +5 -0
  29. package/build/services/auth/oauth1/types.d.ts +102 -0
  30. package/build/services/auth/oauth2/index.d.ts +5 -0
  31. package/build/services/auth/oauth2/types.d.ts +100 -0
  32. package/build/services/auth/oidc/index.d.ts +5 -0
  33. package/build/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  34. package/build/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  35. package/build/services/auth/oidc/providers/index.d.ts +5 -0
  36. package/build/services/auth/oidc/providers/types.d.ts +148 -0
  37. package/build/services/auth/oidc/types.d.ts +40 -0
  38. package/build/services/auth/types.d.ts +39 -0
  39. package/build/services/auth/users/index.d.ts +5 -0
  40. package/build/services/auth/users/types.d.ts +121 -0
  41. package/build/services/configurations/general.d.ts +5 -0
  42. package/build/services/configurations/groups.d.ts +5 -0
  43. package/build/services/configurations/index.d.ts +10 -0
  44. package/build/services/configurations/patients.d.ts +5 -0
  45. package/build/services/configurations/staff.d.ts +5 -0
  46. package/build/services/configurations/types.d.ts +222 -0
  47. package/build/services/configurations/users.d.ts +5 -0
  48. package/build/services/data/comments.d.ts +5 -0
  49. package/build/services/data/documents.d.ts +5 -0
  50. package/build/services/data/index.d.ts +13 -0
  51. package/build/services/data/indexes.d.ts +5 -0
  52. package/build/services/data/infrastructure.d.ts +10 -0
  53. package/build/services/data/json-schema.d.ts +121 -0
  54. package/build/services/data/properties.d.ts +5 -0
  55. package/build/services/data/schemas.d.ts +5 -0
  56. package/build/services/data/statuses.d.ts +5 -0
  57. package/build/services/data/transitions.d.ts +5 -0
  58. package/build/services/data/types.d.ts +1500 -0
  59. package/build/services/dispatchers/actions/index.d.ts +5 -0
  60. package/build/services/dispatchers/actions/types.d.ts +78 -0
  61. package/build/services/dispatchers/dispatchers/index.d.ts +5 -0
  62. package/build/services/dispatchers/dispatchers/types.d.ts +111 -0
  63. package/build/services/dispatchers/index.d.ts +7 -0
  64. package/build/services/dispatchers/types.d.ts +2 -0
  65. package/build/services/events/events.d.ts +5 -0
  66. package/build/services/events/index.d.ts +5 -0
  67. package/build/services/events/subscriptions.d.ts +5 -0
  68. package/build/services/events/types.d.ts +107 -0
  69. package/build/services/files/files.d.ts +5 -0
  70. package/build/services/files/formHelpers.d.ts +3 -0
  71. package/build/services/files/index.d.ts +6 -0
  72. package/build/services/files/settings/index.d.ts +5 -0
  73. package/build/services/files/settings/types.d.ts +38 -0
  74. package/build/services/files/tokens.d.ts +5 -0
  75. package/build/services/files/types.d.ts +185 -0
  76. package/build/services/helpers.d.ts +7 -0
  77. package/build/services/http-client.d.ts +22 -0
  78. package/build/services/index.d.ts +16 -0
  79. package/build/services/localizations/countries.d.ts +5 -0
  80. package/build/services/localizations/index.d.ts +3 -0
  81. package/build/services/localizations/languages.d.ts +5 -0
  82. package/build/services/localizations/localizations.d.ts +5 -0
  83. package/build/services/localizations/types.d.ts +150 -0
  84. package/build/services/logs/access/index.d.ts +5 -0
  85. package/build/services/logs/access/types.d.ts +41 -0
  86. package/build/services/logs/index.d.ts +3 -0
  87. package/build/services/logs/types.d.ts +4 -0
  88. package/build/services/mails/index.d.ts +3 -0
  89. package/build/services/mails/mails.d.ts +5 -0
  90. package/build/services/mails/types.d.ts +149 -0
  91. package/build/services/notifications/index.d.ts +6 -0
  92. package/build/services/notifications/notifications.d.ts +5 -0
  93. package/build/services/notifications/settings.d.ts +5 -0
  94. package/build/services/notifications/types.d.ts +235 -0
  95. package/build/services/notificationsV2/index.d.ts +6 -0
  96. package/build/services/notificationsV2/notificationsV2.d.ts +5 -0
  97. package/build/services/notificationsV2/types.d.ts +166 -0
  98. package/build/services/notificationsV2/userSettings/index.d.ts +5 -0
  99. package/build/services/notificationsV2/userSettings/types.d.ts +138 -0
  100. package/build/services/payments/appStore.d.ts +5 -0
  101. package/build/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/services/payments/health.d.ts +9 -0
  103. package/build/services/payments/index.d.ts +15 -0
  104. package/build/services/payments/orders.d.ts +5 -0
  105. package/build/services/payments/playStore.d.ts +5 -0
  106. package/build/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/services/payments/products.d.ts +5 -0
  109. package/build/services/payments/stripe.d.ts +5 -0
  110. package/build/services/payments/subscriptions.d.ts +5 -0
  111. package/build/services/payments/types.d.ts +1198 -0
  112. package/build/services/profiles/groups.d.ts +5 -0
  113. package/build/services/profiles/index.d.ts +8 -0
  114. package/build/services/profiles/logs.d.ts +5 -0
  115. package/build/services/profiles/profiles.d.ts +5 -0
  116. package/build/services/profiles/types.d.ts +375 -0
  117. package/build/services/tasks/api/index.d.ts +5 -0
  118. package/build/services/tasks/api/types.d.ts +146 -0
  119. package/build/services/tasks/apiRequests/index.d.ts +5 -0
  120. package/build/services/tasks/apiRequests/logs/index.d.ts +5 -0
  121. package/build/services/tasks/apiRequests/logs/types.d.ts +25 -0
  122. package/build/services/tasks/apiRequests/types.d.ts +83 -0
  123. package/build/services/tasks/functions/index.d.ts +5 -0
  124. package/build/services/tasks/functions/types.d.ts +171 -0
  125. package/build/services/tasks/index.d.ts +15 -0
  126. package/build/services/tasks/logs/index.d.ts +5 -0
  127. package/build/services/tasks/logs/types.d.ts +28 -0
  128. package/build/services/tasks/schedules/index.d.ts +5 -0
  129. package/build/services/tasks/schedules/types.d.ts +92 -0
  130. package/build/services/tasks/tasks.d.ts +5 -0
  131. package/build/services/tasks/types.d.ts +118 -0
  132. package/build/services/templates/index.d.ts +3 -0
  133. package/build/services/templates/templates.d.ts +5 -0
  134. package/build/services/templates/types.d.ts +237 -0
  135. package/build/services/templatesV2/index.d.ts +3 -0
  136. package/build/services/templatesV2/templatesV2.d.ts +5 -0
  137. package/build/services/templatesV2/types.d.ts +156 -0
  138. package/build/services/types.d.ts +103 -0
  139. package/build/services/users/activationRequests/index.d.ts +4 -0
  140. package/build/services/users/activationRequests/types.d.ts +70 -0
  141. package/build/services/users/forgotPasswordRequests/index.d.ts +4 -0
  142. package/build/services/users/forgotPasswordRequests/types.d.ts +70 -0
  143. package/build/services/users/globalRoles.d.ts +5 -0
  144. package/build/services/users/groupRoles.d.ts +5 -0
  145. package/build/services/users/index.d.ts +14 -0
  146. package/build/services/users/settings/index.d.ts +4 -0
  147. package/build/services/users/settings/types.d.ts +47 -0
  148. package/build/services/users/types.d.ts +1278 -0
  149. package/build/services/users/users.d.ts +5 -0
  150. package/build/sha1.d.ts +11 -0
  151. package/build/types/version.d.ts +1 -1
  152. package/build/types.d.ts +104 -0
  153. package/build/utils.d.ts +5 -0
  154. package/build/version.d.ts +1 -0
  155. package/package.json +3 -3
@@ -0,0 +1,11 @@
1
+ import { decodeType } from 'typescript-json-decoder';
2
+ export declare type ExHCredentials = decodeType<typeof exhCredentialsDecoder>;
3
+ declare const exhCredentialsDecoder: import("typescript-json-decoder").DecoderFunction<{
4
+ API_HOST?: string;
5
+ API_OAUTH_CONSUMER_KEY?: string;
6
+ API_OAUTH_CONSUMER_SECRET?: string;
7
+ API_OAUTH_TOKEN?: string;
8
+ API_OAUTH_TOKEN_SECRET?: string;
9
+ }>;
10
+ export declare const parseStoredCredentials: (fileContent: string) => ExHCredentials;
11
+ export {};
@@ -0,0 +1,16 @@
1
+ import { RqlBuilderFactory, RQLString } from './types';
2
+ export * from './types';
3
+ /**
4
+ * rqlParser accepts a regular string and returns a valid RQLString if it's valid.
5
+ * @see https://developers.extrahorizon.io/guide/rql.html
6
+ * @returns {RQLString}
7
+ * @throws {URIError}
8
+ * @throws {Error}
9
+ */
10
+ export declare function rqlParser(rql: string): RQLString;
11
+ /**
12
+ * RQL is a Resource Query Language designed for use in URIs with object data structures. RQL can be thought as basically a set of nestable named operators which each have a set of arguments written in a query string.
13
+ * @see https://developers.extrahorizon.io/guide/rql.html
14
+ * @returns
15
+ */
16
+ export declare const rqlBuilder: RqlBuilderFactory;
@@ -0,0 +1 @@
1
+ export default function parse(query?: any, parameters?: any): any;
@@ -0,0 +1,174 @@
1
+ declare type NotAnRQLStringError = 'Please use rqlBuilder to construct valid RQL. See README for an example.';
2
+ declare type RQLCheck<T> = T extends any ? NotAnRQLStringError : T;
3
+ export declare type RQLString = RQLCheck<string>;
4
+ declare type RQLBuilderString = RQLString | string;
5
+ export declare type RQLBuilderOptions = {
6
+ doubleEncodeValues?: boolean;
7
+ rql?: RQLBuilderString;
8
+ };
9
+ export declare type RQLBuilderInput = RQLBuilderString | RQLBuilderOptions;
10
+ export interface RqlBuilderFactory {
11
+ /**
12
+ * @deprecated this property is only meant to be used for backwards compatibility when upgrading to v8.0.0
13
+ *
14
+ * **Previous behaviour:**
15
+ * - RQL values could be provided as double encoded to an rql builder
16
+ * - `rqlBuilder.doubleEncodeValues` could be set to `true` to enable double encoding of values for all rql builders
17
+ * - `rqlBuilder({ doubleEncodeValues: true })...` could enable automatic double encoding of values for an rql builder
18
+ *
19
+ *
20
+ * **New behaviour:**
21
+ * - RQL values are automatically double encoded when using an rql builder
22
+ *
23
+ * **How to upgrade to 8.0.0:**
24
+ * - Update any RQL values to no longer be encoded manually or using methods such as `encodeURIComponent()`
25
+ * - old value: 'Hypertension%2520%252D%2520STAGE%25201'
26
+ * - new value: 'Hypertension - STAGE 1'
27
+ *
28
+ * **Alternatively**:
29
+ * - `rqlBuilder.doubleEncodeValues` can be set to `false` to disable double encoding of values for all rql builders
30
+ * - `rqlBuilder({ doubleEncodeValues: true })...` enables automatic double encoding of values for an rql builder
31
+ *
32
+ */
33
+ doubleEncodeValues?: boolean;
34
+ (input?: RQLBuilderInput): RQLBuilder;
35
+ }
36
+ export interface RQLBuilder {
37
+ /**
38
+ * Trims each object down to the set of properties defined in the arguments
39
+ * - Only return field1 and field2 from the records: select(field1, field2)
40
+ */
41
+ select: (fields: string | string[]) => RQLBuilder;
42
+ /**
43
+ * - Only return 1 record: limit(1)
44
+ * - Only return 10 records and skip the first 50: limit(10, 50)
45
+ */
46
+ limit: (limit: number, offset?: number) => RQLBuilder;
47
+ /**
48
+ * Sorts by the given property in order specified by the prefix
49
+ * - \+ for ascending
50
+ * - \- for descending
51
+ */
52
+ sort: (fields: string | string[]) => RQLBuilder;
53
+ /**
54
+ * Filters for objects where the specified property's value is not in the provided array
55
+ */
56
+ out: (field: string, values: string[]) => RQLBuilder;
57
+ /**
58
+ * Filters for objects where the specified property's value is in the provided array
59
+ */
60
+ in: (field: string, values: string[]) => RQLBuilder;
61
+ /**
62
+ * Filters for objects where the specified property's value is greater than or equal to the provided value
63
+ */
64
+ ge: (field: string, value: string) => RQLBuilder;
65
+ /**
66
+ * Filters for objects where the specified property's value is equal to the provided value
67
+ */
68
+ eq: (field: string, value: string) => RQLBuilder;
69
+ /**
70
+ * Filters for objects where the specified property's value is less than or equal to the provided value
71
+ */
72
+ le: (field: string, value: string) => RQLBuilder;
73
+ /**
74
+ * Filters for objects where the specified property's value is not equal to the provided value
75
+ */
76
+ ne: (field: string, value: string) => RQLBuilder;
77
+ /**
78
+ * Filters for objects where the specified string field contains the substring provided in the value.
79
+ */
80
+ like: (field: string, value: string) => RQLBuilder;
81
+ /**
82
+ * Filters for objects where the specified property's value is less than the provided value
83
+ */
84
+ lt: (field: string, value: string) => RQLBuilder;
85
+ /**
86
+ * Filters for objects where the specified property's value is greater than the provided value
87
+ */
88
+ gt: (field: string, value: string) => RQLBuilder;
89
+ /**
90
+ * Allows combining results of 2 or more queries with the logical AND operator.
91
+ */
92
+ and: (...conditions: RQLString[]) => RQLBuilder;
93
+ /**
94
+ * Allows combining results of 2 or more queries with the logical OR operator.
95
+ */
96
+ or: (...conditions: RQLString[]) => RQLBuilder;
97
+ /**
98
+ * @description Only returns records having this field as property
99
+ * @example
100
+ * await exh.data.documents.find(schemaId, {
101
+ * rql: rqlBuilder().contains('data.indicator').build()
102
+ * });
103
+ * @returns returns documents containing the `data.indicator` field
104
+ */
105
+ contains(field: string): RQLBuilder;
106
+ /**
107
+ * @description Filters for objects where the specified property's value is an array and the array contains
108
+ * any value that equals the provided value or satisfies the provided condition.
109
+ * `contains(field, itemField > 30)` only returns records having a property `field` which have a prop `itemField` for which the condition is valid
110
+ * `contains` with a single property is not strictly needed. This can be replaced with `gt(field.itemField,30)`.
111
+ * @example
112
+ * await exh.data.documents.find(schemaId, {
113
+ * rql: rqlBuilder()
114
+ * .contains(
115
+ * "data",
116
+ * rqlBuilder().gt("heartrate", "60").intermediate(),
117
+ * rqlBuilder().lt("heartrate", "90").intermediate()
118
+ * )
119
+ * .build(),
120
+ * });
121
+ * @return Only returns documents with a data object containing `heartrate > 60` and `heartrate > 90`
122
+ */
123
+ contains(field: string, ...conditions: RQLString[]): RQLBuilder;
124
+ /**
125
+ * @description Only returns records not having this field as property
126
+ * @example
127
+ * await exh.data.documents.find(schemaId, {
128
+ * rql: rqlBuilder().excludes('data.indicator').build()
129
+ * });
130
+ * @returns returns documents not containing the `data.indicator` field
131
+ */
132
+ excludes(field: string): RQLBuilder;
133
+ /**
134
+ * @description Filters for objects where the specified property's value is an array and the array excludes
135
+ * any value that equals the provided value or satisfies the provided condition.
136
+ * `excludes(field, itemField > 30)` only returns records having a property `field` which have a prop `itemField` for which the condition is invalid
137
+ * @example
138
+ * await exh.data.documents.find(schemaId, {
139
+ * rql: rqlBuilder()
140
+ * .excludes(
141
+ * "data",
142
+ * rqlBuilder().gt("heartrate", "60").intermediate(),
143
+ * rqlBuilder().lt("heartrate", "90").intermediate()
144
+ * )
145
+ * .build(),
146
+ * });
147
+ * @return Only returns documents excluding documents where `heartrate > 60` and `heartrate > 90`
148
+ */
149
+ excludes(field: string, ...conditions: RQLString[]): RQLBuilder;
150
+ /**
151
+ * @description skipCount() Skips the record counting step of a request to increase performance.
152
+ *
153
+ * As a result, the page object in a response will not include the total field.
154
+ *
155
+ * @example
156
+ * await exh.data.documents.find(schemaId, {
157
+ * rql: rqlBuilder()
158
+ * .skipCount()
159
+ * .build(),
160
+ * });
161
+ */
162
+ skipCount: () => RQLBuilder;
163
+ /**
164
+ * Returns a valid rqlString
165
+ * @returns valid rqlString
166
+ */
167
+ build: () => RQLString;
168
+ /**
169
+ * Returns an intermediate rqlString you can combine in or/and statements
170
+ * @returns valid rqlString
171
+ */
172
+ intermediate: () => RQLString;
173
+ }
174
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../../types';
2
+ import { HttpClient } from '../../http-client';
3
+ import type { AuthApplicationsService } from '../types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => AuthApplicationsService;
5
+ export default _default;
@@ -0,0 +1,260 @@
1
+ import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult } from '../../../types';
2
+ export interface AuthApplicationsService {
3
+ /**
4
+ * ## Create a new application
5
+ * You can use this function to create a new `oAuth1` or `oAuth2` application.
6
+ *
7
+ * You need permissions to use this function.
8
+ *
9
+ * #### Global Permissions
10
+ * `CREATE_APPLICATIONS` - Provides the ability to create new applications.
11
+ *
12
+ * @param data {@link OAuth1ApplicationCreation} or {@link OAuth2ApplicationCreation}
13
+ * @returns The newly created {@link OAuth1Application} or {@link OAuth2Application}.
14
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
15
+ * @throws {@link FieldFormatError} when one of the provided parameters is not correctly formatted according to the documentation.
16
+ */
17
+ create<T extends OAuth1ApplicationCreation | OAuth2ApplicationCreation>(data: T, options?: OptionsBase): Promise<T extends OAuth1ApplicationCreation ? OAuth1Application : OAuth2Application>;
18
+ /**
19
+ * ## Get a list of applications
20
+ * Provides a paginated list of applications currently registered in the cluster.
21
+ *
22
+ * Every logged-in user is able to retrieve a limited set of fields (only `name`, `description`, `logo` and `type`).
23
+ *
24
+ * #### Global Permissions
25
+ * `VIEW_APPLICATIONS` - Returns all applications fields
26
+ *
27
+ * #### Function details
28
+ * @param options {@link OptionsWithRql} additional options with rql that can be set for your request to the cluster.
29
+ *
30
+ * @returns Provides a paginated list of applications currently registered in the cluster.
31
+ *
32
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
33
+ * */
34
+ find(options?: OptionsWithRql): Promise<PagedResult<OAuth1Application | OAuth2Application>>;
35
+ /**
36
+ * ## Get the first application found
37
+ * Gets the first application from the paginated list of applications currently registered in the cluster.
38
+ *
39
+ * Every logged-in user is able to retrieve a limited set of fields (only `name`, `description`, `logo` and `type`).
40
+ *
41
+ * #### Global Permissions
42
+ * `VIEW_APPLICATIONS` - Returns all applications fields
43
+ *
44
+ * #### Function details
45
+ * @param options {@link OptionsWithRql} additional options with rql that can be set for your request to the cluster.
46
+ *
47
+ * @returns Provides a paginated list of applications currently registered in the cluster.
48
+ *
49
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
50
+ * */
51
+ findFirst(options?: OptionsWithRql): Promise<(OAuth1Application | OAuth2Application) | undefined>;
52
+ /**
53
+ * ## Get an application by its id
54
+ * Gets the application currently registered in the cluster by its id.
55
+ *
56
+ * Every logged-in user is able to retrieve a limited set of fields (only `name`, `description`, `logo` and `type`).
57
+ *
58
+ * #### Global Permissions
59
+ * `VIEW_APPLICATIONS` - Returns all applications fields
60
+ *
61
+ * #### Function details
62
+ * @param options {@link OptionsWithRql} additional options with rql that can be set for your request to the cluster.
63
+ *
64
+ * @returns Provides a paginated list of applications currently registered in the cluster.
65
+ *
66
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
67
+ * */
68
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<(OAuth1Application | OAuth2Application) | undefined>;
69
+ /**
70
+ * ## Get an application by its name
71
+ * Gets the application currently registered in the cluster by its name.
72
+ *
73
+ * Every logged-in user is able to retrieve a limited set of fields (only `name`, `description`, `logo` and `type`).
74
+ *
75
+ * #### Global Permissions
76
+ * `VIEW_APPLICATIONS` - Returns all applications fields
77
+ *
78
+ * #### Function details
79
+ * @param options {@link OptionsWithRql} additional options with rql that can be set for your request to the cluster.
80
+ *
81
+ * @returns Provides a paginated list of applications currently registered in the cluster.
82
+ *
83
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
84
+ * */
85
+ findByName(name: string, options?: OptionsWithRql): Promise<(OAuth1Application | OAuth2Application) | undefined>;
86
+ /**
87
+ * @deprecated Use `find` instead
88
+ *
89
+ * ## Get a list of applications
90
+ * Provides a paginated list of applications currently registered in the cluster.
91
+ *
92
+ * Every logged-in user is able to retrieve a limited set of fields (only `name`, `description`, `logo` and `type`).
93
+ *
94
+ * #### Global Permissions
95
+ * `VIEW_APPLICATIONS` - Returns all applications fields
96
+ *
97
+ * #### Function details
98
+ * @param options {@link OptionsWithRql} additional options with rql that can be set for your request to the cluster.
99
+ *
100
+ * @returns Provides a paginated list of applications currently registered in the cluster.
101
+ *
102
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
103
+ * */
104
+ get(options?: OptionsWithRql): Promise<PagedResult<OAuth1Application | OAuth2Application>>;
105
+ /**
106
+ * ## Update an existing application
107
+ * You can use this function to update an existing `oAuth1` or `oAuth2` application.
108
+ *
109
+ * You need permissions to use this function.
110
+ *
111
+ * #### Global Permissions
112
+ * `UPDATE_APPLICATIONS` - Provides the ability to update existing applications.
113
+ *
114
+ * #### Function details
115
+ * @param applicationId A hexadecimal identifier of 24 characters of the application you want to update.
116
+ * @param data {@link OAuth1ApplicationUpdate} or {@link OAuth2ApplicationUpdate} containing the fields you want to update.
117
+ * The fields that are left undefined will not be updated.
118
+ * @param options {@link OptionsBase} additional options that can be set for your request to the cluster.
119
+ *
120
+ * @returns {Promise} A Promise with the number of affected records.
121
+ *
122
+ * @throws {@link ResourceUnknownError} when no application is found for the specified application Id.
123
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
124
+ * @throws {@link FieldFormatError} when one of the provided parameters is not correctly formatted according to the documentation.
125
+ */
126
+ update<T extends OAuth1ApplicationUpdate | OAuth2ApplicationUpdate>(applicationId: string, data: T, options?: OptionsBase): Promise<AffectedRecords>;
127
+ /**
128
+ * ## Delete an application
129
+ * You can use this function to remove an existing `oAuth1` or `oAuth2` application.
130
+ *
131
+ * You need permissions to use this function.
132
+ *
133
+ * #### Global permisions
134
+ * `DELETE_APPLICATIONS` - Provides the ability to remove the applications.
135
+ *
136
+ * #### Function details
137
+ * @param applicationId A hexadecimal identifier of 24 characters of the application you want to remove.
138
+ * @param options {@link OptionsBase} additional options that can be set for your request to the cluster.
139
+ *
140
+ * @returns {Promise} A Promise with the number of affected records.
141
+ *
142
+ * @throws {@link ResourceUnknownError} when no application is found for the specified application Id.
143
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
144
+ */
145
+ remove(applicationId: string, options?: OptionsBase): Promise<AffectedRecords>;
146
+ /**
147
+ * ## Create an application version
148
+ * You can use this function to create a new application version.
149
+ *
150
+ * You need permissions to use this function.
151
+ *
152
+ * #### Global permissions
153
+ * `CREATE_APPLICATIONS`- Provides the ability to create new application versions.
154
+ *
155
+ * #### Function details
156
+ * @param applicationId A hexadecimal identifier of 24 characters of the application.
157
+ * @param data An {@link ApplicationVersionCreation} object
158
+ * @param options {@link OptionsBase} additional options that can be set for your request to the cluster.
159
+ *
160
+ * @returns The newly created {@link OAuth1ApplicationVersion} or {@link OAuth2ApplicationVersion}.
161
+ *
162
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
163
+ * @throws {@link FieldFormatError} when one of the provided parameters is not correctly formatted according to the documentation.
164
+ */
165
+ createVersion(applicationId: string, data: ApplicationVersionCreation, options?: OptionsBase): Promise<ApplicationVersion>;
166
+ /**
167
+ * ## Delete an application version
168
+ * You can use this function to remove an existing appliction version.
169
+ *
170
+ * When you remove an application version users with existing oAuth1 tokens trying to communicate with the cluster will receive a `OAUTH_KEY_EXCEPTION`.
171
+ * In case of oAuth2 tokens users will receive a `OAUTH2_CLIENT_ID_EXCEPTION` when trying to use their refresh token to get new access tokens.
172
+ * You can use the error's above to force users to switch to a newer version of your applications in case the backend no longer recoginizes them.
173
+ *
174
+ * You need permissions to execute this function
175
+ *
176
+ * #### Global permissions
177
+ * `DELETE_APPLICATIONS` - Provides the ability to remove application versions.
178
+ *
179
+ * #### Function details
180
+ * @param applicationId A hexadecimal identifier of 24 characters of the application.
181
+ * @param versionId the version Identifier or `name` of the application version.
182
+ * @param options {@link OptionsBase} additional options that can be set for your request to the cluster.
183
+ *
184
+ * @returns {Promise} A Promise with the number of affected records.
185
+ *
186
+ * @throws {ResourceUnknownError} when the specified application or version could not be found
187
+ * @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
188
+ */
189
+ deleteVersion(applicationId: string, versionId: string, options?: OptionsBase): Promise<AffectedRecords>;
190
+ }
191
+ /**
192
+ * @name Application
193
+ */
194
+ export interface Application {
195
+ /** A 24 character long hexadecimal value acting as the identifier of your application */
196
+ id: string;
197
+ /** The name of your application. A minimum 1 and maximm of 100 characters is accepted */
198
+ name: string;
199
+ /** A Description of your application. A minimum 1 and maximm of 250 characters is accepted */
200
+ description: string;
201
+ /** The timestamp when the application was last updated */
202
+ updateTimestamp: Date;
203
+ /** The timestamp when the application was created */
204
+ creationTimestamp: Date;
205
+ }
206
+ export interface OAuth1Application extends Application {
207
+ /** type of the application */
208
+ type: ApplicationType.oauth1;
209
+ /** A List cointaining the different versions of the application */
210
+ versions?: OAuth1ApplicationVersion[];
211
+ }
212
+ export interface OAuth2Application extends Application {
213
+ /** type of the application */
214
+ type: ApplicationType.oauth2;
215
+ /** A List containing the different versions of the application */
216
+ versions?: OAuth2ApplicationVersion[];
217
+ /**
218
+ * @deprecated
219
+ * The logo of the application. Can be used in the oAuth2.0 authorization code grant to indicate the user what application he is authorizing.
220
+ * A hexadecimal value with a minimum of 1 and maximum of 100 characters is allowed.
221
+ * */
222
+ logo?: string;
223
+ /** A list of approved uri's that can be used when authenticating with [an authorization code grant flow](https://www.rfc-editor.org/rfc/rfc6749#section-1.3.1). Can only be used in an oAuth2 application type. A minimum of 1 uri and maximum 50 uri's can be provided. This field is required upon creation to the application */
224
+ redirectUris?: string[];
225
+ /**
226
+ * Defines wether your application should be considered a confidential app according to the [oAuth2.0 spec](https://www.rfc-editor.org/rfc/rfc6749). If not provided upon creation this value defaults to false.
227
+ */
228
+ confidential: boolean;
229
+ }
230
+ export declare enum ApplicationType {
231
+ oauth1 = "oauth1",
232
+ oauth2 = "oauth2"
233
+ }
234
+ export declare type ApplicationCreation = Required<Pick<Application, 'name' | 'description'>>;
235
+ export declare type OAuth1ApplicationCreation = ApplicationCreation & Required<Pick<OAuth1Application, 'type'>>;
236
+ export declare type OAuth2ApplicationCreation = ApplicationCreation & Required<Pick<OAuth2Application, 'type' | 'redirectUris'>> & Partial<Pick<OAuth2Application, 'logo' | 'confidential'>>;
237
+ export interface ApplicationVersion {
238
+ /** The identifier of this version */
239
+ id: string;
240
+ /** The name of the application version. We suggest using semantic versioning vX.X.X (e.g. v1.2.0) */
241
+ name: string;
242
+ /** The timestap when this version was created */
243
+ creationTimestamp: Date;
244
+ }
245
+ export interface OAuth1ApplicationVersion extends ApplicationVersion {
246
+ /** the oAuth1 consumerKey */
247
+ consumerKey: string;
248
+ /** the oAuth1 consumerSecret */
249
+ consumerSecret: string;
250
+ }
251
+ export interface OAuth2ApplicationVersion extends ApplicationVersion {
252
+ /** The oAuth2 clientId */
253
+ clientId: string;
254
+ /** The oAuth2 clientSecret */
255
+ clientSecret: string;
256
+ }
257
+ export declare type ApplicationUpdate = Partial<Pick<Application, 'name' | 'description'>>;
258
+ export declare type OAuth1ApplicationUpdate = ApplicationUpdate & Required<Pick<OAuth1Application, 'type'>>;
259
+ export declare type OAuth2ApplicationUpdate = ApplicationUpdate & Required<Pick<OAuth2Application, 'type'>> & Partial<Pick<OAuth2Application, 'logo' | 'redirectUris'>>;
260
+ export declare type ApplicationVersionCreation = Required<Partial<Pick<ApplicationVersion, 'name'>>>;
@@ -0,0 +1,3 @@
1
+ import type { HttpInstance } from '../../types';
2
+ import type { AuthService } from './types';
3
+ export declare function authService(httpWithAuth: HttpInstance): AuthService;
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../../types';
2
+ import { HttpClient } from '../../http-client';
3
+ import type { AuthOauth1Service } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => AuthOauth1Service;
5
+ export default _default;
@@ -0,0 +1,102 @@
1
+ import { AffectedRecords, OptionsWithRql, PagedResult } from '../../types';
2
+ export interface AuthOauth1Service {
3
+ tokens: AuthOauth1TokenService;
4
+ /**
5
+ * Generate an SSO token with OAuth 1 authentication
6
+ *
7
+ * Permission | Scope | Effect
8
+ * - | - | -
9
+ * none | | Everyone can use this endpoint
10
+ * @throws {ApplicationNotAuthenticatedError}
11
+ * @throws {UserNotAuthenticatedError}
12
+ */
13
+ generateSsoToken(): Promise<SsoToken>;
14
+ /**
15
+ * Consume an SSO token to get OAuth 1 tokens
16
+ *
17
+ * Permission | Scope | Effect
18
+ * - | - | -
19
+ * none | | Everyone can use this endpoint
20
+ * @throws {ApplicationNotAuthenticatedError}
21
+ * @throws {ResourceUnknownError}
22
+ */
23
+ consumeSsoToken(ssoToken: string): Promise<OAuth1Token>;
24
+ /**
25
+ * @deprecated Use `exh.auth.oauth1.tokens.find` instead
26
+ *
27
+ * Get a list of OAuth1 tokens
28
+ *
29
+ * Permission | Scope | Effect
30
+ * - | - | -
31
+ * none | | Can only see a list of OAuth1 tokens for this account
32
+ * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
33
+ */
34
+ getTokens(options?: OptionsWithRql): Promise<PagedResult<OAuth1Token>>;
35
+ /**
36
+ * @deprecated Use `exh.auth.oauth1.tokens.remove` instead
37
+ *
38
+ * Remove a token
39
+ *
40
+ * Permission | Scope | Effect
41
+ * - | - | -
42
+ * none | | Can only remove OAuth1 tokens for this account
43
+ * DELETE_AUTHORIZATIONS | | Can remove any OAuth1 tokens of any account
44
+ */
45
+ removeToken(tokenId: string): Promise<AffectedRecords>;
46
+ }
47
+ export interface AuthOauth1TokenService {
48
+ /**
49
+ * Get a list of OAuth1 tokens
50
+ *
51
+ * Permission | Scope | Effect
52
+ * - | - | -
53
+ * none | | Can only see a list of OAuth1 tokens for this account
54
+ * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
55
+ */
56
+ find(options?: OptionsWithRql): Promise<PagedResult<OAuth1Token>>;
57
+ /**
58
+ * Get the first OAuth1 token found
59
+ *
60
+ * Permission | Scope | Effect
61
+ * - | - | -
62
+ * none | | Can only see a list of OAuth1 tokens for this account
63
+ * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
64
+ */
65
+ findFirst(options?: OptionsWithRql): Promise<OAuth1Token | undefined>;
66
+ /**
67
+ * Get an oAuth1 token by its id
68
+ *
69
+ * Permission | Scope | Effect
70
+ * - | - | -
71
+ * none | | Can only see a list of OAuth1 tokens for this account
72
+ * VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
73
+ */
74
+ findById(id: string, options?: OptionsWithRql): Promise<OAuth1Token | undefined>;
75
+ /**
76
+ * Remove a token
77
+ *
78
+ * Permission | Scope | Effect
79
+ * - | - | -
80
+ * none | | Can only remove OAuth1 tokens for this account
81
+ * DELETE_AUTHORIZATIONS | | Can remove any OAuth1 tokens of any account
82
+ */
83
+ remove(id: string): Promise<AffectedRecords>;
84
+ }
85
+ export interface SsoToken {
86
+ id: string;
87
+ ssoToken: string;
88
+ userId: string;
89
+ createdByApplicationId: string;
90
+ expiryTimestamp: Date;
91
+ creationTimestamp: Date;
92
+ updateTimestamp: Date;
93
+ }
94
+ export interface OAuth1Token {
95
+ id: string;
96
+ userId: string;
97
+ applicationId: string;
98
+ token: string;
99
+ tokenSecret: string;
100
+ lastUsedTimestamp: Date;
101
+ creationTimestamp: Date;
102
+ }
@@ -0,0 +1,5 @@
1
+ import type { HttpInstance } from '../../../types';
2
+ import { HttpClient } from '../../http-client';
3
+ import type { AuthOauth2Service } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => AuthOauth2Service;
5
+ export default _default;