@allurereport/service 3.8.1 → 3.8.2
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/service.js +1 -8
- package/package.json +3 -3
- package/dist/legacyService.d.ts +0 -41
- package/dist/legacyService.js +0 -128
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/service.js
CHANGED
|
@@ -14,7 +14,6 @@ import { readFile } from "node:fs/promises";
|
|
|
14
14
|
import { join as joinPosix } from "node:path/posix";
|
|
15
15
|
import { createServiceHttpClient } from "./utils/http.js";
|
|
16
16
|
import { parseServiceToken } from "./utils/token.js";
|
|
17
|
-
const ASSET_MAX_FILE_SIZE = 200 * 1024 * 1024;
|
|
18
17
|
const UPLOAD_CONTENT_TYPE = "application/octet-stream";
|
|
19
18
|
const createUploadBlob = (content) => new Blob([content], { type: UPLOAD_CONTENT_TYPE });
|
|
20
19
|
const createReportUrl = (baseUrl, reportUuid) => `${baseUrl}/${reportUuid}`;
|
|
@@ -68,7 +67,7 @@ export class AllureServiceClient {
|
|
|
68
67
|
}
|
|
69
68
|
async deleteReport(payload) {
|
|
70
69
|
const { reportUuid, pluginId = "" } = payload;
|
|
71
|
-
return __classPrivateFieldGet(this, _AllureServiceClient_client, "f").post(`/api/
|
|
70
|
+
return __classPrivateFieldGet(this, _AllureServiceClient_client, "f").post(`/api/report/${reportUuid}/delete`, {
|
|
72
71
|
body: {
|
|
73
72
|
pluginId,
|
|
74
73
|
},
|
|
@@ -83,9 +82,6 @@ export class AllureServiceClient {
|
|
|
83
82
|
if (!content) {
|
|
84
83
|
content = signal ? await readFile(filepath, { signal }) : await readFile(filepath);
|
|
85
84
|
}
|
|
86
|
-
if (content.length > ASSET_MAX_FILE_SIZE) {
|
|
87
|
-
throw new Error(`Asset size exceeds the maximum allowed size of ${ASSET_MAX_FILE_SIZE / (1024 * 1024)}MB`);
|
|
88
|
-
}
|
|
89
85
|
const form = new FormData();
|
|
90
86
|
form.set("filename", filename);
|
|
91
87
|
form.set("file", createUploadBlob(content), filename);
|
|
@@ -107,9 +103,6 @@ export class AllureServiceClient {
|
|
|
107
103
|
if (!content) {
|
|
108
104
|
content = signal ? await readFile(filepath, { signal }) : await readFile(filepath);
|
|
109
105
|
}
|
|
110
|
-
if (content.length > ASSET_MAX_FILE_SIZE) {
|
|
111
|
-
throw new Error(`Report file size exceeds the maximum allowed size of ${ASSET_MAX_FILE_SIZE / (1024 * 1024)}MB`);
|
|
112
|
-
}
|
|
113
106
|
const form = new FormData();
|
|
114
107
|
form.set("filename", reportFilename);
|
|
115
108
|
form.set("file", createUploadBlob(content), reportFilename);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/service",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "Allure Service API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.8.
|
|
34
|
-
"@allurereport/plugin-api": "3.8.
|
|
33
|
+
"@allurereport/core-api": "3.8.2",
|
|
34
|
+
"@allurereport/plugin-api": "3.8.2",
|
|
35
35
|
"axios": "^1.15.2",
|
|
36
36
|
"open": "^10.1.0"
|
|
37
37
|
},
|
package/dist/legacyService.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type HistoryDataPoint } from "@allurereport/core-api";
|
|
2
|
-
import { type Config } from "@allurereport/plugin-api";
|
|
3
|
-
import type { AllureServiceApiClient } from "./model.js";
|
|
4
|
-
export declare class AllureLegacyServiceClient implements AllureServiceApiClient {
|
|
5
|
-
#private;
|
|
6
|
-
readonly config: Config["allureService"];
|
|
7
|
-
constructor(config: Config["allureService"]);
|
|
8
|
-
downloadHistory(payload: {
|
|
9
|
-
repo?: string;
|
|
10
|
-
branch?: string;
|
|
11
|
-
limit?: number;
|
|
12
|
-
}): Promise<HistoryDataPoint[]>;
|
|
13
|
-
createReport(payload: {
|
|
14
|
-
reportName: string;
|
|
15
|
-
reportUuid?: string;
|
|
16
|
-
repo?: string;
|
|
17
|
-
branch?: string;
|
|
18
|
-
}): Promise<URL>;
|
|
19
|
-
completeReport(payload: {
|
|
20
|
-
reportUuid: string;
|
|
21
|
-
historyPoint: HistoryDataPoint;
|
|
22
|
-
}): Promise<unknown>;
|
|
23
|
-
deleteReport(payload: {
|
|
24
|
-
reportUuid: string;
|
|
25
|
-
pluginId?: string;
|
|
26
|
-
}): Promise<unknown>;
|
|
27
|
-
addReportAsset(payload: {
|
|
28
|
-
filename: string;
|
|
29
|
-
file?: Buffer;
|
|
30
|
-
filepath?: string;
|
|
31
|
-
signal?: AbortSignal;
|
|
32
|
-
}): Promise<unknown>;
|
|
33
|
-
addReportFile(payload: {
|
|
34
|
-
reportUuid: string;
|
|
35
|
-
pluginId?: string;
|
|
36
|
-
filename: string;
|
|
37
|
-
file?: Buffer;
|
|
38
|
-
filepath?: string;
|
|
39
|
-
signal?: AbortSignal;
|
|
40
|
-
}): Promise<string>;
|
|
41
|
-
}
|
package/dist/legacyService.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _AllureLegacyServiceClient_client, _AllureLegacyServiceClient_url, _AllureLegacyServiceClient_reportUrl;
|
|
13
|
-
import { readFile } from "node:fs/promises";
|
|
14
|
-
import { join as joinPosix } from "node:path/posix";
|
|
15
|
-
import { createServiceHttpClient } from "./utils/http.js";
|
|
16
|
-
import { parseServiceToken } from "./utils/token.js";
|
|
17
|
-
const ASSET_MAX_FILE_SIZE = 200 * 1024 * 1024;
|
|
18
|
-
const UPLOAD_CONTENT_TYPE = "application/octet-stream";
|
|
19
|
-
const createUploadBlob = (content) => new Blob([content], { type: UPLOAD_CONTENT_TYPE });
|
|
20
|
-
const createReportFileUrl = (reportUrl, reportFilename) => {
|
|
21
|
-
const fileUrl = new URL(reportUrl);
|
|
22
|
-
fileUrl.pathname = joinPosix(fileUrl.pathname, reportFilename);
|
|
23
|
-
fileUrl.search = "";
|
|
24
|
-
fileUrl.hash = "";
|
|
25
|
-
return fileUrl.toString();
|
|
26
|
-
};
|
|
27
|
-
const createFallbackReportUrl = (baseUrl, reportUuid) => {
|
|
28
|
-
const reportUrl = new URL(`${baseUrl}/`);
|
|
29
|
-
reportUrl.pathname = joinPosix(reportUrl.pathname, reportUuid);
|
|
30
|
-
return reportUrl;
|
|
31
|
-
};
|
|
32
|
-
export class AllureLegacyServiceClient {
|
|
33
|
-
constructor(config) {
|
|
34
|
-
this.config = config;
|
|
35
|
-
_AllureLegacyServiceClient_client.set(this, void 0);
|
|
36
|
-
_AllureLegacyServiceClient_url.set(this, void 0);
|
|
37
|
-
_AllureLegacyServiceClient_reportUrl.set(this, void 0);
|
|
38
|
-
if (!config?.accessToken) {
|
|
39
|
-
throw new Error("Allure service access token is required");
|
|
40
|
-
}
|
|
41
|
-
const { accessToken, url } = parseServiceToken(config.accessToken);
|
|
42
|
-
__classPrivateFieldSet(this, _AllureLegacyServiceClient_url, url.replace(/\/$/, ""), "f");
|
|
43
|
-
__classPrivateFieldSet(this, _AllureLegacyServiceClient_client, createServiceHttpClient(__classPrivateFieldGet(this, _AllureLegacyServiceClient_url, "f"), accessToken), "f");
|
|
44
|
-
}
|
|
45
|
-
async downloadHistory(payload) {
|
|
46
|
-
const { branch, limit } = payload ?? {};
|
|
47
|
-
const { history } = await __classPrivateFieldGet(this, _AllureLegacyServiceClient_client, "f").get("/projects/history", {
|
|
48
|
-
params: {
|
|
49
|
-
limit: limit ? encodeURIComponent(limit) : undefined,
|
|
50
|
-
branch: branch ? encodeURIComponent(branch) : undefined,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
return history;
|
|
54
|
-
}
|
|
55
|
-
async createReport(payload) {
|
|
56
|
-
const { reportName, reportUuid, branch } = payload;
|
|
57
|
-
const { url } = await __classPrivateFieldGet(this, _AllureLegacyServiceClient_client, "f").post("/reports", {
|
|
58
|
-
body: {
|
|
59
|
-
reportName,
|
|
60
|
-
reportUuid,
|
|
61
|
-
branch,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
__classPrivateFieldSet(this, _AllureLegacyServiceClient_reportUrl, new URL(url), "f");
|
|
65
|
-
return __classPrivateFieldGet(this, _AllureLegacyServiceClient_reportUrl, "f");
|
|
66
|
-
}
|
|
67
|
-
async completeReport(payload) {
|
|
68
|
-
const { reportUuid, historyPoint } = payload;
|
|
69
|
-
return __classPrivateFieldGet(this, _AllureLegacyServiceClient_client, "f").post(`/reports/${reportUuid}/complete`, {
|
|
70
|
-
body: {
|
|
71
|
-
historyPoint,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
async deleteReport(payload) {
|
|
76
|
-
const { reportUuid, pluginId = "" } = payload;
|
|
77
|
-
return __classPrivateFieldGet(this, _AllureLegacyServiceClient_client, "f").post(`/reports/${reportUuid}/delete`, {
|
|
78
|
-
body: {
|
|
79
|
-
pluginId,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
async addReportAsset(payload) {
|
|
84
|
-
const { filename, file, filepath, signal } = payload;
|
|
85
|
-
if (!file && !filepath) {
|
|
86
|
-
throw new Error("File or filepath is required");
|
|
87
|
-
}
|
|
88
|
-
let content = file;
|
|
89
|
-
if (!content) {
|
|
90
|
-
content = signal ? await readFile(filepath, { signal }) : await readFile(filepath);
|
|
91
|
-
}
|
|
92
|
-
if (content.length > ASSET_MAX_FILE_SIZE) {
|
|
93
|
-
throw new Error(`Asset size exceeds the maximum allowed size of ${ASSET_MAX_FILE_SIZE / (1024 * 1024)}MB`);
|
|
94
|
-
}
|
|
95
|
-
const form = new FormData();
|
|
96
|
-
form.set("filename", filename);
|
|
97
|
-
form.set("file", createUploadBlob(content), filename);
|
|
98
|
-
return __classPrivateFieldGet(this, _AllureLegacyServiceClient_client, "f").post("/assets/upload", {
|
|
99
|
-
body: form,
|
|
100
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
101
|
-
...(signal ? { signal } : {}),
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async addReportFile(payload) {
|
|
105
|
-
const { reportUuid, filename, file, filepath, pluginId, signal } = payload;
|
|
106
|
-
const reportFilename = pluginId ? joinPosix(pluginId, filename) : filename;
|
|
107
|
-
if (!file && !filepath) {
|
|
108
|
-
throw new Error("File or filepath is required");
|
|
109
|
-
}
|
|
110
|
-
let content = file;
|
|
111
|
-
if (!content) {
|
|
112
|
-
content = signal ? await readFile(filepath, { signal }) : await readFile(filepath);
|
|
113
|
-
}
|
|
114
|
-
if (content.length > ASSET_MAX_FILE_SIZE) {
|
|
115
|
-
throw new Error(`Report file size exceeds the maximum allowed size of ${ASSET_MAX_FILE_SIZE / (1024 * 1024)}MB`);
|
|
116
|
-
}
|
|
117
|
-
const form = new FormData();
|
|
118
|
-
form.set("filename", reportFilename);
|
|
119
|
-
form.set("file", createUploadBlob(content), reportFilename);
|
|
120
|
-
await __classPrivateFieldGet(this, _AllureLegacyServiceClient_client, "f").post(`/reports/${reportUuid}/upload`, {
|
|
121
|
-
body: form,
|
|
122
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
123
|
-
...(signal ? { signal } : {}),
|
|
124
|
-
});
|
|
125
|
-
return createReportFileUrl(__classPrivateFieldGet(this, _AllureLegacyServiceClient_reportUrl, "f") ?? createFallbackReportUrl(__classPrivateFieldGet(this, _AllureLegacyServiceClient_url, "f"), reportUuid), reportFilename);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
_AllureLegacyServiceClient_client = new WeakMap(), _AllureLegacyServiceClient_url = new WeakMap(), _AllureLegacyServiceClient_reportUrl = new WeakMap();
|