attlaz-client 1.9.21 → 1.9.23
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/Model/Log/LogQuery.d.ts +4 -4
- package/dist/Model/Log/LogQuery.js +4 -2
- package/dist/Model/Log/LogStreamId.d.ts +1 -0
- package/dist/Model/Log/LogStreamId.js +3 -0
- package/dist/Model/Project/ProjectDeploy.js +1 -1
- package/dist/Model/User/UserAuthProvider.js +1 -3
- package/dist/Service/Endpoint.js +6 -4
- package/dist/Service/LogEndpoint.js +6 -2
- package/dist/Service/UserEndpoint.js +6 -6
- package/dist/Utils.d.ts +1 -0
- package/dist/Utils.js +4 -0
- package/package.json +1 -1
|
@@ -5,13 +5,13 @@ export declare class LogQuery {
|
|
|
5
5
|
readonly logStreamId: LogStreamId;
|
|
6
6
|
message: string | null;
|
|
7
7
|
hidden: boolean | null;
|
|
8
|
-
logLevels: LogLevel[];
|
|
8
|
+
logLevels: LogLevel[] | null;
|
|
9
9
|
tags: Array<{
|
|
10
10
|
key: string;
|
|
11
11
|
values: DataValueValue[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
}> | null;
|
|
13
|
+
limit: number;
|
|
14
|
+
startingAfterId: string | null;
|
|
15
15
|
sort: Array<{
|
|
16
16
|
field: string;
|
|
17
17
|
direction: number;
|
|
@@ -5,8 +5,10 @@ class LogQuery {
|
|
|
5
5
|
constructor(logStreamId) {
|
|
6
6
|
this.message = null;
|
|
7
7
|
this.hidden = null;
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
8
|
+
this.logLevels = null;
|
|
9
|
+
this.tags = null;
|
|
10
|
+
this.limit = 1000;
|
|
11
|
+
this.startingAfterId = null;
|
|
10
12
|
this.logStreamId = logStreamId;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
@@ -12,7 +12,7 @@ class ProjectDeploy {
|
|
|
12
12
|
static parse(rawProjectDeploy) {
|
|
13
13
|
const projectDeploy = new ProjectDeploy();
|
|
14
14
|
projectDeploy.id = rawProjectDeploy.id.toString();
|
|
15
|
-
projectDeploy.platformId = rawProjectDeploy.
|
|
15
|
+
projectDeploy.platformId = rawProjectDeploy.platform;
|
|
16
16
|
projectDeploy.buildStrategyId = rawProjectDeploy.build_strategy;
|
|
17
17
|
projectDeploy.userId = rawProjectDeploy.user;
|
|
18
18
|
projectDeploy.requested = new Date(rawProjectDeploy.requested);
|
|
@@ -15,9 +15,7 @@ class UserAuthProvider {
|
|
|
15
15
|
userAuthProvider.provider = raw.provider;
|
|
16
16
|
userAuthProvider.providerUserId = raw.provider_user;
|
|
17
17
|
userAuthProvider.providerUserEmail = raw.provider_user_email;
|
|
18
|
-
|
|
19
|
-
userAuthProvider.lastUsed = Utils_1.Utils.parseRawDate(raw.last_used);
|
|
20
|
-
}
|
|
18
|
+
userAuthProvider.lastUsed = Utils_1.Utils.parseRawDate(raw.last_used);
|
|
21
19
|
userAuthProvider.state = State_1.State.fromString(raw.state);
|
|
22
20
|
return userAuthProvider;
|
|
23
21
|
}
|
package/dist/Service/Endpoint.js
CHANGED
|
@@ -8,6 +8,7 @@ const Utils_1 = require("../Utils");
|
|
|
8
8
|
const ObjectWrapper_1 = require("../Model/Result/ObjectWrapper");
|
|
9
9
|
const DataValueCollection_1 = require("../Model/DataValueCollection");
|
|
10
10
|
const JsonSerializable_1 = require("../Model/JsonSerializable");
|
|
11
|
+
const LogStreamId_1 = require("../Model/Log/LogStreamId");
|
|
11
12
|
class Endpoint {
|
|
12
13
|
constructor(httpClient) {
|
|
13
14
|
this.httpClient = httpClient;
|
|
@@ -23,9 +24,9 @@ class Endpoint {
|
|
|
23
24
|
}
|
|
24
25
|
return result;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (Utils_1.Utils.isDate(data)) {
|
|
28
|
+
return data.toISOString();
|
|
29
|
+
}
|
|
29
30
|
// tODo: this does not seem to work correclty
|
|
30
31
|
if (data instanceof JsonSerializable_1.JsonSerializable && 'jsonSerialize' in data) {
|
|
31
32
|
return data.jsonSerialize();
|
|
@@ -41,7 +42,8 @@ class Endpoint {
|
|
|
41
42
|
// data instanceof UserId ||
|
|
42
43
|
// data instanceof DataCollectionResult ||
|
|
43
44
|
// data instanceof SuccessResult ||
|
|
44
|
-
data instanceof DataValueCollection_1.DataValueCollection
|
|
45
|
+
data instanceof DataValueCollection_1.DataValueCollection ||
|
|
46
|
+
data instanceof LogStreamId_1.LogStreamId) {
|
|
45
47
|
return this.formatParameters(data.jsonSerialize());
|
|
46
48
|
}
|
|
47
49
|
const result = {};
|
|
@@ -10,8 +10,12 @@ const LogStream_1 = require("../Model/Log/LogStream");
|
|
|
10
10
|
class LogEndpoint extends Endpoint_1.Endpoint {
|
|
11
11
|
async getLogs(logQuery) {
|
|
12
12
|
const arrQuery = [];
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (logQuery.limit !== null) {
|
|
14
|
+
arrQuery.push('limit=' + logQuery.limit);
|
|
15
|
+
}
|
|
16
|
+
if (logQuery.startingAfterId !== null) {
|
|
17
|
+
arrQuery.push('starting_after=' + logQuery.startingAfterId);
|
|
18
|
+
}
|
|
15
19
|
// Resolved
|
|
16
20
|
if (logQuery.hidden !== null && logQuery.hidden !== undefined) {
|
|
17
21
|
if (logQuery.hidden) {
|
|
@@ -6,7 +6,7 @@ const Endpoint_1 = require("./Endpoint");
|
|
|
6
6
|
const User_1 = require("../Model/User");
|
|
7
7
|
class UserEndpoint extends Endpoint_1.Endpoint {
|
|
8
8
|
async getUser() {
|
|
9
|
-
let cmd = '/
|
|
9
|
+
let cmd = '/users';
|
|
10
10
|
const rawUser = await this.requestObject(cmd, null, User_1.User.parse);
|
|
11
11
|
return rawUser.getData();
|
|
12
12
|
}
|
|
@@ -38,7 +38,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
38
38
|
const parser = (raw) => {
|
|
39
39
|
return raw;
|
|
40
40
|
};
|
|
41
|
-
const result = await this.requestObject('/
|
|
41
|
+
const result = await this.requestObject('/users/auth/providers', { provider_type: providerType, code: data.code, state: data.state }, parser, 'POST');
|
|
42
42
|
// TODO validation
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
@@ -54,7 +54,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
54
54
|
const parser = (raw) => {
|
|
55
55
|
return { deleted: raw.deleted };
|
|
56
56
|
};
|
|
57
|
-
const result = await this.requestObject('/
|
|
57
|
+
const result = await this.requestObject('/users/auth/providers', { provider: providerId }, parser, 'DELETE');
|
|
58
58
|
const re = result.getData();
|
|
59
59
|
if (re === null) {
|
|
60
60
|
console.log('remove auth provider wrong data', { result, parsed: re });
|
|
@@ -70,7 +70,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
async getAuthProviders() {
|
|
73
|
-
let cmd = '/
|
|
73
|
+
let cmd = '/users/auth/providers';
|
|
74
74
|
const rawAuthProviders = await this.requestCollection(cmd, null, UserAuthProvider_1.UserAuthProvider.parse);
|
|
75
75
|
return rawAuthProviders;
|
|
76
76
|
}
|
|
@@ -84,7 +84,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
84
84
|
}
|
|
85
85
|
async update(user) {
|
|
86
86
|
try {
|
|
87
|
-
let url = '/
|
|
87
|
+
let url = '/users/' + user.id;
|
|
88
88
|
const result = await this.requestObject(url, { user }, User_1.User.parse, 'POST');
|
|
89
89
|
const updatedUser = result.getData();
|
|
90
90
|
if (updatedUser === null) {
|
|
@@ -101,7 +101,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
101
101
|
}
|
|
102
102
|
async create(user, invitationCode = null) {
|
|
103
103
|
try {
|
|
104
|
-
let url = '/
|
|
104
|
+
let url = '/users/';
|
|
105
105
|
const data = { user, invitation_code: invitationCode };
|
|
106
106
|
const parser = (raw) => {
|
|
107
107
|
return User_1.User.parse(raw.createdUser);
|
package/dist/Utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class Utils {
|
|
2
2
|
static isNullOrUndefined(variable: any): boolean;
|
|
3
3
|
static isTrue(input: string | number | boolean | null | undefined): boolean;
|
|
4
|
+
static isDate(value: any): boolean;
|
|
4
5
|
static parseRawDate(input: Date): Date;
|
|
5
6
|
static parseEnum<T>(input: string, Enum: any): T | null;
|
|
6
7
|
static parseInt(input: string | number | boolean): number;
|
package/dist/Utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Utils = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
4
5
|
class Utils {
|
|
5
6
|
static isNullOrUndefined(variable) {
|
|
6
7
|
return variable === null || variable === undefined;
|
|
@@ -8,6 +9,9 @@ class Utils {
|
|
|
8
9
|
static isTrue(input) {
|
|
9
10
|
return (input === true || input === 'true' || input === 1 || input === '1');
|
|
10
11
|
}
|
|
12
|
+
static isDate(value) {
|
|
13
|
+
return value !== null && util_1.types.isDate(value) && !isNaN(value.getTime());
|
|
14
|
+
}
|
|
11
15
|
static parseRawDate(input) {
|
|
12
16
|
if (input !== null && input !== undefined) {
|
|
13
17
|
return new Date(input);
|