@suveren/gateway 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/integrations/gmail.json +13 -2
- package/content/integrations/mail.json +12 -2
- package/content/integrations/mollie.json +10 -0
- package/dist/control-plane/index.mjs +24 -6
- package/dist/mcp-server/http.mjs +656 -388
- package/dist/ui/assets/{index-C3vTF2Ye.js → index-wtX8LuiU.js} +10 -10
- package/dist/ui/index.html +1 -1
- package/node_modules/sanitize-html/index.js +47 -10
- package/node_modules/sanitize-html/package.json +2 -3
- package/package.json +1 -1
- package/node_modules/deepmerge/.editorconfig +0 -7
- package/node_modules/deepmerge/.eslintcache +0 -1
- package/node_modules/deepmerge/changelog.md +0 -167
- package/node_modules/deepmerge/dist/cjs.js +0 -133
- package/node_modules/deepmerge/dist/umd.js +0 -139
- package/node_modules/deepmerge/index.d.ts +0 -20
- package/node_modules/deepmerge/index.js +0 -106
- package/node_modules/deepmerge/license.txt +0 -21
- package/node_modules/deepmerge/package.json +0 -42
- package/node_modules/deepmerge/readme.md +0 -264
- package/node_modules/deepmerge/rollup.config.js +0 -22
package/dist/ui/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<meta name="apple-mobile-web-app-title" content="Suveren" />
|
|
15
15
|
<meta name="theme-color" content="#111111" />
|
|
16
16
|
<title>Suveren</title>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-wtX8LuiU.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-DUIlMVlP.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const htmlparser = require('htmlparser2');
|
|
2
2
|
const escapeStringRegexp = require('escape-string-regexp');
|
|
3
3
|
const { isPlainObject } = require('is-plain-object');
|
|
4
|
-
const deepmerge = require('deepmerge');
|
|
5
4
|
const parseSrcset = require('parse-srcset');
|
|
6
5
|
const { parse: postcssParse } = require('postcss');
|
|
7
6
|
const { naughtyHref: launderNaughtyHref } = require('launder');
|
|
@@ -53,6 +52,29 @@ function has(obj, key) {
|
|
|
53
52
|
return ({}).hasOwnProperty.call(obj, key);
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
// Combine the tag-specific and wildcard lists of allowed classes
|
|
56
|
+
function mergeClasses(specific, wildcard) {
|
|
57
|
+
if (!Array.isArray(specific) || !Array.isArray(wildcard)) {
|
|
58
|
+
return wildcard;
|
|
59
|
+
}
|
|
60
|
+
return specific.concat(wildcard);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Combine the tag-specific and wildcard allowed styles, concatenating the
|
|
64
|
+
// lists of regular expressions for properties that appear in both. The result
|
|
65
|
+
// has no prototype, so a property named `__proto__` is just another property
|
|
66
|
+
function mergeStyles(specific, wildcard) {
|
|
67
|
+
const merged = Object.create(null);
|
|
68
|
+
for (const rules of [ specific, wildcard ]) {
|
|
69
|
+
for (const prop of Object.keys(rules)) {
|
|
70
|
+
merged[prop] = has(merged, prop)
|
|
71
|
+
? merged[prop].concat(rules[prop])
|
|
72
|
+
: rules[prop];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return merged;
|
|
76
|
+
}
|
|
77
|
+
|
|
56
78
|
// Returns those elements of `a` for which `cb(a)` returns truthy
|
|
57
79
|
function filter(a, cb) {
|
|
58
80
|
const n = [];
|
|
@@ -103,14 +125,23 @@ module.exports = sanitizeHtml;
|
|
|
103
125
|
// attribute name state with an empty attribute name buffer.
|
|
104
126
|
const VALID_HTML_ATTRIBUTE_NAME = /^[^\0\t\n\f\r /<=>]+$/;
|
|
105
127
|
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
128
|
+
// How many discarded <iframe> elements can be nested while their fallback
|
|
129
|
+
// markup is still re-sanitized as HTML (see the `ontext` handler). Deeper
|
|
130
|
+
// fallback is escaped as text, so that crafted input cannot recurse without
|
|
131
|
+
// bound or re-parse the remainder of the input once per iframe
|
|
132
|
+
// (GHSA-c9rx-x947-fp3h).
|
|
133
|
+
const MAX_IFRAME_FALLBACK_DEPTH = 8;
|
|
109
134
|
|
|
110
|
-
|
|
135
|
+
// `_fallback` is internal: it is set when re-sanitizing the fallback markup
|
|
136
|
+
// of a discarded <iframe>, to carry the current nesting depth into the
|
|
137
|
+
// recursive call.
|
|
138
|
+
|
|
139
|
+
function sanitizeHtml(html, options, _fallback) {
|
|
111
140
|
if (html == null) {
|
|
112
141
|
return '';
|
|
113
142
|
}
|
|
143
|
+
const baseDepth = (_fallback && _fallback.depth) || 0;
|
|
144
|
+
const iframeFallbackDepth = (_fallback && _fallback.iframeFallbackDepth) || 0;
|
|
114
145
|
if (typeof html === 'number') {
|
|
115
146
|
html = html.toString();
|
|
116
147
|
}
|
|
@@ -542,7 +573,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
542
573
|
if (allowedSpecificClasses && allowedWildcardClasses) {
|
|
543
574
|
value = filterClasses(
|
|
544
575
|
value,
|
|
545
|
-
|
|
576
|
+
mergeClasses(allowedSpecificClasses, allowedWildcardClasses),
|
|
546
577
|
allowedClassesGlobs
|
|
547
578
|
);
|
|
548
579
|
} else {
|
|
@@ -682,11 +713,17 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
682
713
|
// (including after an unclosed <iframe>) arrives as a single text node.
|
|
683
714
|
// When the iframe is discarded, re-sanitize that fallback markup as HTML
|
|
684
715
|
// instead of escaping it as plain text (issue #5550).
|
|
716
|
+
// The nested call continues from the current depth so that
|
|
717
|
+
// `nestingLimit` applies to the whole output.
|
|
685
718
|
tag === 'iframe' &&
|
|
686
719
|
!tagAllowed(tag) &&
|
|
687
|
-
options.disallowedTagsMode === 'discard'
|
|
720
|
+
options.disallowedTagsMode === 'discard' &&
|
|
721
|
+
iframeFallbackDepth < MAX_IFRAME_FALLBACK_DEPTH
|
|
688
722
|
) {
|
|
689
|
-
result += sanitizeHtml(text, options
|
|
723
|
+
result += sanitizeHtml(text, options, {
|
|
724
|
+
depth,
|
|
725
|
+
iframeFallbackDepth: iframeFallbackDepth + 1
|
|
726
|
+
});
|
|
690
727
|
} else if (!addedText) {
|
|
691
728
|
const escaped = escapeHtml(text, false);
|
|
692
729
|
if (options.textFilter) {
|
|
@@ -819,7 +856,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
819
856
|
|
|
820
857
|
function initializeState() {
|
|
821
858
|
result = '';
|
|
822
|
-
depth =
|
|
859
|
+
depth = baseDepth;
|
|
823
860
|
stack = [];
|
|
824
861
|
skipMap = {};
|
|
825
862
|
transformMap = {};
|
|
@@ -1053,7 +1090,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
1053
1090
|
|
|
1054
1091
|
// Merge global and tag-specific styles into new AST.
|
|
1055
1092
|
if (allowedStyles[astRules.selector] && allowedStyles['*']) {
|
|
1056
|
-
selectedRule =
|
|
1093
|
+
selectedRule = mergeStyles(
|
|
1057
1094
|
allowedStyles[astRules.selector],
|
|
1058
1095
|
allowedStyles['*']
|
|
1059
1096
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanitize-html",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.1",
|
|
4
4
|
"description": "Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"node": ">=22.12.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"deepmerge": "^4.3.1",
|
|
33
32
|
"escape-string-regexp": "^4.0.0",
|
|
34
33
|
"htmlparser2": "^12.0.0",
|
|
35
34
|
"is-plain-object": "^5.1.0",
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"eslint": "^9.39.5",
|
|
42
41
|
"eslint-config-apostrophe": "^6.1.0",
|
|
43
|
-
"mocha": "^
|
|
42
|
+
"mocha": "^12.0.3",
|
|
44
43
|
"sinon": "^9.2.4"
|
|
45
44
|
},
|
|
46
45
|
"apostropheTestConfig": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suveren/gateway",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"description": "Suveren gateway — local agent gateway built in compliance with the Human Agency Protocol (HAP). Runs the UI, control plane, and MCP server in one Node process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js":"1"},{"size":1990,"mtime":1679007485753,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ktjd5k","/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js",[],[]]
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
# [4.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.1)
|
|
2
|
-
|
|
3
|
-
- Fix type definition for arrayMerge options. [#239](https://github.com/TehShrike/deepmerge/pull/239)
|
|
4
|
-
|
|
5
|
-
# [4.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.0)
|
|
6
|
-
|
|
7
|
-
- Avoid thrown errors if the target doesn't have `propertyIsEnumerable`. [#252](https://github.com/TehShrike/deepmerge/pull/252)
|
|
8
|
-
|
|
9
|
-
# [4.2.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.2)
|
|
10
|
-
|
|
11
|
-
- `isMergeableObject` is now only called if there are two values that could be merged. [a34dd4d2](https://github.com/TehShrike/deepmerge/commit/a34dd4d25bf5e250653540a2022bc832c7b00a19)
|
|
12
|
-
|
|
13
|
-
# [4.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.1)
|
|
14
|
-
|
|
15
|
-
- Fix: falsey values can now be merged. [#170](https://github.com/TehShrike/deepmerge/issues/170)
|
|
16
|
-
|
|
17
|
-
# [4.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.0)
|
|
18
|
-
|
|
19
|
-
- Properties are now only overwritten if they exist on the target object and are enumerable. [#164](https://github.com/TehShrike/deepmerge/pull/164)
|
|
20
|
-
|
|
21
|
-
Technically this could probably be a patch release since "which properties get overwritten" wasn't documented and accidentally overwriting a built-in function or some function up the property chain would almost certainly be undesirable, but it feels like a gray area, so here we are with a feature version bump.
|
|
22
|
-
|
|
23
|
-
# [4.1.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.2)
|
|
24
|
-
|
|
25
|
-
- Rolled back #167 since `Object.assign` breaks ES5 support. [55067352](https://github.com/TehShrike/deepmerge/commit/55067352a92c65a6c44a5165f3387720aae1e192)
|
|
26
|
-
|
|
27
|
-
# [4.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.1)
|
|
28
|
-
|
|
29
|
-
- The `options` argument is no longer mutated [#167](https://github.com/TehShrike/deepmerge/pull/167)
|
|
30
|
-
|
|
31
|
-
# [4.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.0)
|
|
32
|
-
|
|
33
|
-
- `cloneUnlessOtherwiseSpecified` is now exposed to the `arrayMerge` function [#165](https://github.com/TehShrike/deepmerge/pull/165)
|
|
34
|
-
|
|
35
|
-
# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0)
|
|
36
|
-
|
|
37
|
-
- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155)
|
|
38
|
-
|
|
39
|
-
# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0)
|
|
40
|
-
|
|
41
|
-
- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151)
|
|
42
|
-
|
|
43
|
-
# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1)
|
|
44
|
-
|
|
45
|
-
- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149)
|
|
46
|
-
|
|
47
|
-
# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0)
|
|
48
|
-
|
|
49
|
-
- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133)
|
|
50
|
-
|
|
51
|
-
# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0)
|
|
52
|
-
|
|
53
|
-
- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129)
|
|
54
|
-
|
|
55
|
-
# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0)
|
|
56
|
-
|
|
57
|
-
- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123)
|
|
58
|
-
|
|
59
|
-
# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1)
|
|
60
|
-
|
|
61
|
-
- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121)
|
|
62
|
-
|
|
63
|
-
# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0)
|
|
64
|
-
|
|
65
|
-
- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119)
|
|
66
|
-
|
|
67
|
-
# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1)
|
|
68
|
-
|
|
69
|
-
- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103)
|
|
70
|
-
- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107)
|
|
71
|
-
- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0)
|
|
75
|
-
|
|
76
|
-
- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96)
|
|
77
|
-
- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100)
|
|
78
|
-
|
|
79
|
-
# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1)
|
|
80
|
-
|
|
81
|
-
- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84)
|
|
82
|
-
|
|
83
|
-
# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0)
|
|
84
|
-
|
|
85
|
-
- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))`
|
|
86
|
-
- breaking: The `clone` option now defaults to `true`
|
|
87
|
-
- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements
|
|
88
|
-
|
|
89
|
-
See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77).
|
|
90
|
-
|
|
91
|
-
# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2)
|
|
92
|
-
|
|
93
|
-
- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76)
|
|
94
|
-
|
|
95
|
-
# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1)
|
|
96
|
-
|
|
97
|
-
- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63)
|
|
98
|
-
|
|
99
|
-
# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0)
|
|
100
|
-
|
|
101
|
-
- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change.
|
|
102
|
-
|
|
103
|
-
# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4)
|
|
104
|
-
|
|
105
|
-
- bower support: updated `main` in bower.json
|
|
106
|
-
|
|
107
|
-
# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3)
|
|
108
|
-
|
|
109
|
-
- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24)
|
|
110
|
-
|
|
111
|
-
# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2)
|
|
112
|
-
|
|
113
|
-
- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c)
|
|
114
|
-
|
|
115
|
-
# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1)
|
|
116
|
-
|
|
117
|
-
- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47)
|
|
118
|
-
|
|
119
|
-
# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0)
|
|
120
|
-
|
|
121
|
-
- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62)
|
|
122
|
-
|
|
123
|
-
# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2)
|
|
124
|
-
|
|
125
|
-
- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56)
|
|
126
|
-
- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57)
|
|
127
|
-
|
|
128
|
-
# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1)
|
|
129
|
-
|
|
130
|
-
- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51)
|
|
131
|
-
|
|
132
|
-
# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0)
|
|
133
|
-
|
|
134
|
-
- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50)
|
|
135
|
-
|
|
136
|
-
# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0)
|
|
137
|
-
|
|
138
|
-
- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46)
|
|
139
|
-
- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48)
|
|
140
|
-
- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47)
|
|
141
|
-
|
|
142
|
-
# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1)
|
|
143
|
-
|
|
144
|
-
- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46)
|
|
145
|
-
|
|
146
|
-
# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0)
|
|
147
|
-
|
|
148
|
-
- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37)
|
|
149
|
-
|
|
150
|
-
# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3)
|
|
151
|
-
|
|
152
|
-
- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38)
|
|
153
|
-
- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb)
|
|
154
|
-
|
|
155
|
-
# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2)
|
|
156
|
-
|
|
157
|
-
- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5)
|
|
158
|
-
|
|
159
|
-
# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1)
|
|
160
|
-
|
|
161
|
-
- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586)
|
|
162
|
-
|
|
163
|
-
# 1.0.0
|
|
164
|
-
|
|
165
|
-
- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15)
|
|
166
|
-
- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30)
|
|
167
|
-
- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31)
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var isMergeableObject = function isMergeableObject(value) {
|
|
4
|
-
return isNonNullObject(value)
|
|
5
|
-
&& !isSpecial(value)
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
function isNonNullObject(value) {
|
|
9
|
-
return !!value && typeof value === 'object'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function isSpecial(value) {
|
|
13
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
14
|
-
|
|
15
|
-
return stringValue === '[object RegExp]'
|
|
16
|
-
|| stringValue === '[object Date]'
|
|
17
|
-
|| isReactElement(value)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
21
|
-
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
22
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
23
|
-
|
|
24
|
-
function isReactElement(value) {
|
|
25
|
-
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function emptyTarget(val) {
|
|
29
|
-
return Array.isArray(val) ? [] : {}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
33
|
-
return (options.clone !== false && options.isMergeableObject(value))
|
|
34
|
-
? deepmerge(emptyTarget(value), value, options)
|
|
35
|
-
: value
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function defaultArrayMerge(target, source, options) {
|
|
39
|
-
return target.concat(source).map(function(element) {
|
|
40
|
-
return cloneUnlessOtherwiseSpecified(element, options)
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function getMergeFunction(key, options) {
|
|
45
|
-
if (!options.customMerge) {
|
|
46
|
-
return deepmerge
|
|
47
|
-
}
|
|
48
|
-
var customMerge = options.customMerge(key);
|
|
49
|
-
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
53
|
-
return Object.getOwnPropertySymbols
|
|
54
|
-
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
55
|
-
return Object.propertyIsEnumerable.call(target, symbol)
|
|
56
|
-
})
|
|
57
|
-
: []
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function getKeys(target) {
|
|
61
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function propertyIsOnObject(object, property) {
|
|
65
|
-
try {
|
|
66
|
-
return property in object
|
|
67
|
-
} catch(_) {
|
|
68
|
-
return false
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
73
|
-
function propertyIsUnsafe(target, key) {
|
|
74
|
-
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
75
|
-
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
76
|
-
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function mergeObject(target, source, options) {
|
|
80
|
-
var destination = {};
|
|
81
|
-
if (options.isMergeableObject(target)) {
|
|
82
|
-
getKeys(target).forEach(function(key) {
|
|
83
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
getKeys(source).forEach(function(key) {
|
|
87
|
-
if (propertyIsUnsafe(target, key)) {
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
92
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
93
|
-
} else {
|
|
94
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return destination
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function deepmerge(target, source, options) {
|
|
101
|
-
options = options || {};
|
|
102
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
103
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
104
|
-
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
105
|
-
// implementations can use it. The caller may not replace it.
|
|
106
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
107
|
-
|
|
108
|
-
var sourceIsArray = Array.isArray(source);
|
|
109
|
-
var targetIsArray = Array.isArray(target);
|
|
110
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
111
|
-
|
|
112
|
-
if (!sourceAndTargetTypesMatch) {
|
|
113
|
-
return cloneUnlessOtherwiseSpecified(source, options)
|
|
114
|
-
} else if (sourceIsArray) {
|
|
115
|
-
return options.arrayMerge(target, source, options)
|
|
116
|
-
} else {
|
|
117
|
-
return mergeObject(target, source, options)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
122
|
-
if (!Array.isArray(array)) {
|
|
123
|
-
throw new Error('first argument should be an array')
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return array.reduce(function(prev, next) {
|
|
127
|
-
return deepmerge(prev, next, options)
|
|
128
|
-
}, {})
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
var deepmerge_1 = deepmerge;
|
|
132
|
-
|
|
133
|
-
module.exports = deepmerge_1;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = global || self, global.deepmerge = factory());
|
|
5
|
-
}(this, function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
var isMergeableObject = function isMergeableObject(value) {
|
|
8
|
-
return isNonNullObject(value)
|
|
9
|
-
&& !isSpecial(value)
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function isNonNullObject(value) {
|
|
13
|
-
return !!value && typeof value === 'object'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function isSpecial(value) {
|
|
17
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
18
|
-
|
|
19
|
-
return stringValue === '[object RegExp]'
|
|
20
|
-
|| stringValue === '[object Date]'
|
|
21
|
-
|| isReactElement(value)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
25
|
-
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
26
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
27
|
-
|
|
28
|
-
function isReactElement(value) {
|
|
29
|
-
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function emptyTarget(val) {
|
|
33
|
-
return Array.isArray(val) ? [] : {}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
37
|
-
return (options.clone !== false && options.isMergeableObject(value))
|
|
38
|
-
? deepmerge(emptyTarget(value), value, options)
|
|
39
|
-
: value
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function defaultArrayMerge(target, source, options) {
|
|
43
|
-
return target.concat(source).map(function(element) {
|
|
44
|
-
return cloneUnlessOtherwiseSpecified(element, options)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getMergeFunction(key, options) {
|
|
49
|
-
if (!options.customMerge) {
|
|
50
|
-
return deepmerge
|
|
51
|
-
}
|
|
52
|
-
var customMerge = options.customMerge(key);
|
|
53
|
-
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
57
|
-
return Object.getOwnPropertySymbols
|
|
58
|
-
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
59
|
-
return Object.propertyIsEnumerable.call(target, symbol)
|
|
60
|
-
})
|
|
61
|
-
: []
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function getKeys(target) {
|
|
65
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function propertyIsOnObject(object, property) {
|
|
69
|
-
try {
|
|
70
|
-
return property in object
|
|
71
|
-
} catch(_) {
|
|
72
|
-
return false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
77
|
-
function propertyIsUnsafe(target, key) {
|
|
78
|
-
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
79
|
-
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
80
|
-
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function mergeObject(target, source, options) {
|
|
84
|
-
var destination = {};
|
|
85
|
-
if (options.isMergeableObject(target)) {
|
|
86
|
-
getKeys(target).forEach(function(key) {
|
|
87
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
getKeys(source).forEach(function(key) {
|
|
91
|
-
if (propertyIsUnsafe(target, key)) {
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
96
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
97
|
-
} else {
|
|
98
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
return destination
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function deepmerge(target, source, options) {
|
|
105
|
-
options = options || {};
|
|
106
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
107
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
108
|
-
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
109
|
-
// implementations can use it. The caller may not replace it.
|
|
110
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
111
|
-
|
|
112
|
-
var sourceIsArray = Array.isArray(source);
|
|
113
|
-
var targetIsArray = Array.isArray(target);
|
|
114
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
115
|
-
|
|
116
|
-
if (!sourceAndTargetTypesMatch) {
|
|
117
|
-
return cloneUnlessOtherwiseSpecified(source, options)
|
|
118
|
-
} else if (sourceIsArray) {
|
|
119
|
-
return options.arrayMerge(target, source, options)
|
|
120
|
-
} else {
|
|
121
|
-
return mergeObject(target, source, options)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
126
|
-
if (!Array.isArray(array)) {
|
|
127
|
-
throw new Error('first argument should be an array')
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return array.reduce(function(prev, next) {
|
|
131
|
-
return deepmerge(prev, next, options)
|
|
132
|
-
}, {})
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
var deepmerge_1 = deepmerge;
|
|
136
|
-
|
|
137
|
-
return deepmerge_1;
|
|
138
|
-
|
|
139
|
-
}));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, options?: deepmerge.Options): T;
|
|
2
|
-
declare function deepmerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: deepmerge.Options): T1 & T2;
|
|
3
|
-
|
|
4
|
-
declare namespace deepmerge {
|
|
5
|
-
export interface Options {
|
|
6
|
-
arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[];
|
|
7
|
-
clone?: boolean;
|
|
8
|
-
customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined;
|
|
9
|
-
isMergeableObject?(value: object): boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface ArrayMergeOptions {
|
|
12
|
-
isMergeableObject(value: object): boolean;
|
|
13
|
-
cloneUnlessOtherwiseSpecified(value: object, options?: Options): object;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function all (objects: object[], options?: Options): object;
|
|
17
|
-
export function all<T> (objects: Partial<T>[], options?: Options): T;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export = deepmerge;
|