@salesforce/apex-node 3.1.0 → 4.0.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/lib/src/execute/executeService.js +1 -0
- package/lib/src/execute/executeService.js.map +1 -1
- package/lib/src/i18n/i18n.d.ts +1 -0
- package/lib/src/i18n/i18n.js +2 -1
- package/lib/src/i18n/i18n.js.map +1 -1
- package/lib/src/i18n/index.js +2 -2
- package/lib/src/i18n/index.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +3 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/narrowing/index.d.ts +1 -0
- package/lib/src/narrowing/index.js +27 -0
- package/lib/src/narrowing/index.js.map +1 -0
- package/lib/src/narrowing/narrowing.d.ts +18 -0
- package/lib/src/narrowing/narrowing.js +82 -0
- package/lib/src/narrowing/narrowing.js.map +1 -0
- package/lib/src/reporters/humanFormatTransform.d.ts +15 -0
- package/lib/src/reporters/humanFormatTransform.js +240 -0
- package/lib/src/reporters/humanFormatTransform.js.map +1 -0
- package/lib/src/reporters/humanReporter.js +7 -9
- package/lib/src/reporters/humanReporter.js.map +1 -1
- package/lib/src/reporters/index.d.ts +2 -0
- package/lib/src/reporters/index.js +6 -2
- package/lib/src/reporters/index.js.map +1 -1
- package/lib/src/reporters/junitFormatTransformer.d.ts +12 -0
- package/lib/src/reporters/junitFormatTransformer.js +106 -0
- package/lib/src/reporters/junitFormatTransformer.js.map +1 -0
- package/lib/src/reporters/junitReporter.d.ts +1 -2
- package/lib/src/reporters/junitReporter.js +7 -15
- package/lib/src/reporters/junitReporter.js.map +1 -1
- package/lib/src/reporters/tapFormatTransform.d.ts +18 -0
- package/lib/src/reporters/tapFormatTransform.js +86 -0
- package/lib/src/reporters/tapFormatTransform.js.map +1 -0
- package/lib/src/reporters/tapReporter.d.ts +1 -1
- package/lib/src/streaming/codeCoverageStringifyStream.d.ts +12 -0
- package/lib/src/streaming/codeCoverageStringifyStream.js +80 -0
- package/lib/src/streaming/codeCoverageStringifyStream.js.map +1 -0
- package/lib/src/streaming/index.d.ts +3 -0
- package/lib/src/streaming/index.js +11 -1
- package/lib/src/streaming/index.js.map +1 -1
- package/lib/src/streaming/jsonStringifyStream.d.ts +18 -0
- package/lib/src/streaming/jsonStringifyStream.js +118 -0
- package/lib/src/streaming/jsonStringifyStream.js.map +1 -0
- package/lib/src/streaming/streamingClient.js +12 -12
- package/lib/src/streaming/streamingClient.js.map +1 -1
- package/lib/src/streaming/testResultStringifyStream.d.ts +12 -0
- package/lib/src/streaming/testResultStringifyStream.js +102 -0
- package/lib/src/streaming/testResultStringifyStream.js.map +1 -0
- package/lib/src/streaming/utils.d.ts +8 -0
- package/lib/src/streaming/utils.js +43 -0
- package/lib/src/streaming/utils.js.map +1 -0
- package/lib/src/tests/asyncTests.d.ts +6 -3
- package/lib/src/tests/asyncTests.js +32 -35
- package/lib/src/tests/asyncTests.js.map +1 -1
- package/lib/src/tests/index.d.ts +1 -1
- package/lib/src/tests/index.js +2 -2
- package/lib/src/tests/index.js.map +1 -1
- package/lib/src/tests/testService.d.ts +2 -2
- package/lib/src/tests/testService.js +99 -69
- package/lib/src/tests/testService.js.map +1 -1
- package/lib/src/tests/types.d.ts +4 -9
- package/lib/src/tests/types.js.map +1 -1
- package/lib/src/tests/utils.d.ts +0 -2
- package/lib/src/tests/utils.js +1 -12
- package/lib/src/tests/utils.js.map +1 -1
- package/lib/src/utils/dateUtil.d.ts +1 -1
- package/lib/src/utils/dateUtil.js +3 -0
- package/lib/src/utils/dateUtil.js.map +1 -1
- package/lib/src/utils/elapsedTime.d.ts +1 -1
- package/lib/src/utils/elapsedTime.js.map +1 -1
- package/lib/src/utils/index.d.ts +2 -2
- package/lib/src/utils/index.js.map +1 -1
- package/lib/src/utils/table.d.ts +1 -7
- package/lib/src/utils/table.js.map +1 -1
- package/lib/src/utils/tableWritableStream.d.ts +16 -0
- package/lib/src/utils/tableWritableStream.js +111 -0
- package/lib/src/utils/tableWritableStream.js.map +1 -0
- package/lib/src/utils/types.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TableWriteableStream = void 0;
|
|
10
|
+
const elapsedTime_1 = require("./elapsedTime");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
const COLUMN_SEPARATOR = ' ';
|
|
13
|
+
const COLUMN_FILLER = ' ';
|
|
14
|
+
const HEADER_FILLER = '─';
|
|
15
|
+
class TableWriteableStream {
|
|
16
|
+
stream;
|
|
17
|
+
constructor(stream) {
|
|
18
|
+
this.stream = stream;
|
|
19
|
+
this.stream = stream;
|
|
20
|
+
}
|
|
21
|
+
createTable(rows, cols, title) {
|
|
22
|
+
if (!rows) {
|
|
23
|
+
throw Error('rows cannot be undefined');
|
|
24
|
+
}
|
|
25
|
+
if (!cols) {
|
|
26
|
+
throw Error('columns cannot be undefined');
|
|
27
|
+
}
|
|
28
|
+
const maxColWidths = this.calculateMaxColumnWidths(rows, cols);
|
|
29
|
+
let columnHeader = '';
|
|
30
|
+
let headerSeparator = '';
|
|
31
|
+
cols.forEach((col, index, arr) => {
|
|
32
|
+
const width = maxColWidths.get(col.key);
|
|
33
|
+
if (width) {
|
|
34
|
+
const isLastCol = index === arr.length - 1;
|
|
35
|
+
columnHeader += this.fillColumn(col.label || col.key, width, COLUMN_FILLER, isLastCol);
|
|
36
|
+
headerSeparator += this.fillColumn('', width, HEADER_FILLER, isLastCol);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
if (columnHeader && headerSeparator) {
|
|
40
|
+
this.stream.push(`${title ? `=== ${title}\n` : ''}${columnHeader}\n${headerSeparator}\n`);
|
|
41
|
+
}
|
|
42
|
+
rows.forEach((row) => {
|
|
43
|
+
let outputRow = '';
|
|
44
|
+
cols.forEach((col, colIndex, colArr) => {
|
|
45
|
+
const cell = row[col.key];
|
|
46
|
+
const isLastCol = colIndex === colArr.length - 1;
|
|
47
|
+
const rowWidth = outputRow.length;
|
|
48
|
+
cell.split('\n').forEach((line, lineIndex) => {
|
|
49
|
+
const cellWidth = maxColWidths.get(col.key);
|
|
50
|
+
if (cellWidth) {
|
|
51
|
+
if (lineIndex === 0) {
|
|
52
|
+
outputRow += this.fillColumn(line, cellWidth, COLUMN_FILLER, isLastCol);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
outputRow +=
|
|
56
|
+
'\n' +
|
|
57
|
+
this.fillColumn('', rowWidth, COLUMN_FILLER, true) +
|
|
58
|
+
this.fillColumn(line, cellWidth, COLUMN_FILLER, isLastCol);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
this.stream.push(outputRow + '\n');
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
calculateMaxColumnWidths(rows, cols) {
|
|
67
|
+
const maxColWidths = new Map();
|
|
68
|
+
cols.forEach((col) => {
|
|
69
|
+
rows.forEach((row) => {
|
|
70
|
+
const cell = row[col.key];
|
|
71
|
+
if (cell === undefined) {
|
|
72
|
+
throw Error(`Row is missing the key ${col.key}`);
|
|
73
|
+
}
|
|
74
|
+
let maxColWidth = maxColWidths.get(col.key);
|
|
75
|
+
if (maxColWidth === undefined) {
|
|
76
|
+
maxColWidth = (col.label || col.key).length;
|
|
77
|
+
maxColWidths.set(col.key, maxColWidth);
|
|
78
|
+
}
|
|
79
|
+
// if a cell is multiline, find the line that's the longest
|
|
80
|
+
const longestLineWidth = cell
|
|
81
|
+
.split('\n')
|
|
82
|
+
.reduce((maxLine, line) => line.length > maxLine.length ? line : maxLine).length;
|
|
83
|
+
if (longestLineWidth > maxColWidth) {
|
|
84
|
+
maxColWidths.set(col.key, longestLineWidth);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return maxColWidths;
|
|
89
|
+
}
|
|
90
|
+
fillColumn(label, width, filler, isLastCol) {
|
|
91
|
+
let filled = label;
|
|
92
|
+
for (let i = 0; i < width - label.length; i++) {
|
|
93
|
+
filled += filler;
|
|
94
|
+
}
|
|
95
|
+
if (!isLastCol) {
|
|
96
|
+
filled += COLUMN_SEPARATOR;
|
|
97
|
+
}
|
|
98
|
+
return filled;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.TableWriteableStream = TableWriteableStream;
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, elapsedTime_1.elapsedTime)()
|
|
104
|
+
], TableWriteableStream.prototype, "createTable", null);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, elapsedTime_1.elapsedTime)()
|
|
107
|
+
], TableWriteableStream.prototype, "calculateMaxColumnWidths", null);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, elapsedTime_1.elapsedTime)('elapsedTime', core_1.LoggerLevel.TRACE)
|
|
110
|
+
], TableWriteableStream.prototype, "fillColumn", null);
|
|
111
|
+
//# sourceMappingURL=tableWritableStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableWritableStream.js","sourceRoot":"","sources":["../../../src/utils/tableWritableStream.ts"],"names":[],"mappings":";;;;;;;;;AAOA,+CAA4C;AAC5C,2CAA+C;AAC/C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,aAAa,GAAG,GAAG,CAAC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,EAAE,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,MAAM,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,gBAAgB,CAAC;QAC7B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAnHD,oDAmHC;AA7GQ;IADN,IAAA,yBAAW,GAAE;uDA2Db;AAGO;IADP,IAAA,yBAAW,GAAE;oEA+Bb;AAGO;IADP,IAAA,yBAAW,EAAC,aAAa,EAAE,kBAAW,CAAC,KAAK,CAAC;sDAe7C"}
|
package/lib/src/utils/types.d.ts
CHANGED
|
@@ -51,4 +51,17 @@ export type DataRecordResult = {
|
|
|
51
51
|
export type IdRecord = {
|
|
52
52
|
Id: string;
|
|
53
53
|
};
|
|
54
|
+
export interface Row {
|
|
55
|
+
[column: string]: string;
|
|
56
|
+
}
|
|
57
|
+
export interface Column {
|
|
58
|
+
key: string;
|
|
59
|
+
label: string;
|
|
60
|
+
}
|
|
61
|
+
export interface Title {
|
|
62
|
+
title: string;
|
|
63
|
+
}
|
|
64
|
+
export type TableConfig = Title & {
|
|
65
|
+
columns: Column[];
|
|
66
|
+
};
|
|
54
67
|
export {};
|
package/package.json
CHANGED