@elisra-devops/docgen-skins 0.3.4 → 0.3.7
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/.github/sonar-project.properties +4 -4
- package/.github/workflows/ci.yml +18 -18
- package/.github/workflows/release.yml +44 -44
- package/Readme.md +6 -6
- package/bin/index.d.ts +15 -0
- package/bin/index.js +271 -0
- package/bin/index.js.map +1 -0
- package/bin/models/json/JSONRun.d.ts +7 -0
- package/bin/models/json/JSONRun.js +84 -0
- package/bin/models/json/JSONRun.js.map +1 -0
- package/bin/models/json/default.d.ts +3 -0
- package/bin/models/json/default.js +25 -0
- package/bin/models/json/default.js.map +1 -0
- package/bin/models/json/html/JSONHtml.d.ts +6 -0
- package/bin/models/json/html/JSONHtml.js +13 -0
- package/bin/models/json/html/JSONHtml.js.map +1 -0
- package/bin/models/json/paragraph/JSONParagraph.d.ts +9 -0
- package/bin/models/json/paragraph/JSONParagraph.js +62 -0
- package/bin/models/json/paragraph/JSONParagraph.js.map +1 -0
- package/bin/models/json/paragraph/JSONRichTextParagraph.d.ts +9 -0
- package/bin/models/json/paragraph/JSONRichTextParagraph.js +72 -0
- package/bin/models/json/paragraph/JSONRichTextParagraph.js.map +1 -0
- package/bin/models/json/paragraph/JSONTestSuiteHeaderParagraph.d.ts +10 -0
- package/bin/models/json/paragraph/JSONTestSuiteHeaderParagraph.js +76 -0
- package/bin/models/json/paragraph/JSONTestSuiteHeaderParagraph.js.map +1 -0
- package/bin/models/json/table/JSONTable.d.ts +9 -0
- package/bin/models/json/table/JSONTable.js +60 -0
- package/bin/models/json/table/JSONTable.js.map +1 -0
- package/bin/models/json/table/JSONTableCell.d.ts +8 -0
- package/bin/models/json/table/JSONTableCell.js +105 -0
- package/bin/models/json/table/JSONTableCell.js.map +1 -0
- package/bin/models/json/table/JSONTableRow.d.ts +7 -0
- package/bin/models/json/table/JSONTableRow.js +27 -0
- package/bin/models/json/table/JSONTableRow.js.map +1 -0
- package/bin/models/json/wordJsonModels.d.ts +97 -0
- package/bin/models/json/wordJsonModels.js +3 -0
- package/bin/models/json/wordJsonModels.js.map +1 -0
- package/bin/services/logger.d.ts +3 -0
- package/bin/services/logger.js +46 -0
- package/bin/services/logger.js.map +1 -0
- package/bin/snippets/free-runs.d.ts +1 -0
- package/bin/snippets/free-runs.js +58 -0
- package/bin/snippets/free-runs.js.map +1 -0
- package/bin/test/skins.test.d.ts +1 -0
- package/bin/test/skins.test.js +116 -0
- package/bin/test/skins.test.js.map +1 -0
- package/package.json +46 -46
- package/samples/document-skins-examples/document-attchament-table.json +25 -25
- package/samples/document-skins-examples/documentExample.json +66 -66
- package/samples/document-skins-examples/paragraphExample.json +16 -16
- package/samples/document-skins-examples/tableExample.json +29 -29
- package/src/index.ts +401 -401
- package/src/models/json/JSONRun.ts +80 -80
- package/src/models/json/default.ts +23 -23
- package/src/models/json/html/JSONHtml.ts +13 -13
- package/src/models/json/paragraph/JSONParagraph.ts +76 -76
- package/src/models/json/paragraph/JSONRichTextParagraph.ts +84 -84
- package/src/models/json/paragraph/JSONTestSuiteHeaderParagraph.ts +94 -94
- package/src/models/json/table/JSONTable.ts +74 -74
- package/src/models/json/table/JSONTableCell.ts +117 -117
- package/src/models/json/table/JSONTableRow.ts +34 -34
- package/src/models/json/wordJsonModels.ts +97 -97
- package/src/services/logger.ts +26 -26
- package/src/snippets/free-runs.ts +53 -53
- package/src/test/skins.test.ts +171 -171
- package/tsconfig.json +61 -61
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
export interface StyleOptions {
|
|
2
|
-
isBold: boolean;
|
|
3
|
-
IsItalic: boolean;
|
|
4
|
-
IsUnderline: boolean;
|
|
5
|
-
Size: number;
|
|
6
|
-
Uri: string;
|
|
7
|
-
Font: string;
|
|
8
|
-
InsertLineBreak: boolean;
|
|
9
|
-
InsertSpace: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface DocumentSkin {
|
|
12
|
-
templatePath: string;
|
|
13
|
-
contentControls: ContetControlSkin[];
|
|
14
|
-
}
|
|
15
|
-
export interface ContetControlSkin {
|
|
16
|
-
title: string;
|
|
17
|
-
wordObjects: any[]; //can be table or paragraph or file
|
|
18
|
-
}
|
|
19
|
-
export interface JsonHtml {
|
|
20
|
-
type: string;
|
|
21
|
-
Html: string;
|
|
22
|
-
}
|
|
23
|
-
export interface TableRow {
|
|
24
|
-
Cells: TableCell[];
|
|
25
|
-
}
|
|
26
|
-
export interface TableCell {
|
|
27
|
-
attachments?: Attachment[];
|
|
28
|
-
Paragraphs: [
|
|
29
|
-
{
|
|
30
|
-
Runs: Run[];
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
Html?:JsonHtml
|
|
34
|
-
}
|
|
35
|
-
export interface Paragraph {
|
|
36
|
-
type: string;
|
|
37
|
-
headingLevel?: number;
|
|
38
|
-
runs: Run[];
|
|
39
|
-
}
|
|
40
|
-
export interface Attachment {
|
|
41
|
-
type: string;
|
|
42
|
-
path: string;
|
|
43
|
-
}
|
|
44
|
-
export interface Run {
|
|
45
|
-
text: string;
|
|
46
|
-
Bold: boolean;
|
|
47
|
-
Italic: boolean;
|
|
48
|
-
Underline: boolean;
|
|
49
|
-
Size: number;
|
|
50
|
-
Uri: string;
|
|
51
|
-
Font: string;
|
|
52
|
-
InsertLineBreak: boolean;
|
|
53
|
-
InsertSpace: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface WorkItemData {}
|
|
56
|
-
|
|
57
|
-
export interface Table {
|
|
58
|
-
type: string;
|
|
59
|
-
headingLevel: number;
|
|
60
|
-
Rows: TableRow[];
|
|
61
|
-
}
|
|
62
|
-
export interface WIQueryResults {
|
|
63
|
-
columns: WIColumns[];
|
|
64
|
-
workItems: WIData[];
|
|
65
|
-
asOf: string;
|
|
66
|
-
queryResultType: number;
|
|
67
|
-
queryType: number;
|
|
68
|
-
}
|
|
69
|
-
export interface WIData {
|
|
70
|
-
url: string;
|
|
71
|
-
fields: WIProperty[];
|
|
72
|
-
Source: number;
|
|
73
|
-
level: number;
|
|
74
|
-
}
|
|
75
|
-
export interface WIProperty {
|
|
76
|
-
name: string;
|
|
77
|
-
value: any;
|
|
78
|
-
url?: string;
|
|
79
|
-
relativeUrl?: string;
|
|
80
|
-
attachmentLink?: string;
|
|
81
|
-
relativeAttachmentLink?: string;
|
|
82
|
-
richText?: any[];
|
|
83
|
-
}
|
|
84
|
-
export interface MultipeValuesWIProperty {
|
|
85
|
-
name: string;
|
|
86
|
-
value: any[];
|
|
87
|
-
url?: string;
|
|
88
|
-
relativeUrl?: string;
|
|
89
|
-
attachmentLink?: string;
|
|
90
|
-
relativeAttachmentLink?: string;
|
|
91
|
-
richText?: any[];
|
|
92
|
-
}
|
|
93
|
-
export interface WIColumns {
|
|
94
|
-
name: string;
|
|
95
|
-
referenceName: string;
|
|
96
|
-
url: string;
|
|
97
|
-
}
|
|
1
|
+
export interface StyleOptions {
|
|
2
|
+
isBold: boolean;
|
|
3
|
+
IsItalic: boolean;
|
|
4
|
+
IsUnderline: boolean;
|
|
5
|
+
Size: number;
|
|
6
|
+
Uri: string;
|
|
7
|
+
Font: string;
|
|
8
|
+
InsertLineBreak: boolean;
|
|
9
|
+
InsertSpace: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface DocumentSkin {
|
|
12
|
+
templatePath: string;
|
|
13
|
+
contentControls: ContetControlSkin[];
|
|
14
|
+
}
|
|
15
|
+
export interface ContetControlSkin {
|
|
16
|
+
title: string;
|
|
17
|
+
wordObjects: any[]; //can be table or paragraph or file
|
|
18
|
+
}
|
|
19
|
+
export interface JsonHtml {
|
|
20
|
+
type: string;
|
|
21
|
+
Html: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TableRow {
|
|
24
|
+
Cells: TableCell[];
|
|
25
|
+
}
|
|
26
|
+
export interface TableCell {
|
|
27
|
+
attachments?: Attachment[];
|
|
28
|
+
Paragraphs: [
|
|
29
|
+
{
|
|
30
|
+
Runs: Run[];
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
Html?:JsonHtml
|
|
34
|
+
}
|
|
35
|
+
export interface Paragraph {
|
|
36
|
+
type: string;
|
|
37
|
+
headingLevel?: number;
|
|
38
|
+
runs: Run[];
|
|
39
|
+
}
|
|
40
|
+
export interface Attachment {
|
|
41
|
+
type: string;
|
|
42
|
+
path: string;
|
|
43
|
+
}
|
|
44
|
+
export interface Run {
|
|
45
|
+
text: string;
|
|
46
|
+
Bold: boolean;
|
|
47
|
+
Italic: boolean;
|
|
48
|
+
Underline: boolean;
|
|
49
|
+
Size: number;
|
|
50
|
+
Uri: string;
|
|
51
|
+
Font: string;
|
|
52
|
+
InsertLineBreak: boolean;
|
|
53
|
+
InsertSpace: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface WorkItemData {}
|
|
56
|
+
|
|
57
|
+
export interface Table {
|
|
58
|
+
type: string;
|
|
59
|
+
headingLevel: number;
|
|
60
|
+
Rows: TableRow[];
|
|
61
|
+
}
|
|
62
|
+
export interface WIQueryResults {
|
|
63
|
+
columns: WIColumns[];
|
|
64
|
+
workItems: WIData[];
|
|
65
|
+
asOf: string;
|
|
66
|
+
queryResultType: number;
|
|
67
|
+
queryType: number;
|
|
68
|
+
}
|
|
69
|
+
export interface WIData {
|
|
70
|
+
url: string;
|
|
71
|
+
fields: WIProperty[];
|
|
72
|
+
Source: number;
|
|
73
|
+
level: number;
|
|
74
|
+
}
|
|
75
|
+
export interface WIProperty {
|
|
76
|
+
name: string;
|
|
77
|
+
value: any;
|
|
78
|
+
url?: string;
|
|
79
|
+
relativeUrl?: string;
|
|
80
|
+
attachmentLink?: string;
|
|
81
|
+
relativeAttachmentLink?: string;
|
|
82
|
+
richText?: any[];
|
|
83
|
+
}
|
|
84
|
+
export interface MultipeValuesWIProperty {
|
|
85
|
+
name: string;
|
|
86
|
+
value: any[];
|
|
87
|
+
url?: string;
|
|
88
|
+
relativeUrl?: string;
|
|
89
|
+
attachmentLink?: string;
|
|
90
|
+
relativeAttachmentLink?: string;
|
|
91
|
+
richText?: any[];
|
|
92
|
+
}
|
|
93
|
+
export interface WIColumns {
|
|
94
|
+
name: string;
|
|
95
|
+
referenceName: string;
|
|
96
|
+
url: string;
|
|
97
|
+
}
|
package/src/services/logger.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import * as winston from "winston";
|
|
3
|
-
|
|
4
|
-
let logsPath = process.env.logs_path || "./logs/";
|
|
5
|
-
const logFormat = winston.format.printf(
|
|
6
|
-
info => `${info.timestamp} - ${info.level}: ${info.message}`
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
const logger: winston.Logger = winston.createLogger({
|
|
10
|
-
format: winston.format.timestamp(),
|
|
11
|
-
level: "silly",
|
|
12
|
-
transports: [
|
|
13
|
-
new winston.transports.File({
|
|
14
|
-
filename: `${logsPath}word-skins.log`,
|
|
15
|
-
level: "error",
|
|
16
|
-
format: logFormat
|
|
17
|
-
}),
|
|
18
|
-
new winston.transports.File({
|
|
19
|
-
filename: `${logsPath}word-skins-all.log`,
|
|
20
|
-
format: logFormat
|
|
21
|
-
}),
|
|
22
|
-
new winston.transports.Console({ format: logFormat, level: "debug" })
|
|
23
|
-
]
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export default logger;
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as winston from "winston";
|
|
3
|
+
|
|
4
|
+
let logsPath = process.env.logs_path || "./logs/";
|
|
5
|
+
const logFormat = winston.format.printf(
|
|
6
|
+
info => `${info.timestamp} - ${info.level}: ${info.message}`
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
const logger: winston.Logger = winston.createLogger({
|
|
10
|
+
format: winston.format.timestamp(),
|
|
11
|
+
level: "silly",
|
|
12
|
+
transports: [
|
|
13
|
+
new winston.transports.File({
|
|
14
|
+
filename: `${logsPath}word-skins.log`,
|
|
15
|
+
level: "error",
|
|
16
|
+
format: logFormat
|
|
17
|
+
}),
|
|
18
|
+
new winston.transports.File({
|
|
19
|
+
filename: `${logsPath}word-skins-all.log`,
|
|
20
|
+
format: logFormat
|
|
21
|
+
}),
|
|
22
|
+
new winston.transports.Console({ format: logFormat, level: "debug" })
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default logger;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import Skins from "../index";
|
|
2
|
-
|
|
3
|
-
let main = async () => {
|
|
4
|
-
let styles = {
|
|
5
|
-
isBold: false,
|
|
6
|
-
IsItalic: false,
|
|
7
|
-
IsUnderline: false,
|
|
8
|
-
Size: 12,
|
|
9
|
-
Uri: null,
|
|
10
|
-
Font: "Arial",
|
|
11
|
-
InsertLineBreak: false,
|
|
12
|
-
InsertSpace: true,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
let skins = new Skins("json", "c:\test.dotx");
|
|
16
|
-
const QueryData = require("../../samples/mock-data/queries/flat-query-data.json");
|
|
17
|
-
await skins.addNewContentToDocumentSkin(
|
|
18
|
-
"test",
|
|
19
|
-
skins.SKIN_TYPE_PARAGRAPH,
|
|
20
|
-
QueryData,
|
|
21
|
-
styles,
|
|
22
|
-
4
|
|
23
|
-
);
|
|
24
|
-
const documentSkin: any = skins.getDocumentSkin();
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
main();
|
|
28
|
-
|
|
29
|
-
// let json = {
|
|
30
|
-
// workItems: [
|
|
31
|
-
// {
|
|
32
|
-
// //TEST PLAN ROOT
|
|
33
|
-
// url: "test-plan-url",
|
|
34
|
-
// fields: [
|
|
35
|
-
// { value: " test-plan-title", name: "title" },
|
|
36
|
-
// { value: "test-plan-summary", name: "test-plan-summary" },
|
|
37
|
-
// ],
|
|
38
|
-
// parent: null,
|
|
39
|
-
// id: "test-plan-id",
|
|
40
|
-
// },
|
|
41
|
-
// {
|
|
42
|
-
// //TEST SUITE
|
|
43
|
-
// url: "test-suite-url",
|
|
44
|
-
// fields: [
|
|
45
|
-
// { value: " test-suite-title", name: "title" },
|
|
46
|
-
// { value: "test-suite-summary", name: "test-suite-summary" },
|
|
47
|
-
// { value: "User Story", name: "Work Item Type" },
|
|
48
|
-
// ],
|
|
49
|
-
// parent: "suite-id",
|
|
50
|
-
// id: "test-plan-id",
|
|
51
|
-
// },
|
|
52
|
-
// ],
|
|
53
|
-
// };
|
|
1
|
+
import Skins from "../index";
|
|
2
|
+
|
|
3
|
+
let main = async () => {
|
|
4
|
+
let styles = {
|
|
5
|
+
isBold: false,
|
|
6
|
+
IsItalic: false,
|
|
7
|
+
IsUnderline: false,
|
|
8
|
+
Size: 12,
|
|
9
|
+
Uri: null,
|
|
10
|
+
Font: "Arial",
|
|
11
|
+
InsertLineBreak: false,
|
|
12
|
+
InsertSpace: true,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
let skins = new Skins("json", "c:\test.dotx");
|
|
16
|
+
const QueryData = require("../../samples/mock-data/queries/flat-query-data.json");
|
|
17
|
+
await skins.addNewContentToDocumentSkin(
|
|
18
|
+
"test",
|
|
19
|
+
skins.SKIN_TYPE_PARAGRAPH,
|
|
20
|
+
QueryData,
|
|
21
|
+
styles,
|
|
22
|
+
4
|
|
23
|
+
);
|
|
24
|
+
const documentSkin: any = skins.getDocumentSkin();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
main();
|
|
28
|
+
|
|
29
|
+
// let json = {
|
|
30
|
+
// workItems: [
|
|
31
|
+
// {
|
|
32
|
+
// //TEST PLAN ROOT
|
|
33
|
+
// url: "test-plan-url",
|
|
34
|
+
// fields: [
|
|
35
|
+
// { value: " test-plan-title", name: "title" },
|
|
36
|
+
// { value: "test-plan-summary", name: "test-plan-summary" },
|
|
37
|
+
// ],
|
|
38
|
+
// parent: null,
|
|
39
|
+
// id: "test-plan-id",
|
|
40
|
+
// },
|
|
41
|
+
// {
|
|
42
|
+
// //TEST SUITE
|
|
43
|
+
// url: "test-suite-url",
|
|
44
|
+
// fields: [
|
|
45
|
+
// { value: " test-suite-title", name: "title" },
|
|
46
|
+
// { value: "test-suite-summary", name: "test-suite-summary" },
|
|
47
|
+
// { value: "User Story", name: "Work Item Type" },
|
|
48
|
+
// ],
|
|
49
|
+
// parent: "suite-id",
|
|
50
|
+
// id: "test-plan-id",
|
|
51
|
+
// },
|
|
52
|
+
// ],
|
|
53
|
+
// };
|