attlaz-client 1.9.45 → 1.9.47
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/Http/Data/QueryString.d.ts +5 -0
- package/dist/Http/Data/QueryString.js +19 -0
- package/dist/Model/Pagination/CursorPagination.d.ts +4 -0
- package/dist/Model/Pagination/CursorPagination.js +10 -0
- package/dist/Model/Project/ProjectDeploy.d.ts +5 -5
- package/dist/Model/Project/ProjectDeploy.js +8 -3
- package/dist/Service/Endpoint.d.ts +3 -0
- package/dist/Service/Endpoint.js +13 -0
- package/dist/Service/LogEndpoint.d.ts +2 -0
- package/dist/Service/LogEndpoint.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryString = void 0;
|
|
4
|
+
class QueryString {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.parameters = [];
|
|
7
|
+
}
|
|
8
|
+
set(parameter, value) {
|
|
9
|
+
this.parameters.push({ parameter, value });
|
|
10
|
+
}
|
|
11
|
+
build() {
|
|
12
|
+
const output = [];
|
|
13
|
+
for (const parameter of this.parameters) {
|
|
14
|
+
output.push(parameter.parameter + '=' + parameter.value);
|
|
15
|
+
}
|
|
16
|
+
return output.join('&');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.QueryString = QueryString;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CursorPagination = void 0;
|
|
4
|
+
class CursorPagination {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.limit = null;
|
|
7
|
+
this.startingAfter = null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CursorPagination = CursorPagination;
|
|
@@ -6,13 +6,13 @@ export declare class ProjectDeploy {
|
|
|
6
6
|
buildStrategyId: string;
|
|
7
7
|
userId: string;
|
|
8
8
|
requested: Date;
|
|
9
|
-
started: Date;
|
|
10
|
-
finished: Date;
|
|
9
|
+
started: Date | null;
|
|
10
|
+
finished: Date | null;
|
|
11
11
|
status: ProjectDeployStatus;
|
|
12
|
-
bytes: number;
|
|
12
|
+
bytes: number | null;
|
|
13
13
|
commits: ProjectDeployCommit[];
|
|
14
|
-
path: string;
|
|
15
|
-
commitHash: string;
|
|
14
|
+
path: string | null;
|
|
15
|
+
commitHash: string | null;
|
|
16
16
|
errors: {
|
|
17
17
|
message: string;
|
|
18
18
|
}[] | null;
|
|
@@ -6,8 +6,13 @@ const ProjectDeployCommit_1 = require("./ProjectDeployCommit");
|
|
|
6
6
|
const Utils_1 = require("../../Utils");
|
|
7
7
|
class ProjectDeploy {
|
|
8
8
|
constructor() {
|
|
9
|
+
this.started = null;
|
|
10
|
+
this.finished = null;
|
|
9
11
|
this.status = ProjectDeployStatus_1.ProjectDeployStatus.Unknown;
|
|
12
|
+
this.bytes = null;
|
|
10
13
|
this.commits = [];
|
|
14
|
+
this.path = null;
|
|
15
|
+
this.commitHash = null;
|
|
11
16
|
this.errors = null;
|
|
12
17
|
}
|
|
13
18
|
static parse(rawProjectDeploy) {
|
|
@@ -17,10 +22,10 @@ class ProjectDeploy {
|
|
|
17
22
|
projectDeploy.buildStrategyId = rawProjectDeploy.build_strategy;
|
|
18
23
|
projectDeploy.userId = rawProjectDeploy.user;
|
|
19
24
|
projectDeploy.requested = Utils_1.Utils.parseRawDate(rawProjectDeploy.requested);
|
|
20
|
-
projectDeploy.started = Utils_1.Utils.parseRawDate(rawProjectDeploy.started);
|
|
21
|
-
projectDeploy.finished = Utils_1.Utils.parseRawDate(rawProjectDeploy.finished);
|
|
25
|
+
projectDeploy.started = rawProjectDeploy.started === null ? null : Utils_1.Utils.parseRawDate(rawProjectDeploy.started);
|
|
26
|
+
projectDeploy.finished = rawProjectDeploy.finished === null ? null : Utils_1.Utils.parseRawDate(rawProjectDeploy.finished);
|
|
22
27
|
projectDeploy.status = ProjectDeployStatus_1.ProjectDeployStatus.fromString(rawProjectDeploy.status);
|
|
23
|
-
projectDeploy.bytes = parseInt(rawProjectDeploy.bytes);
|
|
28
|
+
projectDeploy.bytes = rawProjectDeploy.bytes === null ? null : parseInt(rawProjectDeploy.bytes);
|
|
24
29
|
projectDeploy.path = rawProjectDeploy.path;
|
|
25
30
|
projectDeploy.commitHash = rawProjectDeploy.commit_hash;
|
|
26
31
|
const rawProjectDeployCommits = rawProjectDeploy.commits;
|
|
@@ -2,6 +2,8 @@ import { OAuthClient } from '../Http/OAuthClient';
|
|
|
2
2
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
3
3
|
import { ObjectResult } from '../Model/Result/ObjectResult';
|
|
4
4
|
import { Parameters } from '../Http/Data/Parameters';
|
|
5
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination';
|
|
6
|
+
import { QueryString } from '../Http/Data/QueryString';
|
|
5
7
|
export declare abstract class Endpoint {
|
|
6
8
|
protected httpClient: OAuthClient;
|
|
7
9
|
constructor(httpClient: OAuthClient);
|
|
@@ -11,4 +13,5 @@ export declare abstract class Endpoint {
|
|
|
11
13
|
requestObject<T>(action: string, parameters: Parameters | undefined, parser: (input: any) => T, method?: string, signWithOauthToken?: boolean): Promise<ObjectResult<T>>;
|
|
12
14
|
parseCollection<T>(rawData: object[], parser: (input: any) => T): T[];
|
|
13
15
|
private parseObject;
|
|
16
|
+
protected buildQuery(pagination: CursorPagination | null): QueryString;
|
|
14
17
|
}
|
package/dist/Service/Endpoint.js
CHANGED
|
@@ -9,6 +9,7 @@ const ObjectWrapper_1 = require("../Model/Result/ObjectWrapper");
|
|
|
9
9
|
const DataValueCollection_1 = require("../Model/DataValueCollection");
|
|
10
10
|
const JsonSerializable_1 = require("../Model/JsonSerializable");
|
|
11
11
|
const LogStreamId_1 = require("../Model/Log/LogStreamId");
|
|
12
|
+
const QueryString_1 = require("../Http/Data/QueryString");
|
|
12
13
|
class Endpoint {
|
|
13
14
|
constructor(httpClient) {
|
|
14
15
|
this.httpClient = httpClient;
|
|
@@ -132,5 +133,17 @@ class Endpoint {
|
|
|
132
133
|
const parsedData = parser(wrappedData);
|
|
133
134
|
return parsedData;
|
|
134
135
|
}
|
|
136
|
+
buildQuery(pagination) {
|
|
137
|
+
const queryString = new QueryString_1.QueryString();
|
|
138
|
+
if (pagination !== null && pagination !== undefined) {
|
|
139
|
+
if (pagination.limit !== null && pagination.limit !== undefined) {
|
|
140
|
+
queryString.set('limit', pagination.limit);
|
|
141
|
+
}
|
|
142
|
+
if (pagination.startingAfter !== null && pagination.startingAfter !== undefined) {
|
|
143
|
+
queryString.set('starting_after', pagination.startingAfter);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return queryString;
|
|
147
|
+
}
|
|
135
148
|
}
|
|
136
149
|
exports.Endpoint = Endpoint;
|
|
@@ -5,8 +5,10 @@ import { LogStreamId } from '../Model/Log/LogStreamId';
|
|
|
5
5
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
6
6
|
import { LogStreamInformation } from '../Model/Log/LogStreamInformation';
|
|
7
7
|
import { LogStream } from '../Model/Log/LogStream';
|
|
8
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination';
|
|
8
9
|
export declare class LogEndpoint extends Endpoint {
|
|
9
10
|
getLogs(logQuery: LogQuery): Promise<CollectionResult<Log>>;
|
|
11
|
+
getCursoredLogEntries(logStreamId: LogStreamId, pagination: CursorPagination | null): Promise<CollectionResult<Log>>;
|
|
10
12
|
save(log: Log): Promise<Log>;
|
|
11
13
|
delete(logId: string): Promise<boolean>;
|
|
12
14
|
clear(logStreamId: LogStreamId): Promise<boolean>;
|
|
@@ -43,6 +43,12 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
43
43
|
const result = await this.requestCollection(cmd, null, Log_1.Log.parse);
|
|
44
44
|
return result;
|
|
45
45
|
}
|
|
46
|
+
async getCursoredLogEntries(logStreamId, pagination) {
|
|
47
|
+
const queryString = this.buildQuery(pagination);
|
|
48
|
+
let cmd = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/logs/?' + queryString.build();
|
|
49
|
+
const result = await this.requestCollection(cmd, null, Log_1.Log.parse);
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
46
52
|
async save(log) {
|
|
47
53
|
try {
|
|
48
54
|
let cmd = '/logstreams/' + Utils_1.Utils.base64encode(log.logStream.id) + '/logs';
|