trusty-cms 4.1.0 → 4.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +98 -98
- data/README.md +1 -1
- data/Rakefile +7 -7
- data/app/assets/javascripts/admin/assets.js +1 -1
- data/app/assets/javascripts/rad_social/rad_ajax_form.js +3 -0
- data/app/assets/javascripts/rad_social/rad_email.js +0 -1
- data/app/assets/javascripts/rad_social/rad_email_form.js +2 -7
- data/app/assets/stylesheets/admin/partials/_forms.scss +1 -1
- data/app/assets/stylesheets/admin/partials/_messages.scss +7 -2
- data/app/assets/stylesheets/admin/partials/_popup.scss +1 -1
- data/app/assets/stylesheets/rad_social/rad_screen.scss +0 -4
- data/app/controllers/admin/assets_controller.rb +21 -31
- data/app/controllers/admin/configuration_controller.rb +9 -11
- data/app/controllers/admin/extensions_controller.rb +3 -3
- data/app/controllers/admin/layouts_controller.rb +3 -4
- data/app/controllers/admin/page_attachments_controller.rb +5 -5
- data/app/controllers/admin/page_fields_controller.rb +3 -4
- data/app/controllers/admin/page_parts_controller.rb +4 -5
- data/app/controllers/admin/pages_controller.rb +55 -56
- data/app/controllers/admin/references_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +132 -130
- data/app/controllers/admin/sites_controller.rb +4 -4
- data/app/controllers/admin/snippets_controller.rb +3 -4
- data/app/controllers/admin/users_controller.rb +16 -16
- data/app/controllers/application_controller.rb +47 -48
- data/app/controllers/site_controller.rb +51 -48
- data/app/controllers/social_mailer_controller.rb +12 -22
- data/app/helpers/admin/configuration_helper.rb +19 -20
- data/app/helpers/admin/layouts_helper.rb +0 -1
- data/app/helpers/admin/node_helper.rb +27 -24
- data/app/helpers/admin/pages_helper.rb +2 -2
- data/app/helpers/admin/preferences_helper.rb +0 -1
- data/app/helpers/admin/references_helper.rb +9 -10
- data/app/helpers/admin/regions_helper.rb +3 -3
- data/app/helpers/application_helper.rb +32 -33
- data/app/helpers/rad_social_helper.rb +8 -11
- data/app/helpers/scoped_helper.rb +1 -3
- data/app/helpers/sites_helper.rb +4 -4
- data/app/mailers/devise_mailer.rb +3 -4
- data/app/mailers/rad_social_mailer.rb +8 -8
- data/app/models/asset.rb +62 -63
- data/app/models/asset_type.rb +38 -39
- data/app/models/deprecated_tags.rb +3 -4
- data/app/models/file_not_found_page.rb +1 -3
- data/app/models/haml_filter.rb +1 -1
- data/app/models/layout.rb +4 -5
- data/app/models/legacy_user.rb +2 -2
- data/app/models/menu_renderer.rb +16 -18
- data/app/models/page.rb +96 -93
- data/app/models/page_attachment.rb +1 -2
- data/app/models/page_context.rb +11 -12
- data/app/models/page_part.rb +3 -4
- data/app/models/rails_page.rb +10 -12
- data/app/models/site.rb +22 -21
- data/app/models/snippet.rb +6 -8
- data/app/models/snippet_finder.rb +3 -3
- data/app/models/snippet_tags.rb +4 -4
- data/app/models/standard_tags.rb +258 -252
- data/app/models/status.rb +8 -8
- data/app/models/trusty_cms/config.rb +25 -25
- data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
- data/app/models/user.rb +15 -14
- data/app/models/user_action_observer.rb +3 -3
- data/app/views/admin/assets/edit.html.haml +0 -9
- data/app/views/admin/assets/new.html.haml +0 -3
- data/app/views/admin/assets/remove.html.haml +1 -1
- data/app/views/admin/layouts/remove.html.haml +4 -3
- data/app/views/admin/page_parts/_page_part.html.haml +1 -1
- data/app/views/admin/pages/remove.html.haml +2 -1
- data/app/views/admin/sites/index.haml +3 -1
- data/app/views/admin/snippets/remove.html.haml +5 -4
- data/app/views/admin/users/remove.html.haml +2 -2
- data/app/views/rad_social_mailer/social_mail_form.html.haml +1 -3
- data/app/views/widget/_email_form.html.haml +0 -5
- data/bin/rails +4 -4
- data/bin/trusty_cms +3 -5
- data/config.ru +1 -1
- data/config/application.rb +14 -15
- data/config/boot.rb +1 -2
- data/config/environment.rb +1 -1
- data/config/environments/production.rb +0 -1
- data/config/environments/test.rb +1 -2
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/kraken.rb +2 -2
- data/config/initializers/tmp.rb +1 -1
- data/config/initializers/trusty_cms_config.rb +48 -48
- data/config/locales/en.yml +8 -8
- data/config/routes.rb +6 -7
- data/lib/active_record_extensions/active_record_extensions.rb +1 -2
- data/lib/annotatable.rb +3 -5
- data/lib/configuration_extensions/configuration_extensions.rb +1 -1
- data/lib/inheritable_class_attributes.rb +13 -9
- data/lib/login_system.rb +73 -73
- data/lib/method_observer.rb +13 -12
- data/lib/ostruct.rb +7 -10
- data/lib/simpleton.rb +0 -4
- data/lib/string_extensions/string_extensions.rb +3 -3
- data/lib/symbol_extensions/symbol_extensions.rb +1 -1
- data/lib/tasks/database.rake +28 -28
- data/lib/tasks/extensions.rake +18 -18
- data/lib/tasks/framework.rake +68 -68
- data/lib/tasks/radiant_config.rake +4 -4
- data/lib/tasks/snippets_extension_tasks.rake +11 -11
- data/lib/tasks/translate.rake +14 -14
- data/lib/tasks/upgrade_to_devise.rake +1 -1
- data/lib/translation_support.rb +22 -22
- data/lib/trusty_cms.rb +2 -2
- data/lib/trusty_cms/admin_ui.rb +19 -16
- data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
- data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
- data/lib/trusty_cms/available_locales.rb +2 -4
- data/lib/trusty_cms/config/definition.rb +11 -8
- data/lib/trusty_cms/engine.rb +13 -14
- data/lib/trusty_cms/extension.rb +14 -16
- data/lib/trusty_cms/extension_loader.rb +6 -6
- data/lib/trusty_cms/extension_migrator.rb +42 -41
- data/lib/trusty_cms/extension_path.rb +20 -19
- data/lib/trusty_cms/initializer.rb +5 -8
- data/lib/trusty_cms/pagination/controller.rb +7 -10
- data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
- data/lib/trusty_cms/resource_responses.rb +3 -3
- data/lib/trusty_cms/setup.rb +130 -132
- data/lib/trusty_cms/taggable.rb +19 -22
- data/lib/trusty_cms/task_support.rb +9 -6
- data/package.json +1 -1
- data/public/dispatch.fcgi +1 -1
- data/public/dispatch.rb +2 -2
- data/script/extension +1 -1
- data/script/rails +2 -2
- data/spec/dummy/package.json +1 -1
- data/spec/dummy/yarn.lock +3 -3
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +126 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +4 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +56 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +43 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +28 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +36 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +76 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +23 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +87 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +157 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +142 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +81 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +17 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +37 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +34 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +40 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +62 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +60 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +35 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +131 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +105 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +80 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +91 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +93 -0
- data/trusty_cms.gemspec +25 -25
- data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +1 -1
- data/yarn.lock +7 -7
- metadata +7609 -105
- data/app/assets/javascripts/rad_social/captcha.js +0 -42
- data/app/views/admin/assets/refresh.html.haml +0 -14
@@ -0,0 +1,81 @@
|
|
1
|
+
import { YAMLSemanticError } from '../../errors';
|
2
|
+
import YAMLMap from '../../schema/Map';
|
3
|
+
import Pair from '../../schema/Pair';
|
4
|
+
import parseSeq from '../../schema/parseSeq';
|
5
|
+
import YAMLSeq from '../../schema/Seq';
|
6
|
+
export function parsePairs(doc, cst) {
|
7
|
+
var seq = parseSeq(doc, cst);
|
8
|
+
|
9
|
+
for (var i = 0; i < seq.items.length; ++i) {
|
10
|
+
var item = seq.items[i];
|
11
|
+
if (item instanceof Pair) continue;else if (item instanceof YAMLMap) {
|
12
|
+
if (item.items.length > 1) {
|
13
|
+
var msg = 'Each pair must have its own sequence indicator';
|
14
|
+
throw new YAMLSemanticError(cst, msg);
|
15
|
+
}
|
16
|
+
|
17
|
+
var pair = item.items[0] || new Pair();
|
18
|
+
if (item.commentBefore) pair.commentBefore = pair.commentBefore ? "".concat(item.commentBefore, "\n").concat(pair.commentBefore) : item.commentBefore;
|
19
|
+
if (item.comment) pair.comment = pair.comment ? "".concat(item.comment, "\n").concat(pair.comment) : item.comment;
|
20
|
+
item = pair;
|
21
|
+
}
|
22
|
+
seq.items[i] = item instanceof Pair ? item : new Pair(item);
|
23
|
+
}
|
24
|
+
|
25
|
+
return seq;
|
26
|
+
}
|
27
|
+
export function createPairs(schema, iterable, ctx) {
|
28
|
+
var pairs = new YAMLSeq(schema);
|
29
|
+
pairs.tag = 'tag:yaml.org,2002:pairs';
|
30
|
+
var _iteratorNormalCompletion = true;
|
31
|
+
var _didIteratorError = false;
|
32
|
+
var _iteratorError = undefined;
|
33
|
+
|
34
|
+
try {
|
35
|
+
for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
36
|
+
var it = _step.value;
|
37
|
+
var key = void 0,
|
38
|
+
value = void 0;
|
39
|
+
|
40
|
+
if (Array.isArray(it)) {
|
41
|
+
if (it.length === 2) {
|
42
|
+
key = it[0];
|
43
|
+
value = it[1];
|
44
|
+
} else throw new TypeError("Expected [key, value] tuple: ".concat(it));
|
45
|
+
} else if (it && it instanceof Object) {
|
46
|
+
var keys = Object.keys(it);
|
47
|
+
|
48
|
+
if (keys.length === 1) {
|
49
|
+
key = keys[0];
|
50
|
+
value = it[key];
|
51
|
+
} else throw new TypeError("Expected { key: value } tuple: ".concat(it));
|
52
|
+
} else {
|
53
|
+
key = it;
|
54
|
+
}
|
55
|
+
|
56
|
+
var pair = schema.createPair(key, value, ctx);
|
57
|
+
pairs.items.push(pair);
|
58
|
+
}
|
59
|
+
} catch (err) {
|
60
|
+
_didIteratorError = true;
|
61
|
+
_iteratorError = err;
|
62
|
+
} finally {
|
63
|
+
try {
|
64
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
65
|
+
_iterator.return();
|
66
|
+
}
|
67
|
+
} finally {
|
68
|
+
if (_didIteratorError) {
|
69
|
+
throw _iteratorError;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
return pairs;
|
75
|
+
}
|
76
|
+
export default {
|
77
|
+
default: false,
|
78
|
+
tag: 'tag:yaml.org,2002:pairs',
|
79
|
+
resolve: parsePairs,
|
80
|
+
createNode: createPairs
|
81
|
+
};
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
6
|
+
import _get from "@babel/runtime/helpers/get";
|
7
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
9
|
+
import { YAMLSemanticError } from '../../errors';
|
10
|
+
import YAMLMap, { findPair } from '../../schema/Map';
|
11
|
+
import Pair from '../../schema/Pair';
|
12
|
+
import parseMap from '../../schema/parseMap';
|
13
|
+
import Scalar from '../../schema/Scalar';
|
14
|
+
export var YAMLSet = /*#__PURE__*/function (_YAMLMap) {
|
15
|
+
_inherits(YAMLSet, _YAMLMap);
|
16
|
+
|
17
|
+
function YAMLSet() {
|
18
|
+
var _this;
|
19
|
+
|
20
|
+
_classCallCheck(this, YAMLSet);
|
21
|
+
|
22
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(YAMLSet).call(this));
|
23
|
+
_this.tag = YAMLSet.tag;
|
24
|
+
return _this;
|
25
|
+
}
|
26
|
+
|
27
|
+
_createClass(YAMLSet, [{
|
28
|
+
key: "add",
|
29
|
+
value: function add(key) {
|
30
|
+
var pair = key instanceof Pair ? key : new Pair(key);
|
31
|
+
var prev = findPair(this.items, pair.key);
|
32
|
+
if (!prev) this.items.push(pair);
|
33
|
+
}
|
34
|
+
}, {
|
35
|
+
key: "get",
|
36
|
+
value: function get(key, keepPair) {
|
37
|
+
var pair = findPair(this.items, key);
|
38
|
+
return !keepPair && pair instanceof Pair ? pair.key instanceof Scalar ? pair.key.value : pair.key : pair;
|
39
|
+
}
|
40
|
+
}, {
|
41
|
+
key: "set",
|
42
|
+
value: function set(key, value) {
|
43
|
+
if (typeof value !== 'boolean') throw new Error("Expected boolean value for set(key, value) in a YAML set, not ".concat(_typeof(value)));
|
44
|
+
var prev = findPair(this.items, key);
|
45
|
+
|
46
|
+
if (prev && !value) {
|
47
|
+
this.items.splice(this.items.indexOf(prev), 1);
|
48
|
+
} else if (!prev && value) {
|
49
|
+
this.items.push(new Pair(key));
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}, {
|
53
|
+
key: "toJSON",
|
54
|
+
value: function toJSON(_, ctx) {
|
55
|
+
return _get(_getPrototypeOf(YAMLSet.prototype), "toJSON", this).call(this, _, ctx, Set);
|
56
|
+
}
|
57
|
+
}, {
|
58
|
+
key: "toString",
|
59
|
+
value: function toString(ctx, onComment, onChompKeep) {
|
60
|
+
if (!ctx) return JSON.stringify(this);
|
61
|
+
if (this.hasAllNullValues()) return _get(_getPrototypeOf(YAMLSet.prototype), "toString", this).call(this, ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
|
62
|
+
}
|
63
|
+
}]);
|
64
|
+
|
65
|
+
return YAMLSet;
|
66
|
+
}(YAMLMap);
|
67
|
+
|
68
|
+
_defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
|
69
|
+
|
70
|
+
function parseSet(doc, cst) {
|
71
|
+
var map = parseMap(doc, cst);
|
72
|
+
if (!map.hasAllNullValues()) throw new YAMLSemanticError(cst, 'Set items must all have null values');
|
73
|
+
return Object.assign(new YAMLSet(), map);
|
74
|
+
}
|
75
|
+
|
76
|
+
function createSet(schema, iterable, ctx) {
|
77
|
+
var set = new YAMLSet();
|
78
|
+
var _iteratorNormalCompletion = true;
|
79
|
+
var _didIteratorError = false;
|
80
|
+
var _iteratorError = undefined;
|
81
|
+
|
82
|
+
try {
|
83
|
+
for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
84
|
+
var value = _step.value;
|
85
|
+
set.items.push(schema.createPair(value, null, ctx));
|
86
|
+
}
|
87
|
+
} catch (err) {
|
88
|
+
_didIteratorError = true;
|
89
|
+
_iteratorError = err;
|
90
|
+
} finally {
|
91
|
+
try {
|
92
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
93
|
+
_iterator.return();
|
94
|
+
}
|
95
|
+
} finally {
|
96
|
+
if (_didIteratorError) {
|
97
|
+
throw _iteratorError;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
return set;
|
103
|
+
}
|
104
|
+
|
105
|
+
export default {
|
106
|
+
identify: function identify(value) {
|
107
|
+
return value instanceof Set;
|
108
|
+
},
|
109
|
+
nodeClass: YAMLSet,
|
110
|
+
default: false,
|
111
|
+
tag: 'tag:yaml.org,2002:set',
|
112
|
+
resolve: parseSet,
|
113
|
+
createNode: createSet
|
114
|
+
};
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import { stringifyNumber } from '../../stringify';
|
2
|
+
|
3
|
+
var parseSexagesimal = function parseSexagesimal(sign, parts) {
|
4
|
+
var n = parts.split(':').reduce(function (n, p) {
|
5
|
+
return n * 60 + Number(p);
|
6
|
+
}, 0);
|
7
|
+
return sign === '-' ? -n : n;
|
8
|
+
}; // hhhh:mm:ss.sss
|
9
|
+
|
10
|
+
|
11
|
+
var stringifySexagesimal = function stringifySexagesimal(_ref) {
|
12
|
+
var value = _ref.value;
|
13
|
+
if (isNaN(value) || !isFinite(value)) return stringifyNumber(value);
|
14
|
+
var sign = '';
|
15
|
+
|
16
|
+
if (value < 0) {
|
17
|
+
sign = '-';
|
18
|
+
value = Math.abs(value);
|
19
|
+
}
|
20
|
+
|
21
|
+
var parts = [value % 60]; // seconds, including ms
|
22
|
+
|
23
|
+
if (value < 60) {
|
24
|
+
parts.unshift(0); // at least one : is required
|
25
|
+
} else {
|
26
|
+
value = Math.round((value - parts[0]) / 60);
|
27
|
+
parts.unshift(value % 60); // minutes
|
28
|
+
|
29
|
+
if (value >= 60) {
|
30
|
+
value = Math.round((value - parts[0]) / 60);
|
31
|
+
parts.unshift(value); // hours
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
return sign + parts.map(function (n) {
|
36
|
+
return n < 10 ? '0' + String(n) : String(n);
|
37
|
+
}).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
|
38
|
+
;
|
39
|
+
};
|
40
|
+
|
41
|
+
export var intTime = {
|
42
|
+
identify: function identify(value) {
|
43
|
+
return typeof value === 'number';
|
44
|
+
},
|
45
|
+
default: true,
|
46
|
+
tag: 'tag:yaml.org,2002:int',
|
47
|
+
format: 'TIME',
|
48
|
+
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
|
49
|
+
resolve: function resolve(str, sign, parts) {
|
50
|
+
return parseSexagesimal(sign, parts.replace(/_/g, ''));
|
51
|
+
},
|
52
|
+
stringify: stringifySexagesimal
|
53
|
+
};
|
54
|
+
export var floatTime = {
|
55
|
+
identify: function identify(value) {
|
56
|
+
return typeof value === 'number';
|
57
|
+
},
|
58
|
+
default: true,
|
59
|
+
tag: 'tag:yaml.org,2002:float',
|
60
|
+
format: 'TIME',
|
61
|
+
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
|
62
|
+
resolve: function resolve(str, sign, parts) {
|
63
|
+
return parseSexagesimal(sign, parts.replace(/_/g, ''));
|
64
|
+
},
|
65
|
+
stringify: stringifySexagesimal
|
66
|
+
};
|
67
|
+
export var timestamp = {
|
68
|
+
identify: function identify(value) {
|
69
|
+
return value instanceof Date;
|
70
|
+
},
|
71
|
+
default: true,
|
72
|
+
tag: 'tag:yaml.org,2002:timestamp',
|
73
|
+
// If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
|
74
|
+
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
75
|
+
// assumed to be 00:00:00Z (start of day, UTC).
|
76
|
+
test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
|
77
|
+
'(?:(?:t|T|[ \\t]+)' + // t | T | whitespace
|
78
|
+
'([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
|
79
|
+
'(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
|
80
|
+
')?' + ')$'),
|
81
|
+
resolve: function resolve(str, year, month, day, hour, minute, second, millisec, tz) {
|
82
|
+
if (millisec) millisec = (millisec + '00').substr(1, 3);
|
83
|
+
var date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
|
84
|
+
|
85
|
+
if (tz && tz !== 'Z') {
|
86
|
+
var d = parseSexagesimal(tz[0], tz.slice(1));
|
87
|
+
if (Math.abs(d) < 30) d *= 60;
|
88
|
+
date -= 60000 * d;
|
89
|
+
}
|
90
|
+
|
91
|
+
return new Date(date);
|
92
|
+
},
|
93
|
+
stringify: function stringify(_ref2) {
|
94
|
+
var value = _ref2.value;
|
95
|
+
return value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '');
|
96
|
+
}
|
97
|
+
};
|
@@ -0,0 +1,114 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = exports.floatObj = exports.expObj = exports.nanObj = exports.hexObj = exports.intObj = exports.octObj = exports.boolObj = exports.nullObj = void 0;
|
7
|
+
|
8
|
+
var _Scalar = _interopRequireDefault(require("../schema/Scalar"));
|
9
|
+
|
10
|
+
var _stringify = require("../stringify");
|
11
|
+
|
12
|
+
var _failsafe = _interopRequireDefault(require("./failsafe"));
|
13
|
+
|
14
|
+
var _options = require("./options");
|
15
|
+
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
+
|
18
|
+
const nullObj = {
|
19
|
+
identify: value => value == null,
|
20
|
+
createNode: (schema, value, ctx) => ctx.wrapScalars ? new _Scalar.default(null) : null,
|
21
|
+
default: true,
|
22
|
+
tag: 'tag:yaml.org,2002:null',
|
23
|
+
test: /^(?:~|[Nn]ull|NULL)?$/,
|
24
|
+
resolve: () => null,
|
25
|
+
options: _options.nullOptions,
|
26
|
+
stringify: () => _options.nullOptions.nullStr
|
27
|
+
};
|
28
|
+
exports.nullObj = nullObj;
|
29
|
+
const boolObj = {
|
30
|
+
identify: value => typeof value === 'boolean',
|
31
|
+
default: true,
|
32
|
+
tag: 'tag:yaml.org,2002:bool',
|
33
|
+
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
34
|
+
resolve: str => str[0] === 't' || str[0] === 'T',
|
35
|
+
options: _options.boolOptions,
|
36
|
+
stringify: ({
|
37
|
+
value
|
38
|
+
}) => value ? _options.boolOptions.trueStr : _options.boolOptions.falseStr
|
39
|
+
};
|
40
|
+
exports.boolObj = boolObj;
|
41
|
+
const octObj = {
|
42
|
+
identify: value => typeof value === 'number',
|
43
|
+
default: true,
|
44
|
+
tag: 'tag:yaml.org,2002:int',
|
45
|
+
format: 'OCT',
|
46
|
+
test: /^0o([0-7]+)$/,
|
47
|
+
resolve: (str, oct) => parseInt(oct, 8),
|
48
|
+
stringify: ({
|
49
|
+
value
|
50
|
+
}) => '0o' + value.toString(8)
|
51
|
+
};
|
52
|
+
exports.octObj = octObj;
|
53
|
+
const intObj = {
|
54
|
+
identify: value => typeof value === 'number',
|
55
|
+
default: true,
|
56
|
+
tag: 'tag:yaml.org,2002:int',
|
57
|
+
test: /^[-+]?[0-9]+$/,
|
58
|
+
resolve: str => parseInt(str, 10),
|
59
|
+
stringify: _stringify.stringifyNumber
|
60
|
+
};
|
61
|
+
exports.intObj = intObj;
|
62
|
+
const hexObj = {
|
63
|
+
identify: value => typeof value === 'number',
|
64
|
+
default: true,
|
65
|
+
tag: 'tag:yaml.org,2002:int',
|
66
|
+
format: 'HEX',
|
67
|
+
test: /^0x([0-9a-fA-F]+)$/,
|
68
|
+
resolve: (str, hex) => parseInt(hex, 16),
|
69
|
+
stringify: ({
|
70
|
+
value
|
71
|
+
}) => '0x' + value.toString(16)
|
72
|
+
};
|
73
|
+
exports.hexObj = hexObj;
|
74
|
+
const nanObj = {
|
75
|
+
identify: value => typeof value === 'number',
|
76
|
+
default: true,
|
77
|
+
tag: 'tag:yaml.org,2002:float',
|
78
|
+
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
79
|
+
resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
80
|
+
stringify: _stringify.stringifyNumber
|
81
|
+
};
|
82
|
+
exports.nanObj = nanObj;
|
83
|
+
const expObj = {
|
84
|
+
identify: value => typeof value === 'number',
|
85
|
+
default: true,
|
86
|
+
tag: 'tag:yaml.org,2002:float',
|
87
|
+
format: 'EXP',
|
88
|
+
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
89
|
+
resolve: str => parseFloat(str),
|
90
|
+
stringify: ({
|
91
|
+
value
|
92
|
+
}) => Number(value).toExponential()
|
93
|
+
};
|
94
|
+
exports.expObj = expObj;
|
95
|
+
const floatObj = {
|
96
|
+
identify: value => typeof value === 'number',
|
97
|
+
default: true,
|
98
|
+
tag: 'tag:yaml.org,2002:float',
|
99
|
+
test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
|
100
|
+
|
101
|
+
resolve(str, frac1, frac2) {
|
102
|
+
const frac = frac1 || frac2;
|
103
|
+
const node = new _Scalar.default(parseFloat(str));
|
104
|
+
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
|
105
|
+
return node;
|
106
|
+
},
|
107
|
+
|
108
|
+
stringify: _stringify.stringifyNumber
|
109
|
+
};
|
110
|
+
exports.floatObj = floatObj;
|
111
|
+
|
112
|
+
var _default = _failsafe.default.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
|
113
|
+
|
114
|
+
exports.default = _default;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _map = _interopRequireDefault(require("./map"));
|
9
|
+
|
10
|
+
var _seq = _interopRequireDefault(require("./seq"));
|
11
|
+
|
12
|
+
var _string = _interopRequireDefault(require("./string"));
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
var _default = [_map.default, _seq.default, _string.default];
|
17
|
+
exports.default = _default;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _Map = _interopRequireDefault(require("../../schema/Map"));
|
9
|
+
|
10
|
+
var _parseMap = _interopRequireDefault(require("../../schema/parseMap"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function createMap(schema, obj, ctx) {
|
15
|
+
const map = new _Map.default(schema);
|
16
|
+
|
17
|
+
if (obj instanceof Map) {
|
18
|
+
for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx));
|
19
|
+
} else if (obj && typeof obj === 'object') {
|
20
|
+
for (const key of Object.keys(obj)) map.items.push(schema.createPair(key, obj[key], ctx));
|
21
|
+
}
|
22
|
+
|
23
|
+
if (typeof schema.sortMapEntries === 'function') {
|
24
|
+
map.items.sort(schema.sortMapEntries);
|
25
|
+
}
|
26
|
+
|
27
|
+
return map;
|
28
|
+
}
|
29
|
+
|
30
|
+
var _default = {
|
31
|
+
createNode: createMap,
|
32
|
+
default: true,
|
33
|
+
nodeClass: _Map.default,
|
34
|
+
tag: 'tag:yaml.org,2002:map',
|
35
|
+
resolve: _parseMap.default
|
36
|
+
};
|
37
|
+
exports.default = _default;
|