attlaz-client 1.63.0 → 1.64.0

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
@@ -8,6 +8,7 @@ import { ChannelEndpoint } from './Service/ChannelEndpoint.js';
8
8
  import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint.js';
9
9
  import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
10
10
  import { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
11
+ import { CommandExecutionEndpoint } from './Service/CommandExecutionEndpoint.js';
11
12
  import { ConfigEndpoint } from './Service/ConfigEndpoint.js';
12
13
  import { ConfigurationEndpoint } from './Service/ConfigurationEndpoint.js';
13
14
  import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
@@ -95,6 +96,7 @@ export declare class Client {
95
96
  getCodeSourceStrategiesEndpoint(): CodeSourceStrategiesEndpoint;
96
97
  getSearchEndpoint(): SearchEndpoint;
97
98
  getUserActionEndpoint(): UserActionEndpoint;
99
+ getCommandExecutionEndpoint(): CommandExecutionEndpoint;
98
100
  getAccessTokenEndpoint(): AccessTokenEndpoint;
99
101
  getCollectionsEndpoint(): CollectionsEndpoint;
100
102
  getRunnerPoolEndpoint(): RunnerPoolEndpoint;
package/dist/Client.js CHANGED
@@ -8,6 +8,7 @@ import { ChannelEndpoint } from './Service/ChannelEndpoint.js';
8
8
  import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint.js';
9
9
  import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
10
10
  import { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
11
+ import { CommandExecutionEndpoint } from './Service/CommandExecutionEndpoint.js';
11
12
  import { ConfigEndpoint } from './Service/ConfigEndpoint.js';
12
13
  import { ConfigurationEndpoint } from './Service/ConfigurationEndpoint.js';
13
14
  import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
@@ -46,6 +47,7 @@ export class Client {
46
47
  ChannelEndpoint,
47
48
  CodeDeployEndpoint,
48
49
  CodeSourceStrategiesEndpoint,
50
+ CommandExecutionEndpoint,
49
51
  ConfigEndpoint,
50
52
  FirewallEndpoint,
51
53
  FlowEndpoint,
@@ -231,6 +233,9 @@ export class Client {
231
233
  getUserActionEndpoint() {
232
234
  return this.getEndpoint('useraction', this.Store.UserActionEndpoint);
233
235
  }
236
+ getCommandExecutionEndpoint() {
237
+ return this.getEndpoint('commandexecution', this.Store.CommandExecutionEndpoint);
238
+ }
234
239
  getAccessTokenEndpoint() {
235
240
  return this.getEndpoint('accesstoken', this.Store.AccessTokenEndpoint);
236
241
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Display/filter status of a user API key. Mirrors the server enum
3
+ * (Library/Core Attlaz-OAuth/Model/UserAccessTokenStatus). Folds the derived "expired" concept
4
+ * (computed from the expiry date, not stored) on top of the stored state.
5
+ */
6
+ export declare enum UserAccessTokenStatus {
7
+ Active = "active",
8
+ Inactive = "inactive",
9
+ Expired = "expired",
10
+ Revoked = "revoked"
11
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Display/filter status of a user API key. Mirrors the server enum
3
+ * (Library/Core Attlaz-OAuth/Model/UserAccessTokenStatus). Folds the derived "expired" concept
4
+ * (computed from the expiry date, not stored) on top of the stored state.
5
+ */
6
+ export var UserAccessTokenStatus;
7
+ (function (UserAccessTokenStatus) {
8
+ UserAccessTokenStatus["Active"] = "active";
9
+ UserAccessTokenStatus["Inactive"] = "inactive";
10
+ UserAccessTokenStatus["Expired"] = "expired";
11
+ UserAccessTokenStatus["Revoked"] = "revoked";
12
+ })(UserAccessTokenStatus || (UserAccessTokenStatus = {}));
@@ -18,7 +18,7 @@ export class AdapterConnection extends MetaDataAware {
18
18
  adapterConnection.projectId = rawAdapterConnection.project;
19
19
  adapterConnection.state = State.fromString(rawAdapterConnection.state);
20
20
  adapterConnection.status = AdapterConnectionStatus.fromString(rawAdapterConnection.status);
21
- adapterConnection.lastUsedAt = (rawAdapterConnection.last_used === null || rawAdapterConnection.last_used === undefined) ? null : Utils.parseRawDate(rawAdapterConnection.last_used);
21
+ adapterConnection.lastUsedAt = (rawAdapterConnection.last_used_at === null || rawAdapterConnection.last_used_at === undefined) ? null : Utils.parseRawDate(rawAdapterConnection.last_used_at);
22
22
  return adapterConnection;
23
23
  }
24
24
  }
@@ -0,0 +1,6 @@
1
+ import { CommandExecutionStatus } from './CommandExecutionStatus.js';
2
+ export interface CommandExecutionFilter {
3
+ status?: CommandExecutionStatus;
4
+ type?: string;
5
+ requestedBy?: string;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { DataValueCollection } from '../DataValueCollection.js';
2
+ import { CommandExecutionStatus } from './CommandExecutionStatus.js';
3
+ export declare class CommandExecutionHistory {
4
+ id: string;
5
+ commandType: string;
6
+ commandTime: Date;
7
+ commandData: DataValueCollection;
8
+ commandVersion: string;
9
+ requestedBy: string;
10
+ executionStarted: Date | null;
11
+ executionFinished: Date | null;
12
+ executionStatus: CommandExecutionStatus;
13
+ executionError: string | null;
14
+ executionResult: string | null;
15
+ }
@@ -0,0 +1,15 @@
1
+ export class CommandExecutionHistory {
2
+ id;
3
+ commandType;
4
+ commandTime;
5
+ commandData;
6
+ commandVersion;
7
+ // The user that requested the command (the platform system user for cron/event/maintenance commands).
8
+ requestedBy;
9
+ executionStarted;
10
+ executionFinished;
11
+ executionStatus;
12
+ executionError;
13
+ // Structured result payload as a JSON string (e.g. '{"removedCount": 1234}'); shape depends on the command type.
14
+ executionResult;
15
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum CommandExecutionStatus {
2
+ Pending = "pending",
3
+ Running = "running",
4
+ Completed = "completed",
5
+ Failed = "failed"
6
+ }
7
+ export declare namespace CommandExecutionStatus {
8
+ const fromString: (input: string) => CommandExecutionStatus;
9
+ }
@@ -0,0 +1,20 @@
1
+ export var CommandExecutionStatus;
2
+ (function (CommandExecutionStatus) {
3
+ CommandExecutionStatus["Pending"] = "pending";
4
+ CommandExecutionStatus["Running"] = "running";
5
+ CommandExecutionStatus["Completed"] = "completed";
6
+ CommandExecutionStatus["Failed"] = "failed";
7
+ })(CommandExecutionStatus || (CommandExecutionStatus = {}));
8
+ (function (CommandExecutionStatus) {
9
+ CommandExecutionStatus.fromString = (input) => {
10
+ switch (input) {
11
+ case CommandExecutionStatus.Pending:
12
+ case CommandExecutionStatus.Running:
13
+ case CommandExecutionStatus.Completed:
14
+ case CommandExecutionStatus.Failed:
15
+ return input;
16
+ default:
17
+ throw new Error('Unknown CommandExecutionStatus "' + input + '"');
18
+ }
19
+ };
20
+ })(CommandExecutionStatus || (CommandExecutionStatus = {}));
@@ -1 +1 @@
1
- export type FilterOperator = 'eq' | 'neq' | 'in' | 'not_in' | 'lt' | 'lte' | 'gt' | 'gte' | 'is_null' | 'is_not_null' | 'starts_with' | 'contains';
1
+ export type FilterOperator = 'eq' | 'neq' | 'in' | 'not_in' | 'lt' | 'lte' | 'gt' | 'gte' | 'is_null' | 'is_not_null' | 'starts_with' | 'ends_with' | 'contains';
@@ -9,6 +9,7 @@ export declare class ProjectEnvironment extends MetaDataAware implements StateAw
9
9
  projectId: string;
10
10
  codeSourceId: string | null;
11
11
  parentId: string | null;
12
+ defaultRunnerPoolId: string | null;
12
13
  type: ProjectEnvironmentType;
13
14
  state: State;
14
15
  static parse(rawProjectEnvironment: ApiRecord): ProjectEnvironment;
@@ -7,6 +7,7 @@ export class ProjectEnvironment extends MetaDataAware {
7
7
  projectId;
8
8
  codeSourceId = null;
9
9
  parentId = null;
10
+ defaultRunnerPoolId = null;
10
11
  type = ProjectEnvironmentType.Production;
11
12
  state = State.Active;
12
13
  static parse(rawProjectEnvironment) {
@@ -16,6 +17,7 @@ export class ProjectEnvironment extends MetaDataAware {
16
17
  projectEnvironment.projectId = rawProjectEnvironment.project;
17
18
  projectEnvironment.codeSourceId = rawProjectEnvironment.code_source;
18
19
  projectEnvironment.parentId = rawProjectEnvironment.parent;
20
+ projectEnvironment.defaultRunnerPoolId = rawProjectEnvironment.default_runner_pool;
19
21
  projectEnvironment.type = ProjectEnvironmentType.fromString(rawProjectEnvironment.type);
20
22
  projectEnvironment.state = State.fromString(rawProjectEnvironment.state);
21
23
  return projectEnvironment;
@@ -1,5 +1,6 @@
1
1
  import { ApiRecord } from '../ApiRecord.js';
2
2
  export declare class ProviderTokenAccessToken {
3
3
  accessToken: string;
4
+ expiresAt: Date | null;
4
5
  static parse(rawToken: ApiRecord): ProviderTokenAccessToken;
5
6
  }
@@ -1,8 +1,11 @@
1
1
  export class ProviderTokenAccessToken {
2
2
  accessToken;
3
+ // When the access token expires — lets callers cache it for the run instead of re-fetching per call.
4
+ expiresAt = null;
3
5
  static parse(rawToken) {
4
6
  const token = new ProviderTokenAccessToken();
5
7
  token.accessToken = rawToken.access_token;
8
+ token.expiresAt = rawToken.expires_at !== undefined && rawToken.expires_at !== null ? new Date(rawToken.expires_at) : null;
6
9
  return token;
7
10
  }
8
11
  }
@@ -1,9 +1,10 @@
1
1
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
2
2
  import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
3
3
  import { UserAccessToken } from '../Model/AccessToken/UserAccessToken.js';
4
+ import { UserAccessTokenStatus } from '../Model/AccessToken/UserAccessTokenStatus.js';
4
5
  import { Endpoint } from './Endpoint.js';
5
6
  export declare class AccessTokenEndpoint extends Endpoint {
6
- getByUser(pagination: CursorPagination): Promise<CollectionResult<UserAccessToken>>;
7
+ getByUser(pagination: CursorPagination, status?: UserAccessTokenStatus | null): Promise<CollectionResult<UserAccessToken>>;
7
8
  create(name: string, scopes: string[], expiresAt: Date): Promise<UserAccessToken>;
8
9
  update(tokenId: string, name: string, scopes: string[]): Promise<UserAccessToken>;
9
10
  revoke(tokenId: string): Promise<boolean>;
@@ -2,9 +2,12 @@ import { QueryString } from '../Http/Data/QueryString.js';
2
2
  import { UserAccessToken } from '../Model/AccessToken/UserAccessToken.js';
3
3
  import { Endpoint } from './Endpoint.js';
4
4
  export class AccessTokenEndpoint extends Endpoint {
5
- async getByUser(pagination) {
5
+ async getByUser(pagination, status = null) {
6
6
  const queryString = new QueryString('/access-tokens');
7
7
  queryString.addPagination(pagination);
8
+ if (status !== null) {
9
+ queryString.set('status', status);
10
+ }
8
11
  try {
9
12
  const result = await this.requestCollection(queryString, UserAccessToken.parse);
10
13
  return result;
@@ -0,0 +1,10 @@
1
+ import { CommandExecutionFilter } from '../Model/Command/CommandExecutionFilter.js';
2
+ import { CommandExecutionHistory } from '../Model/Command/CommandExecutionHistory.js';
3
+ import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
4
+ import { CollectionResult } from '../Model/Result/CollectionResult.js';
5
+ import { Endpoint } from './Endpoint.js';
6
+ export declare class CommandExecutionEndpoint extends Endpoint {
7
+ getAll(pagination?: CursorPagination | null, filter?: CommandExecutionFilter | null): Promise<CollectionResult<CommandExecutionHistory>>;
8
+ getById(id: string): Promise<CommandExecutionHistory | null>;
9
+ private static parse;
10
+ }
@@ -0,0 +1,44 @@
1
+ import { QueryString } from '../Http/Data/QueryString.js';
2
+ import { CommandExecutionHistory } from '../Model/Command/CommandExecutionHistory.js';
3
+ import { CommandExecutionStatus } from '../Model/Command/CommandExecutionStatus.js';
4
+ import { DataValueCollection } from '../Model/DataValueCollection.js';
5
+ import { Utils } from '../Utils.js';
6
+ import { Endpoint } from './Endpoint.js';
7
+ export class CommandExecutionEndpoint extends Endpoint {
8
+ async getAll(pagination = null, filter = null) {
9
+ const queryString = new QueryString('/system/command-executions');
10
+ queryString.addPagination(pagination);
11
+ if (filter !== null) {
12
+ if (filter.status !== undefined) {
13
+ queryString.set('status', filter.status);
14
+ }
15
+ if (filter.type !== undefined) {
16
+ queryString.set('type', filter.type);
17
+ }
18
+ if (filter.requestedBy !== undefined) {
19
+ queryString.set('requested_by', filter.requestedBy);
20
+ }
21
+ }
22
+ return await this.requestCollection(queryString, CommandExecutionEndpoint.parse, null, 'GET');
23
+ }
24
+ async getById(id) {
25
+ const queryString = new QueryString('/system/command-executions/' + id);
26
+ const result = await this.requestObject(queryString, null, CommandExecutionEndpoint.parse, 'GET');
27
+ return result.getData();
28
+ }
29
+ static parse(raw) {
30
+ const history = new CommandExecutionHistory();
31
+ history.id = raw.id;
32
+ history.commandType = raw.command_type;
33
+ history.commandTime = Utils.parseRawDate(raw.command_time);
34
+ history.commandData = DataValueCollection.fromObject(raw.command_data);
35
+ history.commandVersion = raw.command_version;
36
+ history.requestedBy = raw.requested_by;
37
+ history.executionStarted = (raw.execution_started === null || raw.execution_started === undefined) ? null : Utils.parseRawDate(raw.execution_started);
38
+ history.executionFinished = (raw.execution_finished === null || raw.execution_finished === undefined) ? null : Utils.parseRawDate(raw.execution_finished);
39
+ history.executionStatus = CommandExecutionStatus.fromString(raw.execution_status);
40
+ history.executionError = raw.execution_error ?? null;
41
+ history.executionResult = raw.execution_result ?? null;
42
+ return history;
43
+ }
44
+ }
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { LoadAllHelper } from './Helper/LoadAllHelper.js';
24
24
  * Models
25
25
  */
26
26
  export { UserAccessToken } from './Model/AccessToken/UserAccessToken.js';
27
+ export { UserAccessTokenStatus } from './Model/AccessToken/UserAccessTokenStatus.js';
27
28
  export { Adapter } from './Model/Adapter/Adapter.js';
28
29
  export { AdapterConfiguration } from './Model/Adapter/AdapterConfiguration.js';
29
30
  export { AdapterConnection } from './Model/Adapter/AdapterConnection.js';
@@ -127,6 +128,9 @@ export { User } from './Model/User/User.js';
127
128
  export { UserAuthProvider } from './Model/User/UserAuthProvider.js';
128
129
  export { UserAction } from './Model/User/UserAction.js';
129
130
  export { RunnerImage } from './Model/Runner/RunnerImage.js';
131
+ export { CommandExecutionHistory } from './Model/Command/CommandExecutionHistory.js';
132
+ export { CommandExecutionStatus } from './Model/Command/CommandExecutionStatus.js';
133
+ export { CommandExecutionFilter } from './Model/Command/CommandExecutionFilter.js';
130
134
  export { Endpoint } from './Service/Endpoint.js';
131
135
  export { AdapterEndpoint } from './Service/AdapterEndpoint.js';
132
136
  export { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ export { LoadAllHelper } from './Helper/LoadAllHelper.js';
17
17
  * Models
18
18
  */
19
19
  export { UserAccessToken } from './Model/AccessToken/UserAccessToken.js';
20
+ export { UserAccessTokenStatus } from './Model/AccessToken/UserAccessTokenStatus.js';
20
21
  export { Adapter } from './Model/Adapter/Adapter.js';
21
22
  export { AdapterConfiguration } from './Model/Adapter/AdapterConfiguration.js';
22
23
  export { AdapterConnection } from './Model/Adapter/AdapterConnection.js';
@@ -115,6 +116,8 @@ export { User } from './Model/User/User.js';
115
116
  export { UserAuthProvider } from './Model/User/UserAuthProvider.js';
116
117
  export { UserAction } from './Model/User/UserAction.js';
117
118
  export { RunnerImage } from './Model/Runner/RunnerImage.js';
119
+ export { CommandExecutionHistory } from './Model/Command/CommandExecutionHistory.js';
120
+ export { CommandExecutionStatus } from './Model/Command/CommandExecutionStatus.js';
118
121
  export { Endpoint } from './Service/Endpoint.js';
119
122
  /* Endpoints */
120
123
  export { AdapterEndpoint } from './Service/AdapterEndpoint.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.62.0";
1
+ export declare const VERSION = "1.64.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.62.0";
1
+ export const VERSION = "1.64.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.63.0",
3
+ "version": "1.64.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",