ctx-core 4.18.0 → 4.19.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.
@@ -0,0 +1,5 @@
1
+ export declare function CacheControl_1hour_headers_():Record<string, string>
2
+ export {
3
+ CacheControl_1hour_headers_ as _CacheControl_1hour_headers,
4
+ CacheControl_1hour_headers_ as _CacheControl__1hour,
5
+ }
@@ -0,0 +1,10 @@
1
+ import { assign } from '../assign/index.js'
2
+ export function CacheControl_1hour_headers_() {
3
+ return assign({
4
+ 'Cache-Control': 'public, max-age=3600'
5
+ }, ...arguments)
6
+ }
7
+ export {
8
+ CacheControl_1hour_headers_ as _CacheControl_1hour_headers,
9
+ CacheControl_1hour_headers_ as _CacheControl__1hour,
10
+ }
@@ -0,0 +1,5 @@
1
+ export declare function CacheControl_5min_headers_():Record<string, string>
2
+ export {
3
+ CacheControl_5min_headers_ as _CacheControl_5min_headers,
4
+ CacheControl_5min_headers_ as _CacheControl__5min,
5
+ }
@@ -0,0 +1,10 @@
1
+ import { assign } from '../assign/index.js'
2
+ export function CacheControl_5min_headers_() {
3
+ return assign({
4
+ 'Cache-Control': 'public, max-age=300'
5
+ }, ...arguments)
6
+ }
7
+ export {
8
+ CacheControl_5min_headers_ as _CacheControl_5min_headers,
9
+ CacheControl_5min_headers_ as _CacheControl__5min,
10
+ }
@@ -0,0 +1 @@
1
+ export function ContentType__is_binary_(ContentType:string):boolean
@@ -0,0 +1,9 @@
1
+ const is_binary__regex =
2
+ /^(image\/[^(svg)]|audio\/|video\/|application\/(pdf|zip|vnd.|msword|x-shockwave-flash|java-archive))/
3
+ /**
4
+ * @param ContentType{string}
5
+ * @return {boolean}
6
+ */
7
+ export function ContentType__is_binary_(ContentType) {
8
+ return is_binary__regex.test(ContentType)
9
+ }
@@ -0,0 +1,5 @@
1
+ export declare function ContentType_json_headers_():Record<string, string>
2
+ export {
3
+ ContentType_json_headers_ as _ContentType_json_headers,
4
+ ContentType_json_headers_ as _ContentType__json,
5
+ }
@@ -0,0 +1,10 @@
1
+ import { assign } from '../assign/index.js'
2
+ export function ContentType_json_headers_() {
3
+ return assign({
4
+ 'Content-Type': 'application/json'
5
+ }, ...arguments)
6
+ }
7
+ export {
8
+ ContentType_json_headers_ as _ContentType_json_headers,
9
+ ContentType_json_headers_ as _ContentType__json,
10
+ }
@@ -0,0 +1,5 @@
1
+ export declare function ContentType_svg_headers_():Record<string, string>
2
+ export {
3
+ ContentType_svg_headers_ as _ContentType_svg_headers,
4
+ ContentType_svg_headers_ as _ContentType__svg,
5
+ }
@@ -0,0 +1,10 @@
1
+ import { assign } from '../assign/index.js'
2
+ export function ContentType_svg_headers_() {
3
+ return assign({
4
+ 'Content-Type': 'image/svg+xml'
5
+ }, ...arguments)
6
+ }
7
+ export {
8
+ ContentType_svg_headers_ as _ContentType_svg_headers,
9
+ ContentType_svg_headers_ as _ContentType__svg,
10
+ }
@@ -0,0 +1,86 @@
1
+ export declare const ext_R_mime:Readonly<{
2
+ [key:string]:string
3
+ '.aac':'audio/aac'
4
+ '.abw':'application/x-abiword'
5
+ '.arc':'application/x-freearc'
6
+ '.avif':'image/avif'
7
+ '.avi':'video/x-msvideo'
8
+ '.azw':'application/vnd.amazon.ebook'
9
+ '.bin':'application/octet-stream'
10
+ '.bmp':'image/bmp'
11
+ '.bz':'application/x-bzip'
12
+ '.bz2':'application/x-bzip2'
13
+ '.cda':'application/x-cdf'
14
+ '.csh':'application/x-csh'
15
+ '.css':'text/css'
16
+ '.csv':'text/csv'
17
+ '.doc':'application/msword'
18
+ '.docx':'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
19
+ '.eot':'application/vnd.ms-fontobject'
20
+ '.epub':'application/epub+zip'
21
+ '.gz':'application/gzip'
22
+ '.gif':'image/gif'
23
+ '.htm':'text/html'
24
+ '.html':'text/html'
25
+ '.ico':'image/vnd.microsoft.icon'
26
+ '.ics':'text/calendar'
27
+ '.jar':'application/java-archive'
28
+ '.jpeg':'image/jpeg'
29
+ '.jpg':'image/jpeg'
30
+ '.js':'text/javascript'
31
+ '.json':'application/json'
32
+ '.jsonld':'application/ld+json'
33
+ '.mid':'audio/midi'
34
+ '.midi':'audio/midi'
35
+ '.mjs':'text/javascript'
36
+ '.mp3':'audio/mpeg'
37
+ '.mp4':'video/mp4'
38
+ '.mpeg':'video/mpeg'
39
+ '.mpkg':'application/vnd.apple.installer+xml'
40
+ '.odp':'application/vnd.oasis.opendocument.presentation'
41
+ '.ods':'application/vnd.oasis.opendocument.spreadsheet'
42
+ '.odt':'application/vnd.oasis.opendocument.text'
43
+ '.oga':'audio/ogg'
44
+ '.ogv':'video/ogg'
45
+ '.ogx':'application/ogg'
46
+ '.opus':'audio/opus'
47
+ '.otf':'font/otf'
48
+ '.png':'image/png'
49
+ '.pdf':'application/pdf'
50
+ '.php':'application/x-httpd-php'
51
+ '.ppt':'application/vnd.ms-powerpoint'
52
+ '.pptx':'application/vnd.openxmlformats-officedocument.presentationml.presentation'
53
+ '.rar':'application/vnd.rar'
54
+ '.rtf':'application/rtf'
55
+ '.sh':'application/x-sh'
56
+ '.svg':'image/svg+xml'
57
+ '.swf':'application/x-shockwave-flash'
58
+ '.tar':'application/x-tar'
59
+ '.tif':'image/tiff'
60
+ '.tiff':'image/tiff'
61
+ '.ts':'video/mp2t'
62
+ '.ttf':'font/ttf'
63
+ '.txt':'text/plain'
64
+ '.vsd':'application/vnd.visio'
65
+ '.wav':'audio/wav'
66
+ '.weba':'audio/webm'
67
+ '.webm':'video/webm'
68
+ '.webp':'image/webp'
69
+ '.woff':'font/woff'
70
+ '.woff2':'font/woff2'
71
+ '.xhtml':'application/xhtml+xml'
72
+ '.xls':'application/vnd.ms-excel'
73
+ '.xlsx':'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
74
+ '.xml':'application/xml'
75
+ '.xul':'application/vnd.mozilla.xul+xml'
76
+ '.zip':'application/zip'
77
+ '.3gp':'video/3gpp'
78
+ '.3g2':'video/3gpp2'
79
+ '.7z':'application/x-7z-compressed'
80
+ }>
81
+ export {
82
+ ext_R_mime as extname_R_mime,
83
+ ext_R_mime as ext_r_mime,
84
+ ext_R_mime as ext_R_ContentType,
85
+ ext_R_mime as extname_R_ContentType,
86
+ }
@@ -0,0 +1,86 @@
1
+ // source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
2
+ export const ext_R_mime = Object.freeze({
3
+ '.aac': 'audio/aac',
4
+ '.abw': 'application/x-abiword',
5
+ '.arc': 'application/x-freearc',
6
+ '.avif': 'image/avif',
7
+ '.avi': 'video/x-msvideo',
8
+ '.azw': 'application/vnd.amazon.ebook',
9
+ '.bin': 'application/octet-stream',
10
+ '.bmp': 'image/bmp',
11
+ '.bz': 'application/x-bzip',
12
+ '.bz2': 'application/x-bzip2',
13
+ '.cda': 'application/x-cdf',
14
+ '.csh': 'application/x-csh',
15
+ '.css': 'text/css',
16
+ '.csv': 'text/csv',
17
+ '.doc': 'application/msword',
18
+ '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
19
+ '.eot': 'application/vnd.ms-fontobject',
20
+ '.epub': 'application/epub+zip',
21
+ '.gz': 'application/gzip',
22
+ '.gif': 'image/gif',
23
+ '.htm': 'text/html',
24
+ '.html': 'text/html',
25
+ '.ico': 'image/vnd.microsoft.icon',
26
+ '.ics': 'text/calendar',
27
+ '.jar': 'application/java-archive',
28
+ '.jpeg': 'image/jpeg',
29
+ '.jpg': 'image/jpeg',
30
+ '.js': 'text/javascript',
31
+ '.json': 'application/json',
32
+ '.jsonld': 'application/ld+json',
33
+ '.mid': 'audio/midi',
34
+ '.midi': 'audio/midi',
35
+ '.mjs': 'text/javascript',
36
+ '.mp3': 'audio/mpeg',
37
+ '.mp4': 'video/mp4',
38
+ '.mpeg': 'video/mpeg',
39
+ '.mpkg': 'application/vnd.apple.installer+xml',
40
+ '.odp': 'application/vnd.oasis.opendocument.presentation',
41
+ '.ods': 'application/vnd.oasis.opendocument.spreadsheet',
42
+ '.odt': 'application/vnd.oasis.opendocument.text',
43
+ '.oga': 'audio/ogg',
44
+ '.ogv': 'video/ogg',
45
+ '.ogx': 'application/ogg',
46
+ '.opus': 'audio/opus',
47
+ '.otf': 'font/otf',
48
+ '.png': 'image/png',
49
+ '.pdf': 'application/pdf',
50
+ '.php': 'application/x-httpd-php',
51
+ '.ppt': 'application/vnd.ms-powerpoint',
52
+ '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
53
+ '.rar': 'application/vnd.rar',
54
+ '.rtf': 'application/rtf',
55
+ '.sh': 'application/x-sh',
56
+ '.svg': 'image/svg+xml',
57
+ '.swf': 'application/x-shockwave-flash',
58
+ '.tar': 'application/x-tar',
59
+ '.tif': 'image/tiff',
60
+ '.tiff': 'image/tiff',
61
+ '.ts': 'video/mp2t',
62
+ '.ttf': 'font/ttf',
63
+ '.txt': 'text/plain',
64
+ '.vsd': 'application/vnd.visio',
65
+ '.wav': 'audio/wav',
66
+ '.weba': 'audio/webm',
67
+ '.webm': 'video/webm',
68
+ '.webp': 'image/webp',
69
+ '.woff': 'font/woff',
70
+ '.woff2': 'font/woff2',
71
+ '.xhtml': 'application/xhtml+xml',
72
+ '.xls': 'application/vnd.ms-excel',
73
+ '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
74
+ '.xml': 'application/xml',
75
+ '.xul': 'application/vnd.mozilla.xul+xml',
76
+ '.zip': 'application/zip',
77
+ '.3gp': 'video/3gpp',
78
+ '.3g2': 'video/3gpp2',
79
+ '.7z': 'application/x-7z-compressed'
80
+ })
81
+ export {
82
+ ext_R_mime as extname_R_mime,
83
+ ext_R_mime as ext_r_mime,
84
+ ext_R_mime as ext_R_ContentType,
85
+ ext_R_mime as extname_R_ContentType,
86
+ }
@@ -0,0 +1,11 @@
1
+ export declare function http__headers__assign<O extends {
2
+ headers:Record<string, string>
3
+ } = {
4
+ headers:Record<string, string>
5
+ }>(ctx:{
6
+ headers?:object
7
+ }, ...header_a:object[]):O
8
+ export {
9
+ http__headers__assign as assign_http_headers,
10
+ http__headers__assign as assign__headers__http,
11
+ }
@@ -0,0 +1,11 @@
1
+ import { assign } from '../assign/index.js'
2
+ export function http__headers__assign(ctx, ...header_a) {
3
+ const headers = ctx.headers || {}
4
+ assign(headers, ...header_a)
5
+ ctx.headers = headers
6
+ return ctx
7
+ }
8
+ export {
9
+ http__headers__assign as assign_http_headers,
10
+ http__headers__assign as assign__headers__http,
11
+ }
package/all/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ export * from './CacheControl_1hour_headers_/index.js'
2
+ export * from './CacheControl_5min_headers_/index.js'
3
+ export * from './ContentType__is_binary_/index.js'
4
+ export * from './ContentType_json_headers_/index.js'
5
+ export * from './ContentType_svg_headers_/index.js'
1
6
  export * from './LessThan/index.js'
2
7
  export * from './MAX_INT/index.js'
3
8
  export * from './MIN_INT/index.js'
@@ -118,6 +123,7 @@ export * from './error_o/index.js'
118
123
  export * from './every/index.js'
119
124
  export * from './every_arg/index.js'
120
125
  export * from './exclude/index.js'
126
+ export * from './ext_R_mime/index.js'
121
127
  export * from './extract/index.js'
122
128
  export * from './falsy/index.js'
123
129
  export * from './falsy__none/index.js'
@@ -160,6 +166,7 @@ export * from './hour/index.js'
160
166
  export * from './hour/index.js'
161
167
  export * from './hour_seconds/index.js'
162
168
  export * from './hour_seconds/index.js'
169
+ export * from './http__headers__assign/index.js'
163
170
  export * from './http_error/index.js'
164
171
  export * from './idx/index.js'
165
172
  export * from './idx_a/index.js'
@@ -175,6 +182,7 @@ export * from './iife/index.js'
175
182
  export * from './indexOf/index.js'
176
183
  export * from './insert/index.js'
177
184
  export * from './int_hex/index.js'
185
+ export * from './internal_server_error__throw/index.js'
178
186
  export * from './intersection_a/index.js'
179
187
  export * from './intersection_by/index.js'
180
188
  export * from './intersection_set/index.js'
package/all/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ export * from './CacheControl_1hour_headers_/index.js'
2
+ export * from './CacheControl_5min_headers_/index.js'
3
+ export * from './ContentType__is_binary_/index.js'
4
+ export * from './ContentType_json_headers_/index.js'
5
+ export * from './ContentType_svg_headers_/index.js'
1
6
  export * from './LessThan/index.js'
2
7
  export * from './MAX_INT/index.js'
3
8
  export * from './MIN_INT/index.js'
@@ -118,6 +123,7 @@ export * from './error_o/index.js'
118
123
  export * from './every/index.js'
119
124
  export * from './every_arg/index.js'
120
125
  export * from './exclude/index.js'
126
+ export * from './ext_R_mime/index.js'
121
127
  export * from './extract/index.js'
122
128
  export * from './falsy/index.js'
123
129
  export * from './falsy__none/index.js'
@@ -160,6 +166,7 @@ export * from './hour/index.js'
160
166
  export * from './hour/index.js'
161
167
  export * from './hour_seconds/index.js'
162
168
  export * from './hour_seconds/index.js'
169
+ export * from './http__headers__assign/index.js'
163
170
  export * from './http_error/index.js'
164
171
  export * from './idx/index.js'
165
172
  export * from './idx_a/index.js'
@@ -175,6 +182,7 @@ export * from './iife/index.js'
175
182
  export * from './indexOf/index.js'
176
183
  export * from './insert/index.js'
177
184
  export * from './int_hex/index.js'
185
+ export * from './internal_server_error__throw/index.js'
178
186
  export * from './intersection_a/index.js'
179
187
  export * from './intersection_by/index.js'
180
188
  export * from './intersection_set/index.js'
@@ -0,0 +1,5 @@
1
+ export declare function internal_server_error__throw():void
2
+ export {
3
+ internal_server_error__throw as throw_internal_server_error,
4
+ internal_server_error__throw as throw__internal_server_error,
5
+ }
@@ -0,0 +1,7 @@
1
+ export function internal_server_error__throw() {
2
+ throw new Error('Internal server error')
3
+ }
4
+ export {
5
+ internal_server_error__throw as throw_internal_server_error,
6
+ internal_server_error__throw as throw__internal_server_error,
7
+ }
@@ -0,0 +1,8 @@
1
+ export * from '../all/ContentType__is_binary_/index.js'
2
+ export * from '../all/CacheControl_1hour_headers_/index.js'
3
+ export * from '../all/CacheControl_5min_headers_/index.js'
4
+ export * from '../all/ContentType_json_headers_/index.js'
5
+ export * from '../all/ContentType_svg_headers_/index.js'
6
+ export * from '../all/ext_R_mime/index.js'
7
+ export * from '../all/http__headers__assign/index.js'
8
+ export * from '../all/internal_server_error__throw/index.js'
package/http/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from '../all/ContentType__is_binary_/index.js'
2
+ export * from '../all/CacheControl_1hour_headers_/index.js'
3
+ export * from '../all/CacheControl_5min_headers_/index.js'
4
+ export * from '../all/ContentType_json_headers_/index.js'
5
+ export * from '../all/ContentType_svg_headers_/index.js'
6
+ export * from '../all/ext_R_mime/index.js'
7
+ export * from '../all/http__headers__assign/index.js'
8
+ export * from '../all/internal_server_error__throw/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-core",
3
- "version": "4.18.0",
3
+ "version": "4.19.0",
4
4
  "description": "ctx-core core library",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -46,6 +46,7 @@
46
46
  "fibonacci",
47
47
  "function",
48
48
  "functional",
49
+ "http",
49
50
  "math",
50
51
  "matrix",
51
52
  "number",
@@ -88,6 +89,7 @@
88
89
  "./fibonacci": "./fibonacci/index.js",
89
90
  "./function": "./function/index.js",
90
91
  "./functional": "./functional/index.js",
92
+ "./http": "./http/index.js",
91
93
  "./math": "./math/index.js",
92
94
  "./matrix": "./matrix/index.js",
93
95
  "./number": "./number/index.js",