testit-js-commons 2.2.3 → 2.2.5
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/lib/common/utils/utils.d.ts +1 -0
- package/lib/common/utils/utils.js +4 -0
- package/lib/helpers/additions/additions.helper.d.ts +1 -1
- package/lib/services/attachments/attachments.service.d.ts +2 -1
- package/lib/services/attachments/attachments.service.js +1 -1
- package/lib/services/attachments/attachments.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export declare class Additions implements IAdditions {
|
|
|
8
8
|
messages: string[];
|
|
9
9
|
constructor(client: IClient);
|
|
10
10
|
addAttachments(paths: string[]): Promise<Attachment[]>;
|
|
11
|
-
addAttachments(content: string, fileName?: string): Promise<Attachment[]>;
|
|
11
|
+
addAttachments(content: string | Buffer, fileName?: string): Promise<Attachment[]>;
|
|
12
12
|
addLinks(link: Link): void;
|
|
13
13
|
addLinks(links: Link[]): void;
|
|
14
14
|
addMessage(message: string): void;
|
|
@@ -2,10 +2,11 @@ import { AttachmentsApi } from "testit-api-client";
|
|
|
2
2
|
import { AdapterConfig, Attachment } from "../../common";
|
|
3
3
|
import { BaseService } from "../base.service";
|
|
4
4
|
import { IAttachmentsService } from "./attachments.type";
|
|
5
|
+
import { Buffer } from "buffer";
|
|
5
6
|
export declare class AttachmentsService extends BaseService implements IAttachmentsService {
|
|
6
7
|
protected readonly config: AdapterConfig;
|
|
7
8
|
protected _client: AttachmentsApi;
|
|
8
9
|
constructor(config: AdapterConfig);
|
|
9
|
-
uploadTextAttachment(content: string, filename?: string): Promise<Attachment[]>;
|
|
10
|
+
uploadTextAttachment(content: string | Buffer, filename?: string): Promise<Attachment[]>;
|
|
10
11
|
uploadAttachments(paths: string[]): Promise<Attachment[]>;
|
|
11
12
|
}
|
|
@@ -25,7 +25,7 @@ class AttachmentsService extends base_service_1.BaseService {
|
|
|
25
25
|
uploadTextAttachment(content, filename) {
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
const request = {
|
|
28
|
-
value: buffer_1.Buffer.from(content, "utf-8"),
|
|
28
|
+
value: typeof content === "string" ? buffer_1.Buffer.from(content, "utf-8") : content,
|
|
29
29
|
options: { filename: filename !== null && filename !== void 0 ? filename : common_1.Utils.generateFileName() },
|
|
30
30
|
};
|
|
31
31
|
return yield this._client.apiV2AttachmentsPost(request).then(({ body }) => [{ id: body.id }]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Attachment } from "../../common";
|
|
2
2
|
export interface IAttachmentsService {
|
|
3
3
|
uploadAttachments(paths: string[]): Promise<Attachment[]>;
|
|
4
|
-
uploadTextAttachment(content: string, fileName?: string): Promise<Attachment[]>;
|
|
4
|
+
uploadTextAttachment(content: string | Buffer, fileName?: string): Promise<Attachment[]>;
|
|
5
5
|
}
|