-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
headers.ts
172 lines (125 loc) Β· 4.53 KB
/
headers.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import {
CompatibilityValue,
InjectInto,
MultiValue,
NamedValue,
RunAt,
Sandbox,
SingleValue,
StrictHeadersProps,
SwitchValue,
} from '../../types';
import {
IsDefined,
IsEnumValue,
IsMultiValue,
IsNamedValue,
IsNestedValue,
IsOptional,
IsSingleValue,
IsSwitchValue,
IsUnique,
IsURLValue,
partialGroups,
} from './utils';
export enum ValidationGroup {
Main = 'main',
I18n = 'i18n',
}
export const Main = partialGroups(ValidationGroup.Main);
export const I18n = partialGroups(ValidationGroup.I18n);
export const Always = partialGroups(ValidationGroup.Main, ValidationGroup.I18n);
export class Compatibility implements CompatibilityValue {
[x: string]: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly firefox?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly chrome?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly opera?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly safari?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly edge?: SingleValue;
}
export class Headers implements StrictHeadersProps {
@Main(IsDefined(), IsSingleValue())
@I18n(IsOptional(), IsSingleValue())
public readonly name?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly version?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly namespace?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly author?: SingleValue;
@Always(IsOptional(), IsSingleValue())
public readonly description?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('homepage'))
public readonly homepage?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('homepage'))
public readonly homepageURL?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('homepage'))
public readonly website?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('homepage'))
public readonly source?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('icon'))
public readonly icon?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('icon'))
public readonly iconURL?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('icon'))
public readonly defaulticon?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('icon64'))
public readonly icon64?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('icon64'))
public readonly icon64URL?: SingleValue;
@Main(IsOptional(), IsURLValue())
public readonly updateURL?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('downloadURL'))
public readonly downloadURL?: SingleValue;
@Main(IsOptional(), IsURLValue(), IsUnique('downloadURL'))
public readonly installURL?: SingleValue;
@Main(IsOptional(), IsURLValue())
public readonly supportURL?: SingleValue;
@Main(IsOptional(), IsMultiValue())
public readonly include?: MultiValue;
@Main(IsOptional(), IsMultiValue())
public readonly match?: MultiValue;
@Main(IsOptional(), IsMultiValue())
public readonly 'exclude-match'?: MultiValue;
@Main(IsOptional(), IsMultiValue())
public readonly exclude?: MultiValue;
@Main(IsOptional(), IsMultiValue())
public readonly require?: MultiValue;
@Main(IsOptional(), IsNamedValue())
public readonly resource?: NamedValue;
@Main(IsOptional(), IsMultiValue())
public readonly connect?: MultiValue;
@Main(IsOptional(), IsMultiValue())
public readonly grant?: MultiValue;
@Main(IsOptional(), IsMultiValue())
public readonly webRequest?: MultiValue;
@Main(IsOptional(), IsSwitchValue())
public readonly noframes?: SwitchValue;
@Main(IsOptional(), IsSwitchValue())
public readonly unwrap?: SwitchValue;
@Always(IsOptional(), IsNamedValue())
public readonly antifeature?: NamedValue;
@Main(IsOptional(), IsEnumValue(RunAt))
public readonly 'run-at'?: RunAt;
@Main(IsOptional(), IsSingleValue())
public readonly copyright?: SingleValue;
@Main(IsOptional(), IsEnumValue(Sandbox))
public readonly sandbox?: Sandbox;
@Main(IsOptional(), IsEnumValue(InjectInto))
public readonly 'inject-into'?: InjectInto;
@Main(IsOptional(), IsSingleValue())
public readonly license?: SingleValue;
@Main(IsOptional(), IsURLValue())
public readonly contributionURL?: SingleValue;
@Main(IsOptional(), IsSingleValue())
public readonly contributionAmount?: SingleValue;
@Main(IsOptional(), IsNestedValue(Compatibility))
public readonly compatible?: Compatibility;
@Main(IsOptional(), IsNestedValue(Compatibility))
public readonly incompatible?: Compatibility;
}