trusty-cms 5.0.4 → 5.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +68 -68
- data/app/models/asset.rb +8 -2
- data/app/views/admin/assets/_asset_table.html.haml +1 -1
- data/app/views/admin/assets/_search.html.haml +1 -1
- data/app/views/admin/assets/_search_results.html.haml +2 -2
- data/app/views/admin/assets/edit.html.haml +5 -5
- data/app/views/admin/assets/index.html.haml +1 -1
- data/app/views/admin/configuration/_clipped_show.html.haml +1 -1
- data/app/views/admin/pages/_asset_popups.html.haml +5 -5
- data/app/views/admin/removed/_assets_bucket.html.haml +2 -2
- data/app/views/admin/removed/_assets_container.html.haml +6 -6
- data/app/views/admin/removed/_bucket.html.haml +1 -1
- data/app/views/admin/removed/_upload_to_page.html.haml +1 -1
- data/app/views/admin/sites/_form.haml +2 -2
- data/app/views/admin/snippets/edit.html.haml +1 -1
- data/app/views/admin/snippets/new.html.haml +1 -1
- data/lib/generators/extension_controller/templates/view_spec.rb +1 -1
- data/lib/generators/generator_base_extension.rb +0 -1
- data/lib/generators/instance/instance_generator.rb +1 -1
- data/lib/generators/language_extension/language_extension_generator.rb +0 -1
- data/lib/generators/language_extension/templates/test_helper.rb +0 -1
- data/lib/generators/trusty_cms/trusty_cms_generator.rb +0 -2
- data/lib/trusty_cms.rb +1 -1
- data/node_modules/ajv/README.md +158 -72
- data/node_modules/ajv/dist/ajv.bundle.js +136 -112
- data/node_modules/ajv/dist/ajv.min.js +2 -2
- data/node_modules/ajv/dist/ajv.min.js.map +1 -1
- data/node_modules/ajv/lib/ajv.d.ts +3 -1
- data/node_modules/ajv/lib/compile/equal.js +1 -1
- data/node_modules/ajv/lib/compile/formats.js +4 -4
- data/node_modules/ajv/lib/compile/index.js +1 -1
- data/node_modules/ajv/lib/compile/util.js +9 -44
- data/node_modules/ajv/lib/data.js +1 -1
- data/node_modules/ajv/lib/definition_schema.js +1 -1
- data/node_modules/ajv/lib/dot/_limit.jst +9 -0
- data/node_modules/ajv/lib/dot/_limitItems.jst +2 -0
- data/node_modules/ajv/lib/dot/_limitLength.jst +2 -0
- data/node_modules/ajv/lib/dot/_limitProperties.jst +2 -0
- data/node_modules/ajv/lib/dot/allOf.jst +0 -2
- data/node_modules/ajv/lib/dot/anyOf.jst +0 -2
- data/node_modules/ajv/lib/dot/coerce.def +18 -28
- data/node_modules/ajv/lib/dot/contains.jst +0 -2
- data/node_modules/ajv/lib/dot/definitions.def +9 -7
- data/node_modules/ajv/lib/dot/dependencies.jst +1 -2
- data/node_modules/ajv/lib/dot/if.jst +0 -2
- data/node_modules/ajv/lib/dot/items.jst +0 -2
- data/node_modules/ajv/lib/dot/multipleOf.jst +2 -0
- data/node_modules/ajv/lib/dot/properties.jst +6 -5
- data/node_modules/ajv/lib/dot/propertyNames.jst +0 -2
- data/node_modules/ajv/lib/dot/uniqueItems.jst +1 -1
- data/node_modules/ajv/lib/dot/validate.jst +3 -9
- data/node_modules/ajv/lib/dotjs/_limit.js +6 -0
- data/node_modules/ajv/lib/dotjs/_limitItems.js +3 -0
- data/node_modules/ajv/lib/dotjs/_limitLength.js +3 -0
- data/node_modules/ajv/lib/dotjs/_limitProperties.js +3 -0
- data/node_modules/ajv/lib/dotjs/allOf.js +1 -2
- data/node_modules/ajv/lib/dotjs/anyOf.js +1 -2
- data/node_modules/ajv/lib/dotjs/contains.js +1 -2
- data/node_modules/ajv/lib/dotjs/dependencies.js +2 -2
- data/node_modules/ajv/lib/dotjs/if.js +2 -3
- data/node_modules/ajv/lib/dotjs/items.js +3 -4
- data/node_modules/ajv/lib/dotjs/multipleOf.js +3 -0
- data/node_modules/ajv/lib/dotjs/not.js +1 -1
- data/node_modules/ajv/lib/dotjs/oneOf.js +1 -1
- data/node_modules/ajv/lib/dotjs/properties.js +11 -6
- data/node_modules/ajv/lib/dotjs/propertyNames.js +1 -2
- data/node_modules/ajv/lib/dotjs/required.js +1 -1
- data/node_modules/ajv/lib/dotjs/uniqueItems.js +1 -1
- data/node_modules/ajv/lib/dotjs/validate.js +13 -25
- data/node_modules/ajv/lib/keyword.js +1 -1
- data/node_modules/ajv/lib/refs/data.json +1 -1
- data/node_modules/ajv/lib/refs/json-schema-secure.json +1 -1
- data/node_modules/ajv/package.json +18 -10
- data/node_modules/ajv/scripts/info +0 -0
- data/node_modules/ajv/scripts/prepare-tests +0 -0
- data/node_modules/ajv/scripts/publish-built-version +1 -1
- data/node_modules/ajv/scripts/travis-gh-pages +1 -1
- data/node_modules/fast-deep-equal/es6/index.d.ts +1 -1
- data/node_modules/fast-deep-equal/es6/react.d.ts +1 -1
- data/node_modules/fast-deep-equal/package.json +7 -7
- data/node_modules/fast-deep-equal/react.d.ts +1 -1
- data/node_modules/uri-js/LICENSE +11 -0
- data/node_modules/uri-js/README.md +22 -18
- data/node_modules/uri-js/dist/es5/uri.all.d.ts +59 -59
- data/node_modules/uri-js/dist/es5/uri.all.js +61 -7
- data/node_modules/uri-js/dist/es5/uri.all.js.map +1 -1
- data/node_modules/uri-js/dist/es5/uri.all.min.d.ts +59 -59
- data/node_modules/uri-js/dist/es5/uri.all.min.js +2 -2
- data/node_modules/uri-js/dist/es5/uri.all.min.js.map +1 -1
- data/node_modules/uri-js/dist/esnext/index.d.ts +1 -1
- data/node_modules/uri-js/dist/esnext/index.js +16 -12
- data/node_modules/uri-js/dist/esnext/index.js.map +1 -1
- data/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +3 -3
- data/node_modules/uri-js/dist/esnext/regexps-iri.js +2 -2
- data/node_modules/uri-js/dist/esnext/regexps-iri.js.map +0 -0
- data/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +4 -4
- data/node_modules/uri-js/dist/esnext/regexps-uri.js +41 -41
- data/node_modules/uri-js/dist/esnext/regexps-uri.js.map +0 -0
- data/node_modules/uri-js/dist/esnext/schemes/http.d.ts +3 -3
- data/node_modules/uri-js/dist/esnext/schemes/http.js +27 -26
- data/node_modules/uri-js/dist/esnext/schemes/http.js.map +1 -1
- data/node_modules/uri-js/dist/esnext/schemes/https.d.ts +3 -3
- data/node_modules/uri-js/dist/esnext/schemes/https.js +8 -8
- data/node_modules/uri-js/dist/esnext/schemes/https.js.map +0 -0
- data/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +12 -12
- data/node_modules/uri-js/dist/esnext/schemes/mailto.js +0 -0
- data/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +0 -0
- data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +7 -7
- data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +22 -22
- data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +0 -0
- data/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +10 -10
- data/node_modules/uri-js/dist/esnext/schemes/urn.js +48 -48
- data/node_modules/uri-js/dist/esnext/schemes/urn.js.map +0 -0
- data/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +7 -0
- data/node_modules/uri-js/dist/esnext/schemes/ws.js +41 -0
- data/node_modules/uri-js/dist/esnext/schemes/ws.js.map +1 -0
- data/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +3 -0
- data/node_modules/uri-js/dist/esnext/schemes/wss.js +9 -0
- data/node_modules/uri-js/dist/esnext/schemes/wss.js.map +1 -0
- data/node_modules/uri-js/dist/esnext/uri.d.ts +59 -59
- data/node_modules/uri-js/dist/esnext/uri.js +2 -2
- data/node_modules/uri-js/dist/esnext/uri.js.map +1 -1
- data/node_modules/uri-js/dist/esnext/util.d.ts +6 -6
- data/node_modules/uri-js/dist/esnext/util.js +35 -35
- data/node_modules/uri-js/dist/esnext/util.js.map +0 -0
- data/node_modules/uri-js/package.json +19 -7
- data/node_modules/uri-js/yarn.lock +1271 -615
- data/trusty_cms.gemspec +2 -1
- data/yarn.lock +9 -9
- metadata +9 -21
- data/node_modules/uri-js/bower.json +0 -47
- data/node_modules/uri-js/rollup.config.js +0 -32
- data/node_modules/uri-js/src/index.ts +0 -18
- data/node_modules/uri-js/src/punycode.d.ts +0 -24
- data/node_modules/uri-js/src/regexps-iri.ts +0 -4
- data/node_modules/uri-js/src/regexps-uri.ts +0 -89
- data/node_modules/uri-js/src/schemes/http.ts +0 -36
- data/node_modules/uri-js/src/schemes/https.ts +0 -11
- data/node_modules/uri-js/src/schemes/mailto.ts +0 -182
- data/node_modules/uri-js/src/schemes/urn-uuid.ts +0 -36
- data/node_modules/uri-js/src/schemes/urn.ts +0 -69
- data/node_modules/uri-js/src/uri.ts +0 -556
- data/node_modules/uri-js/src/util.ts +0 -40
- data/node_modules/uri-js/tests/qunit.css +0 -118
- data/node_modules/uri-js/tests/qunit.js +0 -1042
- data/node_modules/uri-js/tests/test-es5-min.html +0 -17
- data/node_modules/uri-js/tests/test-es5.html +0 -17
- data/node_modules/uri-js/tests/tests.js +0 -774
- data/node_modules/uri-js/tsconfig.json +0 -20
@@ -1,42 +1,42 @@
|
|
1
|
-
import { merge, subexp } from "./util";
|
2
|
-
export function buildExps(isIRI) {
|
3
|
-
const ALPHA$$ = "[A-Za-z]", CR$ = "[\\x0D]", DIGIT$$ = "[0-9]", DQUOTE$$ = "[\\x22]", HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), //case-insensitive
|
4
|
-
LF$$ = "[\\x0A]", SP$$ = "[\\x20]", PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), //expanded
|
5
|
-
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", //subset, excludes bidi control characters
|
6
|
-
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", //subset
|
7
|
-
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), //relaxed parsing rules
|
8
|
-
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$ + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), // 6( h16 ":" ) ls32
|
9
|
-
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), // "::" 5( h16 ":" ) ls32
|
10
|
-
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[ h16 ] "::" 4( h16 ":" ) ls32
|
11
|
-
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
12
|
-
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
13
|
-
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
14
|
-
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), //[ *4( h16 ":" ) h16 ] "::" ls32
|
15
|
-
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), //[ *5( h16 ":" ) h16 ] "::" h16
|
16
|
-
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), //[ *6( h16 ":" ) h16 ] "::"
|
17
|
-
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), //RFC 6874
|
18
|
-
IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), //RFC 6874
|
19
|
-
IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), //RFC 6874, with relaxed parsing rules
|
20
|
-
IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), //RFC 6874
|
21
|
-
REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), PORT$ = subexp(DIGIT$$ + "*"), AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), SEGMENT$ = subexp(PCHAR$ + "*"), SEGMENT_NZ$ = subexp(PCHAR$ + "+"), SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), //simplified
|
22
|
-
PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified
|
23
|
-
PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified
|
24
|
-
PATH_EMPTY$ = "(?!" + PCHAR$ + ")", PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$";
|
25
|
-
return {
|
26
|
-
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
27
|
-
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
28
|
-
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
29
|
-
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
30
|
-
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
31
|
-
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
32
|
-
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
33
|
-
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
34
|
-
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
|
35
|
-
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
36
|
-
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
|
37
|
-
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
38
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
39
|
-
};
|
40
|
-
}
|
41
|
-
export default buildExps(false);
|
1
|
+
import { merge, subexp } from "./util";
|
2
|
+
export function buildExps(isIRI) {
|
3
|
+
const ALPHA$$ = "[A-Za-z]", CR$ = "[\\x0D]", DIGIT$$ = "[0-9]", DQUOTE$$ = "[\\x22]", HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), //case-insensitive
|
4
|
+
LF$$ = "[\\x0A]", SP$$ = "[\\x20]", PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), //expanded
|
5
|
+
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", //subset, excludes bidi control characters
|
6
|
+
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", //subset
|
7
|
+
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), //relaxed parsing rules
|
8
|
+
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$ + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), // 6( h16 ":" ) ls32
|
9
|
+
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), // "::" 5( h16 ":" ) ls32
|
10
|
+
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[ h16 ] "::" 4( h16 ":" ) ls32
|
11
|
+
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
12
|
+
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
13
|
+
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
14
|
+
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), //[ *4( h16 ":" ) h16 ] "::" ls32
|
15
|
+
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), //[ *5( h16 ":" ) h16 ] "::" h16
|
16
|
+
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), //[ *6( h16 ":" ) h16 ] "::"
|
17
|
+
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), //RFC 6874
|
18
|
+
IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), //RFC 6874
|
19
|
+
IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), //RFC 6874, with relaxed parsing rules
|
20
|
+
IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), //RFC 6874
|
21
|
+
REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), PORT$ = subexp(DIGIT$$ + "*"), AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), SEGMENT$ = subexp(PCHAR$ + "*"), SEGMENT_NZ$ = subexp(PCHAR$ + "+"), SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), //simplified
|
22
|
+
PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified
|
23
|
+
PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified
|
24
|
+
PATH_EMPTY$ = "(?!" + PCHAR$ + ")", PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$";
|
25
|
+
return {
|
26
|
+
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
27
|
+
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
28
|
+
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
29
|
+
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
30
|
+
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
31
|
+
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
32
|
+
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
33
|
+
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
34
|
+
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
|
35
|
+
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
36
|
+
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
|
37
|
+
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
38
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
39
|
+
};
|
40
|
+
}
|
41
|
+
export default buildExps(false);
|
42
42
|
//# sourceMappingURL=regexps-uri.js.map
|
File without changes
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { URISchemeHandler } from "../uri";
|
2
|
-
declare const handler: URISchemeHandler;
|
3
|
-
export default handler;
|
1
|
+
import { URISchemeHandler } from "../uri";
|
2
|
+
declare const handler: URISchemeHandler;
|
3
|
+
export default handler;
|
@@ -1,27 +1,28 @@
|
|
1
|
-
const handler = {
|
2
|
-
scheme: "http",
|
3
|
-
domainHost: true,
|
4
|
-
parse: function (components, options) {
|
5
|
-
//report missing host
|
6
|
-
if (!components.host) {
|
7
|
-
components.error = components.error || "HTTP URIs must have a host.";
|
8
|
-
}
|
9
|
-
return components;
|
10
|
-
},
|
11
|
-
serialize: function (components, options) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
//
|
22
|
-
//
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
|
1
|
+
const handler = {
|
2
|
+
scheme: "http",
|
3
|
+
domainHost: true,
|
4
|
+
parse: function (components, options) {
|
5
|
+
//report missing host
|
6
|
+
if (!components.host) {
|
7
|
+
components.error = components.error || "HTTP URIs must have a host.";
|
8
|
+
}
|
9
|
+
return components;
|
10
|
+
},
|
11
|
+
serialize: function (components, options) {
|
12
|
+
const secure = String(components.scheme).toLowerCase() === "https";
|
13
|
+
//normalize the default port
|
14
|
+
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
15
|
+
components.port = undefined;
|
16
|
+
}
|
17
|
+
//normalize the empty path
|
18
|
+
if (!components.path) {
|
19
|
+
components.path = "/";
|
20
|
+
}
|
21
|
+
//NOTE: We do not parse query strings for HTTP URIs
|
22
|
+
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
23
|
+
//and not the HTTP spec.
|
24
|
+
return components;
|
25
|
+
}
|
26
|
+
};
|
27
|
+
export default handler;
|
27
28
|
//# sourceMappingURL=http.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/schemes/http.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,MAAM;IAEf,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,qBAAqB;QACrB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,6BAA6B,CAAC;SACrE;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,EAAG,UAAU,UAAwB,EAAE,OAAkB;QACjE,
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/schemes/http.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,MAAM;IAEf,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,qBAAqB;QACrB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,6BAA6B,CAAC;SACrE;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,EAAG,UAAU,UAAwB,EAAE,OAAkB;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;QAEnE,4BAA4B;QAC5B,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,EAAE,EAAE;YACtE,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;SAC5B;QAED,0BAA0B;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC;SACtB;QAED,mDAAmD;QACnD,oEAAoE;QACpE,wBAAwB;QAExB,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { URISchemeHandler } from "../uri";
|
2
|
-
declare const handler: URISchemeHandler;
|
3
|
-
export default handler;
|
1
|
+
import { URISchemeHandler } from "../uri";
|
2
|
+
declare const handler: URISchemeHandler;
|
3
|
+
export default handler;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import http from "./http";
|
2
|
-
const handler = {
|
3
|
-
scheme: "https",
|
4
|
-
domainHost: http.domainHost,
|
5
|
-
parse: http.parse,
|
6
|
-
serialize: http.serialize
|
7
|
-
};
|
8
|
-
export default handler;
|
1
|
+
import http from "./http";
|
2
|
+
const handler = {
|
3
|
+
scheme: "https",
|
4
|
+
domainHost: http.domainHost,
|
5
|
+
parse: http.parse,
|
6
|
+
serialize: http.serialize
|
7
|
+
};
|
8
|
+
export default handler;
|
9
9
|
//# sourceMappingURL=https.js.map
|
File without changes
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import { URISchemeHandler, URIComponents } from "../uri";
|
2
|
-
export interface MailtoHeaders {
|
3
|
-
[hfname: string]: string;
|
4
|
-
}
|
5
|
-
export interface MailtoComponents extends URIComponents {
|
6
|
-
to: Array<string>;
|
7
|
-
headers?: MailtoHeaders;
|
8
|
-
subject?: string;
|
9
|
-
body?: string;
|
10
|
-
}
|
11
|
-
declare const handler: URISchemeHandler<MailtoComponents>;
|
12
|
-
export default handler;
|
1
|
+
import { URISchemeHandler, URIComponents } from "../uri";
|
2
|
+
export interface MailtoHeaders {
|
3
|
+
[hfname: string]: string;
|
4
|
+
}
|
5
|
+
export interface MailtoComponents extends URIComponents {
|
6
|
+
to: Array<string>;
|
7
|
+
headers?: MailtoHeaders;
|
8
|
+
subject?: string;
|
9
|
+
body?: string;
|
10
|
+
}
|
11
|
+
declare const handler: URISchemeHandler<MailtoComponents>;
|
12
|
+
export default handler;
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { URISchemeHandler, URIOptions } from "../uri";
|
2
|
-
import { URNComponents } from "./urn";
|
3
|
-
export interface UUIDComponents extends URNComponents {
|
4
|
-
uuid?: string;
|
5
|
-
}
|
6
|
-
declare const handler: URISchemeHandler<UUIDComponents, URIOptions, URNComponents>;
|
7
|
-
export default handler;
|
1
|
+
import { URISchemeHandler, URIOptions } from "../uri";
|
2
|
+
import { URNComponents } from "./urn";
|
3
|
+
export interface UUIDComponents extends URNComponents {
|
4
|
+
uuid?: string;
|
5
|
+
}
|
6
|
+
declare const handler: URISchemeHandler<UUIDComponents, URIOptions, URNComponents>;
|
7
|
+
export default handler;
|
@@ -1,23 +1,23 @@
|
|
1
|
-
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
2
|
-
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
|
3
|
-
//RFC 4122
|
4
|
-
const handler = {
|
5
|
-
scheme: "urn:uuid",
|
6
|
-
parse: function (urnComponents, options) {
|
7
|
-
const uuidComponents = urnComponents;
|
8
|
-
uuidComponents.uuid = uuidComponents.nss;
|
9
|
-
uuidComponents.nss = undefined;
|
10
|
-
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
11
|
-
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
12
|
-
}
|
13
|
-
return uuidComponents;
|
14
|
-
},
|
15
|
-
serialize: function (uuidComponents, options) {
|
16
|
-
const urnComponents = uuidComponents;
|
17
|
-
//normalize UUID
|
18
|
-
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
19
|
-
return urnComponents;
|
20
|
-
},
|
21
|
-
};
|
22
|
-
export default handler;
|
1
|
+
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
2
|
+
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
|
3
|
+
//RFC 4122
|
4
|
+
const handler = {
|
5
|
+
scheme: "urn:uuid",
|
6
|
+
parse: function (urnComponents, options) {
|
7
|
+
const uuidComponents = urnComponents;
|
8
|
+
uuidComponents.uuid = uuidComponents.nss;
|
9
|
+
uuidComponents.nss = undefined;
|
10
|
+
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
11
|
+
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
12
|
+
}
|
13
|
+
return uuidComponents;
|
14
|
+
},
|
15
|
+
serialize: function (uuidComponents, options) {
|
16
|
+
const urnComponents = uuidComponents;
|
17
|
+
//normalize UUID
|
18
|
+
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
19
|
+
return urnComponents;
|
20
|
+
},
|
21
|
+
};
|
22
|
+
export default handler;
|
23
23
|
//# sourceMappingURL=urn-uuid.js.map
|
File without changes
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
|
2
|
-
export interface URNComponents extends URIComponents {
|
3
|
-
nid?: string;
|
4
|
-
nss?: string;
|
5
|
-
}
|
6
|
-
export interface URNOptions extends URIOptions {
|
7
|
-
nid?: string;
|
8
|
-
}
|
9
|
-
declare const handler: URISchemeHandler<URNComponents, URNOptions>;
|
10
|
-
export default handler;
|
1
|
+
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
|
2
|
+
export interface URNComponents extends URIComponents {
|
3
|
+
nid?: string;
|
4
|
+
nss?: string;
|
5
|
+
}
|
6
|
+
export interface URNOptions extends URIOptions {
|
7
|
+
nid?: string;
|
8
|
+
}
|
9
|
+
declare const handler: URISchemeHandler<URNComponents, URNOptions>;
|
10
|
+
export default handler;
|
@@ -1,49 +1,49 @@
|
|
1
|
-
import { SCHEMES } from "../uri";
|
2
|
-
const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})";
|
3
|
-
const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})";
|
4
|
-
const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]";
|
5
|
-
const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)";
|
6
|
-
const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$");
|
7
|
-
const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$");
|
8
|
-
const URN_PARSE = /^([^\:]+)\:(.*)/;
|
9
|
-
const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g;
|
10
|
-
//RFC 2141
|
11
|
-
const handler = {
|
12
|
-
scheme: "urn",
|
13
|
-
parse: function (components, options) {
|
14
|
-
const matches = components.path && components.path.match(URN_PARSE);
|
15
|
-
let urnComponents = components;
|
16
|
-
if (matches) {
|
17
|
-
const scheme = options.scheme || urnComponents.scheme || "urn";
|
18
|
-
const nid = matches[1].toLowerCase();
|
19
|
-
const nss = matches[2];
|
20
|
-
const urnScheme = `${scheme}:${options.nid || nid}`;
|
21
|
-
const schemeHandler = SCHEMES[urnScheme];
|
22
|
-
urnComponents.nid = nid;
|
23
|
-
urnComponents.nss = nss;
|
24
|
-
urnComponents.path = undefined;
|
25
|
-
if (schemeHandler) {
|
26
|
-
urnComponents = schemeHandler.parse(urnComponents, options);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
31
|
-
}
|
32
|
-
return urnComponents;
|
33
|
-
},
|
34
|
-
serialize: function (urnComponents, options) {
|
35
|
-
const scheme = options.scheme || urnComponents.scheme || "urn";
|
36
|
-
const nid = urnComponents.nid;
|
37
|
-
const urnScheme = `${scheme}:${options.nid || nid}`;
|
38
|
-
const schemeHandler = SCHEMES[urnScheme];
|
39
|
-
if (schemeHandler) {
|
40
|
-
urnComponents = schemeHandler.serialize(urnComponents, options);
|
41
|
-
}
|
42
|
-
const uriComponents = urnComponents;
|
43
|
-
const nss = urnComponents.nss;
|
44
|
-
uriComponents.path = `${nid || options.nid}:${nss}`;
|
45
|
-
return uriComponents;
|
46
|
-
},
|
47
|
-
};
|
48
|
-
export default handler;
|
1
|
+
import { SCHEMES } from "../uri";
|
2
|
+
const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})";
|
3
|
+
const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})";
|
4
|
+
const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]";
|
5
|
+
const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)";
|
6
|
+
const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$");
|
7
|
+
const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$");
|
8
|
+
const URN_PARSE = /^([^\:]+)\:(.*)/;
|
9
|
+
const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g;
|
10
|
+
//RFC 2141
|
11
|
+
const handler = {
|
12
|
+
scheme: "urn",
|
13
|
+
parse: function (components, options) {
|
14
|
+
const matches = components.path && components.path.match(URN_PARSE);
|
15
|
+
let urnComponents = components;
|
16
|
+
if (matches) {
|
17
|
+
const scheme = options.scheme || urnComponents.scheme || "urn";
|
18
|
+
const nid = matches[1].toLowerCase();
|
19
|
+
const nss = matches[2];
|
20
|
+
const urnScheme = `${scheme}:${options.nid || nid}`;
|
21
|
+
const schemeHandler = SCHEMES[urnScheme];
|
22
|
+
urnComponents.nid = nid;
|
23
|
+
urnComponents.nss = nss;
|
24
|
+
urnComponents.path = undefined;
|
25
|
+
if (schemeHandler) {
|
26
|
+
urnComponents = schemeHandler.parse(urnComponents, options);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
31
|
+
}
|
32
|
+
return urnComponents;
|
33
|
+
},
|
34
|
+
serialize: function (urnComponents, options) {
|
35
|
+
const scheme = options.scheme || urnComponents.scheme || "urn";
|
36
|
+
const nid = urnComponents.nid;
|
37
|
+
const urnScheme = `${scheme}:${options.nid || nid}`;
|
38
|
+
const schemeHandler = SCHEMES[urnScheme];
|
39
|
+
if (schemeHandler) {
|
40
|
+
urnComponents = schemeHandler.serialize(urnComponents, options);
|
41
|
+
}
|
42
|
+
const uriComponents = urnComponents;
|
43
|
+
const nss = urnComponents.nss;
|
44
|
+
uriComponents.path = `${nid || options.nid}:${nss}`;
|
45
|
+
return uriComponents;
|
46
|
+
},
|
47
|
+
};
|
48
|
+
export default handler;
|
49
49
|
//# sourceMappingURL=urn.js.map
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
function isSecure(wsComponents) {
|
2
|
+
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
3
|
+
}
|
4
|
+
//RFC 6455
|
5
|
+
const handler = {
|
6
|
+
scheme: "ws",
|
7
|
+
domainHost: true,
|
8
|
+
parse: function (components, options) {
|
9
|
+
const wsComponents = components;
|
10
|
+
//indicate if the secure flag is set
|
11
|
+
wsComponents.secure = isSecure(wsComponents);
|
12
|
+
//construct resouce name
|
13
|
+
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
14
|
+
wsComponents.path = undefined;
|
15
|
+
wsComponents.query = undefined;
|
16
|
+
return wsComponents;
|
17
|
+
},
|
18
|
+
serialize: function (wsComponents, options) {
|
19
|
+
//normalize the default port
|
20
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
21
|
+
wsComponents.port = undefined;
|
22
|
+
}
|
23
|
+
//ensure scheme matches secure flag
|
24
|
+
if (typeof wsComponents.secure === 'boolean') {
|
25
|
+
wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
|
26
|
+
wsComponents.secure = undefined;
|
27
|
+
}
|
28
|
+
//reconstruct path from resource name
|
29
|
+
if (wsComponents.resourceName) {
|
30
|
+
const [path, query] = wsComponents.resourceName.split('?');
|
31
|
+
wsComponents.path = (path && path !== '/' ? path : undefined);
|
32
|
+
wsComponents.query = query;
|
33
|
+
wsComponents.resourceName = undefined;
|
34
|
+
}
|
35
|
+
//forbid fragment component
|
36
|
+
wsComponents.fragment = undefined;
|
37
|
+
return wsComponents;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
export default handler;
|
41
|
+
//# sourceMappingURL=ws.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../../src/schemes/ws.ts"],"names":[],"mappings":"AAOA,kBAAkB,YAAyB;IAC1C,OAAO,OAAO,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;AAC7H,CAAC;AAED,UAAU;AACV,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,IAAI;IAEb,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,MAAM,YAAY,GAAG,UAA0B,CAAC;QAEhD,oCAAoC;QACpC,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE7C,wBAAwB;QACxB,YAAY,CAAC,YAAY,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9G,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;QAC9B,YAAY,CAAC,KAAK,GAAG,SAAS,CAAC;QAE/B,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,SAAS,EAAG,UAAU,YAAyB,EAAE,OAAkB;QAClE,4BAA4B;QAC5B,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,KAAK,EAAE,EAAE;YAC1F,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;SAC9B;QAED,mCAAmC;QACnC,IAAI,OAAO,YAAY,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7C,YAAY,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3D,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC;SAChC;QAED,qCAAqC;QACrC,IAAI,YAAY,CAAC,YAAY,EAAE;YAC9B,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3D,YAAY,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC9D,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;YAC3B,YAAY,CAAC,YAAY,GAAG,SAAS,CAAC;SACtC;QAED,2BAA2B;QAC3B,YAAY,CAAC,QAAQ,GAAG,SAAS,CAAC;QAElC,OAAO,YAAY,CAAC;IACrB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wss.js","sourceRoot":"","sources":["../../../src/schemes/wss.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,KAAK;IACd,UAAU,EAAG,EAAE,CAAC,UAAU;IAC1B,KAAK,EAAG,EAAE,CAAC,KAAK;IAChB,SAAS,EAAG,EAAE,CAAC,SAAS;CACxB,CAAA;AAED,eAAe,OAAO,CAAC"}
|