1 |
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 |
|
5 |
|
6 |
|
7 | var AddInType;
|
8 | (function (AddInType) {
|
9 |
|
10 | AddInType["Content"] = "content";
|
11 | AddInType["Mail"] = "mail";
|
12 | AddInType["TaskPane"] = "taskpane";
|
13 |
|
14 | })(AddInType = exports.AddInType || (exports.AddInType = {}));
|
15 |
|
16 | const addInTypes = Object.keys(AddInType).map(key => parseAddInType(key));
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | function getAddInTypeForManifestOfficeAppType(officeAppType) {
|
22 | switch (officeAppType ? officeAppType.trim().toLowerCase() : officeAppType) {
|
23 | case "contentapp":
|
24 | return AddInType.Content;
|
25 | case "mailapp":
|
26 | return AddInType.Mail;
|
27 | case "taskpaneapp":
|
28 | return AddInType.TaskPane;
|
29 | default:
|
30 | return undefined;
|
31 | }
|
32 | }
|
33 | exports.getAddInTypeForManifestOfficeAppType = getAddInTypeForManifestOfficeAppType;
|
34 |
|
35 |
|
36 |
|
37 | function getAddInTypes() {
|
38 | return addInTypes;
|
39 | }
|
40 | exports.getAddInTypes = getAddInTypes;
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function parseAddInType(value) {
|
47 | const addInType = toAddInType(value);
|
48 | if (!addInType) {
|
49 | throw new Error(`${value} is not a valid Office add-in type.`);
|
50 | }
|
51 | return addInType;
|
52 | }
|
53 | exports.parseAddInType = parseAddInType;
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | function parseAddInTypes(input) {
|
60 | if (input.trim().toLowerCase() === "all") {
|
61 | return getAddInTypes();
|
62 | }
|
63 | else {
|
64 | return input.split(",").map(appString => parseAddInType(appString));
|
65 | }
|
66 | }
|
67 | exports.parseAddInTypes = parseAddInTypes;
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | function toAddInType(value) {
|
73 | switch (value.trim().toLowerCase()) {
|
74 | case AddInType.Content:
|
75 | return AddInType.Content;
|
76 | case AddInType.Mail:
|
77 | return AddInType.Mail;
|
78 | case AddInType.TaskPane:
|
79 | return AddInType.TaskPane;
|
80 | default:
|
81 | return undefined;
|
82 | }
|
83 | }
|
84 | exports.toAddInType = toAddInType;
|
85 |
|
\ | No newline at end of file |