@celljs/core 3.0.0 → 3.1.0
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/browser/application/frontend-application-state.js +2 -7
- package/lib/browser/application/frontend-application-state.js.map +1 -1
- package/lib/browser/application/frontend-application.js +8 -16
- package/lib/browser/application/frontend-application.js.map +1 -1
- package/lib/browser/application/index.js +3 -16
- package/lib/browser/application/index.js.map +1 -1
- package/lib/browser/index.js +4 -17
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/shell/application-shell.js +2 -7
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/index.js +3 -16
- package/lib/browser/shell/index.js.map +1 -1
- package/lib/common/annotation/aspect.js +1 -1
- package/lib/common/annotation/aspect.js.map +1 -1
- package/lib/common/annotation/autowired.js +1 -1
- package/lib/common/annotation/autowired.js.map +1 -1
- package/lib/common/annotation/component.js +7 -2
- package/lib/common/annotation/component.js.map +1 -1
- package/lib/common/annotation/detached/index.js +4 -17
- package/lib/common/annotation/detached/index.js.map +1 -1
- package/lib/common/annotation/index.js +18 -31
- package/lib/common/annotation/index.js.map +1 -1
- package/lib/common/annotation/value.js +1 -1
- package/lib/common/annotation/value.js.map +1 -1
- package/lib/common/aop/aop-proxy-factory.js +2 -7
- package/lib/common/aop/aop-proxy-factory.js.map +1 -1
- package/lib/common/aop/class-filter.js +2 -7
- package/lib/common/aop/class-filter.js.map +1 -1
- package/lib/common/aop/index.js +4 -17
- package/lib/common/aop/index.js.map +1 -1
- package/lib/common/application/application-protocol.js +5 -13
- package/lib/common/application/application-protocol.js.map +1 -1
- package/lib/common/application/application-state.js +2 -7
- package/lib/common/application/application-state.js.map +1 -1
- package/lib/common/application/application.js +4 -12
- package/lib/common/application/application.js.map +1 -1
- package/lib/common/application/index.js +3 -16
- package/lib/common/application/index.js.map +1 -1
- package/lib/common/config/config-provider.js +4 -12
- package/lib/common/config/config-provider.js.map +1 -1
- package/lib/common/config/index.js +4 -17
- package/lib/common/config/index.js.map +1 -1
- package/lib/common/container/index.js +6 -19
- package/lib/common/container/index.js.map +1 -1
- package/lib/common/el/core-context-initializer.js +5 -13
- package/lib/common/el/core-context-initializer.js.map +1 -1
- package/lib/common/el/expression-compiler.js +4 -12
- package/lib/common/el/expression-compiler.js.map +1 -1
- package/lib/common/el/expression-context-provider.js +5 -16
- package/lib/common/el/expression-context-provider.js.map +1 -1
- package/lib/common/el/expression-handler.js +8 -16
- package/lib/common/el/expression-handler.js.map +1 -1
- package/lib/common/el/index.js +7 -20
- package/lib/common/el/index.js.map +1 -1
- package/lib/common/el/jexl-engine-provider.js +2 -7
- package/lib/common/el/jexl-engine-provider.js.map +1 -1
- package/lib/common/error/{cutom-error.d.ts → custom-error.d.ts} +1 -1
- package/lib/common/error/custom-error.d.ts.map +1 -0
- package/lib/common/error/{cutom-error.js → custom-error.js} +1 -1
- package/lib/common/error/custom-error.js.map +1 -0
- package/lib/common/error/error-protocol.d.ts +1 -1
- package/lib/common/error/error-protocol.d.ts.map +1 -1
- package/lib/common/error/illegal-argument-error.d.ts +1 -1
- package/lib/common/error/illegal-argument-error.d.ts.map +1 -1
- package/lib/common/error/illegal-argument-error.js +2 -2
- package/lib/common/error/illegal-argument-error.js.map +1 -1
- package/lib/common/error/illegal-state-error.d.ts +4 -0
- package/lib/common/error/illegal-state-error.d.ts.map +1 -0
- package/lib/common/error/illegal-state-error.js +8 -0
- package/lib/common/error/illegal-state-error.js.map +1 -0
- package/lib/common/error/index.d.ts +3 -1
- package/lib/common/error/index.d.ts.map +1 -1
- package/lib/common/error/index.js +6 -17
- package/lib/common/error/index.js.map +1 -1
- package/lib/common/error/invalid-mime-type-error.d.ts +6 -0
- package/lib/common/error/invalid-mime-type-error.d.ts.map +1 -0
- package/lib/common/error/invalid-mime-type-error.js +12 -0
- package/lib/common/error/invalid-mime-type-error.js.map +1 -0
- package/lib/common/index.js +12 -25
- package/lib/common/index.js.map +1 -1
- package/lib/common/logger/abstract-logger.js +5 -13
- package/lib/common/logger/abstract-logger.js.map +1 -1
- package/lib/common/logger/index.js +4 -17
- package/lib/common/logger/index.js.map +1 -1
- package/lib/common/logger/logger.js +2 -7
- package/lib/common/logger/logger.js.map +1 -1
- package/lib/common/provider/component-filter-registry.js +5 -16
- package/lib/common/provider/component-filter-registry.js.map +1 -1
- package/lib/common/provider/index.js +6 -19
- package/lib/common/provider/index.js.map +1 -1
- package/lib/common/provider/provider-creator.js +2 -7
- package/lib/common/provider/provider-creator.js.map +1 -1
- package/lib/common/test/index.js +2 -15
- package/lib/common/test/index.js.map +1 -1
- package/lib/common/test/mock-logger.js +2 -7
- package/lib/common/test/mock-logger.js.map +1 -1
- package/lib/common/utils/assert.d.ts +174 -0
- package/lib/common/utils/assert.d.ts.map +1 -0
- package/lib/common/utils/assert.js +287 -0
- package/lib/common/utils/assert.js.map +1 -0
- package/lib/common/utils/index.d.ts +3 -0
- package/lib/common/utils/index.d.ts.map +1 -1
- package/lib/common/utils/index.js +20 -30
- package/lib/common/utils/index.js.map +1 -1
- package/lib/common/utils/mime-type-util.d.ts +37 -0
- package/lib/common/utils/mime-type-util.d.ts.map +1 -0
- package/lib/common/utils/mime-type-util.js +172 -0
- package/lib/common/utils/mime-type-util.js.map +1 -0
- package/lib/common/utils/mime-type.d.ts +33 -0
- package/lib/common/utils/mime-type.d.ts.map +1 -0
- package/lib/common/utils/mime-type.js +262 -0
- package/lib/common/utils/mime-type.js.map +1 -0
- package/lib/common/utils/os.d.ts +2 -2
- package/lib/common/utils/os.js +2 -2
- package/lib/node/application/backend-application-state.js +2 -7
- package/lib/node/application/backend-application-state.js.map +1 -1
- package/lib/node/application/backend-application.js +4 -12
- package/lib/node/application/backend-application.js.map +1 -1
- package/lib/node/application/index.js +3 -16
- package/lib/node/application/index.js.map +1 -1
- package/lib/node/context/index.js +2 -15
- package/lib/node/context/index.js.map +1 -1
- package/lib/node/index.js +4 -17
- package/lib/node/index.js.map +1 -1
- package/lib/node/utils/index.js +2 -15
- package/lib/node/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/src/common/error/error-protocol.ts +1 -1
- package/src/common/error/illegal-argument-error.ts +1 -1
- package/src/common/error/illegal-state-error.ts +5 -0
- package/src/common/error/index.ts +3 -1
- package/src/common/error/invalid-mime-type-error.ts +7 -0
- package/src/common/utils/assert.ts +300 -0
- package/src/common/utils/index.ts +3 -0
- package/src/common/utils/mime-type-util.ts +180 -0
- package/src/common/utils/mime-type.ts +276 -0
- package/src/common/utils/os.ts +2 -2
- package/lib/common/error/cutom-error.d.ts.map +0 -1
- package/lib/common/error/cutom-error.js.map +0 -1
- /package/src/common/error/{cutom-error.ts → custom-error.ts} +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Assert = void 0;
|
|
4
|
+
const illegal_state_error_1 = require("../error/illegal-state-error");
|
|
5
|
+
const class_util_1 = require("./class-util");
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
/* eslint-disable no-null/no-null */
|
|
8
|
+
class Assert {
|
|
9
|
+
/**
|
|
10
|
+
* Assert a boolean expression, throwing an `IllegalStateError`
|
|
11
|
+
* if the expression evaluates to `false`.
|
|
12
|
+
* @param expression a boolean expression
|
|
13
|
+
* @param message the exception message to use if the assertion fails
|
|
14
|
+
* @throws IllegalStateError if `expression` is `false`
|
|
15
|
+
* @example
|
|
16
|
+
* Assert.state(id === undefined, "The id property must not already be initialized");
|
|
17
|
+
* Assert.state(entity.getId() === undefined,
|
|
18
|
+
* () => "ID for entity " + entity.getName() + " must not already be initialized");
|
|
19
|
+
*/
|
|
20
|
+
static state(expression, message) {
|
|
21
|
+
if (!expression) {
|
|
22
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Assert a boolean expression, throwing an `IllegalStateError`
|
|
27
|
+
* if the expression evaluates to `false`.
|
|
28
|
+
* @param expression a boolean expression
|
|
29
|
+
* @param message the exception message to use if the assertion fails
|
|
30
|
+
* @throws IllegalStateError if `expression` is `false`
|
|
31
|
+
* @example
|
|
32
|
+
* Assert.isTrue(i > 0, "The value must be greater than zero");
|
|
33
|
+
* Assert.isTrue(i > 0, () => "The value '" + i + "' must be greater than zero");
|
|
34
|
+
*/
|
|
35
|
+
static isTrue(expression, message) {
|
|
36
|
+
if (!expression) {
|
|
37
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Assert that an object is `undefined`.
|
|
42
|
+
* @param object the object to check
|
|
43
|
+
* @param message the exception message to use if the assertion fails
|
|
44
|
+
* @throws IllegalStateError if the object is not `undefined`
|
|
45
|
+
* @example
|
|
46
|
+
* Assert.isNull(value, "The value must be null");
|
|
47
|
+
* Assert.isNull(value, () => "The value '" + value + "' must be null");
|
|
48
|
+
*/
|
|
49
|
+
static isNull(object, message) {
|
|
50
|
+
if (object !== undefined || object !== null) {
|
|
51
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Assert that an object is not `undefined`.
|
|
56
|
+
* @param object the object to check
|
|
57
|
+
* @param message the exception message to use if the assertion fails
|
|
58
|
+
* @throws IllegalStateError if the object is `undefined`
|
|
59
|
+
* @example
|
|
60
|
+
* Assert.notNull(clazz, "The class must not be null");
|
|
61
|
+
* Assert.notNull(entity.getId(),
|
|
62
|
+
* () => "ID for entity " + entity.getName() + " must not be null");
|
|
63
|
+
*/
|
|
64
|
+
static notNull(object, message) {
|
|
65
|
+
if (object === undefined || object === null) {
|
|
66
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Assert that the given String is not empty; that is,
|
|
71
|
+
* it must not be `undefined` and not the empty String.
|
|
72
|
+
* @param text the String to check
|
|
73
|
+
* @param message the exception message to use if the assertion fails
|
|
74
|
+
* @throws IllegalStateError if the text is empty
|
|
75
|
+
* @example
|
|
76
|
+
* Assert.hasLength(name, "Name must not be empty");
|
|
77
|
+
* Assert.hasLength(name, () => "Name for account '" + account.getId() + "' must not be empty");
|
|
78
|
+
*/
|
|
79
|
+
static hasLength(text, message) {
|
|
80
|
+
if (!text || text.length === 0) {
|
|
81
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Assert that the given String contains valid text content; that is, it must not
|
|
86
|
+
* be `undefined` and must contain at least one non-whitespace character.
|
|
87
|
+
* @param text the String to check
|
|
88
|
+
* @param message the exception message to use if the assertion fails
|
|
89
|
+
* @throws IllegalStateError if the text does not contain valid text content
|
|
90
|
+
* @example
|
|
91
|
+
* Assert.hasText(account.getName(), "Name must not be empty");
|
|
92
|
+
* Assert.hasText(account.getName(),
|
|
93
|
+
* () => "Name for account '" + account.getId() + "' must not be empty");
|
|
94
|
+
*/
|
|
95
|
+
static hasText(text, message) {
|
|
96
|
+
if (!text || text.trim().length === 0) {
|
|
97
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Assert that the given text does not contain the given substring.
|
|
102
|
+
* @param textToSearch the text to search
|
|
103
|
+
* @param substring the substring to find within the text
|
|
104
|
+
* @param message the exception message to use if the assertion fails
|
|
105
|
+
* @throws IllegalStateError if the text contains the substring
|
|
106
|
+
* @example
|
|
107
|
+
* Assert.doesNotContain(name, forbidden, "Name must not contain '" + forbidden + "'");
|
|
108
|
+
* Assert.doesNotContain(name, forbidden,
|
|
109
|
+
* () => "Name must not contain '" + forbidden + "'");
|
|
110
|
+
*/
|
|
111
|
+
static doesNotContain(textToSearch, substring, message) {
|
|
112
|
+
if (textToSearch && substring && textToSearch.includes(substring)) {
|
|
113
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Assert that an array contains elements; that is, it must not be
|
|
118
|
+
* `undefined` and must contain at least one element.
|
|
119
|
+
* @param array the array to check
|
|
120
|
+
* @param message the exception message to use if the assertion fails
|
|
121
|
+
* @throws IllegalStateError if the object array is `undefined` or contains no elements
|
|
122
|
+
* @example
|
|
123
|
+
* Assert.notEmpty(array, "The array must contain elements");
|
|
124
|
+
* Assert.notEmpty(array, () => "The " + arrayType + " array must contain elements");
|
|
125
|
+
*/
|
|
126
|
+
static notEmpty(array, message) {
|
|
127
|
+
if (!array || array.length === 0) {
|
|
128
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Assert that an array contains no `undefined` elements.
|
|
133
|
+
* <p>Note: Does not complain if the array is empty!
|
|
134
|
+
* @param array the array to check
|
|
135
|
+
* @param message the exception message to use if the assertion fails
|
|
136
|
+
* @throws IllegalStateError if the object array contains a `undefined` element
|
|
137
|
+
* @example
|
|
138
|
+
* Assert.noNullElements(array, "The array must contain non-null elements");
|
|
139
|
+
* Assert.noNullElements(array, () => "The " + arrayType + " array must contain non-null elements");
|
|
140
|
+
*/
|
|
141
|
+
static noNullElements(array, message) {
|
|
142
|
+
if (array) {
|
|
143
|
+
for (const element of array) {
|
|
144
|
+
if (element === undefined || element === null) {
|
|
145
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Assert that a collection contains elements; that is, it must not be
|
|
152
|
+
* `undefined` and must contain at least one element.
|
|
153
|
+
* @param collection the collection to check
|
|
154
|
+
* @param message the exception message to use if the assertion fails
|
|
155
|
+
* @throws IllegalStateError if the collection is `undefined` or
|
|
156
|
+
* contains no elements
|
|
157
|
+
* @example
|
|
158
|
+
* Assert.notEmpty(collection, "Collection must contain elements");
|
|
159
|
+
* Assert.notEmpty(collection, () => "The " + collectionType + " collection must contain elements");
|
|
160
|
+
*/
|
|
161
|
+
static notEmptyCollection(collection, message) {
|
|
162
|
+
if (!collection || collection.length === 0) {
|
|
163
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Assert that a collection contains no `undefined` elements.
|
|
168
|
+
* <p>Note: Does not complain if the collection is empty!
|
|
169
|
+
* @param collection the collection to check
|
|
170
|
+
* @param message the exception message to use if the assertion fails
|
|
171
|
+
* @throws IllegalStateError if the collection contains a `undefined`
|
|
172
|
+
* @example
|
|
173
|
+
* Assert.noNullElements(collection, "Collection must contain non-null elements");
|
|
174
|
+
* Assert.noNullElements(collection, () => "The " + collectionName + " must contain non-null elements");
|
|
175
|
+
*/
|
|
176
|
+
static noNullElementsCollection(collection, message) {
|
|
177
|
+
if (collection) {
|
|
178
|
+
for (const element of collection) {
|
|
179
|
+
if (element === undefined || element === null) {
|
|
180
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Assert that a Map contains entries; that is, it must not be `undefined`
|
|
187
|
+
* and must contain at least one entry.
|
|
188
|
+
* @param map the map to check
|
|
189
|
+
* @param message the exception message to use if the assertion fails
|
|
190
|
+
* @throws IllegalStateError if the map is `undefined` or contains no entries
|
|
191
|
+
* @example
|
|
192
|
+
* Assert.notEmpty(map, "The map must contain entries");
|
|
193
|
+
* Assert.notEmpty(map, () => "The " + mapType + " map must contain entries");
|
|
194
|
+
*/
|
|
195
|
+
static notEmptyMap(map, message) {
|
|
196
|
+
if (!map || map.size === 0) {
|
|
197
|
+
throw new illegal_state_error_1.IllegalStateError(this.resolveMessage(message));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Assert that the provided object is an instance of the provided class.
|
|
202
|
+
* @param type the type to check against
|
|
203
|
+
* @param obj the object to check
|
|
204
|
+
* @param message a message which will be prepended to provide further context.
|
|
205
|
+
* If it is empty or ends in ":" or ";" or "," or ".", a full exception message
|
|
206
|
+
* will be appended. If it ends in a space, the name of the offending object's
|
|
207
|
+
* type will be appended. In any other case, a ":" with a space and the name
|
|
208
|
+
* of the offending object's type will be appended.
|
|
209
|
+
* @throws IllegalStateError if the object is not an instance of type
|
|
210
|
+
* @example
|
|
211
|
+
* Assert.instanceOf(Foo, foo, "Foo expected");
|
|
212
|
+
* Assert.instanceOf(Foo, foo, () => "Processing " + Foo.name + ":");
|
|
213
|
+
* Assert.instanceOf(Foo, foo);
|
|
214
|
+
*/
|
|
215
|
+
static isInstanceOf(type, obj, message) {
|
|
216
|
+
this.notNull(type, 'Type to check against must not be null');
|
|
217
|
+
if (!(obj instanceof type)) {
|
|
218
|
+
this.instanceCheckFailed(type, obj, this.resolveMessage(message));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Assert that `superType.isAssignableFrom(subType)` is `true`.
|
|
223
|
+
* @param superType the supertype to check against
|
|
224
|
+
* @param subType the subtype to check
|
|
225
|
+
* @param message a message which will be prepended to provide further context.
|
|
226
|
+
* If it is empty or ends in ":" or ";" or "," or ".", a full exception message
|
|
227
|
+
* will be appended. If it ends in a space, the name of the offending subtype
|
|
228
|
+
* will be appended. In any other case, a ":" with a space and the name of the
|
|
229
|
+
* offending subtype will be appended.
|
|
230
|
+
* @throws IllegalStateError if the classes are not assignable
|
|
231
|
+
* @example
|
|
232
|
+
* Assert.isAssignable(Number, myClass, "Number expected");
|
|
233
|
+
* Assert.isAssignable(Number, myClass, () => "Processing " + myAttributeName + ":");
|
|
234
|
+
*/
|
|
235
|
+
static isAssignable(superType, subType, message) {
|
|
236
|
+
this.notNull(superType, 'Supertype to check against must not be null');
|
|
237
|
+
if (subType === undefined || !(0, class_util_1.getSuperClasses)(subType).includes(superType)) {
|
|
238
|
+
this.assignableCheckFailed(superType, subType, this.resolveMessage(message));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
static instanceCheckFailed(type, obj, msg) {
|
|
242
|
+
const className = (obj !== undefined ? obj.constructor.name : 'undefined');
|
|
243
|
+
let result = '';
|
|
244
|
+
let defaultMessage = true;
|
|
245
|
+
if (msg && msg.length > 0) {
|
|
246
|
+
if (this.endsWithSeparator(msg)) {
|
|
247
|
+
result = msg + ' ';
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
result = this.messageWithTypeName(msg, className);
|
|
251
|
+
defaultMessage = false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (defaultMessage) {
|
|
255
|
+
result = result + (`Object of class [${className}] must be an instance of ${type}`);
|
|
256
|
+
}
|
|
257
|
+
throw new illegal_state_error_1.IllegalStateError(result);
|
|
258
|
+
}
|
|
259
|
+
static assignableCheckFailed(superType, subType, msg) {
|
|
260
|
+
let result = '';
|
|
261
|
+
let defaultMessage = true;
|
|
262
|
+
if (msg && msg.length > 0) {
|
|
263
|
+
if (this.endsWithSeparator(msg)) {
|
|
264
|
+
result = msg + ' ';
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
result = this.messageWithTypeName(msg, subType);
|
|
268
|
+
defaultMessage = false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (defaultMessage) {
|
|
272
|
+
result = result + (`${subType} is not assignable to ${superType}`);
|
|
273
|
+
}
|
|
274
|
+
throw new illegal_state_error_1.IllegalStateError(result);
|
|
275
|
+
}
|
|
276
|
+
static endsWithSeparator(msg) {
|
|
277
|
+
return (msg.endsWith(':') || msg.endsWith(';') || msg.endsWith(',') || msg.endsWith('.'));
|
|
278
|
+
}
|
|
279
|
+
static messageWithTypeName(msg, typeName) {
|
|
280
|
+
return msg + (msg.endsWith(' ') ? '' : ': ') + ('name' in typeName) ? typeName.name : typeName;
|
|
281
|
+
}
|
|
282
|
+
static resolveMessage(message) {
|
|
283
|
+
return typeof message === 'function' ? message() : message;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
exports.Assert = Assert;
|
|
287
|
+
//# sourceMappingURL=assert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../src/common/utils/assert.ts"],"names":[],"mappings":";;;AAAA,sEAAiE;AACjE,6CAA+C;AAE/C,uDAAuD;AACvD,oCAAoC;AAEpC,MAAsB,MAAM;IACxB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,UAAmB,EAAE,OAAgC;QAC9D,IAAI,CAAC,UAAU,EAAE;YACb,MAAM,IAAI,uCAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7D;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CAAC,UAAmB,EAAE,OAAgC;QAC/D,IAAI,CAAC,UAAU,EAAE;YACb,MAAM,IAAI,uCAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7D;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,CAAC,MAAW,EAAE,OAAgC;QACvD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;YACzC,MAAM,IAAI,uCAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7D;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO,CAAC,MAAe,EAAE,OAAgC;QAC5D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,I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E,CAAC;CACJ;AArSD,wBAqSC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./
|
|
25
|
-
__exportStar(require("./
|
|
26
|
-
__exportStar(require("./
|
|
27
|
-
__exportStar(require("./
|
|
28
|
-
__exportStar(require("./
|
|
29
|
-
__exportStar(require("./
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
32
|
-
__exportStar(require("./
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./prioritizeable"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./promise-util"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./class-util"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./metadata-util"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./disposable"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./os"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./proxy-util"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./annotation-util"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./cancellation"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./event"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./emitter"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./global-util"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./async"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./url-util"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./uuid"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./assert"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./mime-type-util"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./mime-type"), exports);
|
|
33
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,yDAA+B;AAC/B,kDAAwB;AACxB,uDAA6B;AAC7B,0DAAgC;AAChC,uDAA6B;AAC7B,+CAAqB;AACrB,uDAA6B;AAC7B,4DAAkC;AAClC,yDAA+B;AAC/B,kDAAwB;AACxB,oDAA0B;AAC1B,wDAA8B;AAC9B,kDAAwB;AACxB,qDAA2B;AAC3B,iDAAuB;AACvB,mDAAyB;AACzB,2DAAiC;AACjC,sDAA4B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MimeType } from './mime-type';
|
|
2
|
+
export declare abstract class MimeTypeUtils {
|
|
3
|
+
private static readonly BOUNDARY_CHARS;
|
|
4
|
+
static readonly ALL: MimeType;
|
|
5
|
+
static readonly ALL_VALUE: string;
|
|
6
|
+
static readonly APPLICATION_GRAPHQL: MimeType;
|
|
7
|
+
static readonly APPLICATION_GRAPHQL_VALUE: string;
|
|
8
|
+
static readonly APPLICATION_JSON: MimeType;
|
|
9
|
+
static readonly APPLICATION_JSON_VALUE: string;
|
|
10
|
+
static readonly APPLICATION_OCTET_STREAM: MimeType;
|
|
11
|
+
static readonly APPLICATION_OCTET_STREAM_VALUE: string;
|
|
12
|
+
static readonly APPLICATION_XML: MimeType;
|
|
13
|
+
static readonly APPLICATION_XML_VALUE: string;
|
|
14
|
+
static readonly IMAGE_GIF: MimeType;
|
|
15
|
+
static readonly IMAGE_GIF_VALUE: string;
|
|
16
|
+
static readonly IMAGE_JPEG: MimeType;
|
|
17
|
+
static readonly IMAGE_JPEG_VALUE: string;
|
|
18
|
+
static readonly IMAGE_PNG: MimeType;
|
|
19
|
+
static readonly IMAGE_PNG_VALUE: string;
|
|
20
|
+
static readonly TEXT_HTML: MimeType;
|
|
21
|
+
static readonly TEXT_HTML_VALUE: string;
|
|
22
|
+
static readonly TEXT_PLAIN: MimeType;
|
|
23
|
+
static readonly TEXT_PLAIN_VALUE: string;
|
|
24
|
+
static readonly TEXT_XML: MimeType;
|
|
25
|
+
static readonly TEXT_XML_VALUE: string;
|
|
26
|
+
private static cachedMimeTypes;
|
|
27
|
+
static parseMimeType(mimeType: string): MimeType;
|
|
28
|
+
private static parseMimeTypeInternal;
|
|
29
|
+
static parseMimeTypes(mimeTypes: string): MimeType[];
|
|
30
|
+
static tokenize(mimeTypes: string): string[];
|
|
31
|
+
static toString(mimeTypes: MimeType[]): string;
|
|
32
|
+
static sortBySpecificity<T extends MimeType>(mimeTypes: T[]): void;
|
|
33
|
+
private static bubbleSort;
|
|
34
|
+
static generateMultipartBoundary(): Uint8Array;
|
|
35
|
+
static generateMultipartBoundaryString(): string;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mime-type-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-type-util.d.ts","sourceRoot":"","sources":["../../../src/common/utils/mime-type-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,E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,CAAC,gBAAgB,EAAE,MAAM,CAAgB;IACxD,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAA+B;IACjE,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAc;IAEpD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAoC;IAElE,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ;IAahD,OAAO,CAAC,MAAM,CAAC,qBAAqB;IA4DpC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAOpD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IA6B5C,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM;IAI9C,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI;IAOlE,OAAO,CAAC,MAAM,CAAC,UAAU;IAczB,MAAM,CAAC,yBAAyB,IAAI,UAAU;IAO9C,MAAM,CAAC,+BAA+B,IAAI,MAAM;CAGnD"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MimeTypeUtils = void 0;
|
|
4
|
+
const mime_type_1 = require("./mime-type");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
class MimeTypeUtils {
|
|
7
|
+
static parseMimeType(mimeType) {
|
|
8
|
+
if (!mimeType) {
|
|
9
|
+
throw new error_1.InvalidMimeTypeError(mimeType, '"mimeType" must not be empty');
|
|
10
|
+
}
|
|
11
|
+
if (mimeType.startsWith('multipart')) {
|
|
12
|
+
return this.parseMimeTypeInternal(mimeType);
|
|
13
|
+
}
|
|
14
|
+
if (!this.cachedMimeTypes.has(mimeType)) {
|
|
15
|
+
this.cachedMimeTypes.set(mimeType, this.parseMimeTypeInternal(mimeType));
|
|
16
|
+
}
|
|
17
|
+
return this.cachedMimeTypes.get(mimeType);
|
|
18
|
+
}
|
|
19
|
+
static parseMimeTypeInternal(mimeType) {
|
|
20
|
+
let index = mimeType.indexOf(';');
|
|
21
|
+
let fullType = (index >= 0 ? mimeType.substring(0, index) : mimeType).trim();
|
|
22
|
+
if (fullType.length === 0) {
|
|
23
|
+
throw new error_1.InvalidMimeTypeError(mimeType, '"mimeType" must not be empty');
|
|
24
|
+
}
|
|
25
|
+
if (fullType === '*') {
|
|
26
|
+
fullType = '*/*';
|
|
27
|
+
}
|
|
28
|
+
const subIndex = fullType.indexOf('/');
|
|
29
|
+
if (subIndex === -1) {
|
|
30
|
+
throw new error_1.InvalidMimeTypeError(mimeType, 'does not contain "/"');
|
|
31
|
+
}
|
|
32
|
+
if (subIndex === fullType.length - 1) {
|
|
33
|
+
throw new error_1.InvalidMimeTypeError(mimeType, 'does not contain subtype after "/"');
|
|
34
|
+
}
|
|
35
|
+
const type = fullType.substring(0, subIndex);
|
|
36
|
+
const subtype = fullType.substring(subIndex + 1);
|
|
37
|
+
if (type === '*' && subtype !== '*') {
|
|
38
|
+
throw new error_1.InvalidMimeTypeError(mimeType, 'wildcard type is legal only in "*/*" (all mime types)');
|
|
39
|
+
}
|
|
40
|
+
let parameters = undefined;
|
|
41
|
+
do {
|
|
42
|
+
let nextIndex = index + 1;
|
|
43
|
+
let quoted = false;
|
|
44
|
+
while (nextIndex < mimeType.length) {
|
|
45
|
+
const ch = mimeType.charAt(nextIndex);
|
|
46
|
+
if (ch === ';') {
|
|
47
|
+
if (!quoted) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (ch === '"') {
|
|
52
|
+
quoted = !quoted;
|
|
53
|
+
}
|
|
54
|
+
nextIndex++;
|
|
55
|
+
}
|
|
56
|
+
const parameter = mimeType.substring(index + 1, nextIndex).trim();
|
|
57
|
+
if (parameter.length > 0) {
|
|
58
|
+
if (parameters === undefined) {
|
|
59
|
+
parameters = new Map();
|
|
60
|
+
}
|
|
61
|
+
const eqIndex = parameter.indexOf('=');
|
|
62
|
+
if (eqIndex >= 0) {
|
|
63
|
+
const attribute = parameter.substring(0, eqIndex).trim();
|
|
64
|
+
const value = parameter.substring(eqIndex + 1).trim();
|
|
65
|
+
parameters.set(attribute, value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
index = nextIndex;
|
|
69
|
+
} while (index < mimeType.length);
|
|
70
|
+
try {
|
|
71
|
+
return new mime_type_1.MimeType(type, subtype, parameters);
|
|
72
|
+
}
|
|
73
|
+
catch (ex) {
|
|
74
|
+
throw new error_1.InvalidMimeTypeError(mimeType, ex.message);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
static parseMimeTypes(mimeTypes) {
|
|
78
|
+
if (!mimeTypes) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
return this.tokenize(mimeTypes).filter(mimeType => !!mimeType).map(this.parseMimeType);
|
|
82
|
+
}
|
|
83
|
+
static tokenize(mimeTypes) {
|
|
84
|
+
if (!mimeTypes) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const tokens = [];
|
|
88
|
+
let inQuotes = false;
|
|
89
|
+
let startIndex = 0;
|
|
90
|
+
let i = 0;
|
|
91
|
+
while (i < mimeTypes.length) {
|
|
92
|
+
switch (mimeTypes.charAt(i)) {
|
|
93
|
+
case '"':
|
|
94
|
+
inQuotes = !inQuotes;
|
|
95
|
+
break;
|
|
96
|
+
case ',':
|
|
97
|
+
if (!inQuotes) {
|
|
98
|
+
tokens.push(mimeTypes.substring(startIndex, i));
|
|
99
|
+
startIndex = i + 1;
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case '\\':
|
|
103
|
+
i++;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
i++;
|
|
107
|
+
}
|
|
108
|
+
tokens.push(mimeTypes.substring(startIndex));
|
|
109
|
+
return tokens;
|
|
110
|
+
}
|
|
111
|
+
static toString(mimeTypes) {
|
|
112
|
+
return mimeTypes.map(mimeType => mimeType.toString()).join(', ');
|
|
113
|
+
}
|
|
114
|
+
static sortBySpecificity(mimeTypes) {
|
|
115
|
+
if (mimeTypes.length > 50) {
|
|
116
|
+
throw new error_1.InvalidMimeTypeError(mimeTypes.toString(), 'Too many elements');
|
|
117
|
+
}
|
|
118
|
+
this.bubbleSort(mimeTypes, (a, b) => a.isLessSpecific(b));
|
|
119
|
+
}
|
|
120
|
+
static bubbleSort(list, swap) {
|
|
121
|
+
const len = list.length;
|
|
122
|
+
for (let i = 0; i < len; i++) {
|
|
123
|
+
for (let j = 1; j < len - i; j++) {
|
|
124
|
+
const prev = list[j - 1];
|
|
125
|
+
const cur = list[j];
|
|
126
|
+
if (swap(prev, cur)) {
|
|
127
|
+
list[j] = prev;
|
|
128
|
+
list[j - 1] = cur;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
static generateMultipartBoundary() {
|
|
134
|
+
const boundary = new Uint8Array(Math.floor(Math.random() * 11) + 30);
|
|
135
|
+
for (let i = 0; i < boundary.length; i++) {
|
|
136
|
+
boundary[i] = this.BOUNDARY_CHARS[Math.floor(Math.random() * this.BOUNDARY_CHARS.length)].charCodeAt(0);
|
|
137
|
+
}
|
|
138
|
+
return boundary;
|
|
139
|
+
}
|
|
140
|
+
static generateMultipartBoundaryString() {
|
|
141
|
+
return new TextDecoder('ascii').decode(this.generateMultipartBoundary());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.MimeTypeUtils = MimeTypeUtils;
|
|
145
|
+
MimeTypeUtils.BOUNDARY_CHARS = ['-', '_', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
|
146
|
+
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A',
|
|
147
|
+
'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
|
|
148
|
+
'V', 'W', 'X', 'Y', 'Z'];
|
|
149
|
+
MimeTypeUtils.ALL = new mime_type_1.MimeType('*', '*');
|
|
150
|
+
MimeTypeUtils.ALL_VALUE = '*/*';
|
|
151
|
+
MimeTypeUtils.APPLICATION_GRAPHQL = new mime_type_1.MimeType('application', 'graphql+json');
|
|
152
|
+
MimeTypeUtils.APPLICATION_GRAPHQL_VALUE = 'application/graphql+json';
|
|
153
|
+
MimeTypeUtils.APPLICATION_JSON = new mime_type_1.MimeType('application', 'json');
|
|
154
|
+
MimeTypeUtils.APPLICATION_JSON_VALUE = 'application/json';
|
|
155
|
+
MimeTypeUtils.APPLICATION_OCTET_STREAM = new mime_type_1.MimeType('application', 'octet-stream');
|
|
156
|
+
MimeTypeUtils.APPLICATION_OCTET_STREAM_VALUE = 'application/octet-stream';
|
|
157
|
+
MimeTypeUtils.APPLICATION_XML = new mime_type_1.MimeType('application', 'xml');
|
|
158
|
+
MimeTypeUtils.APPLICATION_XML_VALUE = 'application/xml';
|
|
159
|
+
MimeTypeUtils.IMAGE_GIF = new mime_type_1.MimeType('image', 'gif');
|
|
160
|
+
MimeTypeUtils.IMAGE_GIF_VALUE = 'image/gif';
|
|
161
|
+
MimeTypeUtils.IMAGE_JPEG = new mime_type_1.MimeType('image', 'jpeg');
|
|
162
|
+
MimeTypeUtils.IMAGE_JPEG_VALUE = 'image/jpeg';
|
|
163
|
+
MimeTypeUtils.IMAGE_PNG = new mime_type_1.MimeType('image', 'png');
|
|
164
|
+
MimeTypeUtils.IMAGE_PNG_VALUE = 'image/png';
|
|
165
|
+
MimeTypeUtils.TEXT_HTML = new mime_type_1.MimeType('text', 'html');
|
|
166
|
+
MimeTypeUtils.TEXT_HTML_VALUE = 'text/html';
|
|
167
|
+
MimeTypeUtils.TEXT_PLAIN = new mime_type_1.MimeType('text', 'plain');
|
|
168
|
+
MimeTypeUtils.TEXT_PLAIN_VALUE = 'text/plain';
|
|
169
|
+
MimeTypeUtils.TEXT_XML = new mime_type_1.MimeType('text', 'xml');
|
|
170
|
+
MimeTypeUtils.TEXT_XML_VALUE = 'text/xml';
|
|
171
|
+
MimeTypeUtils.cachedMimeTypes = new Map();
|
|
172
|
+
//# sourceMappingURL=mime-type-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-type-util.js","sourceRoot":"","sources":["../../../src/common/utils/mime-type-util.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,oCAAgD;AAEhD,MAAsB,aAAa;IAgC/B,MAAM,CAAC,aAAa,CAAC,QAAgB;QACjC,IAAI,CAAC,QAAQ,EAAE;YACX,MAAM,IAAI,4BAAoB,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC;SAC5E;QACD,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YAClC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;SAC/C;QACD,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACrC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC5E;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;IAC/C,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,QAAgB;QACjD,IAAI,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,QAAQ,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CA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,sCAAwB,GAAa,IAAI,oBAAQ,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AACjF,4CAA8B,GAAW,0BAA0B,CAAC;AACpE,6BAAe,GAAa,IAAI,oBAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAC/D,mCAAqB,GAAW,iBAAiB,CAAC;AAClD,uBAAS,GAAa,IAAI,oBAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,6BAAe,GAAW,WAAW,CAAC;AACtC,wBAAU,GAAa,IAAI,oBAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACrD,8BAAgB,GAAW,YAAY,CAAC;AACxC,uBAAS,GAAa,IAAI,oBAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,6BAAe,GAAW,WAAW,CAAC;AACtC,uBAAS,GAAa,IAAI,oBAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACnD,6BAAe,GAAW,WAAW,CAAC;AACtC,wBAAU,GAAa,IAAI,oBAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrD,8BAAgB,GAAW,YAAY,CAAC;AACxC,sBAAQ,GAAa,IAAI,oBAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,4BAAc,GAAW,UAAU,CAAC;AAErC,6BAAe,GAA0B,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare class MimeType {
|
|
2
|
+
private static readonly WILDCARD_TYPE;
|
|
3
|
+
private static readonly PARAM_CHARSET;
|
|
4
|
+
private static TOKEN;
|
|
5
|
+
private readonly type;
|
|
6
|
+
private readonly subtype;
|
|
7
|
+
private readonly parameters;
|
|
8
|
+
private charset?;
|
|
9
|
+
constructor(type: string, subtype?: string, parameters?: Map<string, string>);
|
|
10
|
+
private checkToken;
|
|
11
|
+
protected checkParameters(parameter: string, value: string): void;
|
|
12
|
+
private isQuotedString;
|
|
13
|
+
protected unquote(s: string): string;
|
|
14
|
+
isWildcardType(): boolean;
|
|
15
|
+
isWildcardSubtype(): boolean;
|
|
16
|
+
isConcrete(): boolean;
|
|
17
|
+
getType(): string;
|
|
18
|
+
getSubtype(): string;
|
|
19
|
+
getSubtypeSuffix(): string | undefined;
|
|
20
|
+
getCharset(): string | undefined;
|
|
21
|
+
getParameter(name: string): string | undefined;
|
|
22
|
+
getParameters(): Map<string, string>;
|
|
23
|
+
includes(other?: MimeType): boolean;
|
|
24
|
+
isCompatibleWith(other?: MimeType): boolean;
|
|
25
|
+
equalsTypeAndSubtype(other?: MimeType): boolean;
|
|
26
|
+
isPresentIn(mimeTypes: MimeType[]): boolean;
|
|
27
|
+
equals(other: unknown): boolean;
|
|
28
|
+
private parametersAreEqual;
|
|
29
|
+
isMoreSpecific(other: MimeType): boolean;
|
|
30
|
+
isLessSpecific(other: MimeType): boolean;
|
|
31
|
+
static valueOf(value: string): MimeType;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=mime-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-type.d.ts","sourceRoot":"","sources":["../../../src/common/utils/mime-type.ts"],"names":[],"mappings":"AAGA,qBAAa,QAAQ;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAO;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAa;IAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAA0B;IAE9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,OAAO,CAAC,CAAS;gBAqCb,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAA+B,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAmBpG,OAAO,CAAC,UAAU;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