ctx-core 4.17.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.
- package/all/CacheControl_1hour_headers_/index.d.ts +5 -0
- package/all/CacheControl_1hour_headers_/index.js +10 -0
- package/all/CacheControl_5min_headers_/index.d.ts +5 -0
- package/all/CacheControl_5min_headers_/index.js +10 -0
- package/all/ContentType__is_binary_/index.d.ts +1 -0
- package/all/ContentType__is_binary_/index.js +9 -0
- package/all/ContentType_json_headers_/index.d.ts +5 -0
- package/all/ContentType_json_headers_/index.js +10 -0
- package/all/ContentType_svg_headers_/index.d.ts +5 -0
- package/all/ContentType_svg_headers_/index.js +10 -0
- package/all/be_/index.test.ts +9 -9
- package/all/ext_R_mime/index.d.ts +86 -0
- package/all/ext_R_mime/index.js +86 -0
- package/all/http__headers__assign/index.d.ts +11 -0
- package/all/http__headers__assign/index.js +11 -0
- package/all/index.d.ts +22 -13
- package/all/index.js +22 -13
- package/all/internal_server_error__throw/index.d.ts +5 -0
- package/all/internal_server_error__throw/index.js +7 -0
- package/all/rmemo/index.d.ts +1 -1
- package/all/tempfile_path/index.d.ts +5 -0
- package/all/tempfile_path/index.js +33 -0
- package/all/tempfile_path/index.test.ts +11 -0
- package/http/index.d.ts +8 -0
- package/http/index.js +8 -0
- package/package.json +5 -1
- package/tempfile/index.d.ts +1 -0
- package/tempfile/index.js +1 -0
|
@@ -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,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,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,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
|
+
}
|
package/all/be_/index.test.ts
CHANGED
|
@@ -27,15 +27,15 @@ test('be_|Map', ()=>{
|
|
|
27
27
|
const ctx = ctx__new()
|
|
28
28
|
let incrementer_num = 0
|
|
29
29
|
const incrementer = ()=>++incrementer_num
|
|
30
|
-
const root_ = be_(()=>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
const root_ = be_(()=>
|
|
31
|
+
incrementer(),
|
|
32
|
+
{ id: 'root_' })
|
|
33
|
+
const child_ = be_(ctx=>
|
|
34
|
+
root_(ctx) + incrementer(),
|
|
35
|
+
{ id: 'child_' })
|
|
36
|
+
const child1_ = be_(ctx=>
|
|
37
|
+
root_(ctx) + child_(ctx),
|
|
38
|
+
{ id: 'child1_' })
|
|
39
39
|
equal(root_(ctx), 1)
|
|
40
40
|
equal(ctx.get('root_'), 1)
|
|
41
41
|
equal(child_(ctx), 3)
|
|
@@ -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,18 @@
|
|
|
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'
|
|
6
|
+
export * from './LessThan/index.js'
|
|
7
|
+
export * from './MAX_INT/index.js'
|
|
8
|
+
export * from './MIN_INT/index.js'
|
|
9
|
+
export * from './Map__object/index.js'
|
|
10
|
+
export * from './NumericRange/index.js'
|
|
11
|
+
export * from './NumericUnit/index.js'
|
|
12
|
+
export * from './PHI/index.js'
|
|
13
|
+
export * from './Request/index.js'
|
|
14
|
+
export * from './Response/index.js'
|
|
15
|
+
export * from './Timeout/index.js'
|
|
1
16
|
export * from './a/index.js'
|
|
2
17
|
export * from './a_assign/index.js'
|
|
3
18
|
export * from './a_in_idx_a_map/index.js'
|
|
@@ -108,6 +123,7 @@ export * from './error_o/index.js'
|
|
|
108
123
|
export * from './every/index.js'
|
|
109
124
|
export * from './every_arg/index.js'
|
|
110
125
|
export * from './exclude/index.js'
|
|
126
|
+
export * from './ext_R_mime/index.js'
|
|
111
127
|
export * from './extract/index.js'
|
|
112
128
|
export * from './falsy/index.js'
|
|
113
129
|
export * from './falsy__none/index.js'
|
|
@@ -134,10 +150,10 @@ export * from './format_date_prose/index.js'
|
|
|
134
150
|
export * from './format_utc_date_prose/index.js'
|
|
135
151
|
export * from './globalThis__prop__ensure/index.js'
|
|
136
152
|
export * from './gte_0_a/index.js'
|
|
153
|
+
export * from './hasOwnProperty_pick/index.js'
|
|
137
154
|
export * from './has_key/index.js'
|
|
138
155
|
export * from './has_multiple/index.js'
|
|
139
156
|
export * from './has_some_key/index.js'
|
|
140
|
-
export * from './hasOwnProperty_pick/index.js'
|
|
141
157
|
export * from './head_arg_a/index.js'
|
|
142
158
|
export * from './headers/index.js'
|
|
143
159
|
export * from './hex__digest/index.js'
|
|
@@ -150,6 +166,7 @@ export * from './hour/index.js'
|
|
|
150
166
|
export * from './hour/index.js'
|
|
151
167
|
export * from './hour_seconds/index.js'
|
|
152
168
|
export * from './hour_seconds/index.js'
|
|
169
|
+
export * from './http__headers__assign/index.js'
|
|
153
170
|
export * from './http_error/index.js'
|
|
154
171
|
export * from './idx/index.js'
|
|
155
172
|
export * from './idx_a/index.js'
|
|
@@ -165,6 +182,7 @@ export * from './iife/index.js'
|
|
|
165
182
|
export * from './indexOf/index.js'
|
|
166
183
|
export * from './insert/index.js'
|
|
167
184
|
export * from './int_hex/index.js'
|
|
185
|
+
export * from './internal_server_error__throw/index.js'
|
|
168
186
|
export * from './intersection_a/index.js'
|
|
169
187
|
export * from './intersection_by/index.js'
|
|
170
188
|
export * from './intersection_set/index.js'
|
|
@@ -191,7 +209,6 @@ export * from './keys/index.js'
|
|
|
191
209
|
export * from './last/index.js'
|
|
192
210
|
export * from './left_and/index.js'
|
|
193
211
|
export * from './left_or/index.js'
|
|
194
|
-
export * from './LessThan/index.js'
|
|
195
212
|
export * from './lte_0_a/index.js'
|
|
196
213
|
export * from './m_m_yyyy/index.js'
|
|
197
214
|
export * from './m_yy/index.js'
|
|
@@ -199,7 +216,6 @@ export * from './m_yyyy/index.js'
|
|
|
199
216
|
export * from './many_andand/index.js'
|
|
200
217
|
export * from './many_andand_or/index.js'
|
|
201
218
|
export * from './map/index.js'
|
|
202
|
-
export * from './Map__object/index.js'
|
|
203
219
|
export * from './map_andand/index.js'
|
|
204
220
|
export * from './map_andand_or/index.js'
|
|
205
221
|
export * from './map_andandfn/index.js'
|
|
@@ -214,12 +230,10 @@ export * from './matrix__dot/index.js'
|
|
|
214
230
|
export * from './matrix__dot__scalar/index.js'
|
|
215
231
|
export * from './matrix__normalize/index.js'
|
|
216
232
|
export * from './matrix__validate_length/index.js'
|
|
217
|
-
export * from './MAX_INT/index.js'
|
|
218
233
|
export * from './maybe/index.js'
|
|
219
234
|
export * from './mean/index.js'
|
|
220
235
|
export * from './median/index.js'
|
|
221
236
|
export * from './merge/index.js'
|
|
222
|
-
export * from './MIN_INT/index.js'
|
|
223
237
|
export * from './minute/index.js'
|
|
224
238
|
export * from './minute/index.js'
|
|
225
239
|
export * from './minute_seconds/index.js'
|
|
@@ -258,8 +272,6 @@ export * from './number_or_mdash_str/index.js'
|
|
|
258
272
|
export * from './numerator_or_0_avg/index.js'
|
|
259
273
|
export * from './numerator_or_0_sum/index.js'
|
|
260
274
|
export * from './numeric_range/index.js'
|
|
261
|
-
export * from './NumericRange/index.js'
|
|
262
|
-
export * from './NumericUnit/index.js'
|
|
263
275
|
export * from './o_a_present/index.js'
|
|
264
276
|
export * from './o_a_present/index.js'
|
|
265
277
|
export * from './o_some/index.js'
|
|
@@ -283,7 +295,6 @@ export * from './pathname/index.js'
|
|
|
283
295
|
export * from './percentage_str/index.js'
|
|
284
296
|
export * from './percentage_str_float/index.js'
|
|
285
297
|
export * from './performance__now/index.js'
|
|
286
|
-
export * from './PHI/index.js'
|
|
287
298
|
export * from './pick/index.js'
|
|
288
299
|
export * from './pick_keys/index.js'
|
|
289
300
|
export * from './pick_val_a/index.js'
|
|
@@ -309,10 +320,8 @@ export * from './reduce/index.js'
|
|
|
309
320
|
export * from './reject/index.js'
|
|
310
321
|
export * from './remove/index.js'
|
|
311
322
|
export * from './remove_idx/index.js'
|
|
312
|
-
export * from './Request/index.js'
|
|
313
323
|
export * from './resolver_curry/index.js'
|
|
314
324
|
export * from './resolver_curry/index.js'
|
|
315
|
-
export * from './Response/index.js'
|
|
316
325
|
export * from './response_o/index.js'
|
|
317
326
|
export * from './response_pair/index.js'
|
|
318
327
|
export * from './reverse/index.js'
|
|
@@ -351,12 +360,12 @@ export * from './stacktrace/index.js'
|
|
|
351
360
|
export * from './std/index.js'
|
|
352
361
|
export * from './sub/index.js'
|
|
353
362
|
export * from './tap/index.js'
|
|
363
|
+
export * from './tempfile_path/index.js'
|
|
354
364
|
export * from './tf/index.js'
|
|
355
365
|
export * from './throttle/index.js'
|
|
356
366
|
export * from './tick/index.js'
|
|
357
367
|
export * from './timedout/index.js'
|
|
358
368
|
export * from './timedout/index.js'
|
|
359
|
-
export * from './Timeout/index.js'
|
|
360
369
|
export * from './timeout_promise/index.js'
|
|
361
370
|
export * from './times/index.js'
|
|
362
371
|
export * from './timestamp_ms/index.js'
|
|
@@ -379,9 +388,9 @@ export * from './url_basename/index.js'
|
|
|
379
388
|
export * from './url_segment/index.js'
|
|
380
389
|
export * from './url_segment/index.js'
|
|
381
390
|
export * from './urn_url/index.js'
|
|
382
|
-
export * from './utc_m_yy/index.js'
|
|
383
|
-
export * from './utc_M_yyyy/index.js'
|
|
384
391
|
export * from './utc_MM_yyyy/index.js'
|
|
392
|
+
export * from './utc_M_yyyy/index.js'
|
|
393
|
+
export * from './utc_m_yy/index.js'
|
|
385
394
|
export * from './utc_yyyymmdd/index.js'
|
|
386
395
|
export * from './utc_yyyymmddhhmmss/index.js'
|
|
387
396
|
export * from './uuid/index.js'
|
package/all/index.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
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'
|
|
6
|
+
export * from './LessThan/index.js'
|
|
7
|
+
export * from './MAX_INT/index.js'
|
|
8
|
+
export * from './MIN_INT/index.js'
|
|
9
|
+
export * from './Map__object/index.js'
|
|
10
|
+
export * from './NumericRange/index.js'
|
|
11
|
+
export * from './NumericUnit/index.js'
|
|
12
|
+
export * from './PHI/index.js'
|
|
13
|
+
export * from './Request/index.js'
|
|
14
|
+
export * from './Response/index.js'
|
|
15
|
+
export * from './Timeout/index.js'
|
|
1
16
|
export * from './a/index.js'
|
|
2
17
|
export * from './a_assign/index.js'
|
|
3
18
|
export * from './a_in_idx_a_map/index.js'
|
|
@@ -108,6 +123,7 @@ export * from './error_o/index.js'
|
|
|
108
123
|
export * from './every/index.js'
|
|
109
124
|
export * from './every_arg/index.js'
|
|
110
125
|
export * from './exclude/index.js'
|
|
126
|
+
export * from './ext_R_mime/index.js'
|
|
111
127
|
export * from './extract/index.js'
|
|
112
128
|
export * from './falsy/index.js'
|
|
113
129
|
export * from './falsy__none/index.js'
|
|
@@ -134,10 +150,10 @@ export * from './format_date_prose/index.js'
|
|
|
134
150
|
export * from './format_utc_date_prose/index.js'
|
|
135
151
|
export * from './globalThis__prop__ensure/index.js'
|
|
136
152
|
export * from './gte_0_a/index.js'
|
|
153
|
+
export * from './hasOwnProperty_pick/index.js'
|
|
137
154
|
export * from './has_key/index.js'
|
|
138
155
|
export * from './has_multiple/index.js'
|
|
139
156
|
export * from './has_some_key/index.js'
|
|
140
|
-
export * from './hasOwnProperty_pick/index.js'
|
|
141
157
|
export * from './head_arg_a/index.js'
|
|
142
158
|
export * from './headers/index.js'
|
|
143
159
|
export * from './hex__digest/index.js'
|
|
@@ -150,6 +166,7 @@ export * from './hour/index.js'
|
|
|
150
166
|
export * from './hour/index.js'
|
|
151
167
|
export * from './hour_seconds/index.js'
|
|
152
168
|
export * from './hour_seconds/index.js'
|
|
169
|
+
export * from './http__headers__assign/index.js'
|
|
153
170
|
export * from './http_error/index.js'
|
|
154
171
|
export * from './idx/index.js'
|
|
155
172
|
export * from './idx_a/index.js'
|
|
@@ -165,6 +182,7 @@ export * from './iife/index.js'
|
|
|
165
182
|
export * from './indexOf/index.js'
|
|
166
183
|
export * from './insert/index.js'
|
|
167
184
|
export * from './int_hex/index.js'
|
|
185
|
+
export * from './internal_server_error__throw/index.js'
|
|
168
186
|
export * from './intersection_a/index.js'
|
|
169
187
|
export * from './intersection_by/index.js'
|
|
170
188
|
export * from './intersection_set/index.js'
|
|
@@ -191,7 +209,6 @@ export * from './keys/index.js'
|
|
|
191
209
|
export * from './last/index.js'
|
|
192
210
|
export * from './left_and/index.js'
|
|
193
211
|
export * from './left_or/index.js'
|
|
194
|
-
export * from './LessThan/index.js'
|
|
195
212
|
export * from './lte_0_a/index.js'
|
|
196
213
|
export * from './m_m_yyyy/index.js'
|
|
197
214
|
export * from './m_yy/index.js'
|
|
@@ -199,7 +216,6 @@ export * from './m_yyyy/index.js'
|
|
|
199
216
|
export * from './many_andand/index.js'
|
|
200
217
|
export * from './many_andand_or/index.js'
|
|
201
218
|
export * from './map/index.js'
|
|
202
|
-
export * from './Map__object/index.js'
|
|
203
219
|
export * from './map_andand/index.js'
|
|
204
220
|
export * from './map_andand_or/index.js'
|
|
205
221
|
export * from './map_andandfn/index.js'
|
|
@@ -214,12 +230,10 @@ export * from './matrix__dot/index.js'
|
|
|
214
230
|
export * from './matrix__dot__scalar/index.js'
|
|
215
231
|
export * from './matrix__normalize/index.js'
|
|
216
232
|
export * from './matrix__validate_length/index.js'
|
|
217
|
-
export * from './MAX_INT/index.js'
|
|
218
233
|
export * from './maybe/index.js'
|
|
219
234
|
export * from './mean/index.js'
|
|
220
235
|
export * from './median/index.js'
|
|
221
236
|
export * from './merge/index.js'
|
|
222
|
-
export * from './MIN_INT/index.js'
|
|
223
237
|
export * from './minute/index.js'
|
|
224
238
|
export * from './minute/index.js'
|
|
225
239
|
export * from './minute_seconds/index.js'
|
|
@@ -258,8 +272,6 @@ export * from './number_or_mdash_str/index.js'
|
|
|
258
272
|
export * from './numerator_or_0_avg/index.js'
|
|
259
273
|
export * from './numerator_or_0_sum/index.js'
|
|
260
274
|
export * from './numeric_range/index.js'
|
|
261
|
-
export * from './NumericRange/index.js'
|
|
262
|
-
export * from './NumericUnit/index.js'
|
|
263
275
|
export * from './o_a_present/index.js'
|
|
264
276
|
export * from './o_a_present/index.js'
|
|
265
277
|
export * from './o_some/index.js'
|
|
@@ -283,7 +295,6 @@ export * from './pathname/index.js'
|
|
|
283
295
|
export * from './percentage_str/index.js'
|
|
284
296
|
export * from './percentage_str_float/index.js'
|
|
285
297
|
export * from './performance__now/index.js'
|
|
286
|
-
export * from './PHI/index.js'
|
|
287
298
|
export * from './pick/index.js'
|
|
288
299
|
export * from './pick_keys/index.js'
|
|
289
300
|
export * from './pick_val_a/index.js'
|
|
@@ -309,10 +320,8 @@ export * from './reduce/index.js'
|
|
|
309
320
|
export * from './reject/index.js'
|
|
310
321
|
export * from './remove/index.js'
|
|
311
322
|
export * from './remove_idx/index.js'
|
|
312
|
-
export * from './Request/index.js'
|
|
313
323
|
export * from './resolver_curry/index.js'
|
|
314
324
|
export * from './resolver_curry/index.js'
|
|
315
|
-
export * from './Response/index.js'
|
|
316
325
|
export * from './response_o/index.js'
|
|
317
326
|
export * from './response_pair/index.js'
|
|
318
327
|
export * from './reverse/index.js'
|
|
@@ -351,12 +360,12 @@ export * from './stacktrace/index.js'
|
|
|
351
360
|
export * from './std/index.js'
|
|
352
361
|
export * from './sub/index.js'
|
|
353
362
|
export * from './tap/index.js'
|
|
363
|
+
export * from './tempfile_path/index.js'
|
|
354
364
|
export * from './tf/index.js'
|
|
355
365
|
export * from './throttle/index.js'
|
|
356
366
|
export * from './tick/index.js'
|
|
357
367
|
export * from './timedout/index.js'
|
|
358
368
|
export * from './timedout/index.js'
|
|
359
|
-
export * from './Timeout/index.js'
|
|
360
369
|
export * from './timeout_promise/index.js'
|
|
361
370
|
export * from './times/index.js'
|
|
362
371
|
export * from './timestamp_ms/index.js'
|
|
@@ -379,9 +388,9 @@ export * from './url_basename/index.js'
|
|
|
379
388
|
export * from './url_segment/index.js'
|
|
380
389
|
export * from './url_segment/index.js'
|
|
381
390
|
export * from './urn_url/index.js'
|
|
382
|
-
export * from './utc_m_yy/index.js'
|
|
383
|
-
export * from './utc_M_yyyy/index.js'
|
|
384
391
|
export * from './utc_MM_yyyy/index.js'
|
|
392
|
+
export * from './utc_M_yyyy/index.js'
|
|
393
|
+
export * from './utc_m_yy/index.js'
|
|
385
394
|
export * from './utc_yyyymmdd/index.js'
|
|
386
395
|
export * from './utc_yyyymmddhhmmss/index.js'
|
|
387
396
|
export * from './uuid/index.js'
|
package/all/rmemo/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function lock_memosig_<val_T>(
|
|
|
16
16
|
):sig_T<val_T>
|
|
17
17
|
export declare function on(rmemo:rmemo_T<unknown>):void
|
|
18
18
|
export declare function off(rmemo:rmemo_T<unknown>):void
|
|
19
|
-
export type rmemo_T<val_T> = memo_T<val_T>|sig_T<val_T>
|
|
19
|
+
export type rmemo_T<val_T> = memo_T<val_T>|sig_T<val_T>|lock_memosig_T<val_T>
|
|
20
20
|
export type memo_T<val_T> = (()=>val_T)&{
|
|
21
21
|
readonly _:val_T
|
|
22
22
|
readonly val:val_T
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { crypto_ } from '../crypto/index.js'
|
|
2
|
+
import { url__join } from '../url__join/index.js'
|
|
3
|
+
/**
|
|
4
|
+
* @param {string}[dir_path]
|
|
5
|
+
* @param {string}[extension]
|
|
6
|
+
* @returns {Promise<string>}
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export async function tempfile_path_(
|
|
10
|
+
dir_path,
|
|
11
|
+
extension = ''
|
|
12
|
+
) {
|
|
13
|
+
if (dir_path == null) {
|
|
14
|
+
dir_path =
|
|
15
|
+
typeof window === 'undefined'
|
|
16
|
+
? await import('fs/promises')
|
|
17
|
+
.then(fs=>
|
|
18
|
+
import('os')
|
|
19
|
+
.then(os=>
|
|
20
|
+
fs.realpath(os.tmpdir())))
|
|
21
|
+
: null
|
|
22
|
+
}
|
|
23
|
+
const crypto = await crypto_()
|
|
24
|
+
return url__join([
|
|
25
|
+
...(dir_path ? [dir_path] : []),
|
|
26
|
+
`${crypto.randomUUID()}${
|
|
27
|
+
extension
|
|
28
|
+
? extension.startsWith('.') ? extension : `.${extension}`
|
|
29
|
+
: ''
|
|
30
|
+
}`
|
|
31
|
+
])
|
|
32
|
+
}
|
|
33
|
+
export { tempfile_path_ as tempfile_ }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'fs/promises'
|
|
2
|
+
import { test } from 'uvu'
|
|
3
|
+
import { equal } from 'uvu/assert'
|
|
4
|
+
import { tempfile_path_ } from './index'
|
|
5
|
+
test('tempfile_', async ()=>{
|
|
6
|
+
const tempfile = await tempfile_path_()
|
|
7
|
+
await writeFile(tempfile, 'the content')
|
|
8
|
+
const content = await readFile(tempfile).then(buf=>buf.toString())
|
|
9
|
+
equal(content, 'the content')
|
|
10
|
+
})
|
|
11
|
+
test.run()
|
package/http/index.d.ts
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/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.
|
|
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",
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
"set",
|
|
58
59
|
"sleep",
|
|
59
60
|
"string",
|
|
61
|
+
"tempfile",
|
|
60
62
|
"time",
|
|
61
63
|
"types",
|
|
62
64
|
"uri",
|
|
@@ -87,6 +89,7 @@
|
|
|
87
89
|
"./fibonacci": "./fibonacci/index.js",
|
|
88
90
|
"./function": "./function/index.js",
|
|
89
91
|
"./functional": "./functional/index.js",
|
|
92
|
+
"./http": "./http/index.js",
|
|
90
93
|
"./math": "./math/index.js",
|
|
91
94
|
"./matrix": "./matrix/index.js",
|
|
92
95
|
"./number": "./number/index.js",
|
|
@@ -98,6 +101,7 @@
|
|
|
98
101
|
"./set": "./set/index.js",
|
|
99
102
|
"./sleep": "./sleep/index.js",
|
|
100
103
|
"./string": "./string/index.js",
|
|
104
|
+
"./tempfile": "./tempfile/index.js",
|
|
101
105
|
"./time": "./time/index.js",
|
|
102
106
|
"./types": "./types/index.js",
|
|
103
107
|
"./uri": "./uri/index.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../all/tempfile_path/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../all/tempfile_path/index.js'
|