attlaz-client 1.13.27 → 1.13.29

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 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,29 @@
1
+ import { State } from '../State.js';
2
+ export class UserAccessToken {
3
+ id;
4
+ accessTokenId;
5
+ userId;
6
+ ipWhitelist = [];
7
+ note = null;
8
+ permissions = [];
9
+ secretRedacted = null;
10
+ createdAt;
11
+ lastUsedAt = null;
12
+ expiresAt = null;
13
+ state = State.Active;
14
+ static parse(rawUser) {
15
+ const user = new UserAccessToken();
16
+ user.id = rawUser.id;
17
+ user.accessTokenId = rawUser.access_token;
18
+ user.userId = rawUser.user_id;
19
+ user.ipWhitelist = rawUser.ip_whitelist;
20
+ user.note = rawUser.note;
21
+ user.permissions = rawUser.permissions;
22
+ user.secretRedacted = rawUser.secret_redacted;
23
+ user.createdAt = rawUser.created_at;
24
+ user.lastUsedAt = rawUser.last_used_at;
25
+ user.expiresAt = rawUser.expires_at;
26
+ user.state = State.fromString(rawUser.state);
27
+ return user;
28
+ }
29
+ }
@@ -14,5 +14,10 @@ export declare class CodeSource implements StateAware {
14
14
  runStrategyId: string;
15
15
  description: string;
16
16
  state: State;
17
+ usage: {
18
+ flows: number;
19
+ environments: number;
20
+ } | null;
21
+ deploys: number | null;
17
22
  static parse(rawCodeSource: any): CodeSource;
18
23
  }
@@ -9,6 +9,8 @@ export class CodeSource {
9
9
  runStrategyId;
10
10
  description;
11
11
  state = State.Active;
12
+ usage = null;
13
+ deploys = null;
12
14
  static parse(rawCodeSource) {
13
15
  const codeSource = new CodeSource();
14
16
  codeSource.id = rawCodeSource.id;
@@ -20,6 +22,12 @@ export class CodeSource {
20
22
  codeSource.runStrategyId = rawCodeSource.run_strategy;
21
23
  codeSource.description = rawCodeSource.description;
22
24
  codeSource.state = State.fromString(rawCodeSource.state);
25
+ if (Object.prototype.hasOwnProperty.call(rawCodeSource, 'usage')) {
26
+ codeSource.usage = rawCodeSource.usage;
27
+ }
28
+ if (Object.prototype.hasOwnProperty.call(rawCodeSource, 'deploys')) {
29
+ codeSource.deploys = rawCodeSource.deploys;
30
+ }
23
31
  return codeSource;
24
32
  }
25
33
  }
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.13.27",
3
+ "version": "1.13.29",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",