attlaz-client 1.13.28 → 1.13.30
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/dist/Client.d.ts +2 -0
- package/dist/Client.js +5 -0
- package/dist/Model/AccessToken/UserAccessToken.d.ts +16 -0
- package/dist/Model/AccessToken/UserAccessToken.js +30 -0
- package/dist/Service/AccessTokenEndpoint.d.ts +7 -0
- package/dist/Service/AccessTokenEndpoint.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
|
29
29
|
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
30
30
|
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
31
31
|
import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
|
|
32
|
+
import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
|
|
32
33
|
export declare class Client {
|
|
33
34
|
private endpoints;
|
|
34
35
|
private httpClient;
|
|
@@ -75,6 +76,7 @@ export declare class Client {
|
|
|
75
76
|
getCodeSourceStrategiesEndpoint(): CodeSourceStrategiesEndpoint;
|
|
76
77
|
getSearchEndpoint(): SearchEndpoint;
|
|
77
78
|
getUserActionEndpoint(): UserActionEndpoint;
|
|
79
|
+
getAccessTokenEndpoint(): AccessTokenEndpoint;
|
|
78
80
|
getFirewallEndpoint(): FirewallEndpoint;
|
|
79
81
|
private getEndpoint;
|
|
80
82
|
}
|
package/dist/Client.js
CHANGED
|
@@ -30,6 +30,7 @@ import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
|
30
30
|
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
31
31
|
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
32
32
|
import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
|
|
33
|
+
import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
|
|
33
34
|
export class Client {
|
|
34
35
|
endpoints;
|
|
35
36
|
httpClient;
|
|
@@ -63,6 +64,7 @@ export class Client {
|
|
|
63
64
|
FirewallEndpoint,
|
|
64
65
|
SearchEndpoint,
|
|
65
66
|
UserActionEndpoint,
|
|
67
|
+
AccessTokenEndpoint,
|
|
66
68
|
};
|
|
67
69
|
apiEndpoint = 'https://api.attlaz.com';
|
|
68
70
|
parseConfig(config) {
|
|
@@ -197,6 +199,9 @@ export class Client {
|
|
|
197
199
|
getUserActionEndpoint() {
|
|
198
200
|
return this.getEndpoint('useraction', this.Store.UserActionEndpoint);
|
|
199
201
|
}
|
|
202
|
+
getAccessTokenEndpoint() {
|
|
203
|
+
return this.getEndpoint('accesstoken', this.Store.AccessTokenEndpoint);
|
|
204
|
+
}
|
|
200
205
|
// TODO: this should be in a separate API?
|
|
201
206
|
getFirewallEndpoint() {
|
|
202
207
|
return this.getEndpoint('firewall', this.Store.FirewallEndpoint);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StateAware } from '../StateAware.js';
|
|
2
|
+
import { State } from '../State.js';
|
|
3
|
+
export declare class UserAccessToken implements StateAware {
|
|
4
|
+
id: string;
|
|
5
|
+
accessTokenId: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
ipWhitelist: string[];
|
|
8
|
+
note: string | null;
|
|
9
|
+
permissions: string[];
|
|
10
|
+
secretRedacted: string | null;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
lastUsedAt: Date | null;
|
|
13
|
+
expiresAt: Date | null;
|
|
14
|
+
state: State;
|
|
15
|
+
static parse(rawUser: any): UserAccessToken;
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { State } from '../State.js';
|
|
2
|
+
import { Utils } from '../../Utils.js';
|
|
3
|
+
export class UserAccessToken {
|
|
4
|
+
id;
|
|
5
|
+
accessTokenId;
|
|
6
|
+
userId;
|
|
7
|
+
ipWhitelist = [];
|
|
8
|
+
note = null;
|
|
9
|
+
permissions = [];
|
|
10
|
+
secretRedacted = null;
|
|
11
|
+
createdAt;
|
|
12
|
+
lastUsedAt = null;
|
|
13
|
+
expiresAt = null;
|
|
14
|
+
state = State.Active;
|
|
15
|
+
static parse(rawUser) {
|
|
16
|
+
const userAccessToken = new UserAccessToken();
|
|
17
|
+
userAccessToken.id = rawUser.id;
|
|
18
|
+
userAccessToken.accessTokenId = rawUser.access_token;
|
|
19
|
+
userAccessToken.userId = rawUser.user;
|
|
20
|
+
userAccessToken.ipWhitelist = rawUser.ip_whitelist;
|
|
21
|
+
userAccessToken.note = rawUser.note;
|
|
22
|
+
userAccessToken.permissions = rawUser.permissions;
|
|
23
|
+
userAccessToken.secretRedacted = rawUser.secret_redacted;
|
|
24
|
+
userAccessToken.createdAt = Utils.parseRawDate(rawUser.created_at);
|
|
25
|
+
userAccessToken.lastUsedAt = rawUser.last_used_at === null ? null : Utils.parseRawDate(rawUser.last_used_at);
|
|
26
|
+
userAccessToken.expiresAt = rawUser.expires_at === null ? null : Utils.parseRawDate(rawUser.expires_at);
|
|
27
|
+
userAccessToken.state = State.fromString(rawUser.state);
|
|
28
|
+
return userAccessToken;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Endpoint } from './Endpoint.js';
|
|
2
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
4
|
+
import { UserAccessToken } from '../Model/AccessToken/UserAccessToken.js';
|
|
5
|
+
export declare class AccessTokenEndpoint extends Endpoint {
|
|
6
|
+
getByUser(pagination: CursorPagination): Promise<CollectionResult<UserAccessToken>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Endpoint } from './Endpoint.js';
|
|
2
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
3
|
+
import { UserAccessToken } from '../Model/AccessToken/UserAccessToken.js';
|
|
4
|
+
export class AccessTokenEndpoint extends Endpoint {
|
|
5
|
+
async getByUser(pagination) {
|
|
6
|
+
const q = new QueryString('/access-tokens');
|
|
7
|
+
q.addPagination(pagination);
|
|
8
|
+
try {
|
|
9
|
+
const result = await this.requestCollection(q, UserAccessToken.parse);
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
14
|
+
console.error('Failed to load user access tokens: ' + e);
|
|
15
|
+
}
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { ClientError } from './Http/ClientError.js';
|
|
|
11
11
|
/**
|
|
12
12
|
* Models
|
|
13
13
|
*/
|
|
14
|
+
export { UserAccessToken } from './Model/AccessToken/UserAccessToken.js';
|
|
14
15
|
export { Adapter } from './Model/Adapter/Adapter.js';
|
|
15
16
|
export { AdapterConfiguration } from './Model/Adapter/AdapterConfiguration.js';
|
|
16
17
|
export { AdapterConnection } from './Model/Adapter/AdapterConnection.js';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { ClientError } from './Http/ClientError.js';
|
|
|
11
11
|
/**
|
|
12
12
|
* Models
|
|
13
13
|
*/
|
|
14
|
+
export { UserAccessToken } from './Model/AccessToken/UserAccessToken.js';
|
|
14
15
|
export { Adapter } from './Model/Adapter/Adapter.js';
|
|
15
16
|
export { AdapterConfiguration } from './Model/Adapter/AdapterConfiguration.js';
|
|
16
17
|
export { AdapterConnection } from './Model/Adapter/AdapterConnection.js';
|