@extrahorizon/javascript-sdk 8.13.0-dev-184-9d8c16c → 8.13.0-dev-188-731b41d

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 CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [8.13.0]
9
9
 
10
+ ### Added
11
+ - Added the `exh.auth.oauth2.refreshTokens.find*` methods to retrieve refresh tokens
12
+ - Added the `exh.auth.oauth2.refreshTokens.remove` method to delete a refresh token
13
+
10
14
  ### Fixed
11
15
  - The following methods are now correctly typed
12
16
  - `exh.auth.oauth1.consumeSsoToken`
@@ -3410,6 +3410,7 @@ function createTokenService$1(client, httpWithAuth) {
3410
3410
 
3411
3411
  var oauth2 = (client, httpWithAuth) => ({
3412
3412
  tokens: createTokenService(client, httpWithAuth),
3413
+ refreshTokens: createRefreshTokenService(client, httpWithAuth),
3413
3414
  async createAuthorization(data, options) {
3414
3415
  return (await client.post(httpWithAuth, '/oauth2/authorizations', data, options)).data;
3415
3416
  },
@@ -3441,6 +3442,34 @@ function createTokenService(client, httpWithAuth) {
3441
3442
  },
3442
3443
  };
3443
3444
  }
3445
+ function createRefreshTokenService(client, httpWithAuth) {
3446
+ async function find(options) {
3447
+ const result = await client.get(httpWithAuth, `/oauth2/refreshTokens${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
3448
+ return result.data;
3449
+ }
3450
+ return {
3451
+ async find(options) {
3452
+ const result = await find(options);
3453
+ return addPagersFn(find, options, result);
3454
+ },
3455
+ async findAll(options) {
3456
+ return await findAllGeneric(find, options);
3457
+ },
3458
+ async findFirst(options) {
3459
+ const result = await find(options);
3460
+ return result.data[0];
3461
+ },
3462
+ async findById(id, options) {
3463
+ const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
3464
+ const result = await find({ ...options, rql: rqlWithId });
3465
+ return result.data[0];
3466
+ },
3467
+ async remove(id, options) {
3468
+ const result = (await client.delete(httpWithAuth, `/oauth2/refreshTokens/${id}`, options));
3469
+ return result.data;
3470
+ },
3471
+ };
3472
+ }
3444
3473
 
3445
3474
  var loginAttempts = (oidcClient, httpWithAuth) => {
3446
3475
  async function query(options) {
@@ -5664,7 +5693,7 @@ const templatesV2Service = (httpWithAuth) => {
5664
5693
  };
5665
5694
  };
5666
5695
 
5667
- const version = '8.13.0-dev-184-9d8c16c';
5696
+ const version = '8.13.0-dev-188-731b41d';
5668
5697
 
5669
5698
  /**
5670
5699
  * Create ExtraHorizon client.
package/build/index.mjs CHANGED
@@ -3380,6 +3380,7 @@ function createTokenService$1(client, httpWithAuth) {
3380
3380
 
3381
3381
  var oauth2 = (client, httpWithAuth) => ({
3382
3382
  tokens: createTokenService(client, httpWithAuth),
3383
+ refreshTokens: createRefreshTokenService(client, httpWithAuth),
3383
3384
  async createAuthorization(data, options) {
3384
3385
  return (await client.post(httpWithAuth, '/oauth2/authorizations', data, options)).data;
3385
3386
  },
@@ -3411,6 +3412,34 @@ function createTokenService(client, httpWithAuth) {
3411
3412
  },
3412
3413
  };
3413
3414
  }
3415
+ function createRefreshTokenService(client, httpWithAuth) {
3416
+ async function find(options) {
3417
+ const result = await client.get(httpWithAuth, `/oauth2/refreshTokens${(options === null || options === void 0 ? void 0 : options.rql) || ''}`, options);
3418
+ return result.data;
3419
+ }
3420
+ return {
3421
+ async find(options) {
3422
+ const result = await find(options);
3423
+ return addPagersFn(find, options, result);
3424
+ },
3425
+ async findAll(options) {
3426
+ return await findAllGeneric(find, options);
3427
+ },
3428
+ async findFirst(options) {
3429
+ const result = await find(options);
3430
+ return result.data[0];
3431
+ },
3432
+ async findById(id, options) {
3433
+ const rqlWithId = rqlBuilder(options === null || options === void 0 ? void 0 : options.rql).eq('id', id).build();
3434
+ const result = await find({ ...options, rql: rqlWithId });
3435
+ return result.data[0];
3436
+ },
3437
+ async remove(id, options) {
3438
+ const result = (await client.delete(httpWithAuth, `/oauth2/refreshTokens/${id}`, options));
3439
+ return result.data;
3440
+ },
3441
+ };
3442
+ }
3414
3443
 
3415
3444
  var loginAttempts = (oidcClient, httpWithAuth) => {
3416
3445
  async function query(options) {
@@ -5634,7 +5663,7 @@ const templatesV2Service = (httpWithAuth) => {
5634
5663
  };
5635
5664
  };
5636
5665
 
5637
- const version = '8.13.0-dev-184-9d8c16c';
5666
+ const version = '8.13.0-dev-188-731b41d';
5638
5667
 
5639
5668
  /**
5640
5669
  * Create ExtraHorizon client.
@@ -517,6 +517,13 @@ export declare type MockClientOAuth1<MockFn> = {
517
517
  findAll: MockFn;
518
518
  remove: MockFn;
519
519
  };
520
+ refreshTokens: {
521
+ find: MockFn;
522
+ findAll: MockFn;
523
+ findFirst: MockFn;
524
+ findById: MockFn;
525
+ remove: MockFn;
526
+ };
520
527
  createAuthorization: MockFn;
521
528
  getAuthorizations: MockFn;
522
529
  deleteAuthorization: MockFn;
@@ -1104,6 +1111,13 @@ export declare type MockClientOAuth2<MockFn> = {
1104
1111
  findAll: MockFn;
1105
1112
  remove: MockFn;
1106
1113
  };
1114
+ refreshTokens: {
1115
+ find: MockFn;
1116
+ findAll: MockFn;
1117
+ findFirst: MockFn;
1118
+ findById: MockFn;
1119
+ remove: MockFn;
1120
+ };
1107
1121
  createAuthorization: MockFn;
1108
1122
  getAuthorizations: MockFn;
1109
1123
  deleteAuthorization: MockFn;
@@ -1691,6 +1705,13 @@ export declare type MockClientProxy<MockFn> = {
1691
1705
  findAll: MockFn;
1692
1706
  remove: MockFn;
1693
1707
  };
1708
+ refreshTokens: {
1709
+ find: MockFn;
1710
+ findAll: MockFn;
1711
+ findFirst: MockFn;
1712
+ findById: MockFn;
1713
+ remove: MockFn;
1714
+ };
1694
1715
  createAuthorization: MockFn;
1695
1716
  getAuthorizations: MockFn;
1696
1717
  deleteAuthorization: MockFn;
@@ -1,4 +1,4 @@
1
- import type { HttpInstance } from '../../../types';
1
+ import { HttpInstance } from '../../../types';
2
2
  import { HttpClient } from '../../http-client';
3
3
  import type { AuthOauth2Service } from './types';
4
4
  declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => AuthOauth2Service;
@@ -1,6 +1,7 @@
1
1
  import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../types';
2
2
  export interface AuthOauth2Service {
3
3
  tokens: AuthOauth2TokenService;
4
+ refreshTokens: OAuth2RefreshTokenService;
4
5
  /**
5
6
  * Create an OAuth2 authorization
6
7
  *
@@ -79,6 +80,68 @@ export interface AuthOauth2TokenService {
79
80
  */
80
81
  remove(id: string): Promise<AffectedRecords>;
81
82
  }
83
+ export interface OAuth2RefreshTokenService {
84
+ /**
85
+ * # Get a list of OAuth2 refresh tokens
86
+ *
87
+ * Permission | Scope | Effect
88
+ * - | - | -
89
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
90
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
91
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
92
+ * @param options.rql Add filters to the requested list
93
+ * @returns PagedResult<OAuth2RefreshToken>
94
+ */
95
+ find(options?: OptionsWithRql): Promise<PagedResult<OAuth2RefreshToken>>;
96
+ /**
97
+ * Get a list of OAuth2 refresh tokens
98
+ *
99
+ * Permission | Scope | Effect
100
+ * - | - | -
101
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
102
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
103
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
104
+ * @param options.rql Add filters to the requested list
105
+ * @returns OAuth2RefreshToken[]
106
+ */
107
+ findAll(options?: OptionsWithRql): Promise<OAuth2RefreshToken[]>;
108
+ /**
109
+ * Get the first OAuth2 refresh token found
110
+ *
111
+ * Permission | Scope | Effect
112
+ * - | - | -
113
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
114
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
115
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
116
+ * @param options.rql Add filters to the requested list
117
+ * @returns {Promise<OAuth2RefreshToken | undefined>}
118
+ */
119
+ findFirst(options?: OptionsWithRql): Promise<OAuth2RefreshToken | undefined>;
120
+ /**
121
+ * Get an oAuth2 refresh token by its id
122
+ *
123
+ * Permission | Scope | Effect
124
+ * - | - | -
125
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
126
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
127
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
128
+ * @param id the refresh token id
129
+ * @param options.rql Add filters to the requested list
130
+ * @returns {Promise<OAuth2RefreshToken | undefined>}
131
+ */
132
+ findById(id: string, options?: OptionsWithRql): Promise<OAuth2RefreshToken | undefined>;
133
+ /**
134
+ * Delete an oAuth2 refresh token
135
+ *
136
+ * Permission | Scope | Effect
137
+ * - | - | -
138
+ * DELETE_OAUTH2_REFRESH_TOKEN or DELETE_AUTHORIZATIONS | global | Required for this endpoint
139
+ * Using DELETE_AUTHORIZATIONS for this endpoint is deprecated; use DELETE_OAUTH2_REFRESH_TOKEN instead
140
+ * @param id the refresh token id
141
+ * @returns AffectedRecords
142
+ */
143
+ remove(id: string, options?: OptionsBase): Promise<AffectedRecords>;
144
+ }
82
145
  export interface OAuth2AuthorizationCreation {
83
146
  responseType: string;
84
147
  clientId: string;
@@ -132,3 +195,11 @@ export interface OAuth2Token {
132
195
  updateTimestamp: Date;
133
196
  creationTimestamp: Date;
134
197
  }
198
+ export interface OAuth2RefreshToken {
199
+ id: string;
200
+ applicationId: string;
201
+ userId: string;
202
+ expiryTimestamp: Date;
203
+ updateTimestamp: Date;
204
+ creationTimestamp: Date;
205
+ }
@@ -517,6 +517,13 @@ export declare type MockClientOAuth1<MockFn> = {
517
517
  findAll: MockFn;
518
518
  remove: MockFn;
519
519
  };
520
+ refreshTokens: {
521
+ find: MockFn;
522
+ findAll: MockFn;
523
+ findFirst: MockFn;
524
+ findById: MockFn;
525
+ remove: MockFn;
526
+ };
520
527
  createAuthorization: MockFn;
521
528
  getAuthorizations: MockFn;
522
529
  deleteAuthorization: MockFn;
@@ -1104,6 +1111,13 @@ export declare type MockClientOAuth2<MockFn> = {
1104
1111
  findAll: MockFn;
1105
1112
  remove: MockFn;
1106
1113
  };
1114
+ refreshTokens: {
1115
+ find: MockFn;
1116
+ findAll: MockFn;
1117
+ findFirst: MockFn;
1118
+ findById: MockFn;
1119
+ remove: MockFn;
1120
+ };
1107
1121
  createAuthorization: MockFn;
1108
1122
  getAuthorizations: MockFn;
1109
1123
  deleteAuthorization: MockFn;
@@ -1691,6 +1705,13 @@ export declare type MockClientProxy<MockFn> = {
1691
1705
  findAll: MockFn;
1692
1706
  remove: MockFn;
1693
1707
  };
1708
+ refreshTokens: {
1709
+ find: MockFn;
1710
+ findAll: MockFn;
1711
+ findFirst: MockFn;
1712
+ findById: MockFn;
1713
+ remove: MockFn;
1714
+ };
1694
1715
  createAuthorization: MockFn;
1695
1716
  getAuthorizations: MockFn;
1696
1717
  deleteAuthorization: MockFn;
@@ -1,4 +1,4 @@
1
- import type { HttpInstance } from '../../../types';
1
+ import { HttpInstance } from '../../../types';
2
2
  import { HttpClient } from '../../http-client';
3
3
  import type { AuthOauth2Service } from './types';
4
4
  declare const _default: (client: HttpClient, httpWithAuth: HttpInstance) => AuthOauth2Service;
@@ -1,6 +1,7 @@
1
1
  import { AffectedRecords, OptionsBase, OptionsWithRql, PagedResult } from '../../types';
2
2
  export interface AuthOauth2Service {
3
3
  tokens: AuthOauth2TokenService;
4
+ refreshTokens: OAuth2RefreshTokenService;
4
5
  /**
5
6
  * Create an OAuth2 authorization
6
7
  *
@@ -79,6 +80,68 @@ export interface AuthOauth2TokenService {
79
80
  */
80
81
  remove(id: string): Promise<AffectedRecords>;
81
82
  }
83
+ export interface OAuth2RefreshTokenService {
84
+ /**
85
+ * # Get a list of OAuth2 refresh tokens
86
+ *
87
+ * Permission | Scope | Effect
88
+ * - | - | -
89
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
90
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
91
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
92
+ * @param options.rql Add filters to the requested list
93
+ * @returns PagedResult<OAuth2RefreshToken>
94
+ */
95
+ find(options?: OptionsWithRql): Promise<PagedResult<OAuth2RefreshToken>>;
96
+ /**
97
+ * Get a list of OAuth2 refresh tokens
98
+ *
99
+ * Permission | Scope | Effect
100
+ * - | - | -
101
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
102
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
103
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
104
+ * @param options.rql Add filters to the requested list
105
+ * @returns OAuth2RefreshToken[]
106
+ */
107
+ findAll(options?: OptionsWithRql): Promise<OAuth2RefreshToken[]>;
108
+ /**
109
+ * Get the first OAuth2 refresh token found
110
+ *
111
+ * Permission | Scope | Effect
112
+ * - | - | -
113
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
114
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
115
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
116
+ * @param options.rql Add filters to the requested list
117
+ * @returns {Promise<OAuth2RefreshToken | undefined>}
118
+ */
119
+ findFirst(options?: OptionsWithRql): Promise<OAuth2RefreshToken | undefined>;
120
+ /**
121
+ * Get an oAuth2 refresh token by its id
122
+ *
123
+ * Permission | Scope | Effect
124
+ * - | - | -
125
+ * none | | Can only see a list of OAuth2 refresh tokens for this account
126
+ * VIEW_OAUTH2_REFRESH_TOKENS or VIEW_AUTHORIZATIONS | global | Can see a list of OAuth2 refresh tokens for any account
127
+ * Using VIEW_AUTHORIZATIONS for this endpoint is deprecated; use VIEW_OAUTH2_REFRESH_TOKENS instead
128
+ * @param id the refresh token id
129
+ * @param options.rql Add filters to the requested list
130
+ * @returns {Promise<OAuth2RefreshToken | undefined>}
131
+ */
132
+ findById(id: string, options?: OptionsWithRql): Promise<OAuth2RefreshToken | undefined>;
133
+ /**
134
+ * Delete an oAuth2 refresh token
135
+ *
136
+ * Permission | Scope | Effect
137
+ * - | - | -
138
+ * DELETE_OAUTH2_REFRESH_TOKEN or DELETE_AUTHORIZATIONS | global | Required for this endpoint
139
+ * Using DELETE_AUTHORIZATIONS for this endpoint is deprecated; use DELETE_OAUTH2_REFRESH_TOKEN instead
140
+ * @param id the refresh token id
141
+ * @returns AffectedRecords
142
+ */
143
+ remove(id: string, options?: OptionsBase): Promise<AffectedRecords>;
144
+ }
82
145
  export interface OAuth2AuthorizationCreation {
83
146
  responseType: string;
84
147
  clientId: string;
@@ -132,3 +195,11 @@ export interface OAuth2Token {
132
195
  updateTimestamp: Date;
133
196
  creationTimestamp: Date;
134
197
  }
198
+ export interface OAuth2RefreshToken {
199
+ id: string;
200
+ applicationId: string;
201
+ userId: string;
202
+ expiryTimestamp: Date;
203
+ updateTimestamp: Date;
204
+ creationTimestamp: Date;
205
+ }
@@ -1 +1 @@
1
- export declare const version = "8.13.0-dev-184-9d8c16c";
1
+ export declare const version = "8.13.0-dev-188-731b41d";
@@ -1 +1 @@
1
- export declare const version = "8.13.0-dev-184-9d8c16c";
1
+ export declare const version = "8.13.0-dev-188-731b41d";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/javascript-sdk",
3
- "version": "8.13.0-dev-184-9d8c16c",
3
+ "version": "8.13.0-dev-188-731b41d",
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",