m3-json-schema 1.0.0-beta1
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/cljc.java_time.extn.calendar_awareness.js +26 -0
- package/cljc.java_time.extn.calendar_awareness.js.map +1 -0
- package/cljc.java_time.local_date.js +384 -0
- package/cljc.java_time.local_date.js.map +1 -0
- package/cljc.java_time.offset_date_time.js +391 -0
- package/cljc.java_time.offset_date_time.js.map +1 -0
- package/cljc.java_time.offset_time.js +305 -0
- package/cljc.java_time.offset_time.js.map +1 -0
- package/cljs.core.js +38762 -0
- package/cljs.core.js.map +1 -0
- package/cljs_env.js +7717 -0
- package/clojure.string.js +492 -0
- package/clojure.string.js.map +1 -0
- package/index.d.ts +45 -0
- package/java.time.js +354 -0
- package/java.time.js.map +1 -0
- package/m3.draft.js +27 -0
- package/m3.draft.js.map +1 -0
- package/m3.ecma.js +28 -0
- package/m3.ecma.js.map +1 -0
- package/m3.format.js +301 -0
- package/m3.format.js.map +1 -0
- package/m3.idn_hostname.js +546 -0
- package/m3.idn_hostname.js.map +1 -0
- package/m3.js.js +330 -0
- package/m3.js.js.map +1 -0
- package/m3.log.js +147 -0
- package/m3.log.js.map +1 -0
- package/m3.pattern.js +36 -0
- package/m3.pattern.js.map +1 -0
- package/m3.platform.js +82 -0
- package/m3.platform.js.map +1 -0
- package/m3.property.js +1940 -0
- package/m3.property.js.map +1 -0
- package/m3.ref.js +404 -0
- package/m3.ref.js.map +1 -0
- package/m3.type.js +133 -0
- package/m3.type.js.map +1 -0
- package/m3.uri.js +259 -0
- package/m3.uri.js.map +1 -0
- package/m3.util.js +192 -0
- package/m3.util.js.map +1 -0
- package/m3.validate.js +522 -0
- package/m3.validate.js.map +1 -0
- package/m3.vocabulary.js +85 -0
- package/m3.vocabulary.js.map +1 -0
- package/package.json +35 -0
- package/shadow.js.js +100 -0
- package/shadow.js.js.map +9 -0
- package/shadow.js.shim.module$$js_joda$core.js +22 -0
- package/shadow.js.shim.module$$js_joda$core.js.map +9 -0
- package/shadow.js.shim.module$punycode.js +22 -0
- package/shadow.js.shim.module$punycode.js.map +9 -0
package/m3.format.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
var $CLJS = require("./cljs_env");
|
|
2
|
+
var $jscomp = $CLJS.$jscomp;
|
|
3
|
+
var COMPILED = false;
|
|
4
|
+
require("./cljs.core.js");
|
|
5
|
+
require("./cljc.java_time.local_date.js");
|
|
6
|
+
require("./cljc.java_time.offset_date_time.js");
|
|
7
|
+
require("./cljc.java_time.offset_time.js");
|
|
8
|
+
require("./clojure.string.js");
|
|
9
|
+
require("./m3.util.js");
|
|
10
|
+
require("./m3.ecma.js");
|
|
11
|
+
require("./m3.pattern.js");
|
|
12
|
+
require("./m3.idn_hostname.js");
|
|
13
|
+
var cljc=$CLJS.cljc || ($CLJS.cljc = {});
|
|
14
|
+
var m3=$CLJS.m3 || ($CLJS.m3 = {});
|
|
15
|
+
var clojure=$CLJS.clojure || ($CLJS.clojure = {});
|
|
16
|
+
var cljs=$CLJS.cljs || ($CLJS.cljs = {});
|
|
17
|
+
var java=$CLJS.java || ($CLJS.java = {});
|
|
18
|
+
var shadow=$CLJS.shadow || ($CLJS.shadow = {});
|
|
19
|
+
var goog=$CLJS.goog || ($CLJS.goog = {});
|
|
20
|
+
var module$shadow_js_shim_module$$js_joda$core=$CLJS.module$shadow_js_shim_module$$js_joda$core || ($CLJS.module$shadow_js_shim_module$$js_joda$core = {});
|
|
21
|
+
var module$shadow_js_shim_module$punycode=$CLJS.module$shadow_js_shim_module$punycode || ($CLJS.module$shadow_js_shim_module$punycode = {});
|
|
22
|
+
|
|
23
|
+
$CLJS.SHADOW_ENV.setLoaded("m3.format.js");
|
|
24
|
+
|
|
25
|
+
goog.provide('m3.format');
|
|
26
|
+
m3.format.match = (function m3$format$match(format,pattern,_c2,p2,m2,p1,m1){
|
|
27
|
+
if(cljs.core.truth_(cljs.core.re_find(pattern,m1))){
|
|
28
|
+
return null;
|
|
29
|
+
} else {
|
|
30
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error(["format: not a valid ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(format)].join(''),p2,m2,p1,m1)], null);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
m3.format.check_pattern = (function m3$format$check_pattern(pattern,format,c2,p2,m2){
|
|
34
|
+
return (function (_c1,p1,m1){
|
|
35
|
+
return m3.format.match(format,pattern,c2,p2,m2,p1,m1);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
m3.format.check_parse = (function m3$format$check_parse(p,f,_c2,p2,m2){
|
|
39
|
+
return (function (_c1,p1,m1){
|
|
40
|
+
try{(p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(m1) : p.call(null,m1));
|
|
41
|
+
|
|
42
|
+
return null;
|
|
43
|
+
}catch (e21993){if((e21993 instanceof Error)){
|
|
44
|
+
var e = e21993;
|
|
45
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error(["format: not a valid ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(f),": ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.ex_message(e))].join(''),p2,m2,p1,m1)], null);
|
|
46
|
+
} else {
|
|
47
|
+
throw e21993;
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
}});
|
|
51
|
+
});
|
|
52
|
+
m3.format.json_duration_QMARK_ = (function m3$format$json_duration_QMARK_(s){
|
|
53
|
+
return cljs.core.boolean$((function (){var temp__5825__auto__ = cljs.core.re_find(m3.pattern.json_duration_pattern,s);
|
|
54
|
+
if(cljs.core.truth_(temp__5825__auto__)){
|
|
55
|
+
var vec__22000 = temp__5825__auto__;
|
|
56
|
+
var _p_t_or_w = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(0),null);
|
|
57
|
+
var _ymdthms_or_w = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(1),null);
|
|
58
|
+
var ymd = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(2),null);
|
|
59
|
+
var _y = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(3),null);
|
|
60
|
+
var _m = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(4),null);
|
|
61
|
+
var _d = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(5),null);
|
|
62
|
+
var thms = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(6),null);
|
|
63
|
+
var _h = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(7),null);
|
|
64
|
+
var _m__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(8),null);
|
|
65
|
+
var _s = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(9),null);
|
|
66
|
+
var w = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22000,(10),null);
|
|
67
|
+
return (!(((((cljs.core.empty_QMARK_(ymd)) && (((cljs.core.empty_QMARK_(thms)) && (cljs.core.empty_QMARK_(w)))))) || (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2("T",thms)))));
|
|
68
|
+
} else {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
})());
|
|
72
|
+
});
|
|
73
|
+
m3.format.parse_int = (function m3$format$parse_int(s){
|
|
74
|
+
return parseInt(s,(10));
|
|
75
|
+
});
|
|
76
|
+
m3.format.leap_second_time_re = /^(\d{2}):(\d{2}):(60(?:\.\d+)?)(z|([+-])(\d{2}):(\d{2}))$/i;
|
|
77
|
+
/**
|
|
78
|
+
* Returns true if s is a valid leap-second time, false if it contains :60 but
|
|
79
|
+
* is invalid, nil if it does not contain :60 (not a leap second).
|
|
80
|
+
*/
|
|
81
|
+
m3.format.valid_leap_second_time_QMARK_ = (function m3$format$valid_leap_second_time_QMARK_(s){
|
|
82
|
+
var temp__5825__auto__ = cljs.core.re_find(m3.format.leap_second_time_re,s);
|
|
83
|
+
if(cljs.core.truth_(temp__5825__auto__)){
|
|
84
|
+
var vec__22025 = temp__5825__auto__;
|
|
85
|
+
var _ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(0),null);
|
|
86
|
+
var hh = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(1),null);
|
|
87
|
+
var mm = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(2),null);
|
|
88
|
+
var _ss = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(3),null);
|
|
89
|
+
var _tz = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(4),null);
|
|
90
|
+
var tz_sign = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(5),null);
|
|
91
|
+
var tz_hh = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(6),null);
|
|
92
|
+
var tz_mm = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22025,(7),null);
|
|
93
|
+
var h = m3.format.parse_int(hh);
|
|
94
|
+
var m = m3.format.parse_int(mm);
|
|
95
|
+
var and__5023__auto__ = ((((0) <= h)) && ((h <= (23))));
|
|
96
|
+
if(and__5023__auto__){
|
|
97
|
+
var and__5023__auto____$1 = ((((0) <= m)) && ((m <= (59))));
|
|
98
|
+
if(and__5023__auto____$1){
|
|
99
|
+
if((tz_sign == null)){
|
|
100
|
+
return ((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(h,(23))) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(m,(59))));
|
|
101
|
+
} else {
|
|
102
|
+
var oh = m3.format.parse_int(tz_hh);
|
|
103
|
+
var om = m3.format.parse_int(tz_mm);
|
|
104
|
+
var and__5023__auto____$2 = ((((0) <= oh)) && ((oh <= (23))));
|
|
105
|
+
if(and__5023__auto____$2){
|
|
106
|
+
var and__5023__auto____$3 = ((((0) <= om)) && ((om <= (59))));
|
|
107
|
+
if(and__5023__auto____$3){
|
|
108
|
+
var local_min = ((h * (60)) + m);
|
|
109
|
+
var off_min = (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(tz_sign,"+"))?(1):(-1)) * ((oh * (60)) + om));
|
|
110
|
+
var utc_min = cljs.core.mod((local_min - off_min),(1440));
|
|
111
|
+
return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(utc_min,(1439));
|
|
112
|
+
} else {
|
|
113
|
+
return and__5023__auto____$3;
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
return and__5023__auto____$2;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
return and__5023__auto____$1;
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
return and__5023__auto__;
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
m3.format.date_time_split_re = /^(\d{4}-\d{2}-\d{2})t(.+)$/i;
|
|
130
|
+
m3.format.check_format_host_name = (function m3$format$check_format_host_name(_c2,p2,m2){
|
|
131
|
+
return m3.format.check_pattern(m3.pattern.hostname_pattern,"host-name",_c2,p2,m2);
|
|
132
|
+
});
|
|
133
|
+
m3.format.check_format_ip_address = (function m3$format$check_format_ip_address(_c2,p2,m2){
|
|
134
|
+
return m3.format.check_pattern(m3.pattern.ip_address_pattern,"ip-address",_c2,p2,m2);
|
|
135
|
+
});
|
|
136
|
+
m3.format.css_color_names = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 17, ["aqua",null,"blue",null,"white",null,"silver",null,"purple",null,"orange",null,"lime",null,"gray",null,"fuchsia",null,"yellow",null,"teal",null,"olive",null,"navy",null,"green",null,"red",null,"maroon",null,"black",null], null), null);
|
|
137
|
+
m3.format.check_format_color = (function m3$format$check_format_color(_c2,p2,m2){
|
|
138
|
+
return (function (_c1,p1,m1){
|
|
139
|
+
if(cljs.core.truth_((function (){var or__5025__auto__ = cljs.core.re_find(m3.pattern.color_pattern,m1);
|
|
140
|
+
if(cljs.core.truth_(or__5025__auto__)){
|
|
141
|
+
return or__5025__auto__;
|
|
142
|
+
} else {
|
|
143
|
+
var G__22030 = clojure.string.lower_case(m1);
|
|
144
|
+
return (m3.format.css_color_names.cljs$core$IFn$_invoke$arity$1 ? m3.format.css_color_names.cljs$core$IFn$_invoke$arity$1(G__22030) : m3.format.css_color_names.call(null,G__22030));
|
|
145
|
+
}
|
|
146
|
+
})())){
|
|
147
|
+
return null;
|
|
148
|
+
} else {
|
|
149
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error("format: not a valid color",p2,m2,p1,m1)], null);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
m3.format.check_format_style = (function m3$format$check_format_style(_c2,_p2,_m2){
|
|
154
|
+
return cljs.core.constantly(null);
|
|
155
|
+
});
|
|
156
|
+
m3.format.check_format_phone = (function m3$format$check_format_phone(_c2,_p2,_m2){
|
|
157
|
+
return cljs.core.constantly(null);
|
|
158
|
+
});
|
|
159
|
+
m3.format.check_format_utc_millisec = (function m3$format$check_format_utc_millisec(_c2,_p2,_m2){
|
|
160
|
+
return cljs.core.constantly(null);
|
|
161
|
+
});
|
|
162
|
+
m3.format.check_format_email = (function m3$format$check_format_email(_c2,p2,m2){
|
|
163
|
+
return m3.format.check_pattern(m3.pattern.email_pattern,"email",_c2,p2,m2);
|
|
164
|
+
});
|
|
165
|
+
m3.format.check_format_ipv4 = (function m3$format$check_format_ipv4(_c2,p2,m2){
|
|
166
|
+
return m3.format.check_pattern(m3.pattern.ipv4_pattern,"ipv4",_c2,p2,m2);
|
|
167
|
+
});
|
|
168
|
+
m3.format.check_format_ipv6 = (function m3$format$check_format_ipv6(_c2,p2,m2){
|
|
169
|
+
return m3.format.check_pattern(m3.pattern.ipv6_pattern,"ipv6",_c2,p2,m2);
|
|
170
|
+
});
|
|
171
|
+
m3.format.check_format_hostname = (function m3$format$check_format_hostname(_c2,p2,m2){
|
|
172
|
+
return m3.format.check_pattern(m3.pattern.hostname_pattern,"hostname",_c2,p2,m2);
|
|
173
|
+
});
|
|
174
|
+
m3.format.check_format_date_time = (function m3$format$check_format_date_time(_c2,p2,m2){
|
|
175
|
+
var normal_check = m3.format.check_parse(cljc.java_time.offset_date_time.parse,"date-time",_c2,p2,m2);
|
|
176
|
+
return (function (_c1,p1,m1){
|
|
177
|
+
var temp__5823__auto__ = cljs.core.re_find(m3.format.date_time_split_re,m1);
|
|
178
|
+
if(cljs.core.truth_(temp__5823__auto__)){
|
|
179
|
+
var vec__22036 = temp__5823__auto__;
|
|
180
|
+
var _ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22036,(0),null);
|
|
181
|
+
var date_part = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22036,(1),null);
|
|
182
|
+
var time_part = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__22036,(2),null);
|
|
183
|
+
var G__22039 = m3.format.valid_leap_second_time_QMARK_(time_part);
|
|
184
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(true,G__22039)){
|
|
185
|
+
try{cljc.java_time.local_date.parse.cljs$core$IFn$_invoke$arity$1(date_part);
|
|
186
|
+
|
|
187
|
+
return null;
|
|
188
|
+
}catch (e22040){if((e22040 instanceof Error)){
|
|
189
|
+
var e = e22040;
|
|
190
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error(["format: not a valid date-time: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.ex_message(e))].join(''),p2,m2,p1,m1)], null);
|
|
191
|
+
} else {
|
|
192
|
+
throw e22040;
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
}} else {
|
|
196
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(false,G__22039)){
|
|
197
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error("format: not a valid date-time",p2,m2,p1,m1)], null);
|
|
198
|
+
} else {
|
|
199
|
+
return normal_check(_c1,p1,m1);
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
return normal_check(_c1,p1,m1);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
m3.format.check_format_date = (function m3$format$check_format_date(_c2,p2,m2){
|
|
209
|
+
return m3.format.check_parse(cljc.java_time.local_date.parse,"date",_c2,p2,m2);
|
|
210
|
+
});
|
|
211
|
+
m3.format.check_format_time_pattern = (function m3$format$check_format_time_pattern(c2,p2,m2){
|
|
212
|
+
return m3.format.check_pattern(m3.pattern.time_pattern,"time",c2,p2,m2);
|
|
213
|
+
});
|
|
214
|
+
m3.format.check_format_time_parse = (function m3$format$check_format_time_parse(_c2,p2,m2){
|
|
215
|
+
var normal_check = m3.format.check_parse(cljc.java_time.offset_time.parse,"time",_c2,p2,m2);
|
|
216
|
+
return (function (_c1,p1,m1){
|
|
217
|
+
var G__22045 = m3.format.valid_leap_second_time_QMARK_(m1);
|
|
218
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(true,G__22045)){
|
|
219
|
+
return null;
|
|
220
|
+
} else {
|
|
221
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(false,G__22045)){
|
|
222
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error("format: not a valid time",p2,m2,p1,m1)], null);
|
|
223
|
+
} else {
|
|
224
|
+
return normal_check(_c1,p1,m1);
|
|
225
|
+
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
m3.format.check_format_json_pointer = (function m3$format$check_format_json_pointer(_c2,p2,m2){
|
|
231
|
+
return m3.format.check_pattern(m3.pattern.json_pointer_pattern,"json-pointer",_c2,p2,m2);
|
|
232
|
+
});
|
|
233
|
+
m3.format.check_format_relative_json_pointer = (function m3$format$check_format_relative_json_pointer(_c2,p2,m2){
|
|
234
|
+
return m3.format.check_pattern(m3.pattern.relative_pointer_pattern,"relative-json-pointer",_c2,p2,m2);
|
|
235
|
+
});
|
|
236
|
+
m3.format.check_format_uri = (function m3$format$check_format_uri(_c2,p2,m2){
|
|
237
|
+
return m3.format.check_pattern(m3.pattern.uri_pattern,"uri",_c2,p2,m2);
|
|
238
|
+
});
|
|
239
|
+
m3.format.check_format_uri_reference = (function m3$format$check_format_uri_reference(_c2,p2,m2){
|
|
240
|
+
return m3.format.check_pattern(m3.pattern.uri_reference_pattern,"uri-reference",_c2,p2,m2);
|
|
241
|
+
});
|
|
242
|
+
m3.format.check_format_uri_template = (function m3$format$check_format_uri_template(_c2,p2,m2){
|
|
243
|
+
return m3.format.check_pattern(m3.pattern.uri_template_pattern,"uri-template",_c2,p2,m2);
|
|
244
|
+
});
|
|
245
|
+
m3.format.check_format_idn_email = (function m3$format$check_format_idn_email(_c2,p2,m2){
|
|
246
|
+
return m3.format.check_pattern(m3.pattern.idn_email_pattern,"idn-email",_c2,p2,m2);
|
|
247
|
+
});
|
|
248
|
+
m3.format.check_format_idn_hostname = (function m3$format$check_format_idn_hostname(_c2,p2,m2){
|
|
249
|
+
return (function (_c1,p1,m1){
|
|
250
|
+
if(cljs.core.truth_(m3.idn_hostname.json_idn_hostname_QMARK_(m1))){
|
|
251
|
+
return null;
|
|
252
|
+
} else {
|
|
253
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error("format: not a valid idn-hostname:",p2,m2,p1,m1)], null);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
m3.format.check_format_iri = (function m3$format$check_format_iri(_c2,p2,m2){
|
|
258
|
+
return m3.format.check_pattern(m3.pattern.iri_pattern,"iri",_c2,p2,m2);
|
|
259
|
+
});
|
|
260
|
+
m3.format.check_format_iri_reference = (function m3$format$check_format_iri_reference(_c2,p2,m2){
|
|
261
|
+
return m3.format.check_pattern(m3.pattern.iri_reference_pattern,"iri-reference",_c2,p2,m2);
|
|
262
|
+
});
|
|
263
|
+
m3.format.check_format_uuid = (function m3$format$check_format_uuid(_c2,p2,m2){
|
|
264
|
+
return m3.format.check_pattern(m3.pattern.uuid_pattern,"uuid",_c2,p2,m2);
|
|
265
|
+
});
|
|
266
|
+
m3.format.check_format_duration = (function m3$format$check_format_duration(_c2,p2,m2){
|
|
267
|
+
return (function (_c1,p1,m1){
|
|
268
|
+
if(m3.format.json_duration_QMARK_(m1)){
|
|
269
|
+
return null;
|
|
270
|
+
} else {
|
|
271
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error("format: not a valid duration:",p2,m2,p1,m1)], null);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
m3.format.check_format_regex = (function m3$format$check_format_regex(_c2,p2,m2){
|
|
276
|
+
return m3.format.check_parse(m3.ecma.ecma_pattern,"regex",_c2,p2,m2);
|
|
277
|
+
});
|
|
278
|
+
m3.format.lookbehind_re = /\(\?<[=!]/;
|
|
279
|
+
m3.format.check_format_regex_draft3 = (function m3$format$check_format_regex_draft3(_c2,p2,m2){
|
|
280
|
+
var base_check = m3.format.check_format_regex(_c2,p2,m2);
|
|
281
|
+
return (function (_c1,p1,m1){
|
|
282
|
+
if(cljs.core.truth_(cljs.core.re_find(m3.format.lookbehind_re,m1))){
|
|
283
|
+
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [m3.util.make_error("format: not a valid regex (lookbehind not supported)",p2,m2,p1,m1)], null);
|
|
284
|
+
} else {
|
|
285
|
+
return base_check(_c1,p1,m1);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
m3.format.check_format_unknown = (function m3$format$check_format_unknown(_c2,_p2,_m2){
|
|
290
|
+
return cljs.core.constantly(null);
|
|
291
|
+
});
|
|
292
|
+
m3.format.draft3_format__GT_checker = cljs.core.PersistentHashMap.fromArrays(["ip-address","host-name","uri","regex","ipv6","email","style","utc-millisec","time","date-time","phone","date","color"],[m3.format.check_format_ip_address,m3.format.check_format_host_name,m3.format.check_format_uri,m3.format.check_format_regex_draft3,m3.format.check_format_ipv6,m3.format.check_format_email,m3.format.check_format_style,m3.format.check_format_utc_millisec,m3.format.check_format_time_pattern,m3.format.check_format_date_time,m3.format.check_format_phone,m3.format.check_format_date,m3.format.check_format_color]);
|
|
293
|
+
m3.format.draft4_format__GT_checker = cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(cljs.core.dissoc.cljs$core$IFn$_invoke$arity$variadic(m3.format.draft3_format__GT_checker,"color",cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["date","phone","style","utc-millisec","host-name","ip-address","time"], 0)),"hostname",m3.format.check_format_hostname,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["ipv4",m3.format.check_format_ipv4,"unknown",m3.format.check_format_unknown], 0));
|
|
294
|
+
m3.format.draft6_format__GT_checker = cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(m3.format.draft4_format__GT_checker,"json-pointer",m3.format.check_format_json_pointer,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["uri-reference",m3.format.check_format_uri_reference,"uri-template",m3.format.check_format_uri_template], 0));
|
|
295
|
+
m3.format.draft7_format__GT_checker = cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(m3.format.draft6_format__GT_checker,"date",m3.format.check_format_date,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["idn-email",m3.format.check_format_idn_email,"idn-hostname",m3.format.check_format_idn_hostname,"iri",m3.format.check_format_iri,"iri-reference",m3.format.check_format_iri_reference,"relative-json-pointer",m3.format.check_format_relative_json_pointer,"time",m3.format.check_format_time_parse], 0));
|
|
296
|
+
m3.format.draft2019_09_format__GT_checker = cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(m3.format.draft7_format__GT_checker,"duration",m3.format.check_format_duration,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["uuid",m3.format.check_format_uuid], 0));
|
|
297
|
+
m3.format.draft2020_12_format__GT_checker = m3.format.draft2019_09_format__GT_checker;
|
|
298
|
+
m3.format.draft_next_format__GT_checker = m3.format.draft2019_09_format__GT_checker;
|
|
299
|
+
m3.format.draft__GT_format__GT_checker = new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"draft3","draft3",-292494828),m3.format.draft3_format__GT_checker,new cljs.core.Keyword(null,"draft4","draft4",1928305297),m3.format.draft4_format__GT_checker,new cljs.core.Keyword(null,"draft6","draft6",223691613),m3.format.draft6_format__GT_checker,new cljs.core.Keyword(null,"draft7","draft7",427992330),m3.format.draft7_format__GT_checker,new cljs.core.Keyword(null,"draft2019-09","draft2019-09",2035136926),m3.format.draft2019_09_format__GT_checker,new cljs.core.Keyword(null,"draft2020-12","draft2020-12",-836724574),m3.format.draft2020_12_format__GT_checker,new cljs.core.Keyword(null,"draft-next","draft-next",-519216993),m3.format.draft_next_format__GT_checker], null);
|
|
300
|
+
|
|
301
|
+
//# sourceMappingURL=m3.format.js.map
|
package/m3.format.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["m3/format.cljc"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,kBAAA,lBAAMA,4CAAOC,OAAOC,QAAQC,IAAIC,GAAGC,GAAGC,GAAGC;AAAzC,AACE,oBAAU,AAACC,kBAAQN,QAAQK;AAA3B;;AAAA,AAAA,0FACG,AAACE,mBAAW,CAAA,mEAA4BR,kBAAQG,GAAGC,GAAGC,GAAGC;;;AAE9D,0BAAA,1BAAMG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,GAAGC;;;;AAE3B,iCAAA,jCAAMyH,0EAAsB7H,IAAIsE,IAAIC;AAApC,AACE,4BAAA,rBAACC;;AAIH,sCAAA,wCAAA,aAAA,YAAA,MAAA,QAAA,OAAA,QAAA,QAAA,eAAA,OAAA,YAAA,QAAA,OAAA,7LAAKsD,ikBACa9D,5BACA4B,9DACAV,lIACAP,5HACAhB,lCACAE,kIACAkB,+LACAN,nOACAkD,6FACAtD,iEACAyB,zLACAS,qJACA7B;AAGlB,AAAKqD,iJACCD,tDACA,0FAAA,0DAAA,OAAA,QAAA,QAAA,eAAA,YAAA,aAAA,nNAACE,rDASD,qRAAA,6FAAA,mCAAA,rZAACC,gSACWhD,yFACAJ,sCACAgD;AAElB,AAAKK,sCACH,yFAAA,qGAAA,qDAAA,nPAACD,qDACAF,mDACgB5B,sGACAM,oDACAE;AAEnB,AAAKwB,sCACH,yFAAA,qFAAA,6CAAA,mDAAA,iCAAA,qDAAA,qEAAA,zaAACF,qDACAC,2CACwBtC,0FACAiB,gDACAE,0CACAE,2CACAE,6DACAd,oDACAL;AAE3B,AAAKoC,4CACH,yFAAA,6FAAA,tLAACH,qDACAE,+CACWZ,yFACAF;AAEd,AAAKgB,4CAA6BD;AAElC,AAAKE,0CAA2BF;AAEhC,yCAAA,2CAAA,6FAAA,6FAAA,4FAAA,4FAAA,+GAAA,+GAAA,pqBAAKG,6IACaT,6FACAC,4FACAG,4FACAC,yGACAC,+GACAC,2GACAC","names":["m3.format/match","format","pattern","_c2","p2","m2","p1","m1","cljs.core/re-find","m3.util/make-error","m3.format/check-pattern","c2","_c1","m3.format/check-parse","p","f","e21993","js/Error","e","cljs.core/ex-message","m3.format/json-duration?","s","cljs.core/boolean","temp__5825__auto__","vec__22000","cljs.core.nth","_p-t-or-w","_ymdthms-or-w","ymd","_y","_m","_d","thms","_h","_s","w","m3.pattern/json-duration-pattern","cljs.core/empty?","cljs.core._EQ_","m3.format/parse-int","js/parseInt","m3.format/leap-second-time-re","m3.format/valid-leap-second-time?","vec__22025","_","hh","mm","_ss","_tz","tz-sign","tz-hh","tz-mm","h","m","and__5023__auto__","oh","om","local-min","off-min","utc-min","cljs.core/mod","m3.format/date-time-split-re","m3.format/check-format-host-name","m3.pattern/hostname-pattern","m3.format/check-format-ip-address","m3.pattern/ip-address-pattern","m3.format/css-color-names","m3.format/check-format-color","or__5025__auto__","m3.pattern/color-pattern","G__22030","clojure.string/lower-case","m3.format/check-format-style","_p2","_m2","cljs.core/constantly","m3.format/check-format-phone","m3.format/check-format-utc-millisec","m3.format/check-format-email","m3.pattern/email-pattern","m3.format/check-format-ipv4","m3.pattern/ipv4-pattern","m3.format/check-format-ipv6","m3.pattern/ipv6-pattern","m3.format/check-format-hostname","m3.format/check-format-date-time","normal-check","cljc.java-time.offset-date-time/parse","temp__5823__auto__","vec__22036","date-part","time-part","G__22039","e22040","cljc.java_time.local_date.parse","m3.format/check-format-date","cljc.java-time.local-date/parse","m3.format/check-format-time-pattern","m3.pattern/time-pattern","m3.format/check-format-time-parse","cljc.java-time.offset-time/parse","G__22045","m3.format/check-format-json-pointer","m3.pattern/json-pointer-pattern","m3.format/check-format-relative-json-pointer","m3.pattern/relative-pointer-pattern","m3.format/check-format-uri","m3.pattern/uri-pattern","m3.format/check-format-uri-reference","m3.pattern/uri-reference-pattern","m3.format/check-format-uri-template","m3.pattern/uri-template-pattern","m3.format/check-format-idn-email","m3.pattern/idn-email-pattern","m3.format/check-format-idn-hostname","m3.idn-hostname/json-idn-hostname?","m3.format/check-format-iri","m3.pattern/iri-pattern","m3.format/check-format-iri-reference","m3.pattern/iri-reference-pattern","m3.format/check-format-uuid","m3.pattern/uuid-pattern","m3.format/check-format-duration","m3.format/check-format-regex","m3.ecma/ecma-pattern","m3.format/lookbehind-re","m3.format/check-format-regex-draft3","base-check","m3.format/check-format-unknown","m3.format/draft3-format->checker","m3.format/draft4-format->checker","cljs.core.dissoc","cljs.core.assoc","m3.format/draft6-format->checker","m3.format/draft7-format->checker","m3.format/draft2019-09-format->checker","m3.format/draft2020-12-format->checker","m3.format/draft-next-format->checker","m3.format/draft->format->checker"],"sourcesContent":[";; Copyright 2025 Julian Gosnell\n;;\n;; Licensed under the Apache License, Version 2.0 (the \"License\");\n;; you may not use this file except in compliance with the License.\n;; You may obtain a copy of the License at\n;;\n;; http://www.apache.org/licenses/LICENSE-2.0\n;;\n;; Unless required by applicable law or agreed to in writing, software\n;; distributed under the License is distributed on an \"AS IS\" BASIS,\n;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n;; See the License for the specific language governing permissions and\n;; limitations under the License.\n\n(ns m3.format\n (:require\n [cljc.java-time.local-date :refer [parse] :rename {parse local-date-parse}]\n [cljc.java-time.offset-date-time :refer [parse] :rename {parse offset-date-time-parse}]\n [cljc.java-time.offset-time :refer [parse] :rename {parse offset-time-parse}]\n [clojure.string :as str]\n [m3.util :refer [make-error]]\n [m3.ecma :refer [ecma-pattern]]\n [m3.pattern :refer [email-pattern ipv4-pattern ipv6-pattern hostname-pattern\n json-pointer-pattern relative-pointer-pattern uri-pattern\n uri-reference-pattern uri-template-pattern idn-email-pattern\n iri-pattern iri-reference-pattern uuid-pattern json-duration-pattern\n time-pattern ip-address-pattern color-pattern]]\n [m3.idn-hostname :refer [json-idn-hostname?]]))\n\n;;------------------------------------------------------------------------------\n;; Helper functions\n\n(defn match [format pattern _c2 p2 m2 p1 m1]\n (when-not (re-find pattern m1)\n [(make-error (str \"format: not a valid \" format) p2 m2 p1 m1)]))\n\n(defn check-pattern [pattern format c2 p2 m2]\n (fn [_c1 p1 m1]\n (match format pattern c2 p2 m2 p1 m1)))\n\n(defn check-parse [p f _c2 p2 m2]\n (fn [_c1 p1 m1]\n (try\n (p m1)\n nil\n (catch #?(:cljs js/Error :clj Exception) e\n [(make-error (str \"format: not a valid \" f \": \" (ex-message e)) p2 m2 p1 m1)]))))\n\n(defn json-duration? [s]\n (boolean\n (when-let [[_p-t-or-w _ymdthms-or-w ymd _y _m _d thms _h _m _s w] (re-find json-duration-pattern s)]\n (not\n (or\n (and (empty? ymd) (empty? thms) (empty? w))\n (= \"T\" thms))))))\n\n(defn ^:private parse-int [s]\n #?(:clj (Integer/parseInt s) :cljs (js/parseInt s 10)))\n\n(def ^:private leap-second-time-re\n #\"(?i)^(\\d{2}):(\\d{2}):(60(?:\\.\\d+)?)(z|([+-])(\\d{2}):(\\d{2}))$\")\n\n(defn ^:private valid-leap-second-time?\n \"Returns true if s is a valid leap-second time, false if it contains :60 but\n is invalid, nil if it does not contain :60 (not a leap second).\"\n [s]\n (when-let [[_ hh mm _ss _tz tz-sign tz-hh tz-mm] (re-find leap-second-time-re s)]\n (let [h (parse-int hh)\n m (parse-int mm)]\n (and (<= 0 h 23)\n (<= 0 m 59)\n (if (nil? tz-sign)\n (and (= h 23) (= m 59))\n (let [oh (parse-int tz-hh)\n om (parse-int tz-mm)]\n (and (<= 0 oh 23)\n (<= 0 om 59)\n (let [local-min (+ (* h 60) m)\n off-min (* (if (= tz-sign \"+\") 1 -1) (+ (* oh 60) om))\n utc-min (mod (- local-min off-min) 1440)]\n (= utc-min 1439)))))))))\n\n(def ^:private date-time-split-re #\"(?i)^(\\d{4}-\\d{2}-\\d{2})t(.+)$\")\n\n;;------------------------------------------------------------------------------\n;; Individual format checker functions\n\n(defn check-format-host-name [_c2 p2 m2]\n (check-pattern hostname-pattern \"host-name\" _c2 p2 m2))\n\n(defn check-format-ip-address [_c2 p2 m2]\n (check-pattern ip-address-pattern \"ip-address\" _c2 p2 m2))\n\n(def ^:private css-color-names\n #{\"aqua\" \"black\" \"blue\" \"fuchsia\" \"gray\" \"green\" \"lime\" \"maroon\"\n \"navy\" \"olive\" \"orange\" \"purple\" \"red\" \"silver\" \"teal\" \"white\" \"yellow\"})\n\n(defn check-format-color [_c2 p2 m2]\n (fn [_c1 p1 m1]\n (when-not (or (re-find color-pattern m1)\n (css-color-names (str/lower-case m1)))\n [(make-error \"format: not a valid color\" p2 m2 p1 m1)])))\n\n(defn check-format-style [_c2 _p2 _m2]\n ;; Draft-03 specific, not validated\n (constantly nil))\n\n(defn check-format-phone [_c2 _p2 _m2]\n ;; Draft-03 specific, not validated\n (constantly nil))\n\n(defn check-format-utc-millisec [_c2 _p2 _m2]\n ;; Draft-03 specific, not validated\n (constantly nil))\n\n(defn check-format-email [_c2 p2 m2]\n (check-pattern email-pattern \"email\" _c2 p2 m2))\n\n(defn check-format-ipv4 [_c2 p2 m2]\n (check-pattern ipv4-pattern \"ipv4\" _c2 p2 m2))\n\n(defn check-format-ipv6 [_c2 p2 m2]\n (check-pattern ipv6-pattern \"ipv6\" _c2 p2 m2))\n\n(defn check-format-hostname [_c2 p2 m2]\n (check-pattern hostname-pattern \"hostname\" _c2 p2 m2))\n\n(defn check-format-date-time [_c2 p2 m2]\n (let [normal-check (check-parse offset-date-time-parse \"date-time\" _c2 p2 m2)]\n (fn [_c1 p1 m1]\n (if-let [[_ date-part time-part] (re-find date-time-split-re m1)]\n (case (valid-leap-second-time? time-part)\n true (try\n (local-date-parse date-part)\n nil\n (catch #?(:cljs js/Error :clj Exception) e\n [(make-error (str \"format: not a valid date-time: \" (ex-message e)) p2 m2 p1 m1)]))\n false [(make-error \"format: not a valid date-time\" p2 m2 p1 m1)]\n (normal-check _c1 p1 m1))\n (normal-check _c1 p1 m1)))))\n\n(defn check-format-date [_c2 p2 m2]\n (check-parse local-date-parse \"date\" _c2 p2 m2))\n\n(defn check-format-time-pattern [c2 p2 m2]\n (check-pattern time-pattern \"time\" c2 p2 m2))\n\n(defn check-format-time-parse [_c2 p2 m2]\n (let [normal-check (check-parse offset-time-parse \"time\" _c2 p2 m2)]\n (fn [_c1 p1 m1]\n (case (valid-leap-second-time? m1)\n true nil\n false [(make-error \"format: not a valid time\" p2 m2 p1 m1)]\n (normal-check _c1 p1 m1)))))\n\n(defn check-format-json-pointer [_c2 p2 m2]\n (check-pattern json-pointer-pattern \"json-pointer\" _c2 p2 m2))\n\n(defn check-format-relative-json-pointer [_c2 p2 m2]\n (check-pattern relative-pointer-pattern \"relative-json-pointer\" _c2 p2 m2))\n\n(defn check-format-uri [_c2 p2 m2]\n (check-pattern uri-pattern \"uri\" _c2 p2 m2))\n\n(defn check-format-uri-reference [_c2 p2 m2]\n (check-pattern uri-reference-pattern \"uri-reference\" _c2 p2 m2))\n\n(defn check-format-uri-template [_c2 p2 m2]\n (check-pattern uri-template-pattern \"uri-template\" _c2 p2 m2))\n\n(defn check-format-idn-email [_c2 p2 m2]\n (check-pattern idn-email-pattern \"idn-email\" _c2 p2 m2))\n\n(defn check-format-idn-hostname [_c2 p2 m2]\n (fn [_c1 p1 m1]\n (when-not (json-idn-hostname? m1)\n [(make-error \"format: not a valid idn-hostname:\" p2 m2 p1 m1)])))\n\n(defn check-format-iri [_c2 p2 m2]\n (check-pattern iri-pattern \"iri\" _c2 p2 m2))\n\n(defn check-format-iri-reference [_c2 p2 m2]\n (check-pattern iri-reference-pattern \"iri-reference\" _c2 p2 m2))\n\n(defn check-format-uuid [_c2 p2 m2]\n (check-pattern uuid-pattern \"uuid\" _c2 p2 m2))\n\n(defn check-format-duration [_c2 p2 m2]\n (fn [_c1 p1 m1]\n (when-not (json-duration? m1)\n [(make-error \"format: not a valid duration:\" p2 m2 p1 m1)])))\n\n(defn check-format-regex [_c2 p2 m2]\n (check-parse ecma-pattern \"regex\" _c2 p2 m2))\n\n(def ^:private lookbehind-re #\"\\(\\?<[=!]\")\n\n(defn check-format-regex-draft3 [_c2 p2 m2]\n (let [base-check (check-format-regex _c2 p2 m2)]\n (fn [_c1 p1 m1]\n (if (re-find lookbehind-re m1)\n [(make-error \"format: not a valid regex (lookbehind not supported)\" p2 m2 p1 m1)]\n (base-check _c1 p1 m1)))))\n\n(defn check-format-unknown [_c2 _p2 _m2]\n (constantly nil))\n\n;;------------------------------------------------------------------------------\n\n(def draft3-format->checker\n {\"color\" check-format-color\n \"date\" check-format-date\n \"date-time\" check-format-date-time\n \"email\" check-format-email\n \"host-name\" check-format-host-name ; renamed to \"hostname\" in draft-04\n \"ip-address\" check-format-ip-address ; renamed to \"ipv4\" in draft-04\n \"ipv6\" check-format-ipv6\n \"phone\" check-format-phone ; dropped in draft-04\n \"regex\" check-format-regex-draft3\n \"style\" check-format-style ; dropped in draft-04\n \"time\" check-format-time-pattern ; uses pattern check in draft-03\n \"uri\" check-format-uri\n \"utc-millisec\" check-format-utc-millisec ; dropped in draft-04\n })\n\n(def draft4-format->checker\n (-> draft3-format->checker\n (dissoc\n \"color\"\n \"date\"\n \"phone\"\n \"style\"\n \"utc-millisec\"\n \"host-name\"\n \"ip-address\"\n \"time\")\n (assoc\n \"hostname\" check-format-hostname\n \"ipv4\" check-format-ipv4\n \"unknown\" check-format-unknown)))\n\n(def draft6-format->checker\n (assoc\n draft4-format->checker\n \"json-pointer\" check-format-json-pointer\n \"uri-reference\" check-format-uri-reference\n \"uri-template\" check-format-uri-template))\n\n(def draft7-format->checker\n (assoc\n draft6-format->checker\n \"date\" check-format-date\n \"idn-email\" check-format-idn-email\n \"idn-hostname\" check-format-idn-hostname\n \"iri\" check-format-iri\n \"iri-reference\" check-format-iri-reference\n \"relative-json-pointer\" check-format-relative-json-pointer\n \"time\" check-format-time-parse))\n\n(def draft2019-09-format->checker\n (assoc\n draft7-format->checker\n \"duration\" check-format-duration\n \"uuid\" check-format-uuid))\n\n(def draft2020-12-format->checker draft2019-09-format->checker)\n\n(def draft-next-format->checker draft2019-09-format->checker)\n\n(def draft->format->checker\n {:draft3 draft3-format->checker\n :draft4 draft4-format->checker\n :draft6 draft6-format->checker\n :draft7 draft7-format->checker\n :draft2019-09 draft2019-09-format->checker\n :draft2020-12 draft2020-12-format->checker\n :draft-next draft-next-format->checker})\n"]}
|