trusty-cms 4.1.4 → 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 +1 -1
- data/Gemfile.lock +68 -68
- data/README.md +1 -1
- data/app/assets/javascripts/admin/assets.js +1 -1
- data/lib/trusty_cms.rb +1 -1
- 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 +1 -1
- data/yarn.lock +3 -3
- metadata +7563 -69
@@ -0,0 +1,43 @@
|
|
1
|
+
import parseSeq from '../../schema/parseSeq';
|
2
|
+
import YAMLSeq from '../../schema/Seq';
|
3
|
+
|
4
|
+
function createSeq(schema, obj, ctx) {
|
5
|
+
var seq = new YAMLSeq(schema);
|
6
|
+
|
7
|
+
if (obj && obj[Symbol.iterator]) {
|
8
|
+
var _iteratorNormalCompletion = true;
|
9
|
+
var _didIteratorError = false;
|
10
|
+
var _iteratorError = undefined;
|
11
|
+
|
12
|
+
try {
|
13
|
+
for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
14
|
+
var it = _step.value;
|
15
|
+
var v = schema.createNode(it, ctx.wrapScalars, null, ctx);
|
16
|
+
seq.items.push(v);
|
17
|
+
}
|
18
|
+
} catch (err) {
|
19
|
+
_didIteratorError = true;
|
20
|
+
_iteratorError = err;
|
21
|
+
} finally {
|
22
|
+
try {
|
23
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
24
|
+
_iterator.return();
|
25
|
+
}
|
26
|
+
} finally {
|
27
|
+
if (_didIteratorError) {
|
28
|
+
throw _iteratorError;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
return seq;
|
35
|
+
}
|
36
|
+
|
37
|
+
export default {
|
38
|
+
createNode: createSeq,
|
39
|
+
default: true,
|
40
|
+
nodeClass: YAMLSeq,
|
41
|
+
tag: 'tag:yaml.org,2002:seq',
|
42
|
+
resolve: parseSeq
|
43
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { stringifyString } from '../../stringify';
|
2
|
+
import { strOptions } from '../options';
|
3
|
+
export var resolveString = function resolveString(doc, node) {
|
4
|
+
// on error, will return { str: string, errors: Error[] }
|
5
|
+
var res = node.strValue;
|
6
|
+
if (!res) return '';
|
7
|
+
if (typeof res === 'string') return res;
|
8
|
+
res.errors.forEach(function (error) {
|
9
|
+
if (!error.source) error.source = node;
|
10
|
+
doc.errors.push(error);
|
11
|
+
});
|
12
|
+
return res.str;
|
13
|
+
};
|
14
|
+
export default {
|
15
|
+
identify: function identify(value) {
|
16
|
+
return typeof value === 'string';
|
17
|
+
},
|
18
|
+
default: true,
|
19
|
+
tag: 'tag:yaml.org,2002:str',
|
20
|
+
resolve: resolveString,
|
21
|
+
stringify: function stringify(item, ctx, onComment, onChompKeep) {
|
22
|
+
ctx = Object.assign({
|
23
|
+
actualString: true
|
24
|
+
}, ctx);
|
25
|
+
return stringifyString(item, ctx, onComment, onChompKeep);
|
26
|
+
},
|
27
|
+
options: strOptions
|
28
|
+
};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import core, { nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj } from './core';
|
2
|
+
import failsafe from './failsafe';
|
3
|
+
import json from './json';
|
4
|
+
import yaml11 from './yaml-1.1';
|
5
|
+
import map from './failsafe/map';
|
6
|
+
import seq from './failsafe/seq';
|
7
|
+
import binary from './yaml-1.1/binary';
|
8
|
+
import omap from './yaml-1.1/omap';
|
9
|
+
import pairs from './yaml-1.1/pairs';
|
10
|
+
import set from './yaml-1.1/set';
|
11
|
+
import { floatTime, intTime, timestamp } from './yaml-1.1/timestamp';
|
12
|
+
export var schemas = {
|
13
|
+
core: core,
|
14
|
+
failsafe: failsafe,
|
15
|
+
json: json,
|
16
|
+
yaml11: yaml11
|
17
|
+
};
|
18
|
+
export var tags = {
|
19
|
+
binary: binary,
|
20
|
+
bool: boolObj,
|
21
|
+
float: floatObj,
|
22
|
+
floatExp: expObj,
|
23
|
+
floatNaN: nanObj,
|
24
|
+
floatTime: floatTime,
|
25
|
+
int: intObj,
|
26
|
+
intHex: hexObj,
|
27
|
+
intOct: octObj,
|
28
|
+
intTime: intTime,
|
29
|
+
map: map,
|
30
|
+
null: nullObj,
|
31
|
+
omap: omap,
|
32
|
+
pairs: pairs,
|
33
|
+
seq: seq,
|
34
|
+
set: set,
|
35
|
+
timestamp: timestamp
|
36
|
+
};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import map from './failsafe/map';
|
2
|
+
import seq from './failsafe/seq';
|
3
|
+
import Scalar from '../schema/Scalar';
|
4
|
+
import { resolveString } from './failsafe/string';
|
5
|
+
var schema = [map, seq, {
|
6
|
+
identify: function identify(value) {
|
7
|
+
return typeof value === 'string';
|
8
|
+
},
|
9
|
+
default: true,
|
10
|
+
tag: 'tag:yaml.org,2002:str',
|
11
|
+
resolve: resolveString,
|
12
|
+
stringify: function stringify(value) {
|
13
|
+
return JSON.stringify(value);
|
14
|
+
}
|
15
|
+
}, {
|
16
|
+
identify: function identify(value) {
|
17
|
+
return value == null;
|
18
|
+
},
|
19
|
+
createNode: function createNode(schema, value, ctx) {
|
20
|
+
return ctx.wrapScalars ? new Scalar(null) : null;
|
21
|
+
},
|
22
|
+
default: true,
|
23
|
+
tag: 'tag:yaml.org,2002:null',
|
24
|
+
test: /^null$/,
|
25
|
+
resolve: function resolve() {
|
26
|
+
return null;
|
27
|
+
},
|
28
|
+
stringify: function stringify(value) {
|
29
|
+
return JSON.stringify(value);
|
30
|
+
}
|
31
|
+
}, {
|
32
|
+
identify: function identify(value) {
|
33
|
+
return typeof value === 'boolean';
|
34
|
+
},
|
35
|
+
default: true,
|
36
|
+
tag: 'tag:yaml.org,2002:bool',
|
37
|
+
test: /^true|false$/,
|
38
|
+
resolve: function resolve(str) {
|
39
|
+
return str === 'true';
|
40
|
+
},
|
41
|
+
stringify: function stringify(value) {
|
42
|
+
return JSON.stringify(value);
|
43
|
+
}
|
44
|
+
}, {
|
45
|
+
identify: function identify(value) {
|
46
|
+
return typeof value === 'number';
|
47
|
+
},
|
48
|
+
default: true,
|
49
|
+
tag: 'tag:yaml.org,2002:int',
|
50
|
+
test: /^-?(?:0|[1-9][0-9]*)$/,
|
51
|
+
resolve: function resolve(str) {
|
52
|
+
return parseInt(str, 10);
|
53
|
+
},
|
54
|
+
stringify: function stringify(value) {
|
55
|
+
return JSON.stringify(value);
|
56
|
+
}
|
57
|
+
}, {
|
58
|
+
identify: function identify(value) {
|
59
|
+
return typeof value === 'number';
|
60
|
+
},
|
61
|
+
default: true,
|
62
|
+
tag: 'tag:yaml.org,2002:float',
|
63
|
+
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
64
|
+
resolve: function resolve(str) {
|
65
|
+
return parseFloat(str);
|
66
|
+
},
|
67
|
+
stringify: function stringify(value) {
|
68
|
+
return JSON.stringify(value);
|
69
|
+
}
|
70
|
+
}];
|
71
|
+
|
72
|
+
schema.scalarFallback = function (str) {
|
73
|
+
throw new SyntaxError("Unresolved plain scalar ".concat(JSON.stringify(str)));
|
74
|
+
};
|
75
|
+
|
76
|
+
export default schema;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { Type } from '../constants';
|
2
|
+
export var binaryOptions = {
|
3
|
+
defaultType: Type.BLOCK_LITERAL,
|
4
|
+
lineWidth: 76
|
5
|
+
};
|
6
|
+
export var boolOptions = {
|
7
|
+
trueStr: 'true',
|
8
|
+
falseStr: 'false'
|
9
|
+
};
|
10
|
+
export var nullOptions = {
|
11
|
+
nullStr: 'null'
|
12
|
+
};
|
13
|
+
export var strOptions = {
|
14
|
+
defaultType: Type.PLAIN,
|
15
|
+
doubleQuoted: {
|
16
|
+
jsonEncoding: false,
|
17
|
+
minMultiLineLength: 40
|
18
|
+
},
|
19
|
+
fold: {
|
20
|
+
lineWidth: 80,
|
21
|
+
minContentWidth: 20
|
22
|
+
}
|
23
|
+
};
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/* global atob, btoa, Buffer */
|
2
|
+
import { Type } from '../../constants';
|
3
|
+
import { YAMLReferenceError } from '../../errors';
|
4
|
+
import { stringifyString } from '../../stringify';
|
5
|
+
import { resolveString } from '../failsafe/string';
|
6
|
+
import { binaryOptions as options } from '../options';
|
7
|
+
export default {
|
8
|
+
identify: function identify(value) {
|
9
|
+
return value instanceof Uint8Array;
|
10
|
+
},
|
11
|
+
// Buffer inherits from Uint8Array
|
12
|
+
default: false,
|
13
|
+
tag: 'tag:yaml.org,2002:binary',
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Returns a Buffer in node and an Uint8Array in browsers
|
17
|
+
*
|
18
|
+
* To use the resulting buffer as an image, you'll want to do something like:
|
19
|
+
*
|
20
|
+
* const blob = new Blob([buffer], { type: 'image/jpeg' })
|
21
|
+
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
22
|
+
*/
|
23
|
+
resolve: function resolve(doc, node) {
|
24
|
+
var src = resolveString(doc, node);
|
25
|
+
|
26
|
+
if (typeof Buffer === 'function') {
|
27
|
+
return Buffer.from(src, 'base64');
|
28
|
+
} else if (typeof atob === 'function') {
|
29
|
+
// On IE 11, atob() can't handle newlines
|
30
|
+
var str = atob(src.replace(/[\n\r]/g, ''));
|
31
|
+
var buffer = new Uint8Array(str.length);
|
32
|
+
|
33
|
+
for (var i = 0; i < str.length; ++i) {
|
34
|
+
buffer[i] = str.charCodeAt(i);
|
35
|
+
}
|
36
|
+
|
37
|
+
return buffer;
|
38
|
+
} else {
|
39
|
+
var msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
|
40
|
+
doc.errors.push(new YAMLReferenceError(node, msg));
|
41
|
+
return null;
|
42
|
+
}
|
43
|
+
},
|
44
|
+
options: options,
|
45
|
+
stringify: function stringify(_ref, ctx, onComment, onChompKeep) {
|
46
|
+
var comment = _ref.comment,
|
47
|
+
type = _ref.type,
|
48
|
+
value = _ref.value;
|
49
|
+
var src;
|
50
|
+
|
51
|
+
if (typeof Buffer === 'function') {
|
52
|
+
src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
|
53
|
+
} else if (typeof btoa === 'function') {
|
54
|
+
var s = '';
|
55
|
+
|
56
|
+
for (var i = 0; i < value.length; ++i) {
|
57
|
+
s += String.fromCharCode(value[i]);
|
58
|
+
}
|
59
|
+
|
60
|
+
src = btoa(s);
|
61
|
+
} else {
|
62
|
+
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
63
|
+
}
|
64
|
+
|
65
|
+
if (!type) type = options.defaultType;
|
66
|
+
|
67
|
+
if (type === Type.QUOTE_DOUBLE) {
|
68
|
+
value = src;
|
69
|
+
} else {
|
70
|
+
var lineWidth = options.lineWidth;
|
71
|
+
var n = Math.ceil(src.length / lineWidth);
|
72
|
+
var lines = new Array(n);
|
73
|
+
|
74
|
+
for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) {
|
75
|
+
lines[_i] = src.substr(o, lineWidth);
|
76
|
+
}
|
77
|
+
|
78
|
+
value = lines.join(type === Type.BLOCK_LITERAL ? '\n' : ' ');
|
79
|
+
}
|
80
|
+
|
81
|
+
return stringifyString({
|
82
|
+
comment: comment,
|
83
|
+
type: type,
|
84
|
+
value: value
|
85
|
+
}, ctx, onComment, onChompKeep);
|
86
|
+
}
|
87
|
+
};
|
@@ -0,0 +1,157 @@
|
|
1
|
+
import Scalar from '../../schema/Scalar';
|
2
|
+
import { stringifyNumber } from '../../stringify';
|
3
|
+
import failsafe from '../failsafe';
|
4
|
+
import { boolOptions, nullOptions } from '../options';
|
5
|
+
import binary from './binary';
|
6
|
+
import omap from './omap';
|
7
|
+
import pairs from './pairs';
|
8
|
+
import set from './set';
|
9
|
+
import { intTime, floatTime, timestamp } from './timestamp';
|
10
|
+
|
11
|
+
var boolStringify = function boolStringify(_ref) {
|
12
|
+
var value = _ref.value;
|
13
|
+
return value ? boolOptions.trueStr : boolOptions.falseStr;
|
14
|
+
};
|
15
|
+
|
16
|
+
export default failsafe.concat([{
|
17
|
+
identify: function identify(value) {
|
18
|
+
return value == null;
|
19
|
+
},
|
20
|
+
createNode: function createNode(schema, value, ctx) {
|
21
|
+
return ctx.wrapScalars ? new Scalar(null) : null;
|
22
|
+
},
|
23
|
+
default: true,
|
24
|
+
tag: 'tag:yaml.org,2002:null',
|
25
|
+
test: /^(?:~|[Nn]ull|NULL)?$/,
|
26
|
+
resolve: function resolve() {
|
27
|
+
return null;
|
28
|
+
},
|
29
|
+
options: nullOptions,
|
30
|
+
stringify: function stringify() {
|
31
|
+
return nullOptions.nullStr;
|
32
|
+
}
|
33
|
+
}, {
|
34
|
+
identify: function identify(value) {
|
35
|
+
return typeof value === 'boolean';
|
36
|
+
},
|
37
|
+
default: true,
|
38
|
+
tag: 'tag:yaml.org,2002:bool',
|
39
|
+
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
40
|
+
resolve: function resolve() {
|
41
|
+
return true;
|
42
|
+
},
|
43
|
+
options: boolOptions,
|
44
|
+
stringify: boolStringify
|
45
|
+
}, {
|
46
|
+
identify: function identify(value) {
|
47
|
+
return typeof value === 'boolean';
|
48
|
+
},
|
49
|
+
default: true,
|
50
|
+
tag: 'tag:yaml.org,2002:bool',
|
51
|
+
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
52
|
+
resolve: function resolve() {
|
53
|
+
return false;
|
54
|
+
},
|
55
|
+
options: boolOptions,
|
56
|
+
stringify: boolStringify
|
57
|
+
}, {
|
58
|
+
identify: function identify(value) {
|
59
|
+
return typeof value === 'number';
|
60
|
+
},
|
61
|
+
default: true,
|
62
|
+
tag: 'tag:yaml.org,2002:int',
|
63
|
+
format: 'BIN',
|
64
|
+
test: /^0b([0-1_]+)$/,
|
65
|
+
resolve: function resolve(str, bin) {
|
66
|
+
return parseInt(bin.replace(/_/g, ''), 2);
|
67
|
+
},
|
68
|
+
stringify: function stringify(_ref2) {
|
69
|
+
var value = _ref2.value;
|
70
|
+
return '0b' + value.toString(2);
|
71
|
+
}
|
72
|
+
}, {
|
73
|
+
identify: function identify(value) {
|
74
|
+
return typeof value === 'number';
|
75
|
+
},
|
76
|
+
default: true,
|
77
|
+
tag: 'tag:yaml.org,2002:int',
|
78
|
+
format: 'OCT',
|
79
|
+
test: /^[-+]?0([0-7_]+)$/,
|
80
|
+
resolve: function resolve(str, oct) {
|
81
|
+
return parseInt(oct.replace(/_/g, ''), 8);
|
82
|
+
},
|
83
|
+
stringify: function stringify(_ref3) {
|
84
|
+
var value = _ref3.value;
|
85
|
+
return (value < 0 ? '-0' : '0') + value.toString(8);
|
86
|
+
}
|
87
|
+
}, {
|
88
|
+
identify: function identify(value) {
|
89
|
+
return typeof value === 'number';
|
90
|
+
},
|
91
|
+
default: true,
|
92
|
+
tag: 'tag:yaml.org,2002:int',
|
93
|
+
test: /^[-+]?[0-9][0-9_]*$/,
|
94
|
+
resolve: function resolve(str) {
|
95
|
+
return parseInt(str.replace(/_/g, ''), 10);
|
96
|
+
},
|
97
|
+
stringify: stringifyNumber
|
98
|
+
}, {
|
99
|
+
identify: function identify(value) {
|
100
|
+
return typeof value === 'number';
|
101
|
+
},
|
102
|
+
default: true,
|
103
|
+
tag: 'tag:yaml.org,2002:int',
|
104
|
+
format: 'HEX',
|
105
|
+
test: /^0x([0-9a-fA-F_]+)$/,
|
106
|
+
resolve: function resolve(str, hex) {
|
107
|
+
return parseInt(hex.replace(/_/g, ''), 16);
|
108
|
+
},
|
109
|
+
stringify: function stringify(_ref4) {
|
110
|
+
var value = _ref4.value;
|
111
|
+
return (value < 0 ? '-0x' : '0x') + value.toString(16);
|
112
|
+
}
|
113
|
+
}, {
|
114
|
+
identify: function identify(value) {
|
115
|
+
return typeof value === 'number';
|
116
|
+
},
|
117
|
+
default: true,
|
118
|
+
tag: 'tag:yaml.org,2002:float',
|
119
|
+
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
120
|
+
resolve: function resolve(str, nan) {
|
121
|
+
return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
|
122
|
+
},
|
123
|
+
stringify: stringifyNumber
|
124
|
+
}, {
|
125
|
+
identify: function identify(value) {
|
126
|
+
return typeof value === 'number';
|
127
|
+
},
|
128
|
+
default: true,
|
129
|
+
tag: 'tag:yaml.org,2002:float',
|
130
|
+
format: 'EXP',
|
131
|
+
test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
132
|
+
resolve: function resolve(str) {
|
133
|
+
return parseFloat(str.replace(/_/g, ''));
|
134
|
+
},
|
135
|
+
stringify: function stringify(_ref5) {
|
136
|
+
var value = _ref5.value;
|
137
|
+
return Number(value).toExponential();
|
138
|
+
}
|
139
|
+
}, {
|
140
|
+
identify: function identify(value) {
|
141
|
+
return typeof value === 'number';
|
142
|
+
},
|
143
|
+
default: true,
|
144
|
+
tag: 'tag:yaml.org,2002:float',
|
145
|
+
test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
|
146
|
+
resolve: function resolve(str, frac) {
|
147
|
+
var node = new Scalar(parseFloat(str.replace(/_/g, '')));
|
148
|
+
|
149
|
+
if (frac) {
|
150
|
+
var f = frac.replace(/_/g, '');
|
151
|
+
if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
|
152
|
+
}
|
153
|
+
|
154
|
+
return node;
|
155
|
+
},
|
156
|
+
stringify: stringifyNumber
|
157
|
+
}], binary, omap, pairs, set, intTime, floatTime, timestamp);
|