@aws-solutions-constructs/core 2.77.0 → 2.78.0
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/.jsii +42 -42
- package/lib/alb-helper.js +2 -3
- package/lib/apigateway-defaults.d.ts +6 -6
- package/lib/apigateway-defaults.js +11 -11
- package/lib/apigateway-helper.d.ts +2 -2
- package/lib/apigateway-helper.js +8 -10
- package/lib/cloudfront-distribution-helper.js +2 -3
- package/lib/cloudwatch-log-group-helper.js +2 -4
- package/lib/cognito-defaults.d.ts +2 -2
- package/lib/cognito-defaults.js +4 -4
- package/lib/cognito-helper.js +3 -5
- package/lib/dynamodb-table-defaults.d.ts +3 -3
- package/lib/dynamodb-table-defaults.js +6 -6
- package/lib/dynamodb-table-helper.js +3 -3
- package/lib/elasticsearch-helper.js +5 -5
- package/lib/eventbridge-helper.js +4 -4
- package/lib/events-rule-defaults.d.ts +1 -1
- package/lib/events-rule-defaults.js +4 -4
- package/lib/fargate-helper.js +2 -3
- package/lib/glue-database-defaults.js +3 -3
- package/lib/glue-job-helper.js +3 -3
- package/lib/glue-table-defaults.js +6 -6
- package/lib/iot-topic-rule-defaults.d.ts +1 -1
- package/lib/iot-topic-rule-defaults.js +6 -6
- package/lib/kendra-helper.d.ts +1 -1
- package/lib/kendra-helper.js +1 -1
- package/lib/kinesis-analytics-defaults.d.ts +2 -2
- package/lib/kinesis-analytics-defaults.js +4 -4
- package/lib/kinesis-analytics-helper.js +2 -2
- package/lib/kinesis-firehose-s3-defaults.d.ts +1 -1
- package/lib/kinesis-firehose-s3-defaults.js +7 -7
- package/lib/kinesis-streams-defaults.d.ts +2 -2
- package/lib/kinesis-streams-defaults.js +4 -4
- package/lib/kinesis-streams-helper.js +2 -3
- package/lib/kms-defaults.d.ts +2 -2
- package/lib/kms-defaults.js +4 -4
- package/lib/kms-helper.js +2 -4
- package/lib/lambda-event-source-mapping-defaults.d.ts +3 -3
- package/lib/lambda-event-source-mapping-defaults.js +16 -16
- package/lib/mediastore-helper.js +2 -3
- package/lib/opensearch-helper.js +2 -2
- package/lib/override-warning-service.js +9 -6
- package/lib/s3-bucket-helper.js +7 -1
- package/lib/sagemaker-helper.d.ts +5 -0
- package/lib/sagemaker-helper.js +10 -9
- package/lib/secretsmanager-defaults.d.ts +2 -2
- package/lib/secretsmanager-defaults.js +4 -4
- package/lib/secretsmanager-helper.js +2 -3
- package/lib/sns-defaults.d.ts +2 -2
- package/lib/sns-defaults.js +4 -4
- package/lib/sns-helper.js +2 -2
- package/lib/sqs-defaults.js +3 -3
- package/lib/sqs-helper.js +2 -2
- package/lib/step-function-defaults.d.ts +1 -1
- package/lib/step-function-defaults.js +3 -3
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +14 -12
- package/lib/vpc-helper.js +1 -3
- package/lib/waf-helper.js +2 -3
- package/lib/websocket-api-helper.js +1 -2
- package/package.json +3 -3
- package/test/apigateway-helper.test.js +3 -3
- package/test/cloudfront-distribution-api-gateway-helper.test.js +11 -11
- package/test/dynamo-table.test.js +9 -9
- package/test/glue-job-helper.test.js +7 -7
- package/test/glue-table-helper.test.js +5 -5
- package/test/kinesis-analytics.test.js +2 -2
- package/test/kinesis-streams-defaults.test.js +2 -2
- package/test/lambda-event-source.test.js +10 -10
- package/test/override-warning-service.test.js +25 -26
- package/test/pipes-helper.test.js +2 -2
- package/test/step-function-helper.test.js +5 -5
- package/test/utils.test.js +11 -12
- package/.eslintignore +0 -9
- package/node_modules/ansi-regex/index.d.ts +0 -37
- package/node_modules/ansi-regex/index.js +0 -10
- package/node_modules/ansi-regex/license +0 -9
- package/node_modules/ansi-regex/package.json +0 -55
- package/node_modules/ansi-regex/readme.md +0 -78
- package/node_modules/aproba/LICENSE +0 -14
- package/node_modules/aproba/README.md +0 -94
- package/node_modules/aproba/index.js +0 -105
- package/node_modules/aproba/package.json +0 -35
- package/node_modules/are-we-there-yet/LICENSE.md +0 -18
- package/node_modules/are-we-there-yet/README.md +0 -208
- package/node_modules/are-we-there-yet/lib/index.js +0 -4
- package/node_modules/are-we-there-yet/lib/tracker-base.js +0 -13
- package/node_modules/are-we-there-yet/lib/tracker-group.js +0 -112
- package/node_modules/are-we-there-yet/lib/tracker-stream.js +0 -42
- package/node_modules/are-we-there-yet/lib/tracker.js +0 -34
- package/node_modules/are-we-there-yet/package.json +0 -53
- package/node_modules/color-support/LICENSE +0 -15
- package/node_modules/color-support/README.md +0 -129
- package/node_modules/color-support/bin.js +0 -3
- package/node_modules/color-support/browser.js +0 -14
- package/node_modules/color-support/index.js +0 -134
- package/node_modules/color-support/package.json +0 -36
- package/node_modules/console-control-strings/LICENSE +0 -13
- package/node_modules/console-control-strings/README.md +0 -145
- package/node_modules/console-control-strings/index.js +0 -125
- package/node_modules/console-control-strings/package.json +0 -27
- package/node_modules/deep-diff/.circleci/config.yml +0 -76
- package/node_modules/deep-diff/.eslintrc +0 -72
- package/node_modules/deep-diff/.vscode/launch.json +0 -30
- package/node_modules/deep-diff/.vscode/tasks.json +0 -12
- package/node_modules/deep-diff/ChangeLog.md +0 -63
- package/node_modules/deep-diff/LICENSE +0 -7
- package/node_modules/deep-diff/Readme.md +0 -239
- package/node_modules/deep-diff/dist/deep-diff.min.js +0 -1
- package/node_modules/deep-diff/dist/deep-diff.min.js.map +0 -1
- package/node_modules/deep-diff/examples/apply-diff-from-any.js +0 -39
- package/node_modules/deep-diff/examples/array-change.js +0 -45
- package/node_modules/deep-diff/examples/capture_change_apply_elsewhere.js +0 -53
- package/node_modules/deep-diff/examples/diff-ignoring-fun.js +0 -88
- package/node_modules/deep-diff/examples/diff-scenarios.js +0 -49
- package/node_modules/deep-diff/examples/example1.js +0 -41
- package/node_modules/deep-diff/examples/issue-111.js +0 -6
- package/node_modules/deep-diff/examples/issue-113-1.js +0 -14
- package/node_modules/deep-diff/examples/issue-113-2.js +0 -11
- package/node_modules/deep-diff/examples/issue-115.js +0 -17
- package/node_modules/deep-diff/examples/issue-124.js +0 -8
- package/node_modules/deep-diff/examples/issue-125.js +0 -19
- package/node_modules/deep-diff/examples/issue-126.js +0 -33
- package/node_modules/deep-diff/examples/issue-35.js +0 -11
- package/node_modules/deep-diff/examples/issue-47.js +0 -17
- package/node_modules/deep-diff/examples/issue-48.js +0 -48
- package/node_modules/deep-diff/examples/issue-62.js +0 -14
- package/node_modules/deep-diff/examples/issue-70.js +0 -6
- package/node_modules/deep-diff/examples/issue-71.js +0 -15
- package/node_modules/deep-diff/examples/issue-72.js +0 -21
- package/node_modules/deep-diff/examples/issue-74.js +0 -9
- package/node_modules/deep-diff/examples/issue-78.js +0 -24
- package/node_modules/deep-diff/examples/issue-83.js +0 -11
- package/node_modules/deep-diff/examples/issue-88.js +0 -26
- package/node_modules/deep-diff/examples/performance.js +0 -64
- package/node_modules/deep-diff/examples/practice-data.json +0 -2501
- package/node_modules/deep-diff/index.js +0 -526
- package/node_modules/deep-diff/package.json +0 -74
- package/node_modules/deep-diff/test/.eslintrc +0 -10
- package/node_modules/deep-diff/test/tests.html +0 -34
- package/node_modules/deep-diff/test/tests.js +0 -759
- 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/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/node_modules/emoji-regex/README.md +0 -73
- package/node_modules/emoji-regex/es2015/index.js +0 -6
- package/node_modules/emoji-regex/es2015/text.js +0 -6
- package/node_modules/emoji-regex/index.d.ts +0 -23
- package/node_modules/emoji-regex/index.js +0 -6
- package/node_modules/emoji-regex/package.json +0 -50
- package/node_modules/emoji-regex/text.js +0 -6
- package/node_modules/gauge/LICENSE.md +0 -20
- package/node_modules/gauge/README.md +0 -402
- package/node_modules/gauge/lib/base-theme.js +0 -18
- package/node_modules/gauge/lib/error.js +0 -24
- package/node_modules/gauge/lib/has-color.js +0 -4
- package/node_modules/gauge/lib/index.js +0 -289
- package/node_modules/gauge/lib/plumbing.js +0 -50
- package/node_modules/gauge/lib/process.js +0 -3
- package/node_modules/gauge/lib/progress-bar.js +0 -41
- package/node_modules/gauge/lib/render-template.js +0 -222
- package/node_modules/gauge/lib/set-immediate.js +0 -7
- package/node_modules/gauge/lib/set-interval.js +0 -3
- package/node_modules/gauge/lib/spin.js +0 -5
- package/node_modules/gauge/lib/template-item.js +0 -87
- package/node_modules/gauge/lib/theme-set.js +0 -122
- package/node_modules/gauge/lib/themes.js +0 -56
- package/node_modules/gauge/lib/wide-truncate.js +0 -31
- package/node_modules/gauge/package.json +0 -68
- package/node_modules/has-unicode/LICENSE +0 -14
- package/node_modules/has-unicode/README.md +0 -43
- package/node_modules/has-unicode/index.js +0 -16
- package/node_modules/has-unicode/package.json +0 -30
- package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
- package/node_modules/is-fullwidth-code-point/index.js +0 -50
- package/node_modules/is-fullwidth-code-point/license +0 -9
- package/node_modules/is-fullwidth-code-point/package.json +0 -42
- package/node_modules/is-fullwidth-code-point/readme.md +0 -39
- package/node_modules/npmlog/LICENSE.md +0 -20
- package/node_modules/npmlog/README.md +0 -216
- package/node_modules/npmlog/lib/log.js +0 -400
- package/node_modules/npmlog/package.json +0 -52
- package/node_modules/set-blocking/LICENSE.txt +0 -14
- package/node_modules/set-blocking/README.md +0 -31
- package/node_modules/set-blocking/index.js +0 -7
- package/node_modules/set-blocking/package.json +0 -42
- package/node_modules/signal-exit/LICENSE.txt +0 -16
- package/node_modules/signal-exit/README.md +0 -74
- package/node_modules/signal-exit/dist/cjs/browser.d.ts +0 -12
- package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/browser.js +0 -10
- package/node_modules/signal-exit/dist/cjs/browser.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/index.d.ts +0 -48
- package/node_modules/signal-exit/dist/cjs/index.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/index.js +0 -279
- package/node_modules/signal-exit/dist/cjs/index.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/package.json +0 -3
- package/node_modules/signal-exit/dist/cjs/signals.d.ts +0 -29
- package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/signals.js +0 -42
- package/node_modules/signal-exit/dist/cjs/signals.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/browser.d.ts +0 -12
- package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/browser.js +0 -4
- package/node_modules/signal-exit/dist/mjs/browser.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/index.d.ts +0 -48
- package/node_modules/signal-exit/dist/mjs/index.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/index.js +0 -275
- package/node_modules/signal-exit/dist/mjs/index.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/package.json +0 -3
- package/node_modules/signal-exit/dist/mjs/signals.d.ts +0 -29
- package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/signals.js +0 -39
- package/node_modules/signal-exit/dist/mjs/signals.js.map +0 -1
- package/node_modules/signal-exit/package.json +0 -106
- package/node_modules/string-width/index.d.ts +0 -29
- package/node_modules/string-width/index.js +0 -47
- package/node_modules/string-width/license +0 -9
- package/node_modules/string-width/package.json +0 -56
- package/node_modules/string-width/readme.md +0 -50
- package/node_modules/strip-ansi/index.d.ts +0 -17
- package/node_modules/strip-ansi/index.js +0 -4
- package/node_modules/strip-ansi/license +0 -9
- package/node_modules/strip-ansi/package.json +0 -54
- package/node_modules/strip-ansi/readme.md +0 -46
- package/node_modules/wide-align/LICENSE +0 -14
- package/node_modules/wide-align/README.md +0 -47
- package/node_modules/wide-align/align.js +0 -65
- package/node_modules/wide-align/package.json +0 -33
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
;(function(root, factory) { // eslint-disable-line no-extra-semi
|
|
2
|
-
var deepDiff = factory(root);
|
|
3
|
-
// eslint-disable-next-line no-undef
|
|
4
|
-
if (typeof define === 'function' && define.amd) {
|
|
5
|
-
// AMD
|
|
6
|
-
define('DeepDiff', function() { // eslint-disable-line no-undef
|
|
7
|
-
return deepDiff;
|
|
8
|
-
});
|
|
9
|
-
} else if (typeof exports === 'object' || typeof navigator === 'object' && navigator.product.match(/ReactNative/i)) {
|
|
10
|
-
// Node.js or ReactNative
|
|
11
|
-
module.exports = deepDiff;
|
|
12
|
-
} else {
|
|
13
|
-
// Browser globals
|
|
14
|
-
var _deepdiff = root.DeepDiff;
|
|
15
|
-
deepDiff.noConflict = function() {
|
|
16
|
-
if (root.DeepDiff === deepDiff) {
|
|
17
|
-
root.DeepDiff = _deepdiff;
|
|
18
|
-
}
|
|
19
|
-
return deepDiff;
|
|
20
|
-
};
|
|
21
|
-
root.DeepDiff = deepDiff;
|
|
22
|
-
}
|
|
23
|
-
}(this, function(root) {
|
|
24
|
-
var validKinds = ['N', 'E', 'A', 'D'];
|
|
25
|
-
|
|
26
|
-
// nodejs compatible on server side and in the browser.
|
|
27
|
-
function inherits(ctor, superCtor) {
|
|
28
|
-
ctor.super_ = superCtor;
|
|
29
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
30
|
-
constructor: {
|
|
31
|
-
value: ctor,
|
|
32
|
-
enumerable: false,
|
|
33
|
-
writable: true,
|
|
34
|
-
configurable: true
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function Diff(kind, path) {
|
|
40
|
-
Object.defineProperty(this, 'kind', {
|
|
41
|
-
value: kind,
|
|
42
|
-
enumerable: true
|
|
43
|
-
});
|
|
44
|
-
if (path && path.length) {
|
|
45
|
-
Object.defineProperty(this, 'path', {
|
|
46
|
-
value: path,
|
|
47
|
-
enumerable: true
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function DiffEdit(path, origin, value) {
|
|
53
|
-
DiffEdit.super_.call(this, 'E', path);
|
|
54
|
-
Object.defineProperty(this, 'lhs', {
|
|
55
|
-
value: origin,
|
|
56
|
-
enumerable: true
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(this, 'rhs', {
|
|
59
|
-
value: value,
|
|
60
|
-
enumerable: true
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
inherits(DiffEdit, Diff);
|
|
64
|
-
|
|
65
|
-
function DiffNew(path, value) {
|
|
66
|
-
DiffNew.super_.call(this, 'N', path);
|
|
67
|
-
Object.defineProperty(this, 'rhs', {
|
|
68
|
-
value: value,
|
|
69
|
-
enumerable: true
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
inherits(DiffNew, Diff);
|
|
73
|
-
|
|
74
|
-
function DiffDeleted(path, value) {
|
|
75
|
-
DiffDeleted.super_.call(this, 'D', path);
|
|
76
|
-
Object.defineProperty(this, 'lhs', {
|
|
77
|
-
value: value,
|
|
78
|
-
enumerable: true
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
inherits(DiffDeleted, Diff);
|
|
82
|
-
|
|
83
|
-
function DiffArray(path, index, item) {
|
|
84
|
-
DiffArray.super_.call(this, 'A', path);
|
|
85
|
-
Object.defineProperty(this, 'index', {
|
|
86
|
-
value: index,
|
|
87
|
-
enumerable: true
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(this, 'item', {
|
|
90
|
-
value: item,
|
|
91
|
-
enumerable: true
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
inherits(DiffArray, Diff);
|
|
95
|
-
|
|
96
|
-
function arrayRemove(arr, from, to) {
|
|
97
|
-
var rest = arr.slice((to || from) + 1 || arr.length);
|
|
98
|
-
arr.length = from < 0 ? arr.length + from : from;
|
|
99
|
-
arr.push.apply(arr, rest);
|
|
100
|
-
return arr;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function realTypeOf(subject) {
|
|
104
|
-
var type = typeof subject;
|
|
105
|
-
if (type !== 'object') {
|
|
106
|
-
return type;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (subject === Math) {
|
|
110
|
-
return 'math';
|
|
111
|
-
} else if (subject === null) {
|
|
112
|
-
return 'null';
|
|
113
|
-
} else if (Array.isArray(subject)) {
|
|
114
|
-
return 'array';
|
|
115
|
-
} else if (Object.prototype.toString.call(subject) === '[object Date]') {
|
|
116
|
-
return 'date';
|
|
117
|
-
} else if (typeof subject.toString === 'function' && /^\/.*\//.test(subject.toString())) {
|
|
118
|
-
return 'regexp';
|
|
119
|
-
}
|
|
120
|
-
return 'object';
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
124
|
-
function hashThisString(string) {
|
|
125
|
-
var hash = 0;
|
|
126
|
-
if (string.length === 0) { return hash; }
|
|
127
|
-
for (var i = 0; i < string.length; i++) {
|
|
128
|
-
var char = string.charCodeAt(i);
|
|
129
|
-
hash = ((hash << 5) - hash) + char;
|
|
130
|
-
hash = hash & hash; // Convert to 32bit integer
|
|
131
|
-
}
|
|
132
|
-
return hash;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Gets a hash of the given object in an array order-independent fashion
|
|
136
|
-
// also object key order independent (easier since they can be alphabetized)
|
|
137
|
-
function getOrderIndependentHash(object) {
|
|
138
|
-
var accum = 0;
|
|
139
|
-
var type = realTypeOf(object);
|
|
140
|
-
|
|
141
|
-
if (type === 'array') {
|
|
142
|
-
object.forEach(function (item) {
|
|
143
|
-
// Addition is commutative so this is order indep
|
|
144
|
-
accum += getOrderIndependentHash(item);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
var arrayString = '[type: array, hash: ' + accum + ']';
|
|
148
|
-
return accum + hashThisString(arrayString);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (type === 'object') {
|
|
152
|
-
for (var key in object) {
|
|
153
|
-
if (object.hasOwnProperty(key)) {
|
|
154
|
-
var keyValueString = '[ type: object, key: ' + key + ', value hash: ' + getOrderIndependentHash(object[key]) + ']';
|
|
155
|
-
accum += hashThisString(keyValueString);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return accum;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Non object, non array...should be good?
|
|
163
|
-
var stringToHash = '[ type: ' + type + ' ; value: ' + object + ']';
|
|
164
|
-
return accum + hashThisString(stringToHash);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function deepDiff(lhs, rhs, changes, prefilter, path, key, stack, orderIndependent) {
|
|
168
|
-
changes = changes || [];
|
|
169
|
-
path = path || [];
|
|
170
|
-
stack = stack || [];
|
|
171
|
-
var currentPath = path.slice(0);
|
|
172
|
-
if (typeof key !== 'undefined' && key !== null) {
|
|
173
|
-
if (prefilter) {
|
|
174
|
-
if (typeof (prefilter) === 'function' && prefilter(currentPath, key)) {
|
|
175
|
-
return;
|
|
176
|
-
} else if (typeof (prefilter) === 'object') {
|
|
177
|
-
if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (prefilter.normalize) {
|
|
181
|
-
var alt = prefilter.normalize(currentPath, key, lhs, rhs);
|
|
182
|
-
if (alt) {
|
|
183
|
-
lhs = alt[0];
|
|
184
|
-
rhs = alt[1];
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
currentPath.push(key);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Use string comparison for regexes
|
|
193
|
-
if (realTypeOf(lhs) === 'regexp' && realTypeOf(rhs) === 'regexp') {
|
|
194
|
-
lhs = lhs.toString();
|
|
195
|
-
rhs = rhs.toString();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
var ltype = typeof lhs;
|
|
199
|
-
var rtype = typeof rhs;
|
|
200
|
-
var i, j, k, other;
|
|
201
|
-
|
|
202
|
-
var ldefined = ltype !== 'undefined' ||
|
|
203
|
-
(stack && (stack.length > 0) && stack[stack.length - 1].lhs &&
|
|
204
|
-
Object.getOwnPropertyDescriptor(stack[stack.length - 1].lhs, key));
|
|
205
|
-
var rdefined = rtype !== 'undefined' ||
|
|
206
|
-
(stack && (stack.length > 0) && stack[stack.length - 1].rhs &&
|
|
207
|
-
Object.getOwnPropertyDescriptor(stack[stack.length - 1].rhs, key));
|
|
208
|
-
|
|
209
|
-
if (!ldefined && rdefined) {
|
|
210
|
-
changes.push(new DiffNew(currentPath, rhs));
|
|
211
|
-
} else if (!rdefined && ldefined) {
|
|
212
|
-
changes.push(new DiffDeleted(currentPath, lhs));
|
|
213
|
-
} else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
|
|
214
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
215
|
-
} else if (realTypeOf(lhs) === 'date' && (lhs - rhs) !== 0) {
|
|
216
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
217
|
-
} else if (ltype === 'object' && lhs !== null && rhs !== null) {
|
|
218
|
-
for (i = stack.length - 1; i > -1; --i) {
|
|
219
|
-
if (stack[i].lhs === lhs) {
|
|
220
|
-
other = true;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (!other) {
|
|
225
|
-
stack.push({ lhs: lhs, rhs: rhs });
|
|
226
|
-
if (Array.isArray(lhs)) {
|
|
227
|
-
// If order doesn't matter, we need to sort our arrays
|
|
228
|
-
if (orderIndependent) {
|
|
229
|
-
lhs.sort(function (a, b) {
|
|
230
|
-
return getOrderIndependentHash(a) - getOrderIndependentHash(b);
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
rhs.sort(function (a, b) {
|
|
234
|
-
return getOrderIndependentHash(a) - getOrderIndependentHash(b);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
i = rhs.length - 1;
|
|
238
|
-
j = lhs.length - 1;
|
|
239
|
-
while (i > j) {
|
|
240
|
-
changes.push(new DiffArray(currentPath, i, new DiffNew(undefined, rhs[i--])));
|
|
241
|
-
}
|
|
242
|
-
while (j > i) {
|
|
243
|
-
changes.push(new DiffArray(currentPath, j, new DiffDeleted(undefined, lhs[j--])));
|
|
244
|
-
}
|
|
245
|
-
for (; i >= 0; --i) {
|
|
246
|
-
deepDiff(lhs[i], rhs[i], changes, prefilter, currentPath, i, stack, orderIndependent);
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
var akeys = Object.keys(lhs);
|
|
250
|
-
var pkeys = Object.keys(rhs);
|
|
251
|
-
for (i = 0; i < akeys.length; ++i) {
|
|
252
|
-
k = akeys[i];
|
|
253
|
-
other = pkeys.indexOf(k);
|
|
254
|
-
if (other >= 0) {
|
|
255
|
-
deepDiff(lhs[k], rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
256
|
-
pkeys[other] = null;
|
|
257
|
-
} else {
|
|
258
|
-
deepDiff(lhs[k], undefined, changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
for (i = 0; i < pkeys.length; ++i) {
|
|
262
|
-
k = pkeys[i];
|
|
263
|
-
if (k) {
|
|
264
|
-
deepDiff(undefined, rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
stack.length = stack.length - 1;
|
|
269
|
-
} else if (lhs !== rhs) {
|
|
270
|
-
// lhs is contains a cycle at this element and it differs from rhs
|
|
271
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
272
|
-
}
|
|
273
|
-
} else if (lhs !== rhs) {
|
|
274
|
-
if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
|
|
275
|
-
changes.push(new DiffEdit(currentPath, lhs, rhs));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function observableDiff(lhs, rhs, observer, prefilter, orderIndependent) {
|
|
281
|
-
var changes = [];
|
|
282
|
-
deepDiff(lhs, rhs, changes, prefilter, null, null, null, orderIndependent);
|
|
283
|
-
if (observer) {
|
|
284
|
-
for (var i = 0; i < changes.length; ++i) {
|
|
285
|
-
observer(changes[i]);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return changes;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function orderIndependentDeepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
|
|
292
|
-
return deepDiff(lhs, rhs, changes, prefilter, path, key, stack, true);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function accumulateDiff(lhs, rhs, prefilter, accum) {
|
|
296
|
-
var observer = (accum) ?
|
|
297
|
-
function (difference) {
|
|
298
|
-
if (difference) {
|
|
299
|
-
accum.push(difference);
|
|
300
|
-
}
|
|
301
|
-
} : undefined;
|
|
302
|
-
var changes = observableDiff(lhs, rhs, observer, prefilter);
|
|
303
|
-
return (accum) ? accum : (changes.length) ? changes : undefined;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function accumulateOrderIndependentDiff(lhs, rhs, prefilter, accum) {
|
|
307
|
-
var observer = (accum) ?
|
|
308
|
-
function (difference) {
|
|
309
|
-
if (difference) {
|
|
310
|
-
accum.push(difference);
|
|
311
|
-
}
|
|
312
|
-
} : undefined;
|
|
313
|
-
var changes = observableDiff(lhs, rhs, observer, prefilter, true);
|
|
314
|
-
return (accum) ? accum : (changes.length) ? changes : undefined;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function applyArrayChange(arr, index, change) {
|
|
318
|
-
if (change.path && change.path.length) {
|
|
319
|
-
var it = arr[index],
|
|
320
|
-
i, u = change.path.length - 1;
|
|
321
|
-
for (i = 0; i < u; i++) {
|
|
322
|
-
it = it[change.path[i]];
|
|
323
|
-
}
|
|
324
|
-
switch (change.kind) {
|
|
325
|
-
case 'A':
|
|
326
|
-
applyArrayChange(it[change.path[i]], change.index, change.item);
|
|
327
|
-
break;
|
|
328
|
-
case 'D':
|
|
329
|
-
delete it[change.path[i]];
|
|
330
|
-
break;
|
|
331
|
-
case 'E':
|
|
332
|
-
case 'N':
|
|
333
|
-
it[change.path[i]] = change.rhs;
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
} else {
|
|
337
|
-
switch (change.kind) {
|
|
338
|
-
case 'A':
|
|
339
|
-
applyArrayChange(arr[index], change.index, change.item);
|
|
340
|
-
break;
|
|
341
|
-
case 'D':
|
|
342
|
-
arr = arrayRemove(arr, index);
|
|
343
|
-
break;
|
|
344
|
-
case 'E':
|
|
345
|
-
case 'N':
|
|
346
|
-
arr[index] = change.rhs;
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return arr;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function applyChange(target, source, change) {
|
|
354
|
-
if (typeof change === 'undefined' && source && ~validKinds.indexOf(source.kind)) {
|
|
355
|
-
change = source;
|
|
356
|
-
}
|
|
357
|
-
if (target && change && change.kind) {
|
|
358
|
-
var it = target,
|
|
359
|
-
i = -1,
|
|
360
|
-
last = change.path ? change.path.length - 1 : 0;
|
|
361
|
-
while (++i < last) {
|
|
362
|
-
if (typeof it[change.path[i]] === 'undefined') {
|
|
363
|
-
it[change.path[i]] = (typeof change.path[i + 1] !== 'undefined' && typeof change.path[i + 1] === 'number') ? [] : {};
|
|
364
|
-
}
|
|
365
|
-
it = it[change.path[i]];
|
|
366
|
-
}
|
|
367
|
-
switch (change.kind) {
|
|
368
|
-
case 'A':
|
|
369
|
-
if (change.path && typeof it[change.path[i]] === 'undefined') {
|
|
370
|
-
it[change.path[i]] = [];
|
|
371
|
-
}
|
|
372
|
-
applyArrayChange(change.path ? it[change.path[i]] : it, change.index, change.item);
|
|
373
|
-
break;
|
|
374
|
-
case 'D':
|
|
375
|
-
delete it[change.path[i]];
|
|
376
|
-
break;
|
|
377
|
-
case 'E':
|
|
378
|
-
case 'N':
|
|
379
|
-
it[change.path[i]] = change.rhs;
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function revertArrayChange(arr, index, change) {
|
|
386
|
-
if (change.path && change.path.length) {
|
|
387
|
-
// the structure of the object at the index has changed...
|
|
388
|
-
var it = arr[index],
|
|
389
|
-
i, u = change.path.length - 1;
|
|
390
|
-
for (i = 0; i < u; i++) {
|
|
391
|
-
it = it[change.path[i]];
|
|
392
|
-
}
|
|
393
|
-
switch (change.kind) {
|
|
394
|
-
case 'A':
|
|
395
|
-
revertArrayChange(it[change.path[i]], change.index, change.item);
|
|
396
|
-
break;
|
|
397
|
-
case 'D':
|
|
398
|
-
it[change.path[i]] = change.lhs;
|
|
399
|
-
break;
|
|
400
|
-
case 'E':
|
|
401
|
-
it[change.path[i]] = change.lhs;
|
|
402
|
-
break;
|
|
403
|
-
case 'N':
|
|
404
|
-
delete it[change.path[i]];
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
} else {
|
|
408
|
-
// the array item is different...
|
|
409
|
-
switch (change.kind) {
|
|
410
|
-
case 'A':
|
|
411
|
-
revertArrayChange(arr[index], change.index, change.item);
|
|
412
|
-
break;
|
|
413
|
-
case 'D':
|
|
414
|
-
arr[index] = change.lhs;
|
|
415
|
-
break;
|
|
416
|
-
case 'E':
|
|
417
|
-
arr[index] = change.lhs;
|
|
418
|
-
break;
|
|
419
|
-
case 'N':
|
|
420
|
-
arr = arrayRemove(arr, index);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
return arr;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function revertChange(target, source, change) {
|
|
428
|
-
if (target && source && change && change.kind) {
|
|
429
|
-
var it = target,
|
|
430
|
-
i, u;
|
|
431
|
-
u = change.path.length - 1;
|
|
432
|
-
for (i = 0; i < u; i++) {
|
|
433
|
-
if (typeof it[change.path[i]] === 'undefined') {
|
|
434
|
-
it[change.path[i]] = {};
|
|
435
|
-
}
|
|
436
|
-
it = it[change.path[i]];
|
|
437
|
-
}
|
|
438
|
-
switch (change.kind) {
|
|
439
|
-
case 'A':
|
|
440
|
-
// Array was modified...
|
|
441
|
-
// it will be an array...
|
|
442
|
-
revertArrayChange(it[change.path[i]], change.index, change.item);
|
|
443
|
-
break;
|
|
444
|
-
case 'D':
|
|
445
|
-
// Item was deleted...
|
|
446
|
-
it[change.path[i]] = change.lhs;
|
|
447
|
-
break;
|
|
448
|
-
case 'E':
|
|
449
|
-
// Item was edited...
|
|
450
|
-
it[change.path[i]] = change.lhs;
|
|
451
|
-
break;
|
|
452
|
-
case 'N':
|
|
453
|
-
// Item is new...
|
|
454
|
-
delete it[change.path[i]];
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
function applyDiff(target, source, filter) {
|
|
461
|
-
if (target && source) {
|
|
462
|
-
var onChange = function (change) {
|
|
463
|
-
if (!filter || filter(target, source, change)) {
|
|
464
|
-
applyChange(target, source, change);
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
observableDiff(target, source, onChange);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
Object.defineProperties(accumulateDiff, {
|
|
472
|
-
|
|
473
|
-
diff: {
|
|
474
|
-
value: accumulateDiff,
|
|
475
|
-
enumerable: true
|
|
476
|
-
},
|
|
477
|
-
orderIndependentDiff: {
|
|
478
|
-
value: accumulateOrderIndependentDiff,
|
|
479
|
-
enumerable: true
|
|
480
|
-
},
|
|
481
|
-
observableDiff: {
|
|
482
|
-
value: observableDiff,
|
|
483
|
-
enumerable: true
|
|
484
|
-
},
|
|
485
|
-
orderIndependentObservableDiff: {
|
|
486
|
-
value: orderIndependentDeepDiff,
|
|
487
|
-
enumerable: true
|
|
488
|
-
},
|
|
489
|
-
orderIndepHash: {
|
|
490
|
-
value: getOrderIndependentHash,
|
|
491
|
-
enumerable: true
|
|
492
|
-
},
|
|
493
|
-
applyDiff: {
|
|
494
|
-
value: applyDiff,
|
|
495
|
-
enumerable: true
|
|
496
|
-
},
|
|
497
|
-
applyChange: {
|
|
498
|
-
value: applyChange,
|
|
499
|
-
enumerable: true
|
|
500
|
-
},
|
|
501
|
-
revertChange: {
|
|
502
|
-
value: revertChange,
|
|
503
|
-
enumerable: true
|
|
504
|
-
},
|
|
505
|
-
isConflict: {
|
|
506
|
-
value: function () {
|
|
507
|
-
return typeof $conflict !== 'undefined';
|
|
508
|
-
},
|
|
509
|
-
enumerable: true
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
// hackish...
|
|
514
|
-
accumulateDiff.DeepDiff = accumulateDiff;
|
|
515
|
-
// ...but works with:
|
|
516
|
-
// import DeepDiff from 'deep-diff'
|
|
517
|
-
// import { DeepDiff } from 'deep-diff'
|
|
518
|
-
// const DeepDiff = require('deep-diff');
|
|
519
|
-
// const { DeepDiff } = require('deep-diff');
|
|
520
|
-
|
|
521
|
-
if (root) {
|
|
522
|
-
root.DeepDiff = accumulateDiff;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
return accumulateDiff;
|
|
526
|
-
}));
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "deep-diff",
|
|
3
|
-
"description": "Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.",
|
|
4
|
-
"version": "1.0.2",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"diff",
|
|
8
|
-
"difference",
|
|
9
|
-
"compare",
|
|
10
|
-
"change-tracking"
|
|
11
|
-
],
|
|
12
|
-
"author": "Phillip Clark <phillip@flitbit.com>",
|
|
13
|
-
"contributors": [
|
|
14
|
-
"Simen Bekkhus <sbekkhus91@gmail.com>",
|
|
15
|
-
"Paul Pflugradt <paulpflugradt@googlemail.com>",
|
|
16
|
-
"wooorm <tituswormer@gmail.com>",
|
|
17
|
-
"Nicholas Calugar <njcalugar@gmail.com>",
|
|
18
|
-
"Yandell <hyandell@amazon.com>",
|
|
19
|
-
"Thiago Santos <thia.mdossantos@gmail.com>",
|
|
20
|
-
"Steve Mao <maochenyan@gmail.com>",
|
|
21
|
-
"Mats Bryntse <mats.dev@bryntum.com>",
|
|
22
|
-
"Phillip Clark <pclark@leisurelink.com>",
|
|
23
|
-
"ZauberNerd <zaubernerd@zaubernerd.de>",
|
|
24
|
-
"ravishivt <javishi@gmail.com>",
|
|
25
|
-
"Daniel Spangler <daniel.spangler@gmail.com>",
|
|
26
|
-
"Sam Beran <sberan@gmail.com>",
|
|
27
|
-
"Thomas de Barochez <thomas.barochez+github@gmail.com>",
|
|
28
|
-
"Morton Fox <github@qslw.com>",
|
|
29
|
-
"Amila Welihinda <amilajack@users.noreply.github.com>",
|
|
30
|
-
"Will Biddy <willbiddy@gmail.com>",
|
|
31
|
-
"icesoar <icesoar@hotmail.com>",
|
|
32
|
-
"Serkan Serttop <serkanserttop@yahoo.com>",
|
|
33
|
-
"orlando <operri@opentable.com>",
|
|
34
|
-
"Tom MacWright <tmcw@users.noreply.github.com>",
|
|
35
|
-
"Denning <denningj@amazon.com>",
|
|
36
|
-
"Dan Drinkard <dan.drinkard@gmail.com>",
|
|
37
|
-
"Elad Efrat <elad@iNNU.ORG>",
|
|
38
|
-
"caasi Huang <caasi.igd@gmail.com>",
|
|
39
|
-
"Tom Ashworth <tashworth@twitter.com>"
|
|
40
|
-
],
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "git://github.com/flitbit/diff.git"
|
|
44
|
-
},
|
|
45
|
-
"main": "./index.js",
|
|
46
|
-
"scripts": {
|
|
47
|
-
"prerelease": "npm run clean && npm run test",
|
|
48
|
-
"release": "uglifyjs -c -m -o dist/deep-diff.min.js --source-map -r '$,require,exports,self,module,define,navigator' index.js",
|
|
49
|
-
"clean": "rimraf dist && mkdir dist",
|
|
50
|
-
"preversion": "npm run release",
|
|
51
|
-
"postversion": "git push && git push --tags",
|
|
52
|
-
"pretest": "npm run lint",
|
|
53
|
-
"test": "mocha test/**/*.js",
|
|
54
|
-
"test:watch": "nodemon --ext js,json --ignore dist/ --exec 'npm test'",
|
|
55
|
-
"preci": "npm run lint",
|
|
56
|
-
"ci": "mocha --reporter mocha-junit-reporter test/**/*.js",
|
|
57
|
-
"lint": "eslint index.js test"
|
|
58
|
-
},
|
|
59
|
-
"devDependencies": {
|
|
60
|
-
"bluebird": "^3.5.1",
|
|
61
|
-
"deep-equal": "^1.0.1",
|
|
62
|
-
"eslint": "^4.19.1",
|
|
63
|
-
"eslint-plugin-mocha": "^5.0.0",
|
|
64
|
-
"expect.js": "^0.3.1",
|
|
65
|
-
"json": "^9.0.6",
|
|
66
|
-
"json-ptr": "^1.1.0",
|
|
67
|
-
"lodash": "^4.17.10",
|
|
68
|
-
"mocha": "^5.1.1",
|
|
69
|
-
"mocha-junit-reporter": "^1.17.0",
|
|
70
|
-
"nodemon": "^1.17.4",
|
|
71
|
-
"rimraf": "^2.6.2",
|
|
72
|
-
"uglify-js": "^3.3.25"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Mocha Tests</title>
|
|
6
|
-
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body>
|
|
10
|
-
<!-- You should open this file directly in a browser from your file system, not from a server... -->
|
|
11
|
-
<div id="mocha"></div>
|
|
12
|
-
<script>
|
|
13
|
-
globalConflict = "This is a conflict";
|
|
14
|
-
DeepDiff = globalConflict;
|
|
15
|
-
</script>
|
|
16
|
-
<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>
|
|
17
|
-
<script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>
|
|
18
|
-
<script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
|
|
19
|
-
<script>
|
|
20
|
-
mocha.setup('bdd')
|
|
21
|
-
</script>
|
|
22
|
-
<!--script src="../index.js"></script-->
|
|
23
|
-
<script src="../dist/deep-diff.min.js"></script>
|
|
24
|
-
<script src="tests.js"></script>
|
|
25
|
-
<script>
|
|
26
|
-
window.onload = function () {
|
|
27
|
-
mocha.checkLeaks();
|
|
28
|
-
mocha.globals(['jQuery']);
|
|
29
|
-
mocha.run();
|
|
30
|
-
};
|
|
31
|
-
</script>
|
|
32
|
-
</body>
|
|
33
|
-
|
|
34
|
-
</html>
|