@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.
- package/CHANGELOG.md +1161 -0
- package/LICENSE +21 -0
- package/README.md +119 -0
- package/build/index.cjs.js +1 -0
- package/build/index.mjs +1 -0
- package/build/types/btoa.d.ts +6 -0
- package/build/types/client.d.ts +136 -0
- package/build/types/constants.d.ts +15 -0
- package/build/types/errorHandler.d.ts +2 -0
- package/build/types/errors.d.ts +332 -0
- package/build/types/http/client.d.ts +2 -0
- package/build/types/http/index.d.ts +4 -0
- package/build/types/http/interceptors.d.ts +9 -0
- package/build/types/http/oAuth1Signature.d.ts +14 -0
- package/build/types/http/oauth1.d.ts +3 -0
- package/build/types/http/oauth2.d.ts +3 -0
- package/build/types/http/proxy.d.ts +3 -0
- package/build/types/http/types.d.ts +331 -0
- package/build/types/http/utils.d.ts +21 -0
- package/build/types/index.d.ts +9 -0
- package/build/types/mock.d.ts +43 -0
- package/build/types/mockType.d.ts +1511 -0
- package/build/types/parseStoredCredentials.d.ts +11 -0
- package/build/types/rql/index.d.ts +16 -0
- package/build/types/rql/parser.d.ts +1 -0
- package/build/types/rql/types.d.ts +168 -0
- package/build/types/services/auth/applications/index.d.ts +5 -0
- package/build/types/services/auth/applications/types.d.ts +190 -0
- package/build/types/services/auth/index.d.ts +3 -0
- package/build/types/services/auth/oauth1/index.d.ts +5 -0
- package/build/types/services/auth/oauth1/types.d.ts +63 -0
- package/build/types/services/auth/oauth2/index.d.ts +5 -0
- package/build/types/services/auth/oauth2/types.d.ts +52 -0
- package/build/types/services/auth/oidc/index.d.ts +5 -0
- package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -0
- package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -0
- package/build/types/services/auth/oidc/providers/index.d.ts +5 -0
- package/build/types/services/auth/oidc/providers/types.d.ts +144 -0
- package/build/types/services/auth/oidc/types.d.ts +40 -0
- package/build/types/services/auth/types.d.ts +39 -0
- package/build/types/services/auth/users/index.d.ts +5 -0
- package/build/types/services/auth/users/types.d.ts +121 -0
- package/build/types/services/configurations/general.d.ts +5 -0
- package/build/types/services/configurations/groups.d.ts +5 -0
- package/build/types/services/configurations/index.d.ts +10 -0
- package/build/types/services/configurations/patients.d.ts +5 -0
- package/build/types/services/configurations/staff.d.ts +5 -0
- package/build/types/services/configurations/types.d.ts +222 -0
- package/build/types/services/configurations/users.d.ts +5 -0
- package/build/types/services/data/comments.d.ts +5 -0
- package/build/types/services/data/documents.d.ts +5 -0
- package/build/types/services/data/index.d.ts +13 -0
- package/build/types/services/data/indexes.d.ts +5 -0
- package/build/types/services/data/infrastructure.d.ts +10 -0
- package/build/types/services/data/json-schema.d.ts +121 -0
- package/build/types/services/data/properties.d.ts +5 -0
- package/build/types/services/data/schemas.d.ts +5 -0
- package/build/types/services/data/statuses.d.ts +5 -0
- package/build/types/services/data/transitions.d.ts +5 -0
- package/build/types/services/data/types.d.ts +899 -0
- package/build/types/services/dispatchers/actions/index.d.ts +5 -0
- package/build/types/services/dispatchers/actions/types.d.ts +78 -0
- package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -0
- package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -0
- package/build/types/services/dispatchers/index.d.ts +7 -0
- package/build/types/services/dispatchers/types.d.ts +2 -0
- package/build/types/services/events/events.d.ts +5 -0
- package/build/types/services/events/health.d.ts +9 -0
- package/build/types/services/events/index.d.ts +6 -0
- package/build/types/services/events/subscriptions.d.ts +5 -0
- package/build/types/services/events/types.d.ts +90 -0
- package/build/types/services/files/files.d.ts +5 -0
- package/build/types/services/files/formHelpers.d.ts +3 -0
- package/build/types/services/files/index.d.ts +6 -0
- package/build/types/services/files/settings/index.d.ts +5 -0
- package/build/types/services/files/settings/types.d.ts +38 -0
- package/build/types/services/files/tokens.d.ts +5 -0
- package/build/types/services/files/types.d.ts +185 -0
- package/build/types/services/helpers.d.ts +7 -0
- package/build/types/services/http-client.d.ts +22 -0
- package/build/types/services/index.d.ts +15 -0
- package/build/types/services/localizations/countries.d.ts +5 -0
- package/build/types/services/localizations/health.d.ts +9 -0
- package/build/types/services/localizations/index.d.ts +4 -0
- package/build/types/services/localizations/languages.d.ts +5 -0
- package/build/types/services/localizations/localizations.d.ts +5 -0
- package/build/types/services/localizations/types.d.ts +145 -0
- package/build/types/services/logs/access/index.d.ts +5 -0
- package/build/types/services/logs/access/types.d.ts +41 -0
- package/build/types/services/logs/index.d.ts +3 -0
- package/build/types/services/logs/types.d.ts +4 -0
- package/build/types/services/mails/index.d.ts +3 -0
- package/build/types/services/mails/mails.d.ts +5 -0
- package/build/types/services/mails/types.d.ts +141 -0
- package/build/types/services/notifications/health.d.ts +9 -0
- package/build/types/services/notifications/index.d.ts +7 -0
- package/build/types/services/notifications/notifications.d.ts +5 -0
- package/build/types/services/notifications/settings.d.ts +5 -0
- package/build/types/services/notifications/types.d.ts +222 -0
- package/build/types/services/payments/appStore.d.ts +5 -0
- package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -0
- package/build/types/services/payments/health.d.ts +9 -0
- package/build/types/services/payments/index.d.ts +15 -0
- package/build/types/services/payments/orders.d.ts +5 -0
- package/build/types/services/payments/playStore.d.ts +5 -0
- package/build/types/services/payments/playStoreHistory.d.ts +5 -0
- package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -0
- package/build/types/services/payments/products.d.ts +5 -0
- package/build/types/services/payments/stripe.d.ts +5 -0
- package/build/types/services/payments/subscriptions.d.ts +5 -0
- package/build/types/services/payments/types.d.ts +1189 -0
- package/build/types/services/profiles/groups.d.ts +5 -0
- package/build/types/services/profiles/health.d.ts +9 -0
- package/build/types/services/profiles/index.d.ts +9 -0
- package/build/types/services/profiles/logs.d.ts +5 -0
- package/build/types/services/profiles/profiles.d.ts +5 -0
- package/build/types/services/profiles/types.d.ts +369 -0
- package/build/types/services/tasks/api/index.d.ts +5 -0
- package/build/types/services/tasks/api/types.d.ts +146 -0
- package/build/types/services/tasks/apiRequests/index.d.ts +5 -0
- package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -0
- package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -0
- package/build/types/services/tasks/apiRequests/types.d.ts +83 -0
- package/build/types/services/tasks/functions/index.d.ts +5 -0
- package/build/types/services/tasks/functions/types.d.ts +27 -0
- package/build/types/services/tasks/index.d.ts +15 -0
- package/build/types/services/tasks/logs/index.d.ts +5 -0
- package/build/types/services/tasks/logs/types.d.ts +28 -0
- package/build/types/services/tasks/schedules/index.d.ts +5 -0
- package/build/types/services/tasks/schedules/types.d.ts +88 -0
- package/build/types/services/tasks/tasks.d.ts +5 -0
- package/build/types/services/tasks/types.d.ts +107 -0
- package/build/types/services/templates/index.d.ts +3 -0
- package/build/types/services/templates/templates.d.ts +5 -0
- package/build/types/services/templates/types.d.ts +202 -0
- package/build/types/services/types.d.ts +77 -0
- package/build/types/services/users/activationRequests/index.d.ts +4 -0
- package/build/types/services/users/activationRequests/types.d.ts +70 -0
- package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -0
- package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -0
- package/build/types/services/users/globalRoles.d.ts +5 -0
- package/build/types/services/users/groupRoles.d.ts +5 -0
- package/build/types/services/users/health.d.ts +9 -0
- package/build/types/services/users/index.d.ts +16 -0
- package/build/types/services/users/settings/index.d.ts +4 -0
- package/build/types/services/users/settings/types.d.ts +47 -0
- package/build/types/services/users/types.d.ts +1055 -0
- package/build/types/services/users/users.d.ts +5 -0
- package/build/types/sha1.d.ts +11 -0
- package/build/types/types.d.ts +102 -0
- package/build/types/utils.d.ts +4 -0
- package/build/types/version.d.ts +1 -0
- package/package.json +57 -0
|
@@ -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,168 @@
|
|
|
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 `contains(field)` only returns records having this field as property
|
|
99
|
+
* @example
|
|
100
|
+
* await exh.data.documents.find(
|
|
101
|
+
* schemaId,
|
|
102
|
+
* { rql: rqlBuilder().contains('data.indicator').build()
|
|
103
|
+
* });
|
|
104
|
+
* @returns returns documents containing the `data.indicator` field
|
|
105
|
+
*
|
|
106
|
+
* @description Filters for objects where the specified property's value is an array and the array contains
|
|
107
|
+
* any value that equals the provided value or satisfies the provided condition.
|
|
108
|
+
* `contains(field, itemField > 30)` only returns records having a property `field` which have a prop `itemField` for which the condition is valid
|
|
109
|
+
* `contains` with a single property is not strictly needed. This can be replaced with `gt(field.itemField,30)`.
|
|
110
|
+
* @example
|
|
111
|
+
* await exh.data.documents.find(schemaId, {
|
|
112
|
+
* rql: rqlBuilder()
|
|
113
|
+
* .contains(
|
|
114
|
+
* "data",
|
|
115
|
+
* rqlBuilder().gt("heartrate", "60").intermediate(),
|
|
116
|
+
* rqlBuilder().lt("heartrate", "90").intermediate()
|
|
117
|
+
* )
|
|
118
|
+
* .build();
|
|
119
|
+
* });
|
|
120
|
+
* @return Only returns documents with a data object containing `heartrate > 60` and `heartrate > 90`
|
|
121
|
+
*/
|
|
122
|
+
contains: (field: string, ...conditions: RQLString[]) => RQLBuilder;
|
|
123
|
+
/**
|
|
124
|
+
* @description `excludes(field)` only returns records not having this field as property
|
|
125
|
+
* @example
|
|
126
|
+
* await exh.data.documents.find(
|
|
127
|
+
* schemaId,
|
|
128
|
+
* { rql: rqlBuilder().excludes('data.indicator').build()
|
|
129
|
+
* });
|
|
130
|
+
* @returns returns documents not containing the `data.indicator` field
|
|
131
|
+
*
|
|
132
|
+
* @description Filters for objects where the specified property's value is an array and the array excludes
|
|
133
|
+
* any value that equals the provided value or satisfies the provided condition.
|
|
134
|
+
* `excludes(field, itemField > 30)` only returns records having a property `field` which have a prop `itemField` for which the condition is invalid
|
|
135
|
+
* @example
|
|
136
|
+
* await exh.data.documents.find(schemaId, {
|
|
137
|
+
* rql: rqlBuilder()
|
|
138
|
+
* .excludes("data", rqlBuilder().gt("heartrate", "60").intermediate())
|
|
139
|
+
* .build(),
|
|
140
|
+
* });
|
|
141
|
+
* @return Only returns documents excluding documents where `data.heartrate > 60`
|
|
142
|
+
*/
|
|
143
|
+
excludes: (field: string, ...conditions: RQLString[]) => RQLBuilder;
|
|
144
|
+
/**
|
|
145
|
+
* @description skipCount() Skips the record counting step of a request to increase performance.
|
|
146
|
+
*
|
|
147
|
+
* As a result, the page object in a response will not include the total field.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* await exh.data.documents.find(schemaId, {
|
|
151
|
+
* rql: rqlBuilder()
|
|
152
|
+
* .skipCount()
|
|
153
|
+
* .build(),
|
|
154
|
+
* });
|
|
155
|
+
*/
|
|
156
|
+
skipCount: () => RQLBuilder;
|
|
157
|
+
/**
|
|
158
|
+
* Returns a valid rqlString
|
|
159
|
+
* @returns valid rqlString
|
|
160
|
+
*/
|
|
161
|
+
build: () => RQLString;
|
|
162
|
+
/**
|
|
163
|
+
* Returns an intermediate rqlString you can combine in or/and statements
|
|
164
|
+
* @returns valid rqlString
|
|
165
|
+
*/
|
|
166
|
+
intermediate: () => RQLString;
|
|
167
|
+
}
|
|
168
|
+
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,190 @@
|
|
|
1
|
+
import { AffectedRecords, 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} addional 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
|
+
get(options?: OptionsWithRql): Promise<PagedResult<OAuth1Application | OAuth2Application>>;
|
|
35
|
+
/**
|
|
36
|
+
* ## Update an existing application
|
|
37
|
+
* You can use this function to update an existing `oAuth1` or `oAuth2` application.
|
|
38
|
+
*
|
|
39
|
+
* You need permissions to use this function.
|
|
40
|
+
*
|
|
41
|
+
* #### Global Permissions
|
|
42
|
+
* `UPDATE_APPLICATIONS` - Provides the ability to update existing applications.
|
|
43
|
+
*
|
|
44
|
+
* #### Function details
|
|
45
|
+
* @param applicationId A hexadecimal identifier of 24 characters of the application you want to update.
|
|
46
|
+
* @param data {@link OAuth1ApplicationUpdate} or {@link OAuth2ApplicationUpdate} containing the fields you want to update.
|
|
47
|
+
* The fields that are left undefined will not be updated.
|
|
48
|
+
* @param options {@link OptionsBase} addional options that can be set for your request to the cluster.
|
|
49
|
+
*
|
|
50
|
+
* @returns {Promise} A Promise with the number of affected records.
|
|
51
|
+
*
|
|
52
|
+
* @throws {@link ResourceUnknownError} when no application is found for the specified application Id.
|
|
53
|
+
* @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
|
|
54
|
+
* @throws {@link FieldFormatError} when one of the provided parameters is not correctly formatted according to the documentation.
|
|
55
|
+
*/
|
|
56
|
+
update<T extends OAuth1ApplicationUpdate | OAuth2ApplicationUpdate>(applicationId: string, data: T, options?: OptionsBase): Promise<AffectedRecords>;
|
|
57
|
+
/**
|
|
58
|
+
* ## Delete an application
|
|
59
|
+
* You can use this function to remove an existing `oAuth1` or `oAuth2` application.
|
|
60
|
+
*
|
|
61
|
+
* You need permissions to use this function.
|
|
62
|
+
*
|
|
63
|
+
* #### Global permisions
|
|
64
|
+
* `DELETE_APPLICATIONS` - Provides the ability to remove the applications.
|
|
65
|
+
*
|
|
66
|
+
* #### Function details
|
|
67
|
+
* @param applicationId A hexadecimal identifier of 24 characters of the application you want to remove.
|
|
68
|
+
* @param options {@link OptionsBase} addional options that can be set for your request to the cluster.
|
|
69
|
+
*
|
|
70
|
+
* @returns {Promise} A Promise with the number of affected records.
|
|
71
|
+
*
|
|
72
|
+
* @throws {@link ResourceUnknownError} when no application is found for the specified application Id.
|
|
73
|
+
* @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
|
|
74
|
+
*/
|
|
75
|
+
remove(applicationId: string, options?: OptionsBase): Promise<AffectedRecords>;
|
|
76
|
+
/**
|
|
77
|
+
* ## Create an application version
|
|
78
|
+
* You can use this function to create a new application version.
|
|
79
|
+
*
|
|
80
|
+
* You need permissions to use this function.
|
|
81
|
+
*
|
|
82
|
+
* #### Global permissions
|
|
83
|
+
* `CREATE_APPLICATIONS`- Provides the ability to create new application versions.
|
|
84
|
+
*
|
|
85
|
+
* #### Function details
|
|
86
|
+
* @param applicationId A hexadecimal identifier of 24 characters of the application.
|
|
87
|
+
* @param data An {@link ApplicationVersionCreation} object
|
|
88
|
+
* @param options {@link OptionsBase} addional options that can be set for your request to the cluster.
|
|
89
|
+
*
|
|
90
|
+
* @returns The newly created {@link OAuth1ApplicationVersion} or {@link OAuth2ApplicationVersion}.
|
|
91
|
+
*
|
|
92
|
+
* @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
|
|
93
|
+
* @throws {@link FieldFormatError} when one of the provided parameters is not correctly formatted according to the documentation.
|
|
94
|
+
*/
|
|
95
|
+
createVersion(applicationId: string, data: ApplicationVersionCreation, options?: OptionsBase): Promise<ApplicationVersion>;
|
|
96
|
+
/**
|
|
97
|
+
* ## Delete an application version
|
|
98
|
+
* You can use this function to remove an existing appliction version.
|
|
99
|
+
*
|
|
100
|
+
* When you remove an application version users with existing oAuth1 tokens trying to communicate with the cluster will receive a `OAUTH_KEY_EXCEPTION`.
|
|
101
|
+
* 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.
|
|
102
|
+
* 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.
|
|
103
|
+
*
|
|
104
|
+
* You need permissions to execute this function
|
|
105
|
+
*
|
|
106
|
+
* #### Global permissions
|
|
107
|
+
* `DELETE_APPLICATIONS` - Provides the ability to remove application versions.
|
|
108
|
+
*
|
|
109
|
+
* #### Function details
|
|
110
|
+
* @param applicationId A hexadecimal identifier of 24 characters of the application.
|
|
111
|
+
* @param versionId the version Identifier or `name` of the application version.
|
|
112
|
+
* @param options {@link OptionsBase} addional options that can be set for your request to the cluster.
|
|
113
|
+
*
|
|
114
|
+
* @returns {Promise} A Promise with the number of affected records.
|
|
115
|
+
*
|
|
116
|
+
* @throws {ResourceUnknownError} when the specified application or version could not be found
|
|
117
|
+
* @throws {@link NoPermissionError} when the user doesn't have the required permissions to execute the function.
|
|
118
|
+
*/
|
|
119
|
+
deleteVersion(applicationId: string, versionId: string, options?: OptionsBase): Promise<AffectedRecords>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @name Application
|
|
123
|
+
*/
|
|
124
|
+
export interface Application {
|
|
125
|
+
/** A 24 character long hexadecimal value acting as the identifier of your application */
|
|
126
|
+
id: string;
|
|
127
|
+
/** The name of your application. A minimum 1 and maximm of 100 characters is accepted */
|
|
128
|
+
name: string;
|
|
129
|
+
/** A Description of your application. A minimum 1 and maximm of 250 characters is accepted */
|
|
130
|
+
description: string;
|
|
131
|
+
/** The timestamp when the application was last updated */
|
|
132
|
+
updateTimestamp: Date;
|
|
133
|
+
/** The timestamp when the application was created */
|
|
134
|
+
creationTimestamp: Date;
|
|
135
|
+
}
|
|
136
|
+
export interface OAuth1Application extends Application {
|
|
137
|
+
/** type of the application */
|
|
138
|
+
type: ApplicationType.oauth1;
|
|
139
|
+
/** A List cointaining the different versions of the application */
|
|
140
|
+
versions?: OAuth1ApplicationVersion[];
|
|
141
|
+
}
|
|
142
|
+
export interface OAuth2Application extends Application {
|
|
143
|
+
/** type of the application */
|
|
144
|
+
type: ApplicationType.oauth2;
|
|
145
|
+
/** A List containing the different versions of the application */
|
|
146
|
+
versions?: OAuth2ApplicationVersion[];
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated
|
|
149
|
+
* The logo of the application. Can be used in the oAuth2.0 authorization code grant to indicate the user what application he is authorizing.
|
|
150
|
+
* A hexadecimal value with a minimum of 1 and maximum of 100 characters is allowed.
|
|
151
|
+
* */
|
|
152
|
+
logo?: string;
|
|
153
|
+
/** 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 */
|
|
154
|
+
redirectUris?: string[];
|
|
155
|
+
/**
|
|
156
|
+
* 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.
|
|
157
|
+
*/
|
|
158
|
+
confidential: boolean;
|
|
159
|
+
}
|
|
160
|
+
export declare enum ApplicationType {
|
|
161
|
+
oauth1 = "oauth1",
|
|
162
|
+
oauth2 = "oauth2"
|
|
163
|
+
}
|
|
164
|
+
export declare type ApplicationCreation = Required<Pick<Application, 'name' | 'description'>>;
|
|
165
|
+
export declare type OAuth1ApplicationCreation = ApplicationCreation & Required<Pick<OAuth1Application, 'type'>>;
|
|
166
|
+
export declare type OAuth2ApplicationCreation = ApplicationCreation & Required<Pick<OAuth2Application, 'type' | 'redirectUris'>> & Partial<Pick<OAuth2Application, 'logo' | 'confidential'>>;
|
|
167
|
+
export interface ApplicationVersion {
|
|
168
|
+
/** The identifier of this version */
|
|
169
|
+
id: string;
|
|
170
|
+
/** The name of the application version. We suggest using semantic versioning vX.X.X (e.g. v1.2.0) */
|
|
171
|
+
name: string;
|
|
172
|
+
/** The timestap when this version was created */
|
|
173
|
+
creationTimestamp: Date;
|
|
174
|
+
}
|
|
175
|
+
export interface OAuth1ApplicationVersion extends ApplicationVersion {
|
|
176
|
+
/** the oAuth1 consumerKey */
|
|
177
|
+
consumerKey: string;
|
|
178
|
+
/** the oAuth1 consumerSecret */
|
|
179
|
+
consumerSecret: string;
|
|
180
|
+
}
|
|
181
|
+
export interface OAuth2ApplicationVersion extends ApplicationVersion {
|
|
182
|
+
/** The oAuth2 clientId */
|
|
183
|
+
clientId: string;
|
|
184
|
+
/** The oAuth2 clientSecret */
|
|
185
|
+
clientSecret: string;
|
|
186
|
+
}
|
|
187
|
+
export declare type ApplicationUpdate = Partial<Pick<Application, 'name' | 'description'>>;
|
|
188
|
+
export declare type OAuth1ApplicationUpdate = ApplicationUpdate & Required<Pick<OAuth1Application, 'type'>>;
|
|
189
|
+
export declare type OAuth2ApplicationUpdate = ApplicationUpdate & Required<Pick<OAuth2Application, 'type'>> & Partial<Pick<OAuth2Application, 'logo' | 'redirectUris'>>;
|
|
190
|
+
export declare type ApplicationVersionCreation = Required<Partial<Pick<ApplicationVersion, 'name'>>>;
|
|
@@ -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,63 @@
|
|
|
1
|
+
import { AffectedRecords, OptionsWithRql, PagedResult } from '../../types';
|
|
2
|
+
export interface AuthOauth1Service {
|
|
3
|
+
/**
|
|
4
|
+
* Generate an SSO token with OAuth 1 authentication
|
|
5
|
+
*
|
|
6
|
+
* Permission | Scope | Effect
|
|
7
|
+
* - | - | -
|
|
8
|
+
* none | | Everyone can use this endpoint
|
|
9
|
+
* @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/SSO/post_oauth1_ssoTokens_generate
|
|
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
|
+
* @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/SSO/post_oauth1_ssoTokens_generate
|
|
21
|
+
* @throws {ApplicationNotAuthenticatedError}
|
|
22
|
+
* @throws {ResourceUnknownError}
|
|
23
|
+
*/
|
|
24
|
+
consumeSsoToken(ssoToken: string): Promise<OAuth1Token>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a list of OAuth1 tokens
|
|
27
|
+
*
|
|
28
|
+
* Permission | Scope | Effect
|
|
29
|
+
* - | - | -
|
|
30
|
+
* none | | Can only see a list of OAuth1 tokens for this account
|
|
31
|
+
* VIEW_AUTHORIZATIONS | global | Can see a list of OAuth1 tokens for any account
|
|
32
|
+
* @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth1/get_oauth1_tokens
|
|
33
|
+
*/
|
|
34
|
+
getTokens(options?: OptionsWithRql): Promise<PagedResult<OAuth1Token>>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete a token
|
|
37
|
+
*
|
|
38
|
+
* Permission | Scope | Effect
|
|
39
|
+
* - | - | -
|
|
40
|
+
* none | | Can only see a list of OAuth1 tokens for this account
|
|
41
|
+
* VIEW_AUTHORIZATIONS | | Can remove any OAuth1 tokens of any account
|
|
42
|
+
* * @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth1/post_oauth1_tokens_mfa
|
|
43
|
+
*/
|
|
44
|
+
removeToken(tokenId: string): Promise<AffectedRecords>;
|
|
45
|
+
}
|
|
46
|
+
export interface SsoToken {
|
|
47
|
+
id: string;
|
|
48
|
+
ssoToken: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
createdByApplicationId: string;
|
|
51
|
+
expiryTimestamp: Date;
|
|
52
|
+
creationTimestamp: Date;
|
|
53
|
+
updateTimestamp: Date;
|
|
54
|
+
}
|
|
55
|
+
export interface OAuth1Token {
|
|
56
|
+
id: string;
|
|
57
|
+
userId: string;
|
|
58
|
+
applicationId: string;
|
|
59
|
+
token: string;
|
|
60
|
+
tokenSecret: string;
|
|
61
|
+
lastUsedTimestamp: Date;
|
|
62
|
+
creationTimestamp: Date;
|
|
63
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../types';
|
|
2
|
+
export interface AuthOauth2Service {
|
|
3
|
+
/**
|
|
4
|
+
* Create an OAuth2 authorization
|
|
5
|
+
*
|
|
6
|
+
* Permission | Scope | Effect
|
|
7
|
+
* - | - | -
|
|
8
|
+
* none | | Everyone can use this endpoint
|
|
9
|
+
* @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth2/post_oauth2_authorizations
|
|
10
|
+
* @throws {ApplicationUnknownError}
|
|
11
|
+
* @throws {CallbackNotValidError}
|
|
12
|
+
* @throws {UnsupportedResponseTypeError}
|
|
13
|
+
*/
|
|
14
|
+
createAuthorization(data: OAuth2AuthorizationCreation, options?: OptionsBase): Promise<OAuth2Authorization>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a list of OAuth2 Authorizations
|
|
17
|
+
*
|
|
18
|
+
* Permission | Scope | Effect
|
|
19
|
+
* - | - | -
|
|
20
|
+
* VIEW_AUTHORIZATIONS | global | **Required** for this endpoint
|
|
21
|
+
* @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth2/get_oauth2_authorizations
|
|
22
|
+
*/
|
|
23
|
+
getAuthorizations(options?: OptionsWithRql): Promise<PagedResult<OAuth2Authorization>>;
|
|
24
|
+
/**
|
|
25
|
+
* Delete an OAuth2 Authorization
|
|
26
|
+
*
|
|
27
|
+
* Permission | Scope | Effect
|
|
28
|
+
* - | - | -
|
|
29
|
+
* DELETE_AUTHORIZATIONS | global | **Required** for this endpoint
|
|
30
|
+
* @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth2/delete_oauth2_authorizations__authorizationId_
|
|
31
|
+
* @throws {ResourceUnknownError}
|
|
32
|
+
*/
|
|
33
|
+
deleteAuthorization(authorizationId: string, options?: OptionsWithRql): Promise<AffectedRecords>;
|
|
34
|
+
}
|
|
35
|
+
export interface OAuth2AuthorizationCreation {
|
|
36
|
+
responseType: string;
|
|
37
|
+
clientId: string;
|
|
38
|
+
redirectUri: string;
|
|
39
|
+
state: string;
|
|
40
|
+
scope: string;
|
|
41
|
+
}
|
|
42
|
+
export interface OAuth2Authorization {
|
|
43
|
+
id: string;
|
|
44
|
+
userId: string;
|
|
45
|
+
clientId: string;
|
|
46
|
+
authorizationCode: string;
|
|
47
|
+
state: string;
|
|
48
|
+
/** The timestamp when the authorization was last updated */
|
|
49
|
+
updateTimestamp?: Date;
|
|
50
|
+
/** The timestamp when the authorization was created */
|
|
51
|
+
creationTimestamp?: Date;
|
|
52
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpInstance } from '../../../../http/types';
|
|
2
|
+
import { HttpClient } from '../../../http-client';
|
|
3
|
+
import { LoginAttemptsService } from './types';
|
|
4
|
+
declare const _default: (oidcClient: HttpClient, httpWithAuth: HttpInstance) => LoginAttemptsService;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FindAllIterator } from '../../../helpers';
|
|
2
|
+
import { OptionsWithRql, PagedResultWithPager } from '../../../types';
|
|
3
|
+
export interface LoginAttemptsService {
|
|
4
|
+
/**
|
|
5
|
+
* ## Retrieve a paged list of login attempts
|
|
6
|
+
*
|
|
7
|
+
* **Global Permissions:**
|
|
8
|
+
* - `VIEW_OIDC_LOGIN_ATTEMPTS` - Allows a user to view login attempts
|
|
9
|
+
* @param options {@link OptionsWithRql} - Add filters to the requested list
|
|
10
|
+
* @returns A paged list of login attempts {@link PagedResultWithPager PagedResultWithPager<LoginAttempt>}
|
|
11
|
+
*/
|
|
12
|
+
find(options?: OptionsWithRql): Promise<PagedResultWithPager<LoginAttempt>>;
|
|
13
|
+
/**
|
|
14
|
+
* ## Retrieve a list of all login attempts
|
|
15
|
+
*
|
|
16
|
+
* **Global Permissions:**
|
|
17
|
+
* - `VIEW_OIDC_LOGIN_ATTEMPTS` - Allows a user to view login attempts
|
|
18
|
+
* @param options {@link OptionsWithRql} - Add filters to the requested list
|
|
19
|
+
* @returns An array of login attempts {@link LoginAttempt LoginAttempt[]}
|
|
20
|
+
* @throws {@link Error} Do not pass in limit operator with findAll
|
|
21
|
+
*/
|
|
22
|
+
findAll(options?: OptionsWithRql): Promise<LoginAttempt[]>;
|
|
23
|
+
/**
|
|
24
|
+
* ## Retrieve a paged list of login attempts
|
|
25
|
+
*
|
|
26
|
+
* **Global Permissions:**
|
|
27
|
+
* - `VIEW_OIDC_LOGIN_ATTEMPTS` - Allows a user to view login attempts
|
|
28
|
+
* @param options {@link OptionsWithRql} - Add filters to the requested list
|
|
29
|
+
* @returns An iterator for the queried login attempts {@link FindAllIterator FindAllIterator<LoginAttempt>}
|
|
30
|
+
*/
|
|
31
|
+
findAllIterator(options?: OptionsWithRql): FindAllIterator<LoginAttempt>;
|
|
32
|
+
/**
|
|
33
|
+
* ## Retrieve the first queried login attempt
|
|
34
|
+
*
|
|
35
|
+
* **Global Permissions:**
|
|
36
|
+
* - `VIEW_OIDC_LOGIN_ATTEMPTS` - Allows a user to view login attempts
|
|
37
|
+
* @param options {@link OptionsWithRql} - Add filters to the requested list
|
|
38
|
+
* @returns The first element of the queried login attempts {@link LoginAttempt}
|
|
39
|
+
*/
|
|
40
|
+
findFirst(options?: OptionsWithRql): Promise<LoginAttempt>;
|
|
41
|
+
}
|
|
42
|
+
export declare enum LoginAttemptStatus {
|
|
43
|
+
SUCCESS = "success",
|
|
44
|
+
FAILED = "failed"
|
|
45
|
+
}
|
|
46
|
+
export interface LoginAttempt {
|
|
47
|
+
/** The Extra Horizon document id */
|
|
48
|
+
id: string;
|
|
49
|
+
/** The (success / failed) status of a login attempt. */
|
|
50
|
+
status: LoginAttemptStatus;
|
|
51
|
+
/** The id of the provider */
|
|
52
|
+
providerId: string;
|
|
53
|
+
/** The unique name of the provider */
|
|
54
|
+
providerName: string;
|
|
55
|
+
/** The subject id (sub) of the user for the given provider */
|
|
56
|
+
providerSubjectId: string;
|
|
57
|
+
/** The Extra Horizon user id */
|
|
58
|
+
userId: string;
|
|
59
|
+
/** An Extra Horizon formatted error for failed requests */
|
|
60
|
+
error: {
|
|
61
|
+
name: string;
|
|
62
|
+
message: string;
|
|
63
|
+
code: number;
|
|
64
|
+
};
|
|
65
|
+
/** The date and time of the login attempt */
|
|
66
|
+
creationTimestamp: Date;
|
|
67
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpInstance } from '../../../../http/types';
|
|
2
|
+
import { HttpClient } from '../../../http-client';
|
|
3
|
+
import { OidcProviderService } from './types';
|
|
4
|
+
declare const _default: (oidcClient: HttpClient, httpWithAuth: HttpInstance) => OidcProviderService;
|
|
5
|
+
export default _default;
|