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
data/trusty_cms.gemspec
CHANGED
@@ -17,7 +17,8 @@ a general purpose content managment system--not merely a blogging engine.'
|
|
17
17
|
s.extra_rdoc_files = ['README.md', 'INSTALL.md', 'LICENSE.md']
|
18
18
|
s.files = Dir['**/*', '.gitignore', 'public/.htaccess', 'log/.keep', 'vendor/extensions/.keep']
|
19
19
|
s.homepage = 'https://github.com/pgharts/trusty-cms'
|
20
|
-
s.rdoc_options = ['--title', 'TrustyCms -- Content Management You Can Trust', '--line-numbers', '--main', 'README', '--exclude', 'app', '--exclude', 'bin', '--exclude',
|
20
|
+
s.rdoc_options = ['--title', 'TrustyCms -- Content Management You Can Trust', '--line-numbers', '--main', 'README', '--exclude', 'app', '--exclude', 'bin', '--exclude',
|
21
|
+
'config', '--exclude', 'db', '--exclude', 'features', '--exclude', 'lib', '--exclude', 'log', '--exclude', 'pkg', '--exclude', 'public', '--exclude', 'script', '--exclude', 'spec', '--exclude', 'test', '--exclude', 'tmp', '--exclude', 'vendor']
|
21
22
|
s.require_paths = ['lib']
|
22
23
|
s.rubygems_version = '1.3.7'
|
23
24
|
s.summary = 'A no-fluff content management system designed for small teams.'
|
data/yarn.lock
CHANGED
@@ -251,9 +251,9 @@
|
|
251
251
|
integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==
|
252
252
|
|
253
253
|
ajv@^6.10.2:
|
254
|
-
version "6.12.
|
255
|
-
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.
|
256
|
-
integrity sha512-
|
254
|
+
version "6.12.6"
|
255
|
+
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
|
256
|
+
integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==
|
257
257
|
dependencies:
|
258
258
|
fast-deep-equal "^3.1.1"
|
259
259
|
fast-json-stable-stringify "^2.0.0"
|
@@ -588,9 +588,9 @@ extend@^3.0.0:
|
|
588
588
|
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
|
589
589
|
|
590
590
|
fast-deep-equal@^3.1.1:
|
591
|
-
version "3.1.
|
592
|
-
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.
|
593
|
-
integrity sha512-
|
591
|
+
version "3.1.3"
|
592
|
+
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
593
|
+
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
|
594
594
|
|
595
595
|
fast-glob@^3.1.1:
|
596
596
|
version "3.2.2"
|
@@ -1910,9 +1910,9 @@ unist-util-visit@^2.0.0:
|
|
1910
1910
|
unist-util-visit-parents "^3.0.0"
|
1911
1911
|
|
1912
1912
|
uri-js@^4.2.2:
|
1913
|
-
version "4.
|
1914
|
-
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.
|
1915
|
-
integrity sha512-
|
1913
|
+
version "4.4.1"
|
1914
|
+
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
|
1915
|
+
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
|
1916
1916
|
dependencies:
|
1917
1917
|
punycode "^2.1.0"
|
1918
1918
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrustyCms CMS dev team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|
@@ -8239,8 +8239,8 @@ files:
|
|
8239
8239
|
- node_modules/unist-util-visit/package.json
|
8240
8240
|
- node_modules/unist-util-visit/readme.md
|
8241
8241
|
- node_modules/unist-util-visit/types/index.d.ts
|
8242
|
+
- node_modules/uri-js/LICENSE
|
8242
8243
|
- node_modules/uri-js/README.md
|
8243
|
-
- node_modules/uri-js/bower.json
|
8244
8244
|
- node_modules/uri-js/dist/es5/uri.all.d.ts
|
8245
8245
|
- node_modules/uri-js/dist/es5/uri.all.js
|
8246
8246
|
- node_modules/uri-js/dist/es5/uri.all.js.map
|
@@ -8271,6 +8271,12 @@ files:
|
|
8271
8271
|
- node_modules/uri-js/dist/esnext/schemes/urn.d.ts
|
8272
8272
|
- node_modules/uri-js/dist/esnext/schemes/urn.js
|
8273
8273
|
- node_modules/uri-js/dist/esnext/schemes/urn.js.map
|
8274
|
+
- node_modules/uri-js/dist/esnext/schemes/ws.d.ts
|
8275
|
+
- node_modules/uri-js/dist/esnext/schemes/ws.js
|
8276
|
+
- node_modules/uri-js/dist/esnext/schemes/ws.js.map
|
8277
|
+
- node_modules/uri-js/dist/esnext/schemes/wss.d.ts
|
8278
|
+
- node_modules/uri-js/dist/esnext/schemes/wss.js
|
8279
|
+
- node_modules/uri-js/dist/esnext/schemes/wss.js.map
|
8274
8280
|
- node_modules/uri-js/dist/esnext/uri.d.ts
|
8275
8281
|
- node_modules/uri-js/dist/esnext/uri.js
|
8276
8282
|
- node_modules/uri-js/dist/esnext/uri.js.map
|
@@ -8278,24 +8284,6 @@ files:
|
|
8278
8284
|
- node_modules/uri-js/dist/esnext/util.js
|
8279
8285
|
- node_modules/uri-js/dist/esnext/util.js.map
|
8280
8286
|
- node_modules/uri-js/package.json
|
8281
|
-
- node_modules/uri-js/rollup.config.js
|
8282
|
-
- node_modules/uri-js/src/index.ts
|
8283
|
-
- node_modules/uri-js/src/punycode.d.ts
|
8284
|
-
- node_modules/uri-js/src/regexps-iri.ts
|
8285
|
-
- node_modules/uri-js/src/regexps-uri.ts
|
8286
|
-
- node_modules/uri-js/src/schemes/http.ts
|
8287
|
-
- node_modules/uri-js/src/schemes/https.ts
|
8288
|
-
- node_modules/uri-js/src/schemes/mailto.ts
|
8289
|
-
- node_modules/uri-js/src/schemes/urn-uuid.ts
|
8290
|
-
- node_modules/uri-js/src/schemes/urn.ts
|
8291
|
-
- node_modules/uri-js/src/uri.ts
|
8292
|
-
- node_modules/uri-js/src/util.ts
|
8293
|
-
- node_modules/uri-js/tests/qunit.css
|
8294
|
-
- node_modules/uri-js/tests/qunit.js
|
8295
|
-
- node_modules/uri-js/tests/test-es5-min.html
|
8296
|
-
- node_modules/uri-js/tests/test-es5.html
|
8297
|
-
- node_modules/uri-js/tests/tests.js
|
8298
|
-
- node_modules/uri-js/tsconfig.json
|
8299
8287
|
- node_modules/uri-js/yarn.lock
|
8300
8288
|
- node_modules/util-deprecate/History.md
|
8301
8289
|
- node_modules/util-deprecate/LICENSE
|
@@ -1,47 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "uri-js",
|
3
|
-
"description": "An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.",
|
4
|
-
"main": "dist/es5/uri.all.js",
|
5
|
-
"moduleType": [
|
6
|
-
"globals",
|
7
|
-
"amd",
|
8
|
-
"node",
|
9
|
-
"es6"
|
10
|
-
],
|
11
|
-
"authors": [
|
12
|
-
"Gary Court <gary.court@gmail.com>"
|
13
|
-
],
|
14
|
-
"license": "BSD-2-Clause",
|
15
|
-
"keywords": [
|
16
|
-
"URI",
|
17
|
-
"IRI",
|
18
|
-
"IDN",
|
19
|
-
"URN",
|
20
|
-
"HTTP",
|
21
|
-
"HTTPS",
|
22
|
-
"MAILTO",
|
23
|
-
"RFC3986",
|
24
|
-
"RFC3987",
|
25
|
-
"RFC5891",
|
26
|
-
"RFC2616",
|
27
|
-
"RFC2818",
|
28
|
-
"RFC2141",
|
29
|
-
"RFC4122",
|
30
|
-
"RFC6068"
|
31
|
-
],
|
32
|
-
"homepage": "https://github.com/garycourt/uri-js",
|
33
|
-
"repository": {
|
34
|
-
"type": "git",
|
35
|
-
"url": "http://github.com/garycourt/uri-js"
|
36
|
-
},
|
37
|
-
"dependencies": {
|
38
|
-
"punycode": "^2.1.0"
|
39
|
-
},
|
40
|
-
"ignore": [
|
41
|
-
"**/.*",
|
42
|
-
"node_modules",
|
43
|
-
"bower_components",
|
44
|
-
"test",
|
45
|
-
"tests"
|
46
|
-
]
|
47
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import resolve from 'rollup-plugin-node-resolve';
|
2
|
-
import babel from 'rollup-plugin-babel';
|
3
|
-
const packageJson = require('./package.json');
|
4
|
-
|
5
|
-
export default {
|
6
|
-
entry : "dist/esnext/index.js",
|
7
|
-
format : "umd",
|
8
|
-
moduleName : "URI",
|
9
|
-
plugins: [
|
10
|
-
resolve({
|
11
|
-
module: true,
|
12
|
-
jsnext: true,
|
13
|
-
preferBuiltins: false
|
14
|
-
}),
|
15
|
-
|
16
|
-
babel({
|
17
|
-
"presets": [
|
18
|
-
["latest", {
|
19
|
-
"es2015": {
|
20
|
-
"modules": false
|
21
|
-
}
|
22
|
-
}]
|
23
|
-
],
|
24
|
-
"plugins": ["external-helpers"],
|
25
|
-
"externalHelpers": false
|
26
|
-
}
|
27
|
-
)
|
28
|
-
],
|
29
|
-
dest : "dist/es5/uri.all.js",
|
30
|
-
sourceMap: true,
|
31
|
-
banner: "/** @license URI.js v" + packageJson.version + " (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */"
|
32
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { SCHEMES } from "./uri";
|
2
|
-
|
3
|
-
import http from "./schemes/http";
|
4
|
-
SCHEMES[http.scheme] = http;
|
5
|
-
|
6
|
-
import https from "./schemes/https";
|
7
|
-
SCHEMES[https.scheme] = https;
|
8
|
-
|
9
|
-
import mailto from "./schemes/mailto";
|
10
|
-
SCHEMES[mailto.scheme] = mailto;
|
11
|
-
|
12
|
-
import urn from "./schemes/urn";
|
13
|
-
SCHEMES[urn.scheme] = urn;
|
14
|
-
|
15
|
-
import uuid from "./schemes/urn-uuid";
|
16
|
-
SCHEMES[uuid.scheme] = uuid;
|
17
|
-
|
18
|
-
export * from "./uri";
|
@@ -1,24 +0,0 @@
|
|
1
|
-
declare module 'punycode' {
|
2
|
-
function ucs2decode(string:string):Array<number>;
|
3
|
-
function ucs2encode(array:Array<number>):string;
|
4
|
-
function decode(string:string):string;
|
5
|
-
function encode(string:string):string;
|
6
|
-
function toASCII(string:string):string;
|
7
|
-
function toUnicode(string:string):string;
|
8
|
-
|
9
|
-
interface Punycode {
|
10
|
-
'version': '2.2.0';
|
11
|
-
'ucs2': {
|
12
|
-
'decode': typeof ucs2decode;
|
13
|
-
'encode': typeof ucs2encode;
|
14
|
-
},
|
15
|
-
'decode': typeof decode;
|
16
|
-
'encode': typeof encode;
|
17
|
-
'toASCII': typeof toASCII;
|
18
|
-
'toUnicode': typeof toUnicode;
|
19
|
-
}
|
20
|
-
|
21
|
-
const punycode:Punycode;
|
22
|
-
|
23
|
-
export default punycode;
|
24
|
-
}
|
@@ -1,89 +0,0 @@
|
|
1
|
-
import { URIRegExps } from "./uri";
|
2
|
-
import { merge, subexp } from "./util";
|
3
|
-
|
4
|
-
export function buildExps(isIRI:boolean):URIRegExps {
|
5
|
-
const
|
6
|
-
ALPHA$$ = "[A-Za-z]",
|
7
|
-
CR$ = "[\\x0D]",
|
8
|
-
DIGIT$$ = "[0-9]",
|
9
|
-
DQUOTE$$ = "[\\x22]",
|
10
|
-
HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), //case-insensitive
|
11
|
-
LF$$ = "[\\x0A]",
|
12
|
-
SP$$ = "[\\x20]",
|
13
|
-
PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), //expanded
|
14
|
-
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
|
15
|
-
SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
|
16
|
-
RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
|
17
|
-
UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", //subset, excludes bidi control characters
|
18
|
-
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", //subset
|
19
|
-
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$),
|
20
|
-
SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"),
|
21
|
-
USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"),
|
22
|
-
DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$),
|
23
|
-
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
|
24
|
-
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
25
|
-
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
26
|
-
LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
|
27
|
-
IPV6ADDRESS1$ = subexp( subexp(H16$ + "\\:") + "{6}" + LS32$), // 6( h16 ":" ) ls32
|
28
|
-
IPV6ADDRESS2$ = subexp( "\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), // "::" 5( h16 ":" ) ls32
|
29
|
-
IPV6ADDRESS3$ = subexp(subexp( H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[ h16 ] "::" 4( h16 ":" ) ls32
|
30
|
-
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
31
|
-
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
32
|
-
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
33
|
-
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), //[ *4( h16 ":" ) h16 ] "::" ls32
|
34
|
-
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$ ), //[ *5( h16 ":" ) h16 ] "::" h16
|
35
|
-
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:" ), //[ *6( h16 ":" ) h16 ] "::"
|
36
|
-
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
37
|
-
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), //RFC 6874
|
38
|
-
IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), //RFC 6874
|
39
|
-
IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), //RFC 6874, with relaxed parsing rules
|
40
|
-
IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"),
|
41
|
-
IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), //RFC 6874
|
42
|
-
REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"),
|
43
|
-
HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$),
|
44
|
-
PORT$ = subexp(DIGIT$$ + "*"),
|
45
|
-
AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"),
|
46
|
-
PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")),
|
47
|
-
SEGMENT$ = subexp(PCHAR$ + "*"),
|
48
|
-
SEGMENT_NZ$ = subexp(PCHAR$ + "+"),
|
49
|
-
SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"),
|
50
|
-
PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"),
|
51
|
-
PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), //simplified
|
52
|
-
PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified
|
53
|
-
PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified
|
54
|
-
PATH_EMPTY$ = "(?!" + PCHAR$ + ")",
|
55
|
-
PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
|
56
|
-
QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"),
|
57
|
-
FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"),
|
58
|
-
HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
|
59
|
-
URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
|
60
|
-
RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$),
|
61
|
-
RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
|
62
|
-
URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$),
|
63
|
-
ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"),
|
64
|
-
|
65
|
-
GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
|
66
|
-
RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
|
67
|
-
ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$",
|
68
|
-
SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
|
69
|
-
AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"
|
70
|
-
;
|
71
|
-
|
72
|
-
return {
|
73
|
-
NOT_SCHEME : new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
74
|
-
NOT_USERINFO : new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
75
|
-
NOT_HOST : new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
76
|
-
NOT_PATH : new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
77
|
-
NOT_PATH_NOSCHEME : new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
78
|
-
NOT_QUERY : new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
79
|
-
NOT_FRAGMENT : new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
80
|
-
ESCAPE : new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
81
|
-
UNRESERVED : new RegExp(UNRESERVED$$, "g"),
|
82
|
-
OTHER_CHARS : new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
83
|
-
PCT_ENCODED : new RegExp(PCT_ENCODED$, "g"),
|
84
|
-
IPV4ADDRESS : new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
85
|
-
IPV6ADDRESS : new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
86
|
-
};
|
87
|
-
}
|
88
|
-
|
89
|
-
export default buildExps(false);
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
|
2
|
-
|
3
|
-
const handler:URISchemeHandler = {
|
4
|
-
scheme : "http",
|
5
|
-
|
6
|
-
domainHost : true,
|
7
|
-
|
8
|
-
parse : function (components:URIComponents, options:URIOptions):URIComponents {
|
9
|
-
//report missing host
|
10
|
-
if (!components.host) {
|
11
|
-
components.error = components.error || "HTTP URIs must have a host.";
|
12
|
-
}
|
13
|
-
|
14
|
-
return components;
|
15
|
-
},
|
16
|
-
|
17
|
-
serialize : function (components:URIComponents, options:URIOptions):URIComponents {
|
18
|
-
//normalize the default port
|
19
|
-
if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
|
20
|
-
components.port = undefined;
|
21
|
-
}
|
22
|
-
|
23
|
-
//normalize the empty path
|
24
|
-
if (!components.path) {
|
25
|
-
components.path = "/";
|
26
|
-
}
|
27
|
-
|
28
|
-
//NOTE: We do not parse query strings for HTTP URIs
|
29
|
-
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
30
|
-
//and not the HTTP spec.
|
31
|
-
|
32
|
-
return components;
|
33
|
-
}
|
34
|
-
};
|
35
|
-
|
36
|
-
export default handler;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
|
2
|
-
import http from "./http";
|
3
|
-
|
4
|
-
const handler:URISchemeHandler = {
|
5
|
-
scheme : "https",
|
6
|
-
domainHost : http.domainHost,
|
7
|
-
parse : http.parse,
|
8
|
-
serialize : http.serialize
|
9
|
-
}
|
10
|
-
|
11
|
-
export default handler;
|
@@ -1,182 +0,0 @@
|
|
1
|
-
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
|
2
|
-
import { pctEncChar, pctDecChars, unescapeComponent } from "../uri";
|
3
|
-
import punycode from "punycode";
|
4
|
-
import { merge, subexp, toUpperCase, toArray } from "../util";
|
5
|
-
|
6
|
-
export interface MailtoHeaders {
|
7
|
-
[hfname:string]:string
|
8
|
-
}
|
9
|
-
|
10
|
-
export interface MailtoComponents extends URIComponents {
|
11
|
-
to:Array<string>,
|
12
|
-
headers?:MailtoHeaders,
|
13
|
-
subject?:string,
|
14
|
-
body?:string
|
15
|
-
}
|
16
|
-
|
17
|
-
const O:MailtoHeaders = {};
|
18
|
-
const isIRI = true;
|
19
|
-
|
20
|
-
//RFC 3986
|
21
|
-
const UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";
|
22
|
-
const HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
|
23
|
-
const PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
|
24
|
-
|
25
|
-
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
|
26
|
-
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
|
27
|
-
//const WSP$$ = "[\\x20\\x09]";
|
28
|
-
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
|
29
|
-
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
|
30
|
-
//const VCHAR$$ = "[\\x21-\\x7E]";
|
31
|
-
//const WSP$$ = "[\\x20\\x09]";
|
32
|
-
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
|
33
|
-
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
|
34
|
-
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
|
35
|
-
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
|
36
|
-
const ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
|
37
|
-
const QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
|
38
|
-
const VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
|
39
|
-
const DOT_ATOM_TEXT$ = subexp(ATEXT$$ + "+" + subexp("\\." + ATEXT$$ + "+") + "*");
|
40
|
-
const QUOTED_PAIR$ = subexp("\\\\" + VCHAR$$);
|
41
|
-
const QCONTENT$ = subexp(QTEXT$$ + "|" + QUOTED_PAIR$);
|
42
|
-
const QUOTED_STRING$ = subexp('\\"' + QCONTENT$ + "*" + '\\"');
|
43
|
-
|
44
|
-
//RFC 6068
|
45
|
-
const DTEXT_NO_OBS$$ = "[\\x21-\\x5A\\x5E-\\x7E]"; //%d33-90 / %d94-126
|
46
|
-
const SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
|
47
|
-
const QCHAR$ = subexp(UNRESERVED$$ + "|" + PCT_ENCODED$ + "|" + SOME_DELIMS$$);
|
48
|
-
const DOMAIN$ = subexp(DOT_ATOM_TEXT$ + "|" + "\\[" + DTEXT_NO_OBS$$ + "*" + "\\]");
|
49
|
-
const LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + "|" + QUOTED_STRING$);
|
50
|
-
const ADDR_SPEC$ = subexp(LOCAL_PART$ + "\\@" + DOMAIN$);
|
51
|
-
const TO$ = subexp(ADDR_SPEC$ + subexp("\\," + ADDR_SPEC$) + "*");
|
52
|
-
const HFNAME$ = subexp(QCHAR$ + "*");
|
53
|
-
const HFVALUE$ = HFNAME$;
|
54
|
-
const HFIELD$ = subexp(HFNAME$ + "\\=" + HFVALUE$);
|
55
|
-
const HFIELDS2$ = subexp(HFIELD$ + subexp("\\&" + HFIELD$) + "*");
|
56
|
-
const HFIELDS$ = subexp("\\?" + HFIELDS2$);
|
57
|
-
const MAILTO_URI = new RegExp("^mailto\\:" + TO$ + "?" + HFIELDS$ + "?$");
|
58
|
-
|
59
|
-
const UNRESERVED = new RegExp(UNRESERVED$$, "g");
|
60
|
-
const PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
|
61
|
-
const NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
|
62
|
-
const NOT_DOMAIN = new RegExp(merge("[^]", ATEXT$$, "[\\.]", "[\\[]", DTEXT_NO_OBS$$, "[\\]]"), "g");
|
63
|
-
const NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
|
64
|
-
const NOT_HFVALUE = NOT_HFNAME;
|
65
|
-
const TO = new RegExp("^" + TO$ + "$");
|
66
|
-
const HFIELDS = new RegExp("^" + HFIELDS2$ + "$");
|
67
|
-
|
68
|
-
function decodeUnreserved(str:string):string {
|
69
|
-
const decStr = pctDecChars(str);
|
70
|
-
return (!decStr.match(UNRESERVED) ? str : decStr);
|
71
|
-
}
|
72
|
-
|
73
|
-
const handler:URISchemeHandler<MailtoComponents> = {
|
74
|
-
scheme : "mailto",
|
75
|
-
|
76
|
-
parse : function (components:URIComponents, options:URIOptions):MailtoComponents {
|
77
|
-
const mailtoComponents = components as MailtoComponents;
|
78
|
-
const to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(",") : []);
|
79
|
-
mailtoComponents.path = undefined;
|
80
|
-
|
81
|
-
if (mailtoComponents.query) {
|
82
|
-
let unknownHeaders = false
|
83
|
-
const headers:MailtoHeaders = {};
|
84
|
-
const hfields = mailtoComponents.query.split("&");
|
85
|
-
|
86
|
-
for (let x = 0, xl = hfields.length; x < xl; ++x) {
|
87
|
-
const hfield = hfields[x].split("=");
|
88
|
-
|
89
|
-
switch (hfield[0]) {
|
90
|
-
case "to":
|
91
|
-
const toAddrs = hfield[1].split(",");
|
92
|
-
for (let x = 0, xl = toAddrs.length; x < xl; ++x) {
|
93
|
-
to.push(toAddrs[x]);
|
94
|
-
}
|
95
|
-
break;
|
96
|
-
case "subject":
|
97
|
-
mailtoComponents.subject = unescapeComponent(hfield[1], options);
|
98
|
-
break;
|
99
|
-
case "body":
|
100
|
-
mailtoComponents.body = unescapeComponent(hfield[1], options);
|
101
|
-
break;
|
102
|
-
default:
|
103
|
-
unknownHeaders = true;
|
104
|
-
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
|
105
|
-
break;
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
if (unknownHeaders) mailtoComponents.headers = headers;
|
110
|
-
}
|
111
|
-
|
112
|
-
mailtoComponents.query = undefined;
|
113
|
-
|
114
|
-
for (let x = 0, xl = to.length; x < xl; ++x) {
|
115
|
-
const addr = to[x].split("@");
|
116
|
-
|
117
|
-
addr[0] = unescapeComponent(addr[0]);
|
118
|
-
|
119
|
-
if (!options.unicodeSupport) {
|
120
|
-
//convert Unicode IDN -> ASCII IDN
|
121
|
-
try {
|
122
|
-
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
|
123
|
-
} catch (e) {
|
124
|
-
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
|
125
|
-
}
|
126
|
-
} else {
|
127
|
-
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
|
128
|
-
}
|
129
|
-
|
130
|
-
to[x] = addr.join("@");
|
131
|
-
}
|
132
|
-
|
133
|
-
return mailtoComponents;
|
134
|
-
},
|
135
|
-
|
136
|
-
serialize : function (mailtoComponents:MailtoComponents, options:URIOptions):URIComponents {
|
137
|
-
const components = mailtoComponents as URIComponents;
|
138
|
-
const to = toArray(mailtoComponents.to);
|
139
|
-
if (to) {
|
140
|
-
for (let x = 0, xl = to.length; x < xl; ++x) {
|
141
|
-
const toAddr = String(to[x]);
|
142
|
-
const atIdx = toAddr.lastIndexOf("@");
|
143
|
-
const localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
|
144
|
-
let domain = toAddr.slice(atIdx + 1);
|
145
|
-
|
146
|
-
//convert IDN via punycode
|
147
|
-
try {
|
148
|
-
domain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain));
|
149
|
-
} catch (e) {
|
150
|
-
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
151
|
-
}
|
152
|
-
|
153
|
-
to[x] = localPart + "@" + domain;
|
154
|
-
}
|
155
|
-
|
156
|
-
components.path = to.join(",");
|
157
|
-
}
|
158
|
-
|
159
|
-
const headers = mailtoComponents.headers = mailtoComponents.headers || {};
|
160
|
-
|
161
|
-
if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
|
162
|
-
if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
|
163
|
-
|
164
|
-
const fields = [];
|
165
|
-
for (const name in headers) {
|
166
|
-
if (headers[name] !== O[name]) {
|
167
|
-
fields.push(
|
168
|
-
name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) +
|
169
|
-
"=" +
|
170
|
-
headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)
|
171
|
-
);
|
172
|
-
}
|
173
|
-
}
|
174
|
-
if (fields.length) {
|
175
|
-
components.query = fields.join("&");
|
176
|
-
}
|
177
|
-
|
178
|
-
return components;
|
179
|
-
}
|
180
|
-
}
|
181
|
-
|
182
|
-
export default handler;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
|
2
|
-
import { URNComponents } from "./urn";
|
3
|
-
import { SCHEMES } from "../uri";
|
4
|
-
|
5
|
-
export interface UUIDComponents extends URNComponents {
|
6
|
-
uuid?: string;
|
7
|
-
}
|
8
|
-
|
9
|
-
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
10
|
-
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
|
11
|
-
|
12
|
-
//RFC 4122
|
13
|
-
const handler:URISchemeHandler<UUIDComponents, URIOptions, URNComponents> = {
|
14
|
-
scheme : "urn:uuid",
|
15
|
-
|
16
|
-
parse : function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
|
17
|
-
const uuidComponents = urnComponents as UUIDComponents;
|
18
|
-
uuidComponents.uuid = uuidComponents.nss;
|
19
|
-
uuidComponents.nss = undefined;
|
20
|
-
|
21
|
-
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
22
|
-
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
23
|
-
}
|
24
|
-
|
25
|
-
return uuidComponents;
|
26
|
-
},
|
27
|
-
|
28
|
-
serialize : function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
|
29
|
-
const urnComponents = uuidComponents as URNComponents;
|
30
|
-
//normalize UUID
|
31
|
-
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
32
|
-
return urnComponents;
|
33
|
-
},
|
34
|
-
};
|
35
|
-
|
36
|
-
export default handler;
|