@extrahorizon/javascript-sdk 8.14.0-dev-196-5b15a56 → 8.14.0-dev-198-0b81795

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.
@@ -972,6 +972,12 @@ exports.ApplicationType = void 0;
972
972
  ApplicationType["oauth2"] = "oauth2";
973
973
  })(exports.ApplicationType || (exports.ApplicationType = {}));
974
974
 
975
+ exports.PKCECodeMethods = void 0;
976
+ (function (PKCECodeMethods) {
977
+ PKCECodeMethods["PLAIN"] = "plain";
978
+ PKCECodeMethods["S256"] = "S256";
979
+ })(exports.PKCECodeMethods || (exports.PKCECodeMethods = {}));
980
+
975
981
  exports.LoginAttemptStatus = void 0;
976
982
  (function (LoginAttemptStatus) {
977
983
  LoginAttemptStatus["SUCCESS"] = "success";
@@ -3411,9 +3417,42 @@ function createTokenService$1(client, httpWithAuth) {
3411
3417
  };
3412
3418
  }
3413
3419
 
3420
+ var authorizations = (client, httpWithAuth) => {
3421
+ async function find(options) {
3422
+ const result = await client.get(httpWithAuth, `/oauth2/authorizations${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
3423
+ return result.data;
3424
+ }
3425
+ return {
3426
+ async create(data, options) {
3427
+ const result = await client.post(httpWithAuth, '/oauth2/authorizations', data, options);
3428
+ return result.data;
3429
+ },
3430
+ async find(options) {
3431
+ const result = await find(options);
3432
+ return addPagersFn(find, options, result);
3433
+ },
3434
+ async findAll(options) {
3435
+ return findAllGeneric(find, options);
3436
+ },
3437
+ async findFirst(options) {
3438
+ const result = await find(options);
3439
+ return result.data[0];
3440
+ },
3441
+ async findById(authorizationId, options) {
3442
+ const rql = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', authorizationId).build();
3443
+ return await this.findFirst({ ...options, rql });
3444
+ },
3445
+ async remove(authorizationId, options) {
3446
+ const result = await client.delete(httpWithAuth, `/oauth2/authorizations/${authorizationId}`, options);
3447
+ return result.data;
3448
+ },
3449
+ };
3450
+ };
3451
+
3414
3452
  var oauth2 = (client, httpWithAuth) => ({
3415
3453
  tokens: createTokenService(client, httpWithAuth),
3416
3454
  refreshTokens: createRefreshTokenService(client, httpWithAuth),
3455
+ authorizations: authorizations(client, httpWithAuth),
3417
3456
  async createAuthorization(data, options) {
3418
3457
  return (await client.post(httpWithAuth, '/oauth2/authorizations', data, options)).data;
3419
3458
  },
@@ -5696,7 +5735,7 @@ const templatesV2Service = (httpWithAuth) => {
5696
5735
  };
5697
5736
  };
5698
5737
 
5699
- const version = '8.14.0-dev-196-5b15a56';
5738
+ const version = '8.14.0-dev-198-0b81795';
5700
5739
 
5701
5740
  /**
5702
5741
  * Create ExtraHorizon client.
package/build/index.mjs CHANGED
@@ -942,6 +942,12 @@ var ApplicationType;
942
942
  ApplicationType["oauth2"] = "oauth2";
943
943
  })(ApplicationType || (ApplicationType = {}));
944
944
 
945
+ var PKCECodeMethods;
946
+ (function (PKCECodeMethods) {
947
+ PKCECodeMethods["PLAIN"] = "plain";
948
+ PKCECodeMethods["S256"] = "S256";
949
+ })(PKCECodeMethods || (PKCECodeMethods = {}));
950
+
945
951
  var LoginAttemptStatus;
946
952
  (function (LoginAttemptStatus) {
947
953
  LoginAttemptStatus["SUCCESS"] = "success";
@@ -3381,9 +3387,42 @@ function createTokenService$1(client, httpWithAuth) {
3381
3387
  };
3382
3388
  }
3383
3389
 
3390
+ var authorizations = (client, httpWithAuth) => {
3391
+ async function find(options) {
3392
+ const result = await client.get(httpWithAuth, `/oauth2/authorizations${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
3393
+ return result.data;
3394
+ }
3395
+ return {
3396
+ async create(data, options) {
3397
+ const result = await client.post(httpWithAuth, '/oauth2/authorizations', data, options);
3398
+ return result.data;
3399
+ },
3400
+ async find(options) {
3401
+ const result = await find(options);
3402
+ return addPagersFn(find, options, result);
3403
+ },
3404
+ async findAll(options) {
3405
+ return findAllGeneric(find, options);
3406
+ },
3407
+ async findFirst(options) {
3408
+ const result = await find(options);
3409
+ return result.data[0];
3410
+ },
3411
+ async findById(authorizationId, options) {
3412
+ const rql = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', authorizationId).build();
3413
+ return await this.findFirst({ ...options, rql });
3414
+ },
3415
+ async remove(authorizationId, options) {
3416
+ const result = await client.delete(httpWithAuth, `/oauth2/authorizations/${authorizationId}`, options);
3417
+ return result.data;
3418
+ },
3419
+ };
3420
+ };
3421
+
3384
3422
  var oauth2 = (client, httpWithAuth) => ({
3385
3423
  tokens: createTokenService(client, httpWithAuth),
3386
3424
  refreshTokens: createRefreshTokenService(client, httpWithAuth),
3425
+ authorizations: authorizations(client, httpWithAuth),
3387
3426
  async createAuthorization(data, options) {
3388
3427
  return (await client.post(httpWithAuth, '/oauth2/authorizations', data, options)).data;
3389
3428
  },
@@ -5666,7 +5705,7 @@ const templatesV2Service = (httpWithAuth) => {
5666
5705
  };
5667
5706
  };
5668
5707
 
5669
- const version = '8.14.0-dev-196-5b15a56';
5708
+ const version = '8.14.0-dev-198-0b81795';
5670
5709
 
5671
5710
  /**
5672
5711
  * Create ExtraHorizon client.
@@ -5846,4 +5885,4 @@ const parseStoredCredentials = (fileContent) => exhCredentialsDecoder(fileConten
5846
5885
  .filter(line => line.length === 2)
5847
5886
  .reduce((memo, [key, value]) => ({ ...memo, [key]: value }), {}));
5848
5887
 
5849
- export { AccessTokenExpiredError, AccessTokenUnknownError, ActionType, ActivationRequestLimitError, ActivationRequestTimeoutError, ActivationUnknownError, AlreadyActivatedError, ApiError, ApiFunctionRequestMethod, ApiRequestErrorType, AppStoreTransactionAlreadyLinked, ApplicationNotAuthenticatedError, ApplicationType, ApplicationUnknownError, AuthenticationError, AuthorizationCodeExpiredError, AuthorizationUnknownError, BadGatewayServerError, BadRequestError, BodyFormatError, CallbackNotValidError, Comorbidities, DefaultLocalizationMissingError, DisabledForOidcUsersError, DuplicateRequestError, EmailUnknownError, EmailUsedError, EmptyBodyError, ErrorClassMap, FieldFormatError, FieldType, FileTooLargeError, FirebaseConnectionError, FirebaseInvalidPlatformDataError, ForbiddenError, ForgotPasswordRequestLimitError, ForgotPasswordRequestTimeoutError, FunctionPermissionMode, Gender, GlobalPermissionName, IDFormatError, IllegalArgumentError, IllegalStateError, Impediments, IncorrectPinCodeError, InvalidClientError, InvalidCurrencyForProductPrice, InvalidGrantError, InvalidMfaCodeError, InvalidMfaTokenError, InvalidNonceError, InvalidPKCEError, InvalidPresenceTokenError, InvalidReceiptDataError, InvalidRequestError, InvalidRqlError, InvalidTokenError, JSONSchemaType, LambdaInvocationError, LocalizationKeyMissingError, LockedDocumentError, LoginAttemptStatus, LoginFreezeError, LoginTimeoutError, MedicationFrequency, MedicationUnit, MfaReattemptDelayError, MfaRequiredError, MissingPKCEVerifierError, MissingRequiredFieldsError, NewMFARequiredError, NewPasswordHashUnknownError, NewPasswordPinCodeUnknownError, NoConfiguredAppStoreProduct, NoConfiguredPlayStoreProduct, NoMatchingPlayStoreLinkedSubscription, NoPermissionError, NotActivatedError, NotEnoughMfaMethodsError, NotFoundError, OAuth2ClientIdError, OAuth2ClientSecretError, OAuth2ErrorClassMap, OAuth2LoginError, OAuth2MissingClientCredentialsError, OauthKeyError, OauthSignatureError, OauthTokenError, OidcIdTokenError, OidcInvalidAuthorizationCodeError, OidcProviderResponseError, OrderSchemaStatus, PasswordError, PaymentIntentCreationSchemaPaymentMethodType, PaymentIntentCreationSchemaSetupPaymentMethodReuse, PinCodesNotEnabledError, PlayStoreTransactionAlreadyLinked, ProfileActivity, ProfileAlreadyExistsError, QueuedMailStatus, RefreshTokenExpiredError, RefreshTokenUnknownError, RemoveFieldError, RequestAbortedError, ResourceAlreadyExistsError, ResourceUnknownError, Results, ServerError, ServiceNotFoundError, ServiceUnavailableError, ServiceUnreachableError, StatusInUseError, StripePaymentMethodError, StripeRequestError, SubscriptionEntitlementSource, SubscriptionEntitlementStatus, SubscriptionEntitlementStatusCategory, SubscriptionEventSource, SubscriptionEventType, SupportedLanguageCodes, TaskStatus, TemplateFillingError, TemplateResolvingError, TemplateSyntaxError, TokenNotDeleteableError, TokenPermission, TooManyFailedAttemptsError, UnauthorizedClientError, UnauthorizedError, UnauthorizedTokenError, UnknownReceiptTransactionError, UnsupportedGrantError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UserNotAuthenticatedError, createClient, createOAuth1Client, createOAuth2Client, createProxyClient, findAllGeneric, findAllIterator, getMockSdkOAuth2 as getMockSdk, getMockSdkOAuth1, getMockSdkOAuth2, getMockSdkProxy, parseGlobalPermissions, parseStoredCredentials, recursiveMap, rqlBuilder, rqlParser };
5888
+ export { AccessTokenExpiredError, AccessTokenUnknownError, ActionType, ActivationRequestLimitError, ActivationRequestTimeoutError, ActivationUnknownError, AlreadyActivatedError, ApiError, ApiFunctionRequestMethod, ApiRequestErrorType, AppStoreTransactionAlreadyLinked, ApplicationNotAuthenticatedError, ApplicationType, ApplicationUnknownError, AuthenticationError, AuthorizationCodeExpiredError, AuthorizationUnknownError, BadGatewayServerError, BadRequestError, BodyFormatError, CallbackNotValidError, Comorbidities, DefaultLocalizationMissingError, DisabledForOidcUsersError, DuplicateRequestError, EmailUnknownError, EmailUsedError, EmptyBodyError, ErrorClassMap, FieldFormatError, FieldType, FileTooLargeError, FirebaseConnectionError, FirebaseInvalidPlatformDataError, ForbiddenError, ForgotPasswordRequestLimitError, ForgotPasswordRequestTimeoutError, FunctionPermissionMode, Gender, GlobalPermissionName, IDFormatError, IllegalArgumentError, IllegalStateError, Impediments, IncorrectPinCodeError, InvalidClientError, InvalidCurrencyForProductPrice, InvalidGrantError, InvalidMfaCodeError, InvalidMfaTokenError, InvalidNonceError, InvalidPKCEError, InvalidPresenceTokenError, InvalidReceiptDataError, InvalidRequestError, InvalidRqlError, InvalidTokenError, JSONSchemaType, LambdaInvocationError, LocalizationKeyMissingError, LockedDocumentError, LoginAttemptStatus, LoginFreezeError, LoginTimeoutError, MedicationFrequency, MedicationUnit, MfaReattemptDelayError, MfaRequiredError, MissingPKCEVerifierError, MissingRequiredFieldsError, NewMFARequiredError, NewPasswordHashUnknownError, NewPasswordPinCodeUnknownError, NoConfiguredAppStoreProduct, NoConfiguredPlayStoreProduct, NoMatchingPlayStoreLinkedSubscription, NoPermissionError, NotActivatedError, NotEnoughMfaMethodsError, NotFoundError, OAuth2ClientIdError, OAuth2ClientSecretError, OAuth2ErrorClassMap, OAuth2LoginError, OAuth2MissingClientCredentialsError, OauthKeyError, OauthSignatureError, OauthTokenError, OidcIdTokenError, OidcInvalidAuthorizationCodeError, OidcProviderResponseError, OrderSchemaStatus, PKCECodeMethods, PasswordError, PaymentIntentCreationSchemaPaymentMethodType, PaymentIntentCreationSchemaSetupPaymentMethodReuse, PinCodesNotEnabledError, PlayStoreTransactionAlreadyLinked, ProfileActivity, ProfileAlreadyExistsError, QueuedMailStatus, RefreshTokenExpiredError, RefreshTokenUnknownError, RemoveFieldError, RequestAbortedError, ResourceAlreadyExistsError, ResourceUnknownError, Results, ServerError, ServiceNotFoundError, ServiceUnavailableError, ServiceUnreachableError, StatusInUseError, StripePaymentMethodError, StripeRequestError, SubscriptionEntitlementSource, SubscriptionEntitlementStatus, SubscriptionEntitlementStatusCategory, SubscriptionEventSource, SubscriptionEventType, SupportedLanguageCodes, TaskStatus, TemplateFillingError, TemplateResolvingError, TemplateSyntaxError, TokenNotDeleteableError, TokenPermission, TooManyFailedAttemptsError, UnauthorizedClientError, UnauthorizedError, UnauthorizedTokenError, UnknownReceiptTransactionError, UnsupportedGrantError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UserNotAuthenticatedError, createClient, createOAuth1Client, createOAuth2Client, createProxyClient, findAllGeneric, findAllIterator, getMockSdkOAuth2 as getMockSdk, getMockSdkOAuth1, getMockSdkOAuth2, getMockSdkProxy, parseGlobalPermissions, parseStoredCredentials, recursiveMap, rqlBuilder, rqlParser };
@@ -524,6 +524,14 @@ export declare type MockClientOAuth1<MockFn> = {
524
524
  findById: MockFn;
525
525
  remove: MockFn;
526
526
  };
527
+ authorizations: {
528
+ create: MockFn;
529
+ find: MockFn;
530
+ findAll: MockFn;
531
+ findFirst: MockFn;
532
+ findById: MockFn;
533
+ remove: MockFn;
534
+ };
527
535
  createAuthorization: MockFn;
528
536
  getAuthorizations: MockFn;
529
537
  deleteAuthorization: MockFn;
@@ -1118,6 +1126,14 @@ export declare type MockClientOAuth2<MockFn> = {
1118
1126
  findById: MockFn;
1119
1127
  remove: MockFn;
1120
1128
  };
1129
+ authorizations: {
1130
+ create: MockFn;
1131
+ find: MockFn;
1132
+ findAll: MockFn;
1133
+ findFirst: MockFn;
1134
+ findById: MockFn;
1135
+ remove: MockFn;
1136
+ };
1121
1137
  createAuthorization: MockFn;
1122
1138
  getAuthorizations: MockFn;
1123
1139
  deleteAuthorization: MockFn;
@@ -1712,6 +1728,14 @@ export declare type MockClientProxy<MockFn> = {
1712
1728
  findById: MockFn;
1713
1729
  remove: MockFn;
1714
1730
  };
1731
+ authorizations: {
1732
+ create: MockFn;
1733
+ find: MockFn;
1734
+ findAll: MockFn;
1735
+ findFirst: MockFn;
1736
+ findById: MockFn;
1737
+ remove: MockFn;
1738
+ };
1715
1739
  createAuthorization: MockFn;
1716
1740
  getAuthorizations: MockFn;
1717
1741
  deleteAuthorization: MockFn;
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../../http/types';
2
+ import { HttpClient } from '../../../http-client';
3
+ import { OAuth2AuthorizationsService } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => OAuth2AuthorizationsService;
5
+ export default _default;
@@ -0,0 +1,67 @@
1
+ import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../../types';
2
+ import { OAuth2Authorization, OAuth2AuthorizationCreation, OAuth2AuthorizationCreationResponse } from '../types';
3
+ export interface OAuth2AuthorizationsService {
4
+ /**
5
+ * Create an OAuth2 authorization
6
+ *
7
+ * Permission | Scope | Effect
8
+ * - | - | -
9
+ * none | | Everyone can use this endpoint
10
+ */
11
+ create(data: OAuth2AuthorizationCreation, options?: OptionsBase): Promise<OAuth2AuthorizationCreationResponse>;
12
+ /**
13
+ * Get a list of OAuth2 authorizations
14
+ *
15
+ * Permission | Scope | Effect
16
+ * - | - | -
17
+ * none | | Can only see a list of OAuth2 authorizations for this account
18
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
19
+ * @param options.rql Add filters to the requested list
20
+ * @returns PagedResult<OAuth2Authorization>
21
+ */
22
+ find(options?: OptionsWithRql): Promise<PagedResult<OAuth2Authorization>>;
23
+ /**
24
+ * Get a list of OAuth2 authorizations
25
+ *
26
+ * Permission | Scope | Effect
27
+ * - | - | -
28
+ * none | | Can only see a list of OAuth2 authorizations for this account
29
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
30
+ * @param options.rql Add filters to the requested list
31
+ * @returns OAuth2Authorization[]
32
+ */
33
+ findAll(options?: OptionsWithRql): Promise<OAuth2Authorization[]>;
34
+ /**
35
+ * Get the first OAuth2 authorization found
36
+ *
37
+ * Permission | Scope | Effect
38
+ * - | - | -
39
+ * none | | Can only see a list of OAuth2 authorizations for this account
40
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
41
+ * @param options.rql Add filters to the requested list
42
+ * @returns {Promise<OAuth2Authorization | undefined>}
43
+ */
44
+ findFirst(options?: OptionsWithRql): Promise<OAuth2Authorization | undefined>;
45
+ /**
46
+ * Get an OAuth2 authorization by its id
47
+ *
48
+ * Permission | Scope | Effect
49
+ * - | - | -
50
+ * none | | Can only see a list of OAuth2 authorizations for this account
51
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
52
+ * @param authorizationId the authorization id
53
+ * @param options.rql Add filters to the requested list
54
+ * @returns {Promise<OAuth2Authorization | undefined>}
55
+ */
56
+ findById(authorizationId: string, options?: OptionsWithRql): Promise<OAuth2Authorization | undefined>;
57
+ /**
58
+ * Delete an OAuth2 authorization
59
+ *
60
+ * Permission | Scope | Effect
61
+ * - | - | -
62
+ * none | | Can only delete OAuth2 authorizations for this account
63
+ * DELETE_AUTHORIZATIONS | global | Delete any authorizations belonging to any user
64
+ * @param authorizationId the Authorization id
65
+ */
66
+ remove(authorizationId: string, options?: OptionsBase): Promise<AffectedRecords>;
67
+ }
@@ -1,7 +1,9 @@
1
1
  import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../types';
2
+ import { OAuth2AuthorizationsService } from './authorizations/types';
2
3
  export interface AuthOauth2Service {
3
4
  tokens: AuthOauth2TokenService;
4
5
  refreshTokens: OAuth2RefreshTokenService;
6
+ authorizations: OAuth2AuthorizationsService;
5
7
  /**
6
8
  * Create an OAuth2 authorization
7
9
  *
@@ -12,6 +14,7 @@ export interface AuthOauth2Service {
12
14
  * @throws {ApplicationUnknownError}
13
15
  * @throws {CallbackNotValidError}
14
16
  * @throws {UnsupportedResponseTypeError}
17
+ * @deprecated - Will be removed in a future version, please use `auth.oauth2.authorizations.create` instead
15
18
  */
16
19
  createAuthorization(data: OAuth2AuthorizationCreation, options?: OptionsBase): Promise<OAuth2AuthorizationCreationResponse>;
17
20
  /**
@@ -22,6 +25,7 @@ export interface AuthOauth2Service {
22
25
  * none | | Can only see a list of OAuth2 authorizations for this account
23
26
  * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
24
27
  * @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth2/get_oauth2_authorizations
28
+ * @deprecated - Will be removed in a future version, please use `auth.oauth2.authorizations.find*` instead
25
29
  */
26
30
  getAuthorizations(options?: OptionsWithRql): Promise<PagedResult<OAuth2Authorization>>;
27
31
  /**
@@ -33,6 +37,7 @@ export interface AuthOauth2Service {
33
37
  * DELETE_AUTHORIZATIONS | global | Delete any authorizations belonging to any user
34
38
  * @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_
35
39
  * @throws {ResourceUnknownError}
40
+ * @deprecated - Will be removed in a future version, please use `auth.oauth2.authorizations.remove` instead
36
41
  */
37
42
  deleteAuthorization(authorizationId: string, options?: OptionsWithRql): Promise<AffectedRecords>;
38
43
  }
@@ -147,11 +152,11 @@ export interface OAuth2RefreshTokenService {
147
152
  remove(id: string, options?: OptionsBase): Promise<AffectedRecords>;
148
153
  }
149
154
  export interface OAuth2AuthorizationCreation {
150
- responseType: string;
155
+ responseType: 'code';
151
156
  clientId: string;
152
157
  redirectUri?: string;
153
158
  state?: string;
154
- codeChallengeMethod?: string;
159
+ codeChallengeMethod?: PKCECodeMethods;
155
160
  codeChallenge?: string;
156
161
  }
157
162
  export interface OAuth2AuthorizationCreationResponse {
@@ -160,7 +165,7 @@ export interface OAuth2AuthorizationCreationResponse {
160
165
  userId: string;
161
166
  redirectUri: string;
162
167
  state?: string;
163
- codeChallengeMethod?: string;
168
+ codeChallengeMethod?: PKCECodeMethods;
164
169
  codeChallenge?: string;
165
170
  authorizationCode: string;
166
171
  expiryTimestamp: Date;
@@ -173,7 +178,7 @@ export interface OAuth2Authorization {
173
178
  userId: string;
174
179
  redirectUri: string;
175
180
  state?: string;
176
- codeChallengeMethod?: string;
181
+ codeChallengeMethod?: PKCECodeMethods;
177
182
  /**
178
183
  @deprecated `codeChallenge` will be removed from responses returned by listing endpoints in a future version.
179
184
  */
@@ -207,3 +212,7 @@ export interface OAuth2RefreshToken {
207
212
  updateTimestamp: Date;
208
213
  creationTimestamp: Date;
209
214
  }
215
+ export declare enum PKCECodeMethods {
216
+ PLAIN = "plain",
217
+ S256 = "S256"
218
+ }
@@ -524,6 +524,14 @@ export declare type MockClientOAuth1<MockFn> = {
524
524
  findById: MockFn;
525
525
  remove: MockFn;
526
526
  };
527
+ authorizations: {
528
+ create: MockFn;
529
+ find: MockFn;
530
+ findAll: MockFn;
531
+ findFirst: MockFn;
532
+ findById: MockFn;
533
+ remove: MockFn;
534
+ };
527
535
  createAuthorization: MockFn;
528
536
  getAuthorizations: MockFn;
529
537
  deleteAuthorization: MockFn;
@@ -1118,6 +1126,14 @@ export declare type MockClientOAuth2<MockFn> = {
1118
1126
  findById: MockFn;
1119
1127
  remove: MockFn;
1120
1128
  };
1129
+ authorizations: {
1130
+ create: MockFn;
1131
+ find: MockFn;
1132
+ findAll: MockFn;
1133
+ findFirst: MockFn;
1134
+ findById: MockFn;
1135
+ remove: MockFn;
1136
+ };
1121
1137
  createAuthorization: MockFn;
1122
1138
  getAuthorizations: MockFn;
1123
1139
  deleteAuthorization: MockFn;
@@ -1712,6 +1728,14 @@ export declare type MockClientProxy<MockFn> = {
1712
1728
  findById: MockFn;
1713
1729
  remove: MockFn;
1714
1730
  };
1731
+ authorizations: {
1732
+ create: MockFn;
1733
+ find: MockFn;
1734
+ findAll: MockFn;
1735
+ findFirst: MockFn;
1736
+ findById: MockFn;
1737
+ remove: MockFn;
1738
+ };
1715
1739
  createAuthorization: MockFn;
1716
1740
  getAuthorizations: MockFn;
1717
1741
  deleteAuthorization: MockFn;
@@ -0,0 +1,5 @@
1
+ import { HttpInstance } from '../../../../http/types';
2
+ import { HttpClient } from '../../../http-client';
3
+ import { OAuth2AuthorizationsService } from './types';
4
+ declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => OAuth2AuthorizationsService;
5
+ export default _default;
@@ -0,0 +1,67 @@
1
+ import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../../types';
2
+ import { OAuth2Authorization, OAuth2AuthorizationCreation, OAuth2AuthorizationCreationResponse } from '../types';
3
+ export interface OAuth2AuthorizationsService {
4
+ /**
5
+ * Create an OAuth2 authorization
6
+ *
7
+ * Permission | Scope | Effect
8
+ * - | - | -
9
+ * none | | Everyone can use this endpoint
10
+ */
11
+ create(data: OAuth2AuthorizationCreation, options?: OptionsBase): Promise<OAuth2AuthorizationCreationResponse>;
12
+ /**
13
+ * Get a list of OAuth2 authorizations
14
+ *
15
+ * Permission | Scope | Effect
16
+ * - | - | -
17
+ * none | | Can only see a list of OAuth2 authorizations for this account
18
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
19
+ * @param options.rql Add filters to the requested list
20
+ * @returns PagedResult<OAuth2Authorization>
21
+ */
22
+ find(options?: OptionsWithRql): Promise<PagedResult<OAuth2Authorization>>;
23
+ /**
24
+ * Get a list of OAuth2 authorizations
25
+ *
26
+ * Permission | Scope | Effect
27
+ * - | - | -
28
+ * none | | Can only see a list of OAuth2 authorizations for this account
29
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
30
+ * @param options.rql Add filters to the requested list
31
+ * @returns OAuth2Authorization[]
32
+ */
33
+ findAll(options?: OptionsWithRql): Promise<OAuth2Authorization[]>;
34
+ /**
35
+ * Get the first OAuth2 authorization found
36
+ *
37
+ * Permission | Scope | Effect
38
+ * - | - | -
39
+ * none | | Can only see a list of OAuth2 authorizations for this account
40
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
41
+ * @param options.rql Add filters to the requested list
42
+ * @returns {Promise<OAuth2Authorization | undefined>}
43
+ */
44
+ findFirst(options?: OptionsWithRql): Promise<OAuth2Authorization | undefined>;
45
+ /**
46
+ * Get an OAuth2 authorization by its id
47
+ *
48
+ * Permission | Scope | Effect
49
+ * - | - | -
50
+ * none | | Can only see a list of OAuth2 authorizations for this account
51
+ * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
52
+ * @param authorizationId the authorization id
53
+ * @param options.rql Add filters to the requested list
54
+ * @returns {Promise<OAuth2Authorization | undefined>}
55
+ */
56
+ findById(authorizationId: string, options?: OptionsWithRql): Promise<OAuth2Authorization | undefined>;
57
+ /**
58
+ * Delete an OAuth2 authorization
59
+ *
60
+ * Permission | Scope | Effect
61
+ * - | - | -
62
+ * none | | Can only delete OAuth2 authorizations for this account
63
+ * DELETE_AUTHORIZATIONS | global | Delete any authorizations belonging to any user
64
+ * @param authorizationId the Authorization id
65
+ */
66
+ remove(authorizationId: string, options?: OptionsBase): Promise<AffectedRecords>;
67
+ }
@@ -1,7 +1,9 @@
1
1
  import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../types';
2
+ import { OAuth2AuthorizationsService } from './authorizations/types';
2
3
  export interface AuthOauth2Service {
3
4
  tokens: AuthOauth2TokenService;
4
5
  refreshTokens: OAuth2RefreshTokenService;
6
+ authorizations: OAuth2AuthorizationsService;
5
7
  /**
6
8
  * Create an OAuth2 authorization
7
9
  *
@@ -12,6 +14,7 @@ export interface AuthOauth2Service {
12
14
  * @throws {ApplicationUnknownError}
13
15
  * @throws {CallbackNotValidError}
14
16
  * @throws {UnsupportedResponseTypeError}
17
+ * @deprecated - Will be removed in a future version, please use `auth.oauth2.authorizations.create` instead
15
18
  */
16
19
  createAuthorization(data: OAuth2AuthorizationCreation, options?: OptionsBase): Promise<OAuth2AuthorizationCreationResponse>;
17
20
  /**
@@ -22,6 +25,7 @@ export interface AuthOauth2Service {
22
25
  * none | | Can only see a list of OAuth2 authorizations for this account
23
26
  * VIEW_AUTHORIZATIONS | global | See any authorizations belonging to any user
24
27
  * @see https://swagger.extrahorizon.com/swagger-ui/?url=https://swagger.extrahorizon.com/auth-service/2.0.4-dev/openapi.yaml#/OAuth2/get_oauth2_authorizations
28
+ * @deprecated - Will be removed in a future version, please use `auth.oauth2.authorizations.find*` instead
25
29
  */
26
30
  getAuthorizations(options?: OptionsWithRql): Promise<PagedResult<OAuth2Authorization>>;
27
31
  /**
@@ -33,6 +37,7 @@ export interface AuthOauth2Service {
33
37
  * DELETE_AUTHORIZATIONS | global | Delete any authorizations belonging to any user
34
38
  * @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_
35
39
  * @throws {ResourceUnknownError}
40
+ * @deprecated - Will be removed in a future version, please use `auth.oauth2.authorizations.remove` instead
36
41
  */
37
42
  deleteAuthorization(authorizationId: string, options?: OptionsWithRql): Promise<AffectedRecords>;
38
43
  }
@@ -147,11 +152,11 @@ export interface OAuth2RefreshTokenService {
147
152
  remove(id: string, options?: OptionsBase): Promise<AffectedRecords>;
148
153
  }
149
154
  export interface OAuth2AuthorizationCreation {
150
- responseType: string;
155
+ responseType: 'code';
151
156
  clientId: string;
152
157
  redirectUri?: string;
153
158
  state?: string;
154
- codeChallengeMethod?: string;
159
+ codeChallengeMethod?: PKCECodeMethods;
155
160
  codeChallenge?: string;
156
161
  }
157
162
  export interface OAuth2AuthorizationCreationResponse {
@@ -160,7 +165,7 @@ export interface OAuth2AuthorizationCreationResponse {
160
165
  userId: string;
161
166
  redirectUri: string;
162
167
  state?: string;
163
- codeChallengeMethod?: string;
168
+ codeChallengeMethod?: PKCECodeMethods;
164
169
  codeChallenge?: string;
165
170
  authorizationCode: string;
166
171
  expiryTimestamp: Date;
@@ -173,7 +178,7 @@ export interface OAuth2Authorization {
173
178
  userId: string;
174
179
  redirectUri: string;
175
180
  state?: string;
176
- codeChallengeMethod?: string;
181
+ codeChallengeMethod?: PKCECodeMethods;
177
182
  /**
178
183
  @deprecated `codeChallenge` will be removed from responses returned by listing endpoints in a future version.
179
184
  */
@@ -207,3 +212,7 @@ export interface OAuth2RefreshToken {
207
212
  updateTimestamp: Date;
208
213
  creationTimestamp: Date;
209
214
  }
215
+ export declare enum PKCECodeMethods {
216
+ PLAIN = "plain",
217
+ S256 = "S256"
218
+ }
@@ -1 +1 @@
1
- export declare const version = "8.14.0-dev-196-5b15a56";
1
+ export declare const version = "8.14.0-dev-198-0b81795";
@@ -1 +1 @@
1
- export declare const version = "8.14.0-dev-196-5b15a56";
1
+ export declare const version = "8.14.0-dev-198-0b81795";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.14.0-dev-196-5b15a56",
3
+ "version": "8.14.0-dev-198-0b81795",
4
4
  "description": "This package serves as a JavaScript wrapper around all Extra Horizon cloud services.",
5
5
  "main": "build/index.cjs.js",
6
6
  "types": "build/types/index.d.ts",