@tstdl/base 0.90.67 → 0.90.69

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.
@@ -1,11 +1,10 @@
1
- import type { HttpClientOptions } from '../../http/client/index.js';
2
- import { HttpClient } from '../../http/client/index.js';
3
- import type { Resolvable } from '../../injector/interfaces.js';
4
- import type { ApiClientImplementation, ApiDefinition, ApiEndpointDefinition } from '../types.js';
1
+ import { HttpClient, type HttpClientOptions } from '../../http/client/index.js';
2
+ import { type Resolvable } from '../../injector/interfaces.js';
3
+ import { type ApiClientImplementation, type ApiDefinition, type ApiEndpointDefinition } from '../types.js';
5
4
  export type ApiClient<T extends ApiDefinition> = new (httpClientOrOptions?: HttpClient | HttpClientOptions) => ApiClientImplementation<T> & Resolvable<HttpClient | HttpClientOptions>;
6
5
  export type ClientOptions = {
7
6
  /**
8
- * url prefix
7
+ * Url prefix
9
8
  * @default `api/`
10
9
  */
11
10
  prefix?: string;
@@ -17,3 +16,5 @@ export type ApiClientHttpRequestContext = {
17
16
  export declare const httpClientSymbol: unique symbol;
18
17
  export declare const apiDefinitionSymbol: unique symbol;
19
18
  export declare function compileClient<T extends ApiDefinition>(definition: T, options?: ClientOptions): ApiClient<T>;
19
+ export declare function getHttpClientOfApiClient(apiClient: any): HttpClient;
20
+ export declare function getApiDefinitionOfApiClient(apiClient: any): ApiDefinition;
@@ -10,6 +10,7 @@ import { objectEntries } from '../../utils/object/object.js';
10
10
  import { toTitleCase } from '../../utils/string/title-case.js';
11
11
  import { isArray, isBlob, isDefined, isObject, isReadableStream, isString, isUint8Array, isUndefined } from '../../utils/type-guards.js';
12
12
  import { buildUrl } from '../../utils/url-builder.js';
13
+ import { resolveValueOrProvider } from '../../utils/value-or-provider.js';
13
14
  import { normalizedApiDefinitionEndpointsEntries } from '../types.js';
14
15
  import { getFullApiEndpointResource } from '../utils.js';
15
16
  export const httpClientSymbol = Symbol('ApiTransport');
@@ -27,6 +28,17 @@ export function compileClient(definition, options = {}) {
27
28
  this[httpClientSymbol] = (httpClientOrOptions instanceof HttpClient) ? httpClientOrOptions : inject(HttpClient, httpClientOrOptions);
28
29
  this[apiDefinitionSymbol] = definition;
29
30
  }
31
+ getEndpointResource(endpoint, parameters) {
32
+ const resource = getFullApiEndpointResource({ api: definition, endpoint: resolveValueOrProvider(definition.endpoints[endpoint]), defaultPrefix: options.prefix });
33
+ if (isUndefined(parameters)) {
34
+ return resource;
35
+ }
36
+ return buildUrl(resource, parameters).parsedUrl;
37
+ }
38
+ getEndpointUrl(endpoint, parameters) {
39
+ const url = this.getEndpointResource(endpoint, parameters);
40
+ return new URL(url, this[httpClientSymbol].options.baseUrl);
41
+ }
30
42
  }
31
43
  }[apiName];
32
44
  Injector.registerSingleton(api, {
@@ -40,7 +52,7 @@ export function compileClient(definition, options = {}) {
40
52
  const methods = isArray(endpoint.method) ? endpoint.method : [endpoint.method ?? 'GET'];
41
53
  const resource = getFullApiEndpointResource({ api: definition, endpoint, defaultPrefix: options.prefix });
42
54
  const hasGet = methods.includes('GET');
43
- const fallbackMethod = methods.filter((method) => method != 'GET')[0] ?? 'GET';
55
+ const fallbackMethod = methods.find((method) => method != 'GET') ?? 'GET';
44
56
  const apiEndpointFunction = {
45
57
  async [name](parameters, requestBody) {
46
58
  const context = { endpoint };
@@ -119,3 +131,9 @@ function getServerSentEvents(baseUrl, resource, endpoint, parameters) {
119
131
  }
120
132
  return new ServerSentEvents(url.toString(), { withCredentials: endpoint.credentials });
121
133
  }
134
+ export function getHttpClientOfApiClient(apiClient) {
135
+ return apiClient[httpClientSymbol];
136
+ }
137
+ export function getApiDefinitionOfApiClient(apiClient) {
138
+ return apiClient[apiDefinitionSymbol];
139
+ }
package/api/types.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { SchemaOutput, SchemaTestable } from '../schema/index.js';
4
4
  import type { ServerSentEventsSource } from '../sse/server-sent-events-source.js';
5
5
  import type { ServerSentEvents } from '../sse/server-sent-events.js';
6
6
  import type { NonUndefinable, OneOrMany, Record, ReturnTypeOrT } from '../types.js';
7
+ import { type ValueOrProvider } from '../utils/value-or-provider.js';
7
8
  import type { ApiGatewayMiddlewareContext } from './server/index.js';
8
9
  export type ApiRegistrationOptions = {
9
10
  name?: string;
@@ -69,7 +70,7 @@ export type ApiEndpointDefinition = {
69
70
  credentials?: boolean;
70
71
  cors?: ApiEndpointDefinitionCors;
71
72
  };
72
- export type ApiEndpointsDefinition = Record<string, ApiEndpointDefinition | (() => ApiEndpointDefinition)>;
73
+ export type ApiEndpointsDefinition = Record<string, ValueOrProvider<ApiEndpointDefinition>>;
73
74
  export type ApiDefinition<Resource extends string = string, Endpoints extends ApiEndpointsDefinition = ApiEndpointsDefinition> = {
74
75
  /**
75
76
  * Default root resource for endpoints.
@@ -112,6 +113,9 @@ export type ApiController<T extends ApiDefinition = any> = {
112
113
  };
113
114
  export type ApiClientImplementation<T extends ApiDefinition = any> = {
114
115
  [P in ApiEndpointKeys<T>]: ApiEndpointClientImplementation<T, P>;
116
+ } & {
117
+ getEndpointResource<E extends ApiEndpointKeys<T>>(endpoint: E, parameters?: ApiParameters<T, E>): string;
118
+ getEndpointUrl<E extends ApiEndpointKeys<T>>(endpoint: E, parameters?: ApiParameters<T, E>): string;
115
119
  };
116
120
  export declare function defineApi<T extends ApiDefinition>(definition: T): T;
117
121
  export declare function resolveApiEndpointDataProvider<T>(request: HttpServerRequest, context: ApiGatewayMiddlewareContext, provider: ApiEndpointDataProvider<T>): Promise<T>;
package/api/types.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { objectEntries } from '../utils/object/object.js';
2
2
  import { isFunction } from '../utils/type-guards.js';
3
+ import { resolveValueOrProvider } from '../utils/value-or-provider.js';
3
4
  export function defineApi(definition) {
4
5
  return definition;
5
6
  }
@@ -14,5 +15,5 @@ export function normalizedApiDefinitionEndpoints(apiDefinitionEndpoints) {
14
15
  return Object.fromEntries(entries);
15
16
  }
16
17
  export function normalizedApiDefinitionEndpointsEntries(apiDefinition) {
17
- return objectEntries(apiDefinition).map(([key, def]) => [key, isFunction(def) ? def() : def]);
18
+ return objectEntries(apiDefinition).map(([key, def]) => [key, resolveValueOrProvider(def)]);
18
19
  }
package/file/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './mime-type.js';
2
+ export * from './mime-types.js';
package/file/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from './mime-type.js';
2
+ export * from './mime-types.js';
@@ -1,2 +1,2 @@
1
1
  export declare function getMimeType(file: Uint8Array | ReadableStream<Uint8Array>): Promise<string>;
2
- export declare function getMimeTypeExtension(file: Uint8Array | ReadableStream<Uint8Array>): Promise<string | null>;
2
+ export declare function getMimeTypeExtensions(mimeType: string): string[];
package/file/mime-type.js CHANGED
@@ -2,17 +2,12 @@ import { dynamicImport } from '../import.js';
2
2
  import { decodeTextStream } from '../utils/encoding.js';
3
3
  import { readTextStream } from '../utils/stream/stream-reader.js';
4
4
  import { isUint8Array } from '../utils/type-guards.js';
5
+ import { mimeTypesMap } from './mime-types.js';
5
6
  export async function getMimeType(file) {
6
7
  return spawnFileCommand(['--brief', '--mime-type', '-'], file);
7
8
  }
8
- export async function getMimeTypeExtension(file) {
9
- const extensions = await spawnFileCommand(['--brief', '--extension', '-'], file);
10
- const indexOfSlash = extensions.indexOf('/');
11
- const extension = (indexOfSlash > 0) ? extensions.slice(0, indexOfSlash) : extensions;
12
- if (extension == '???') {
13
- return null;
14
- }
15
- return extension;
9
+ export function getMimeTypeExtensions(mimeType) {
10
+ return mimeTypesMap.get(mimeType) ?? [];
16
11
  }
17
12
  async function spawnFileCommand(args, file) {
18
13
  const { spawn } = await dynamicImport('node:child_process');
@@ -0,0 +1,2 @@
1
+ export declare const mimeTypes: Record<string, string[]>;
2
+ export declare const mimeTypesMap: Map<string, string[]>;
@@ -0,0 +1,799 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import { objectEntries } from '../utils/object/object.js';
3
+ export const mimeTypes = {
4
+ 'application/andrew-inset': ['ez'],
5
+ 'application/applixware': ['aw'],
6
+ 'application/atom+xml': ['atom'],
7
+ 'application/atomcat+xml': ['atomcat'],
8
+ 'application/atomsvc+xml': ['atomsvc'],
9
+ 'application/ccxml+xml': ['ccxml'],
10
+ 'application/cdmi-capability': ['cdmia'],
11
+ 'application/cdmi-container': ['cdmic'],
12
+ 'application/cdmi-domain': ['cdmid'],
13
+ 'application/cdmi-object': ['cdmio'],
14
+ 'application/cdmi-queue': ['cdmiq'],
15
+ 'application/cu-seeme': ['cu'],
16
+ 'application/davmount+xml': ['davmount'],
17
+ 'application/docbook+xml': ['dbk'],
18
+ 'application/dssc+der': ['dssc'],
19
+ 'application/dssc+xml': ['xdssc'],
20
+ 'application/ecmascript': ['ecma'],
21
+ 'application/emma+xml': ['emma'],
22
+ 'application/epub+zip': ['epub'],
23
+ 'application/exi': ['exi'],
24
+ 'application/font-tdpfr': ['pfr'],
25
+ 'application/gml+xml': ['gml'],
26
+ 'application/gpx+xml': ['gpx'],
27
+ 'application/gxf': ['gxf'],
28
+ 'application/hyperstudio': ['stk'],
29
+ 'application/inkml+xml': ['ink', 'inkml'],
30
+ 'application/ipfix': ['ipfix'],
31
+ 'application/java-archive': ['jar'],
32
+ 'application/java-serialized-object': ['ser'],
33
+ 'application/java-vm': ['class'],
34
+ 'application/json': ['json'],
35
+ 'application/jsonml+json': ['jsonml'],
36
+ 'application/lost+xml': ['lostxml'],
37
+ 'application/mac-binhex40': ['hqx'],
38
+ 'application/mac-compactpro': ['cpt'],
39
+ 'application/mads+xml': ['mads'],
40
+ 'application/marc': ['mrc'],
41
+ 'application/marcxml+xml': ['mrcx'],
42
+ 'application/mathematica': ['ma', 'nb', 'mb'],
43
+ 'application/mathml+xml': ['mathml'],
44
+ 'application/mbox': ['mbox'],
45
+ 'application/mediaservercontrol+xml': ['mscml'],
46
+ 'application/metalink+xml': ['metalink'],
47
+ 'application/metalink4+xml': ['meta4'],
48
+ 'application/mets+xml': ['mets'],
49
+ 'application/mods+xml': ['mods'],
50
+ 'application/mp21': ['m21', 'mp21'],
51
+ 'application/mp4': ['mp4s'],
52
+ 'application/msword': ['doc', 'dot'],
53
+ 'application/mxf': ['mxf'],
54
+ 'application/octet-stream': [
55
+ 'bin', 'dms',
56
+ 'lrf', 'mar',
57
+ 'so', 'dist',
58
+ 'distz', 'pkg',
59
+ 'bpk', 'dump',
60
+ 'elc', 'deploy'
61
+ ],
62
+ 'application/oda': ['oda'],
63
+ 'application/oebps-package+xml': ['opf'],
64
+ 'application/ogg': ['ogx'],
65
+ 'application/omdoc+xml': ['omdoc'],
66
+ 'application/onenote': ['onetoc', 'onetoc2', 'onetmp', 'onepkg'],
67
+ 'application/oxps': ['oxps'],
68
+ 'application/patch-ops-error+xml': ['xer'],
69
+ 'application/pdf': ['pdf'],
70
+ 'application/pgp-encrypted': ['pgp'],
71
+ 'application/pgp-signature': ['asc', 'sig'],
72
+ 'application/pics-rules': ['prf'],
73
+ 'application/pkcs10': ['p10'],
74
+ 'application/pkcs7-mime': ['p7m', 'p7c'],
75
+ 'application/pkcs7-signature': ['p7s'],
76
+ 'application/pkcs8': ['p8'],
77
+ 'application/pkix-attr-cert': ['ac'],
78
+ 'application/pkix-cert': ['cer'],
79
+ 'application/pkix-crl': ['crl'],
80
+ 'application/pkix-pkipath': ['pkipath'],
81
+ 'application/pkixcmp': ['pki'],
82
+ 'application/pls+xml': ['pls'],
83
+ 'application/postscript': ['ai', 'eps', 'ps'],
84
+ 'application/prs.cww': ['cww'],
85
+ 'application/pskc+xml': ['pskcxml'],
86
+ 'application/rdf+xml': ['rdf'],
87
+ 'application/reginfo+xml': ['rif'],
88
+ 'application/relax-ng-compact-syntax': ['rnc'],
89
+ 'application/resource-lists+xml': ['rl'],
90
+ 'application/resource-lists-diff+xml': ['rld'],
91
+ 'application/rls-services+xml': ['rs'],
92
+ 'application/rpki-ghostbusters': ['gbr'],
93
+ 'application/rpki-manifest': ['mft'],
94
+ 'application/rpki-roa': ['roa'],
95
+ 'application/rsd+xml': ['rsd'],
96
+ 'application/rss+xml': ['rss'],
97
+ 'application/rtf': ['rtf'],
98
+ 'application/sbml+xml': ['sbml'],
99
+ 'application/scvp-cv-request': ['scq'],
100
+ 'application/scvp-cv-response': ['scs'],
101
+ 'application/scvp-vp-request': ['spq'],
102
+ 'application/scvp-vp-response': ['spp'],
103
+ 'application/sdp': ['sdp'],
104
+ 'application/set-payment-initiation': ['setpay'],
105
+ 'application/set-registration-initiation': ['setreg'],
106
+ 'application/shf+xml': ['shf'],
107
+ 'application/smil+xml': ['smi', 'smil'],
108
+ 'application/sparql-query': ['rq'],
109
+ 'application/sparql-results+xml': ['srx'],
110
+ 'application/srgs': ['gram'],
111
+ 'application/srgs+xml': ['grxml'],
112
+ 'application/sru+xml': ['sru'],
113
+ 'application/ssdl+xml': ['ssdl'],
114
+ 'application/ssml+xml': ['ssml'],
115
+ 'application/tei+xml': ['tei', 'teicorpus'],
116
+ 'application/thraud+xml': ['tfi'],
117
+ 'application/timestamped-data': ['tsd'],
118
+ 'application/vnd.3gpp.pic-bw-large': ['plb'],
119
+ 'application/vnd.3gpp.pic-bw-small': ['psb'],
120
+ 'application/vnd.3gpp.pic-bw-var': ['pvb'],
121
+ 'application/vnd.3gpp2.tcap': ['tcap'],
122
+ 'application/vnd.3m.post-it-notes': ['pwn'],
123
+ 'application/vnd.accpac.simply.aso': ['aso'],
124
+ 'application/vnd.accpac.simply.imp': ['imp'],
125
+ 'application/vnd.acucobol': ['acu'],
126
+ 'application/vnd.acucorp': ['atc', 'acutc'],
127
+ 'application/vnd.adobe.air-application-installer-package+zip': ['air'],
128
+ 'application/vnd.adobe.formscentral.fcdt': ['fcdt'],
129
+ 'application/vnd.adobe.fxp': ['fxp', 'fxpl'],
130
+ 'application/vnd.adobe.xdp+xml': ['xdp'],
131
+ 'application/vnd.adobe.xfdf': ['xfdf'],
132
+ 'application/vnd.ahead.space': ['ahead'],
133
+ 'application/vnd.airzip.filesecure.azf': ['azf'],
134
+ 'application/vnd.airzip.filesecure.azs': ['azs'],
135
+ 'application/vnd.amazon.ebook': ['azw'],
136
+ 'application/vnd.americandynamics.acc': ['acc'],
137
+ 'application/vnd.amiga.ami': ['ami'],
138
+ 'application/vnd.android.package-archive': ['apk'],
139
+ 'application/vnd.anser-web-certificate-issue-initiation': ['cii'],
140
+ 'application/vnd.anser-web-funds-transfer-initiation': ['fti'],
141
+ 'application/vnd.antix.game-component': ['atx'],
142
+ 'application/vnd.apple.installer+xml': ['mpkg'],
143
+ 'application/vnd.apple.mpegurl': ['m3u8'],
144
+ 'application/vnd.aristanetworks.swi': ['swi'],
145
+ 'application/vnd.astraea-software.iota': ['iota'],
146
+ 'application/vnd.audiograph': ['aep'],
147
+ 'application/vnd.blueice.multipass': ['mpm'],
148
+ 'application/vnd.bmi': ['bmi'],
149
+ 'application/vnd.businessobjects': ['rep'],
150
+ 'application/vnd.chemdraw+xml': ['cdxml'],
151
+ 'application/vnd.chipnuts.karaoke-mmd': ['mmd'],
152
+ 'application/vnd.cinderella': ['cdy'],
153
+ 'application/vnd.claymore': ['cla'],
154
+ 'application/vnd.cloanto.rp9': ['rp9'],
155
+ 'application/vnd.clonk.c4group': ['c4g', 'c4d', 'c4f', 'c4p', 'c4u'],
156
+ 'application/vnd.cluetrust.cartomobile-config': ['c11amc'],
157
+ 'application/vnd.cluetrust.cartomobile-config-pkg': ['c11amz'],
158
+ 'application/vnd.commonspace': ['csp'],
159
+ 'application/vnd.contact.cmsg': ['cdbcmsg'],
160
+ 'application/vnd.cosmocaller': ['cmc'],
161
+ 'application/vnd.crick.clicker': ['clkx'],
162
+ 'application/vnd.crick.clicker.keyboard': ['clkk'],
163
+ 'application/vnd.crick.clicker.palette': ['clkp'],
164
+ 'application/vnd.crick.clicker.template': ['clkt'],
165
+ 'application/vnd.crick.clicker.wordbank': ['clkw'],
166
+ 'application/vnd.criticaltools.wbs+xml': ['wbs'],
167
+ 'application/vnd.ctc-posml': ['pml'],
168
+ 'application/vnd.cups-ppd': ['ppd'],
169
+ 'application/vnd.curl.car': ['car'],
170
+ 'application/vnd.curl.pcurl': ['pcurl'],
171
+ 'application/vnd.dart': ['dart'],
172
+ 'application/vnd.data-vision.rdz': ['rdz'],
173
+ 'application/vnd.dece.data': ['uvf', 'uvvf', 'uvd', 'uvvd'],
174
+ 'application/vnd.dece.ttml+xml': ['uvt', 'uvvt'],
175
+ 'application/vnd.dece.unspecified': ['uvx', 'uvvx'],
176
+ 'application/vnd.dece.zip': ['uvz', 'uvvz'],
177
+ 'application/vnd.denovo.fcselayout-link': ['fe_launch'],
178
+ 'application/vnd.dna': ['dna'],
179
+ 'application/vnd.dolby.mlp': ['mlp'],
180
+ 'application/vnd.dpgraph': ['dpg'],
181
+ 'application/vnd.dreamfactory': ['dfac'],
182
+ 'application/vnd.ds-keypoint': ['kpxx'],
183
+ 'application/vnd.dvb.ait': ['ait'],
184
+ 'application/vnd.dvb.service': ['svc'],
185
+ 'application/vnd.dynageo': ['geo'],
186
+ 'application/vnd.ecowin.chart': ['mag'],
187
+ 'application/vnd.enliven': ['nml'],
188
+ 'application/vnd.epson.esf': ['esf'],
189
+ 'application/vnd.epson.msf': ['msf'],
190
+ 'application/vnd.epson.quickanime': ['qam'],
191
+ 'application/vnd.epson.salt': ['slt'],
192
+ 'application/vnd.epson.ssf': ['ssf'],
193
+ 'application/vnd.eszigno3+xml': ['es3', 'et3'],
194
+ 'application/vnd.ezpix-album': ['ez2'],
195
+ 'application/vnd.ezpix-package': ['ez3'],
196
+ 'application/vnd.fdf': ['fdf'],
197
+ 'application/vnd.fdsn.mseed': ['mseed'],
198
+ 'application/vnd.fdsn.seed': ['seed', 'dataless'],
199
+ 'application/vnd.flographit': ['gph'],
200
+ 'application/vnd.fluxtime.clip': ['ftc'],
201
+ 'application/vnd.framemaker': ['fm', 'frame', 'maker', 'book'],
202
+ 'application/vnd.frogans.fnc': ['fnc'],
203
+ 'application/vnd.frogans.ltf': ['ltf'],
204
+ 'application/vnd.fsc.weblaunch': ['fsc'],
205
+ 'application/vnd.fujitsu.oasys': ['oas'],
206
+ 'application/vnd.fujitsu.oasys2': ['oa2'],
207
+ 'application/vnd.fujitsu.oasys3': ['oa3'],
208
+ 'application/vnd.fujitsu.oasysgp': ['fg5'],
209
+ 'application/vnd.fujitsu.oasysprs': ['bh2'],
210
+ 'application/vnd.fujixerox.ddd': ['ddd'],
211
+ 'application/vnd.fujixerox.docuworks': ['xdw'],
212
+ 'application/vnd.fujixerox.docuworks.binder': ['xbd'],
213
+ 'application/vnd.fuzzysheet': ['fzs'],
214
+ 'application/vnd.genomatix.tuxedo': ['txd'],
215
+ 'application/vnd.geogebra.file': ['ggb'],
216
+ 'application/vnd.geogebra.slides': ['ggs'],
217
+ 'application/vnd.geogebra.tool': ['ggt'],
218
+ 'application/vnd.geometry-explorer': ['gex', 'gre'],
219
+ 'application/vnd.geonext': ['gxt'],
220
+ 'application/vnd.geoplan': ['g2w'],
221
+ 'application/vnd.geospace': ['g3w'],
222
+ 'application/vnd.gmx': ['gmx'],
223
+ 'application/vnd.google-earth.kml+xml': ['kml'],
224
+ 'application/vnd.google-earth.kmz': ['kmz'],
225
+ 'application/vnd.grafeq': ['gqf', 'gqs'],
226
+ 'application/vnd.groove-account': ['gac'],
227
+ 'application/vnd.groove-help': ['ghf'],
228
+ 'application/vnd.groove-identity-message': ['gim'],
229
+ 'application/vnd.groove-injector': ['grv'],
230
+ 'application/vnd.groove-tool-message': ['gtm'],
231
+ 'application/vnd.groove-tool-template': ['tpl'],
232
+ 'application/vnd.groove-vcard': ['vcg'],
233
+ 'application/vnd.hal+xml': ['hal'],
234
+ 'application/vnd.handheld-entertainment+xml': ['zmm'],
235
+ 'application/vnd.hbci': ['hbci'],
236
+ 'application/vnd.hhe.lesson-player': ['les'],
237
+ 'application/vnd.hp-hpgl': ['hpgl'],
238
+ 'application/vnd.hp-hpid': ['hpid'],
239
+ 'application/vnd.hp-hps': ['hps'],
240
+ 'application/vnd.hp-jlyt': ['jlt'],
241
+ 'application/vnd.hp-pcl': ['pcl'],
242
+ 'application/vnd.hp-pclxl': ['pclxl'],
243
+ 'application/vnd.ibm.minipay': ['mpy'],
244
+ 'application/vnd.ibm.modcap': ['afp', 'listafp', 'list3820'],
245
+ 'application/vnd.ibm.rights-management': ['irm'],
246
+ 'application/vnd.ibm.secure-container': ['sc'],
247
+ 'application/vnd.iccprofile': ['icc', 'icm'],
248
+ 'application/vnd.igloader': ['igl'],
249
+ 'application/vnd.immervision-ivp': ['ivp'],
250
+ 'application/vnd.immervision-ivu': ['ivu'],
251
+ 'application/vnd.insors.igm': ['igm'],
252
+ 'application/vnd.intercon.formnet': ['xpw', 'xpx'],
253
+ 'application/vnd.intergeo': ['i2g'],
254
+ 'application/vnd.intu.qbo': ['qbo'],
255
+ 'application/vnd.intu.qfx': ['qfx'],
256
+ 'application/vnd.ipunplugged.rcprofile': ['rcprofile'],
257
+ 'application/vnd.irepository.package+xml': ['irp'],
258
+ 'application/vnd.is-xpr': ['xpr'],
259
+ 'application/vnd.isac.fcs': ['fcs'],
260
+ 'application/vnd.jam': ['jam'],
261
+ 'application/vnd.jcp.javame.midlet-rms': ['rms'],
262
+ 'application/vnd.jisp': ['jisp'],
263
+ 'application/vnd.joost.joda-archive': ['joda'],
264
+ 'application/vnd.kahootz': ['ktz', 'ktr'],
265
+ 'application/vnd.kde.karbon': ['karbon'],
266
+ 'application/vnd.kde.kchart': ['chrt'],
267
+ 'application/vnd.kde.kformula': ['kfo'],
268
+ 'application/vnd.kde.kivio': ['flw'],
269
+ 'application/vnd.kde.kontour': ['kon'],
270
+ 'application/vnd.kde.kpresenter': ['kpr', 'kpt'],
271
+ 'application/vnd.kde.kspread': ['ksp'],
272
+ 'application/vnd.kde.kword': ['kwd', 'kwt'],
273
+ 'application/vnd.kenameaapp': ['htke'],
274
+ 'application/vnd.kidspiration': ['kia'],
275
+ 'application/vnd.kinar': ['kne', 'knp'],
276
+ 'application/vnd.koan': ['skp', 'skd', 'skt', 'skm'],
277
+ 'application/vnd.kodak-descriptor': ['sse'],
278
+ 'application/vnd.las.las+xml': ['lasxml'],
279
+ 'application/vnd.llamagraphics.life-balance.desktop': ['lbd'],
280
+ 'application/vnd.llamagraphics.life-balance.exchange+xml': ['lbe'],
281
+ 'application/vnd.lotus-1-2-3': ['123'],
282
+ 'application/vnd.lotus-approach': ['apr'],
283
+ 'application/vnd.lotus-freelance': ['pre'],
284
+ 'application/vnd.lotus-notes': ['nsf'],
285
+ 'application/vnd.lotus-organizer': ['org'],
286
+ 'application/vnd.lotus-screencam': ['scm'],
287
+ 'application/vnd.lotus-wordpro': ['lwp'],
288
+ 'application/vnd.macports.portpkg': ['portpkg'],
289
+ 'application/vnd.mcd': ['mcd'],
290
+ 'application/vnd.medcalcdata': ['mc1'],
291
+ 'application/vnd.mediastation.cdkey': ['cdkey'],
292
+ 'application/vnd.mfer': ['mwf'],
293
+ 'application/vnd.mfmp': ['mfm'],
294
+ 'application/vnd.micrografx.flo': ['flo'],
295
+ 'application/vnd.micrografx.igx': ['igx'],
296
+ 'application/vnd.mif': ['mif'],
297
+ 'application/vnd.mobius.daf': ['daf'],
298
+ 'application/vnd.mobius.dis': ['dis'],
299
+ 'application/vnd.mobius.mbk': ['mbk'],
300
+ 'application/vnd.mobius.mqy': ['mqy'],
301
+ 'application/vnd.mobius.msl': ['msl'],
302
+ 'application/vnd.mobius.plc': ['plc'],
303
+ 'application/vnd.mobius.txf': ['txf'],
304
+ 'application/vnd.mophun.application': ['mpn'],
305
+ 'application/vnd.mophun.certificate': ['mpc'],
306
+ 'application/vnd.mozilla.xul+xml': ['xul'],
307
+ 'application/vnd.ms-artgalry': ['cil'],
308
+ 'application/vnd.ms-cab-compressed': ['cab'],
309
+ 'application/vnd.ms-excel': ['xls', 'xlm', 'xla', 'xlc', 'xlt', 'xlw'],
310
+ 'application/vnd.ms-excel.addin.macroenabled.12': ['xlam'],
311
+ 'application/vnd.ms-excel.sheet.binary.macroenabled.12': ['xlsb'],
312
+ 'application/vnd.ms-excel.sheet.macroenabled.12': ['xlsm'],
313
+ 'application/vnd.ms-excel.template.macroenabled.12': ['xltm'],
314
+ 'application/vnd.ms-fontobject': ['eot'],
315
+ 'application/vnd.ms-htmlhelp': ['chm'],
316
+ 'application/vnd.ms-ims': ['ims'],
317
+ 'application/vnd.ms-lrm': ['lrm'],
318
+ 'application/vnd.ms-officetheme': ['thmx'],
319
+ 'application/vnd.ms-pki.seccat': ['cat'],
320
+ 'application/vnd.ms-pki.stl': ['stl'],
321
+ 'application/vnd.ms-powerpoint': ['ppt', 'pps', 'pot'],
322
+ 'application/vnd.ms-powerpoint.addin.macroenabled.12': ['ppam'],
323
+ 'application/vnd.ms-powerpoint.presentation.macroenabled.12': ['pptm'],
324
+ 'application/vnd.ms-powerpoint.slide.macroenabled.12': ['sldm'],
325
+ 'application/vnd.ms-powerpoint.slideshow.macroenabled.12': ['ppsm'],
326
+ 'application/vnd.ms-powerpoint.template.macroenabled.12': ['potm'],
327
+ 'application/vnd.ms-project': ['mpp', 'mpt'],
328
+ 'application/vnd.ms-word.document.macroenabled.12': ['docm'],
329
+ 'application/vnd.ms-word.template.macroenabled.12': ['dotm'],
330
+ 'application/vnd.ms-works': ['wps', 'wks', 'wcm', 'wdb'],
331
+ 'application/vnd.ms-wpl': ['wpl'],
332
+ 'application/vnd.ms-xpsdocument': ['xps'],
333
+ 'application/vnd.mseq': ['mseq'],
334
+ 'application/vnd.musician': ['mus'],
335
+ 'application/vnd.muvee.style': ['msty'],
336
+ 'application/vnd.mynfc': ['taglet'],
337
+ 'application/vnd.neurolanguage.nlu': ['nlu'],
338
+ 'application/vnd.nitf': ['ntf', 'nitf'],
339
+ 'application/vnd.noblenet-directory': ['nnd'],
340
+ 'application/vnd.noblenet-sealer': ['nns'],
341
+ 'application/vnd.noblenet-web': ['nnw'],
342
+ 'application/vnd.nokia.n-gage.data': ['ngdat'],
343
+ 'application/vnd.nokia.radio-preset': ['rpst'],
344
+ 'application/vnd.nokia.radio-presets': ['rpss'],
345
+ 'application/vnd.novadigm.edm': ['edm'],
346
+ 'application/vnd.novadigm.edx': ['edx'],
347
+ 'application/vnd.novadigm.ext': ['ext'],
348
+ 'application/vnd.oasis.opendocument.chart': ['odc'],
349
+ 'application/vnd.oasis.opendocument.chart-template': ['otc'],
350
+ 'application/vnd.oasis.opendocument.database': ['odb'],
351
+ 'application/vnd.oasis.opendocument.formula': ['odf'],
352
+ 'application/vnd.oasis.opendocument.formula-template': ['odft'],
353
+ 'application/vnd.oasis.opendocument.graphics': ['odg'],
354
+ 'application/vnd.oasis.opendocument.graphics-template': ['otg'],
355
+ 'application/vnd.oasis.opendocument.image': ['odi'],
356
+ 'application/vnd.oasis.opendocument.image-template': ['oti'],
357
+ 'application/vnd.oasis.opendocument.presentation': ['odp'],
358
+ 'application/vnd.oasis.opendocument.presentation-template': ['otp'],
359
+ 'application/vnd.oasis.opendocument.spreadsheet': ['ods'],
360
+ 'application/vnd.oasis.opendocument.spreadsheet-template': ['ots'],
361
+ 'application/vnd.oasis.opendocument.text': ['odt'],
362
+ 'application/vnd.oasis.opendocument.text-master': ['odm'],
363
+ 'application/vnd.oasis.opendocument.text-template': ['ott'],
364
+ 'application/vnd.oasis.opendocument.text-web': ['oth'],
365
+ 'application/vnd.olpc-sugar': ['xo'],
366
+ 'application/vnd.oma.dd2+xml': ['dd2'],
367
+ 'application/vnd.openofficeorg.extension': ['oxt'],
368
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': ['pptx'],
369
+ 'application/vnd.openxmlformats-officedocument.presentationml.slide': ['sldx'],
370
+ 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': ['ppsx'],
371
+ 'application/vnd.openxmlformats-officedocument.presentationml.template': ['potx'],
372
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['xlsx'],
373
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': ['xltx'],
374
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['docx'],
375
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': ['dotx'],
376
+ 'application/vnd.osgeo.mapguide.package': ['mgp'],
377
+ 'application/vnd.osgi.dp': ['dp'],
378
+ 'application/vnd.osgi.subsystem': ['esa'],
379
+ 'application/vnd.palm': ['pdb', 'pqa', 'oprc'],
380
+ 'application/vnd.pawaafile': ['paw'],
381
+ 'application/vnd.pg.format': ['str'],
382
+ 'application/vnd.pg.osasli': ['ei6'],
383
+ 'application/vnd.picsel': ['efif'],
384
+ 'application/vnd.pmi.widget': ['wg'],
385
+ 'application/vnd.pocketlearn': ['plf'],
386
+ 'application/vnd.powerbuilder6': ['pbd'],
387
+ 'application/vnd.previewsystems.box': ['box'],
388
+ 'application/vnd.proteus.magazine': ['mgz'],
389
+ 'application/vnd.publishare-delta-tree': ['qps'],
390
+ 'application/vnd.pvi.ptid1': ['ptid'],
391
+ 'application/vnd.quark.quarkxpress': ['qxd', 'qxt', 'qwd', 'qwt', 'qxl', 'qxb'],
392
+ 'application/vnd.realvnc.bed': ['bed'],
393
+ 'application/vnd.recordare.musicxml': ['mxl'],
394
+ 'application/vnd.recordare.musicxml+xml': ['musicxml'],
395
+ 'application/vnd.rig.cryptonote': ['cryptonote'],
396
+ 'application/vnd.rim.cod': ['cod'],
397
+ 'application/vnd.rn-realmedia': ['rm'],
398
+ 'application/vnd.rn-realmedia-vbr': ['rmvb'],
399
+ 'application/vnd.route66.link66+xml': ['link66'],
400
+ 'application/vnd.sailingtracker.track': ['st'],
401
+ 'application/vnd.seemail': ['see'],
402
+ 'application/vnd.sema': ['sema'],
403
+ 'application/vnd.semd': ['semd'],
404
+ 'application/vnd.semf': ['semf'],
405
+ 'application/vnd.shana.informed.formdata': ['ifm'],
406
+ 'application/vnd.shana.informed.formtemplate': ['itp'],
407
+ 'application/vnd.shana.informed.interchange': ['iif'],
408
+ 'application/vnd.shana.informed.package': ['ipk'],
409
+ 'application/vnd.simtech-mindmapper': ['twd', 'twds'],
410
+ 'application/vnd.smaf': ['mmf'],
411
+ 'application/vnd.smart.teacher': ['teacher'],
412
+ 'application/vnd.solent.sdkm+xml': ['sdkm', 'sdkd'],
413
+ 'application/vnd.spotfire.dxp': ['dxp'],
414
+ 'application/vnd.spotfire.sfs': ['sfs'],
415
+ 'application/vnd.stardivision.calc': ['sdc'],
416
+ 'application/vnd.stardivision.draw': ['sda'],
417
+ 'application/vnd.stardivision.impress': ['sdd'],
418
+ 'application/vnd.stardivision.math': ['smf'],
419
+ 'application/vnd.stardivision.writer': ['sdw', 'vor'],
420
+ 'application/vnd.stardivision.writer-global': ['sgl'],
421
+ 'application/vnd.stepmania.package': ['smzip'],
422
+ 'application/vnd.stepmania.stepchart': ['sm'],
423
+ 'application/vnd.sun.xml.calc': ['sxc'],
424
+ 'application/vnd.sun.xml.calc.template': ['stc'],
425
+ 'application/vnd.sun.xml.draw': ['sxd'],
426
+ 'application/vnd.sun.xml.draw.template': ['std'],
427
+ 'application/vnd.sun.xml.impress': ['sxi'],
428
+ 'application/vnd.sun.xml.impress.template': ['sti'],
429
+ 'application/vnd.sun.xml.math': ['sxm'],
430
+ 'application/vnd.sun.xml.writer': ['sxw'],
431
+ 'application/vnd.sun.xml.writer.global': ['sxg'],
432
+ 'application/vnd.sun.xml.writer.template': ['stw'],
433
+ 'application/vnd.sus-calendar': ['sus', 'susp'],
434
+ 'application/vnd.svd': ['svd'],
435
+ 'application/vnd.symbian.install': ['sis', 'sisx'],
436
+ 'application/vnd.syncml+xml': ['xsm'],
437
+ 'application/vnd.syncml.dm+wbxml': ['bdm'],
438
+ 'application/vnd.syncml.dm+xml': ['xdm'],
439
+ 'application/vnd.tao.intent-module-archive': ['tao'],
440
+ 'application/vnd.tcpdump.pcap': ['pcap', 'cap', 'dmp'],
441
+ 'application/vnd.tmobile-livetv': ['tmo'],
442
+ 'application/vnd.trid.tpt': ['tpt'],
443
+ 'application/vnd.triscape.mxs': ['mxs'],
444
+ 'application/vnd.trueapp': ['tra'],
445
+ 'application/vnd.ufdl': ['ufd', 'ufdl'],
446
+ 'application/vnd.uiq.theme': ['utz'],
447
+ 'application/vnd.umajin': ['umj'],
448
+ 'application/vnd.unity': ['unityweb'],
449
+ 'application/vnd.uoml+xml': ['uoml'],
450
+ 'application/vnd.vcx': ['vcx'],
451
+ 'application/vnd.visio': ['vsd', 'vst', 'vss', 'vsw'],
452
+ 'application/vnd.visionary': ['vis'],
453
+ 'application/vnd.vsf': ['vsf'],
454
+ 'application/vnd.wap.wbxml': ['wbxml'],
455
+ 'application/vnd.wap.wmlc': ['wmlc'],
456
+ 'application/vnd.wap.wmlscriptc': ['wmlsc'],
457
+ 'application/vnd.webturbo': ['wtb'],
458
+ 'application/vnd.wolfram.player': ['nbp'],
459
+ 'application/vnd.wordperfect': ['wpd'],
460
+ 'application/vnd.wqd': ['wqd'],
461
+ 'application/vnd.wt.stf': ['stf'],
462
+ 'application/vnd.xara': ['xar'],
463
+ 'application/vnd.xfdl': ['xfdl'],
464
+ 'application/vnd.yamaha.hv-dic': ['hvd'],
465
+ 'application/vnd.yamaha.hv-script': ['hvs'],
466
+ 'application/vnd.yamaha.hv-voice': ['hvp'],
467
+ 'application/vnd.yamaha.openscoreformat': ['osf'],
468
+ 'application/vnd.yamaha.openscoreformat.osfpvg+xml': ['osfpvg'],
469
+ 'application/vnd.yamaha.smaf-audio': ['saf'],
470
+ 'application/vnd.yamaha.smaf-phrase': ['spf'],
471
+ 'application/vnd.yellowriver-custom-menu': ['cmp'],
472
+ 'application/vnd.zul': ['zir', 'zirz'],
473
+ 'application/vnd.zzazz.deck+xml': ['zaz'],
474
+ 'application/voicexml+xml': ['vxml'],
475
+ 'application/wasm': ['wasm'],
476
+ 'application/widget': ['wgt'],
477
+ 'application/winhlp': ['hlp'],
478
+ 'application/wsdl+xml': ['wsdl'],
479
+ 'application/wspolicy+xml': ['wspolicy'],
480
+ 'application/x-7z-compressed': ['7z'],
481
+ 'application/x-abiword': ['abw'],
482
+ 'application/x-ace-compressed': ['ace'],
483
+ 'application/x-apple-diskimage': ['dmg'],
484
+ 'application/x-authorware-bin': ['aab', 'x32', 'u32', 'vox'],
485
+ 'application/x-authorware-map': ['aam'],
486
+ 'application/x-authorware-seg': ['aas'],
487
+ 'application/x-bcpio': ['bcpio'],
488
+ 'application/x-bittorrent': ['torrent'],
489
+ 'application/x-blorb': ['blb', 'blorb'],
490
+ 'application/x-bzip': ['bz'],
491
+ 'application/x-bzip2': ['bz2', 'boz'],
492
+ 'application/x-cbr': ['cbr', 'cba', 'cbt', 'cbz', 'cb7'],
493
+ 'application/x-cdlink': ['vcd'],
494
+ 'application/x-cfs-compressed': ['cfs'],
495
+ 'application/x-chat': ['chat'],
496
+ 'application/x-chess-pgn': ['pgn'],
497
+ 'application/x-conference': ['nsc'],
498
+ 'application/x-cpio': ['cpio'],
499
+ 'application/x-csh': ['csh'],
500
+ 'application/x-debian-package': ['deb', 'udeb'],
501
+ 'application/x-dgc-compressed': ['dgc'],
502
+ 'application/x-director': [
503
+ 'dir', 'dcr',
504
+ 'dxr', 'cst',
505
+ 'cct', 'cxt',
506
+ 'w3d', 'fgd',
507
+ 'swa'
508
+ ],
509
+ 'application/x-doom': ['wad'],
510
+ 'application/x-dtbncx+xml': ['ncx'],
511
+ 'application/x-dtbook+xml': ['dtb'],
512
+ 'application/x-dtbresource+xml': ['res'],
513
+ 'application/x-dvi': ['dvi'],
514
+ 'application/x-envoy': ['evy'],
515
+ 'application/x-eva': ['eva'],
516
+ 'application/x-font-bdf': ['bdf'],
517
+ 'application/x-font-ghostscript': ['gsf'],
518
+ 'application/x-font-linux-psf': ['psf'],
519
+ 'application/x-font-pcf': ['pcf'],
520
+ 'application/x-font-snf': ['snf'],
521
+ 'application/x-font-type1': ['pfa', 'pfb', 'pfm', 'afm'],
522
+ 'application/x-freearc': ['arc'],
523
+ 'application/x-futuresplash': ['spl'],
524
+ 'application/x-gca-compressed': ['gca'],
525
+ 'application/x-glulx': ['ulx'],
526
+ 'application/x-gnumeric': ['gnumeric'],
527
+ 'application/x-gramps-xml': ['gramps'],
528
+ 'application/x-gtar': ['gtar'],
529
+ 'application/x-hdf': ['hdf'],
530
+ 'application/x-install-instructions': ['install'],
531
+ 'application/x-iso9660-image': ['iso'],
532
+ 'application/x-java-jnlp-file': ['jnlp'],
533
+ 'application/x-latex': ['latex'],
534
+ 'application/x-lzh-compressed': ['lzh', 'lha'],
535
+ 'application/x-mie': ['mie'],
536
+ 'application/x-mobipocket-ebook': ['prc', 'mobi'],
537
+ 'application/x-ms-application': ['application'],
538
+ 'application/x-ms-shortcut': ['lnk'],
539
+ 'application/x-ms-wmd': ['wmd'],
540
+ 'application/x-ms-wmz': ['wmz'],
541
+ 'application/x-ms-xbap': ['xbap'],
542
+ 'application/x-msaccess': ['mdb'],
543
+ 'application/x-msbinder': ['obd'],
544
+ 'application/x-mscardfile': ['crd'],
545
+ 'application/x-msclip': ['clp'],
546
+ 'application/x-msdownload': ['exe', 'dll', 'com', 'bat', 'msi'],
547
+ 'application/x-msmediaview': ['mvb', 'm13', 'm14'],
548
+ 'application/x-msmetafile': ['wmf', 'wmz', 'emf', 'emz'],
549
+ 'application/x-msmoney': ['mny'],
550
+ 'application/x-mspublisher': ['pub'],
551
+ 'application/x-msschedule': ['scd'],
552
+ 'application/x-msterminal': ['trm'],
553
+ 'application/x-mswrite': ['wri'],
554
+ 'application/x-netcdf': ['nc', 'cdf'],
555
+ 'application/x-nzb': ['nzb'],
556
+ 'application/x-pkcs12': ['p12', 'pfx'],
557
+ 'application/x-pkcs7-certificates': ['p7b', 'spc'],
558
+ 'application/x-pkcs7-certreqresp': ['p7r'],
559
+ 'application/x-rar-compressed': ['rar'],
560
+ 'application/x-research-info-systems': ['ris'],
561
+ 'application/x-sh': ['sh'],
562
+ 'application/x-shar': ['shar'],
563
+ 'application/x-shockwave-flash': ['swf'],
564
+ 'application/x-silverlight-app': ['xap'],
565
+ 'application/x-sql': ['sql'],
566
+ 'application/x-stuffit': ['sit'],
567
+ 'application/x-stuffitx': ['sitx'],
568
+ 'application/x-subrip': ['srt'],
569
+ 'application/x-sv4cpio': ['sv4cpio'],
570
+ 'application/x-sv4crc': ['sv4crc'],
571
+ 'application/x-t3vm-image': ['t3'],
572
+ 'application/x-tads': ['gam'],
573
+ 'application/x-tar': ['tar'],
574
+ 'application/x-tcl': ['tcl'],
575
+ 'application/x-tex': ['tex'],
576
+ 'application/x-tex-tfm': ['tfm'],
577
+ 'application/x-texinfo': ['texinfo', 'texi'],
578
+ 'application/x-tgif': ['obj'],
579
+ 'application/x-ustar': ['ustar'],
580
+ 'application/x-wais-source': ['src'],
581
+ 'application/x-x509-ca-cert': ['der', 'crt'],
582
+ 'application/x-xfig': ['fig'],
583
+ 'application/x-xliff+xml': ['xlf'],
584
+ 'application/x-xpinstall': ['xpi'],
585
+ 'application/x-xz': ['xz'],
586
+ 'application/x-zmachine': [
587
+ 'z1', 'z2', 'z3',
588
+ 'z4', 'z5', 'z6',
589
+ 'z7', 'z8'
590
+ ],
591
+ 'application/xaml+xml': ['xaml'],
592
+ 'application/xcap-diff+xml': ['xdf'],
593
+ 'application/xenc+xml': ['xenc'],
594
+ 'application/xhtml+xml': ['xhtml', 'xht'],
595
+ 'application/xml': ['xml', 'xsl'],
596
+ 'application/xml-dtd': ['dtd'],
597
+ 'application/xop+xml': ['xop'],
598
+ 'application/xproc+xml': ['xpl'],
599
+ 'application/xslt+xml': ['xslt'],
600
+ 'application/xspf+xml': ['xspf'],
601
+ 'application/xv+xml': ['mxml', 'xhvml', 'xvml', 'xvm'],
602
+ 'application/yang': ['yang'],
603
+ 'application/yin+xml': ['yin'],
604
+ 'application/zip': ['zip'],
605
+ 'audio/adpcm': ['adp'],
606
+ 'audio/basic': ['au', 'snd'],
607
+ 'audio/midi': ['mid', 'midi', 'kar', 'rmi'],
608
+ 'audio/mp4': ['m4a', 'mp4a'],
609
+ 'audio/mpeg': ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'],
610
+ 'audio/ogg': ['oga', 'ogg', 'spx', 'opus'],
611
+ 'audio/s3m': ['s3m'],
612
+ 'audio/silk': ['sil'],
613
+ 'audio/vnd.dece.audio': ['uva', 'uvva'],
614
+ 'audio/vnd.digital-winds': ['eol'],
615
+ 'audio/vnd.dra': ['dra'],
616
+ 'audio/vnd.dts': ['dts'],
617
+ 'audio/vnd.dts.hd': ['dtshd'],
618
+ 'audio/vnd.lucent.voice': ['lvp'],
619
+ 'audio/vnd.ms-playready.media.pya': ['pya'],
620
+ 'audio/vnd.nuera.ecelp4800': ['ecelp4800'],
621
+ 'audio/vnd.nuera.ecelp7470': ['ecelp7470'],
622
+ 'audio/vnd.nuera.ecelp9600': ['ecelp9600'],
623
+ 'audio/vnd.rip': ['rip'],
624
+ 'audio/webm': ['weba'],
625
+ 'audio/x-aac': ['aac'],
626
+ 'audio/x-aiff': ['aif', 'aiff', 'aifc'],
627
+ 'audio/x-caf': ['caf'],
628
+ 'audio/x-flac': ['flac'],
629
+ 'audio/x-matroska': ['mka'],
630
+ 'audio/x-mpegurl': ['m3u'],
631
+ 'audio/x-ms-wax': ['wax'],
632
+ 'audio/x-ms-wma': ['wma'],
633
+ 'audio/x-pn-realaudio': ['ram', 'ra'],
634
+ 'audio/x-pn-realaudio-plugin': ['rmp'],
635
+ 'audio/x-wav': ['wav'],
636
+ 'audio/xm': ['xm'],
637
+ 'chemical/x-cdx': ['cdx'],
638
+ 'chemical/x-cif': ['cif'],
639
+ 'chemical/x-cmdf': ['cmdf'],
640
+ 'chemical/x-cml': ['cml'],
641
+ 'chemical/x-csml': ['csml'],
642
+ 'chemical/x-xyz': ['xyz'],
643
+ 'font/collection': ['ttc'],
644
+ 'font/otf': ['otf'],
645
+ 'font/ttf': ['ttf'],
646
+ 'font/woff': ['woff'],
647
+ 'font/woff2': ['woff2'],
648
+ 'image/bmp': ['bmp'],
649
+ 'image/cgm': ['cgm'],
650
+ 'image/g3fax': ['g3'],
651
+ 'image/gif': ['gif'],
652
+ 'image/ief': ['ief'],
653
+ 'image/jpeg': ['jpeg', 'jpg', 'jpe'],
654
+ 'image/ktx': ['ktx'],
655
+ 'image/png': ['png'],
656
+ 'image/prs.btif': ['btif'],
657
+ 'image/sgi': ['sgi'],
658
+ 'image/svg+xml': ['svg', 'svgz'],
659
+ 'image/tiff': ['tiff', 'tif'],
660
+ 'image/vnd.adobe.photoshop': ['psd'],
661
+ 'image/vnd.dece.graphic': ['uvi', 'uvvi', 'uvg', 'uvvg'],
662
+ 'image/vnd.djvu': ['djvu', 'djv'],
663
+ 'image/vnd.dvb.subtitle': ['sub'],
664
+ 'image/vnd.dwg': ['dwg'],
665
+ 'image/vnd.dxf': ['dxf'],
666
+ 'image/vnd.fastbidsheet': ['fbs'],
667
+ 'image/vnd.fpx': ['fpx'],
668
+ 'image/vnd.fst': ['fst'],
669
+ 'image/vnd.fujixerox.edmics-mmr': ['mmr'],
670
+ 'image/vnd.fujixerox.edmics-rlc': ['rlc'],
671
+ 'image/vnd.ms-modi': ['mdi'],
672
+ 'image/vnd.ms-photo': ['wdp'],
673
+ 'image/vnd.net-fpx': ['npx'],
674
+ 'image/vnd.wap.wbmp': ['wbmp'],
675
+ 'image/vnd.xiff': ['xif'],
676
+ 'image/webp': ['webp'],
677
+ 'image/x-3ds': ['3ds'],
678
+ 'image/x-cmu-raster': ['ras'],
679
+ 'image/x-cmx': ['cmx'],
680
+ 'image/x-freehand': ['fh', 'fhc', 'fh4', 'fh5', 'fh7'],
681
+ 'image/x-icon': ['ico'],
682
+ 'image/x-mrsid-image': ['sid'],
683
+ 'image/x-pcx': ['pcx'],
684
+ 'image/x-pict': ['pic', 'pct'],
685
+ 'image/x-portable-anymap': ['pnm'],
686
+ 'image/x-portable-bitmap': ['pbm'],
687
+ 'image/x-portable-graymap': ['pgm'],
688
+ 'image/x-portable-pixmap': ['ppm'],
689
+ 'image/x-rgb': ['rgb'],
690
+ 'image/x-tga': ['tga'],
691
+ 'image/x-xbitmap': ['xbm'],
692
+ 'image/x-xpixmap': ['xpm'],
693
+ 'image/x-xwindowdump': ['xwd'],
694
+ 'message/rfc822': ['eml', 'mime'],
695
+ 'model/iges': ['igs', 'iges'],
696
+ 'model/mesh': ['msh', 'mesh', 'silo'],
697
+ 'model/vnd.collada+xml': ['dae'],
698
+ 'model/vnd.dwf': ['dwf'],
699
+ 'model/vnd.gdl': ['gdl'],
700
+ 'model/vnd.gtw': ['gtw'],
701
+ 'model/vnd.vtu': ['vtu'],
702
+ 'model/vrml': ['wrl', 'vrml'],
703
+ 'model/x3d+binary': ['x3db', 'x3dbz'],
704
+ 'model/x3d+vrml': ['x3dv', 'x3dvz'],
705
+ 'model/x3d+xml': ['x3d', 'x3dz'],
706
+ 'text/cache-manifest': ['appcache'],
707
+ 'text/calendar': ['ics', 'ifb'],
708
+ 'text/css': ['css'],
709
+ 'text/csv': ['csv'],
710
+ 'text/html': ['html', 'htm'],
711
+ 'text/javascript': ['js', 'mjs'],
712
+ 'text/n3': ['n3'],
713
+ 'text/plain': [
714
+ 'txt', 'text',
715
+ 'conf', 'def',
716
+ 'list', 'log',
717
+ 'in'
718
+ ],
719
+ 'text/prs.lines.tag': ['dsc'],
720
+ 'text/richtext': ['rtx'],
721
+ 'text/sgml': ['sgml', 'sgm'],
722
+ 'text/tab-separated-values': ['tsv'],
723
+ 'text/troff': ['t', 'tr', 'roff', 'man', 'me', 'ms'],
724
+ 'text/turtle': ['ttl'],
725
+ 'text/uri-list': ['uri', 'uris', 'urls'],
726
+ 'text/vcard': ['vcard'],
727
+ 'text/vnd.curl': ['curl'],
728
+ 'text/vnd.curl.dcurl': ['dcurl'],
729
+ 'text/vnd.curl.mcurl': ['mcurl'],
730
+ 'text/vnd.curl.scurl': ['scurl'],
731
+ 'text/vnd.dvb.subtitle': ['sub'],
732
+ 'text/vnd.fly': ['fly'],
733
+ 'text/vnd.fmi.flexstor': ['flx'],
734
+ 'text/vnd.graphviz': ['gv'],
735
+ 'text/vnd.in3d.3dml': ['3dml'],
736
+ 'text/vnd.in3d.spot': ['spot'],
737
+ 'text/vnd.sun.j2me.app-descriptor': ['jad'],
738
+ 'text/vnd.wap.wml': ['wml'],
739
+ 'text/vnd.wap.wmlscript': ['wmls'],
740
+ 'text/x-asm': ['s', 'asm'],
741
+ 'text/x-c': [
742
+ 'c', 'cc',
743
+ 'cxx', 'cpp',
744
+ 'h', 'hh',
745
+ 'dic'
746
+ ],
747
+ 'text/x-fortran': ['f', 'for', 'f77', 'f90'],
748
+ 'text/x-java-source': ['java'],
749
+ 'text/x-nfo': ['nfo'],
750
+ 'text/x-opml': ['opml'],
751
+ 'text/x-pascal': ['p', 'pas'],
752
+ 'text/x-setext': ['etx'],
753
+ 'text/x-sfv': ['sfv'],
754
+ 'text/x-uuencode': ['uu'],
755
+ 'text/x-vcalendar': ['vcs'],
756
+ 'text/x-vcard': ['vcf'],
757
+ 'video/3gpp': ['3gp'],
758
+ 'video/3gpp2': ['3g2'],
759
+ 'video/h261': ['h261'],
760
+ 'video/h263': ['h263'],
761
+ 'video/h264': ['h264'],
762
+ 'video/jpeg': ['jpgv'],
763
+ 'video/jpm': ['jpm', 'jpgm'],
764
+ 'video/mj2': ['mj2', 'mjp2'],
765
+ 'video/mp2t': ['ts', 'm2t', 'm2ts', 'mts'],
766
+ 'video/mp4': ['mp4', 'mp4v', 'mpg4'],
767
+ 'video/mpeg': ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'],
768
+ 'video/ogg': ['ogv'],
769
+ 'video/quicktime': ['qt', 'mov'],
770
+ 'video/vnd.dece.hd': ['uvh', 'uvvh'],
771
+ 'video/vnd.dece.mobile': ['uvm', 'uvvm'],
772
+ 'video/vnd.dece.pd': ['uvp', 'uvvp'],
773
+ 'video/vnd.dece.sd': ['uvs', 'uvvs'],
774
+ 'video/vnd.dece.video': ['uvv', 'uvvv'],
775
+ 'video/vnd.dvb.file': ['dvb'],
776
+ 'video/vnd.fvt': ['fvt'],
777
+ 'video/vnd.mpegurl': ['mxu', 'm4u'],
778
+ 'video/vnd.ms-playready.media.pyv': ['pyv'],
779
+ 'video/vnd.uvvu.mp4': ['uvu', 'uvvu'],
780
+ 'video/vnd.vivo': ['viv'],
781
+ 'video/webm': ['webm'],
782
+ 'video/x-f4v': ['f4v'],
783
+ 'video/x-fli': ['fli'],
784
+ 'video/x-flv': ['flv'],
785
+ 'video/x-m4v': ['m4v'],
786
+ 'video/x-matroska': ['mkv', 'mk3d', 'mks'],
787
+ 'video/x-mng': ['mng'],
788
+ 'video/x-ms-asf': ['asf', 'asx'],
789
+ 'video/x-ms-vob': ['vob'],
790
+ 'video/x-ms-wm': ['wm'],
791
+ 'video/x-ms-wmv': ['wmv'],
792
+ 'video/x-ms-wmx': ['wmx'],
793
+ 'video/x-ms-wvx': ['wvx'],
794
+ 'video/x-msvideo': ['avi'],
795
+ 'video/x-sgi-movie': ['movie'],
796
+ 'video/x-smv': ['smv'],
797
+ 'x-conference/x-cooltalk': ['ice']
798
+ };
799
+ export const mimeTypesMap = new Map(objectEntries(mimeTypes));
@@ -1,17 +1,12 @@
1
- import type { CancellationSignal } from '../../cancellation/index.js';
2
- import type { Disposable } from '../../disposable/index.js';
3
- import { dispose } from '../../disposable/index.js';
1
+ import { type CancellationSignal } from '../../cancellation/index.js';
2
+ import { dispose, type Disposable } from '../../disposable/index.js';
4
3
  import type { Record, TypedOmit, UndefinableJson, UndefinableJsonObject } from '../../types.js';
5
- import type { HttpFormObject } from '../http-form.js';
6
- import { HttpForm } from '../http-form.js';
7
- import type { HttpHeadersObject } from '../http-headers.js';
8
- import { HttpHeaders } from '../http-headers.js';
9
- import type { HttpQueryObject } from '../http-query.js';
10
- import { HttpQuery } from '../http-query.js';
11
- import type { HttpUrlParametersObject } from '../http-url-parameters.js';
12
- import { HttpUrlParameters } from '../http-url-parameters.js';
4
+ import { HttpForm, type HttpFormObject } from '../http-form.js';
5
+ import { HttpHeaders, type HttpHeadersObject } from '../http-headers.js';
6
+ import { HttpQuery, type HttpQueryObject } from '../http-query.js';
7
+ import { HttpUrlParameters, type HttpUrlParametersObject } from '../http-url-parameters.js';
13
8
  import type { HttpMethod } from '../types.js';
14
- /** only one type at a time is supported. If multiple are set, behaviour is undefined */
9
+ /** Only one type at a time is supported. If multiple are set, behaviour is undefined */
15
10
  export type HttpRequestBody = {
16
11
  text?: string;
17
12
  json?: UndefinableJson;
@@ -54,7 +49,7 @@ export declare class HttpClientRequest implements Disposable {
54
49
  method: HttpMethod;
55
50
  headers: HttpHeaders;
56
51
  /**
57
- * automatically maps parameters to `urlParameters`, `query` and `body`
52
+ * Automatically maps parameters to `urlParameters`, `query` and `body`
58
53
  * depending on whether the `url` has parameters specified, the request `method`
59
54
  * and if there is already a `body` or not
60
55
  * @see mapParameters
@@ -63,13 +58,13 @@ export declare class HttpClientRequest implements Disposable {
63
58
  * @see mapParametersToBody
64
59
  */
65
60
  parameters: UndefinableJsonObject | undefined;
66
- /** if false, disable parameters mapping completely */
61
+ /** If false, disable parameters mapping completely */
67
62
  mapParameters: boolean;
68
63
  mapParametersToUrl: boolean;
69
64
  mapParametersToQuery: boolean;
70
65
  mapParametersToBody: boolean;
71
66
  /**
72
- * parameters for url
67
+ * Parameters for url
73
68
  * @example
74
69
  * {
75
70
  * url: 'http://domain.tld/users/:userId',
@@ -79,7 +74,7 @@ export declare class HttpClientRequest implements Disposable {
79
74
  */
80
75
  urlParameters: HttpUrlParameters;
81
76
  /**
82
- * separator for url parameter array
77
+ * Separator for url parameter array
83
78
  * @default ','
84
79
  * @example
85
80
  * {
@@ -91,7 +86,7 @@ export declare class HttpClientRequest implements Disposable {
91
86
  */
92
87
  urlParametersSeparator: string;
93
88
  /**
94
- * url query
89
+ * Url query
95
90
  * @example
96
91
  * {
97
92
  * url: 'http://domain.tld/search',
@@ -104,25 +99,25 @@ export declare class HttpClientRequest implements Disposable {
104
99
  authorization: HttpRequestAuthorization | undefined;
105
100
  body: HttpRequestBody | undefined;
106
101
  /**
107
- * request timeout in milliseconds
102
+ * Request timeout in milliseconds
108
103
  * @default 30000
109
104
  */
110
105
  timeout: number;
111
106
  throwOnNon200: boolean;
112
107
  /**
113
- * can be used to store data for middleware etc.
108
+ * Can be used to store data for middleware etc.
114
109
  *
115
110
  * will not be used for actual request
116
111
  */
117
112
  context: Record<string>;
118
113
  /**
119
- * can be used to cancel the request. Throws HttpError
114
+ * Can be used to cancel the request. Throws HttpError
120
115
  */
121
116
  get abortSignal(): CancellationSignal;
122
117
  constructor(url: string, method?: HttpMethod, options?: HttpClientRequestOptions);
123
118
  constructor(requestObject: HttpClientRequestObject);
124
119
  [dispose](): void;
125
- /** abort the request */
120
+ /** Abort the request */
126
121
  abort(): void;
127
122
  clone(): HttpClientRequest;
128
123
  asObject(): HttpClientRequestObject;
@@ -12,7 +12,7 @@ export class HttpClientRequest {
12
12
  method;
13
13
  headers;
14
14
  /**
15
- * automatically maps parameters to `urlParameters`, `query` and `body`
15
+ * Automatically maps parameters to `urlParameters`, `query` and `body`
16
16
  * depending on whether the `url` has parameters specified, the request `method`
17
17
  * and if there is already a `body` or not
18
18
  * @see mapParameters
@@ -21,13 +21,13 @@ export class HttpClientRequest {
21
21
  * @see mapParametersToBody
22
22
  */
23
23
  parameters;
24
- /** if false, disable parameters mapping completely */
24
+ /** If false, disable parameters mapping completely */
25
25
  mapParameters;
26
26
  mapParametersToUrl;
27
27
  mapParametersToQuery;
28
28
  mapParametersToBody;
29
29
  /**
30
- * parameters for url
30
+ * Parameters for url
31
31
  * @example
32
32
  * {
33
33
  * url: 'http://domain.tld/users/:userId',
@@ -37,7 +37,7 @@ export class HttpClientRequest {
37
37
  */
38
38
  urlParameters;
39
39
  /**
40
- * separator for url parameter array
40
+ * Separator for url parameter array
41
41
  * @default ','
42
42
  * @example
43
43
  * {
@@ -49,7 +49,7 @@ export class HttpClientRequest {
49
49
  */
50
50
  urlParametersSeparator;
51
51
  /**
52
- * url query
52
+ * Url query
53
53
  * @example
54
54
  * {
55
55
  * url: 'http://domain.tld/search',
@@ -62,19 +62,19 @@ export class HttpClientRequest {
62
62
  authorization;
63
63
  body;
64
64
  /**
65
- * request timeout in milliseconds
65
+ * Request timeout in milliseconds
66
66
  * @default 30000
67
67
  */
68
68
  timeout;
69
69
  throwOnNon200;
70
70
  /**
71
- * can be used to store data for middleware etc.
71
+ * Can be used to store data for middleware etc.
72
72
  *
73
73
  * will not be used for actual request
74
74
  */
75
75
  context;
76
76
  /**
77
- * can be used to cancel the request. Throws HttpError
77
+ * Can be used to cancel the request. Throws HttpError
78
78
  */
79
79
  get abortSignal() {
80
80
  return this.#abortToken.signal;
@@ -110,7 +110,7 @@ export class HttpClientRequest {
110
110
  this.#abortToken.set();
111
111
  this.#abortToken.complete();
112
112
  }
113
- /** abort the request */
113
+ /** Abort the request */
114
114
  abort() {
115
115
  this.#abortToken.set();
116
116
  this.#abortToken.complete();
@@ -272,14 +272,14 @@ function mapParameters(request, baseUrl) {
272
272
  const filteredParameterEntries = objectEntries(request.parameters ?? {}).filter(([_, value]) => isDefined(value));
273
273
  const filteredParameters = Object.fromEntries(filteredParameterEntries);
274
274
  let parameterEntries = new Set(filteredParameterEntries);
275
- if (!request.mapParametersToUrl) {
276
- url = new URL(request.url, baseUrl);
277
- }
278
- else {
275
+ if (request.mapParametersToUrl) {
279
276
  const { parsedUrl, parametersRest } = buildUrl(request.url, filteredParameters, { arraySeparator: request.urlParametersSeparator });
280
277
  url = new URL(parsedUrl, baseUrl);
281
278
  parameterEntries = new Set(objectEntries(parametersRest));
282
279
  }
280
+ else {
281
+ url = new URL(request.url, baseUrl);
282
+ }
283
283
  if (request.mapParametersToBody && !isGetOrHead && isUndefined(request.body)) {
284
284
  request.body = { json: Object.fromEntries(parameterEntries) };
285
285
  parameterEntries.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.90.67",
3
+ "version": "0.90.69",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,7 +14,7 @@
14
14
  "build:docs": "typedoc",
15
15
  "build:docs:watch": "typedoc --watch",
16
16
  "lint": "eslint --config .eslintrc.json --cache source/",
17
- "pub": "npm run build:production && rm -vf dist/test* && npm publish dist/",
17
+ "pub": "npm run build:production && rm -vf dist/test* && rm -vrf dist/tools/ && npm publish dist/",
18
18
  "tsc:watch": "tsc --watch",
19
19
  "tsc-alias:watch": "tsc-alias --watch"
20
20
  },
@@ -110,7 +110,7 @@
110
110
  "luxon": "^3.4",
111
111
  "reflect-metadata": "^0.2",
112
112
  "rxjs": "^7.8",
113
- "type-fest": "4.15"
113
+ "type-fest": "4.16"
114
114
  },
115
115
  "devDependencies": {
116
116
  "@mxssfd/typedoc-theme": "1.1",