cdk8s 2.3.9 → 2.3.12
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 +3 -3
- package/changelog.md +6 -1
- package/lib/api-object.js +1 -1
- package/lib/app.js +1 -1
- package/lib/chart.js +1 -1
- package/lib/dependency.js +2 -2
- package/lib/duration.js +1 -1
- package/lib/helm.js +1 -1
- package/lib/include.js +1 -1
- package/lib/json-patch.js +4 -4
- package/lib/lazy.js +1 -1
- package/lib/metadata.js +1 -1
- package/lib/names.js +1 -1
- package/lib/size.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/fast-json-patch/LICENSE.txt +1 -1
- package/node_modules/fast-json-patch/README.md +183 -164
- package/node_modules/fast-json-patch/{lib → commonjs}/core.d.ts +4 -23
- package/node_modules/fast-json-patch/{lib → commonjs}/core.js +78 -33
- package/node_modules/fast-json-patch/commonjs/duplex.d.ts +23 -0
- package/node_modules/fast-json-patch/{lib → commonjs}/duplex.js +16 -56
- package/node_modules/fast-json-patch/{lib → commonjs}/helpers.d.ts +2 -2
- package/node_modules/fast-json-patch/{lib → commonjs}/helpers.js +9 -9
- package/node_modules/fast-json-patch/dist/fast-json-patch.js +121 -161
- package/node_modules/fast-json-patch/dist/fast-json-patch.min.js +6 -6
- package/node_modules/fast-json-patch/index.d.ts +34 -0
- package/node_modules/fast-json-patch/index.js +11 -0
- package/node_modules/fast-json-patch/index.mjs +29 -0
- package/node_modules/fast-json-patch/index.ts +31 -0
- package/node_modules/fast-json-patch/jasmine-run.mjs +23 -0
- package/node_modules/fast-json-patch/module/core.d.ts +111 -0
- package/node_modules/fast-json-patch/module/core.mjs +433 -0
- package/node_modules/fast-json-patch/module/duplex.d.ts +23 -0
- package/node_modules/fast-json-patch/module/duplex.mjs +176 -0
- package/node_modules/fast-json-patch/module/helpers.d.ts +41 -0
- package/node_modules/fast-json-patch/module/helpers.mjs +171 -0
- package/node_modules/fast-json-patch/package.json +63 -67
- package/node_modules/fast-json-patch/tsc-to-mjs.sh +10 -0
- package/node_modules/fast-json-patch/webpack.config.js +2 -3
- package/package.json +3 -3
- package/releasetag.txt +1 -1
- package/version.txt +1 -1
- package/node_modules/fast-json-patch/lib/duplex.d.ts +0 -63
- package/node_modules/fast-json-patch/node_modules/fast-deep-equal/LICENSE +0 -21
- package/node_modules/fast-json-patch/node_modules/fast-deep-equal/README.md +0 -58
- package/node_modules/fast-json-patch/node_modules/fast-deep-equal/index.d.ts +0 -4
- package/node_modules/fast-json-patch/node_modules/fast-deep-equal/index.js +0 -55
- package/node_modules/fast-json-patch/node_modules/fast-deep-equal/package.json +0 -59
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
exports.
|
|
5
|
-
exports.deepClone = helpers_1._deepClone;
|
|
2
|
+
var helpers_js_1 = require("./helpers.js");
|
|
3
|
+
exports.JsonPatchError = helpers_js_1.PatchError;
|
|
4
|
+
exports.deepClone = helpers_js_1._deepClone;
|
|
6
5
|
/* We use a Javascript hash to store each
|
|
7
6
|
function. Each hash entry (property) uses
|
|
8
7
|
the operation identifiers specified in rfc6902.
|
|
@@ -31,7 +30,7 @@ var objOps = {
|
|
|
31
30
|
and is potentially unneeded */
|
|
32
31
|
var removed = getValueByPointer(document, this.path);
|
|
33
32
|
if (removed) {
|
|
34
|
-
removed =
|
|
33
|
+
removed = helpers_js_1._deepClone(removed);
|
|
35
34
|
}
|
|
36
35
|
var originalValue = applyOperation(document, { op: "remove", path: this.from }).removed;
|
|
37
36
|
applyOperation(document, { op: "add", path: this.path, value: originalValue });
|
|
@@ -40,11 +39,11 @@ var objOps = {
|
|
|
40
39
|
copy: function (obj, key, document) {
|
|
41
40
|
var valueToCopy = getValueByPointer(document, this.from);
|
|
42
41
|
// enforce copy by value so further operations don't affect source (see issue #177)
|
|
43
|
-
applyOperation(document, { op: "add", path: this.path, value:
|
|
42
|
+
applyOperation(document, { op: "add", path: this.path, value: helpers_js_1._deepClone(valueToCopy) });
|
|
44
43
|
return { newDocument: document };
|
|
45
44
|
},
|
|
46
45
|
test: function (obj, key, document) {
|
|
47
|
-
return { newDocument: document, test:
|
|
46
|
+
return { newDocument: document, test: _areEquals(obj[key], this.value) };
|
|
48
47
|
},
|
|
49
48
|
_get: function (obj, key, document) {
|
|
50
49
|
this.value = obj[key];
|
|
@@ -54,7 +53,7 @@ var objOps = {
|
|
|
54
53
|
/* The operations applicable to an array. Many are the same as for the object */
|
|
55
54
|
var arrOps = {
|
|
56
55
|
add: function (arr, i, document) {
|
|
57
|
-
if (
|
|
56
|
+
if (helpers_js_1.isInteger(i)) {
|
|
58
57
|
arr.splice(i, 0, this.value);
|
|
59
58
|
}
|
|
60
59
|
else { // array props
|
|
@@ -141,7 +140,7 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
|
141
140
|
return returnValue;
|
|
142
141
|
}
|
|
143
142
|
else if (operation.op === 'test') {
|
|
144
|
-
returnValue.test =
|
|
143
|
+
returnValue.test = _areEquals(document, operation.value);
|
|
145
144
|
if (returnValue.test === false) {
|
|
146
145
|
throw new exports.JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
147
146
|
}
|
|
@@ -168,7 +167,7 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
|
168
167
|
} /* END ROOT OPERATIONS */
|
|
169
168
|
else {
|
|
170
169
|
if (!mutateDocument) {
|
|
171
|
-
document =
|
|
170
|
+
document = helpers_js_1._deepClone(document);
|
|
172
171
|
}
|
|
173
172
|
var path = operation.path || "";
|
|
174
173
|
var keys = path.split('/');
|
|
@@ -186,8 +185,13 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
|
186
185
|
}
|
|
187
186
|
while (true) {
|
|
188
187
|
key = keys[t];
|
|
189
|
-
if (
|
|
190
|
-
|
|
188
|
+
if (key && key.indexOf('~') != -1) {
|
|
189
|
+
key = helpers_js_1.unescapePathComponent(key);
|
|
190
|
+
}
|
|
191
|
+
if (banPrototypeModifications &&
|
|
192
|
+
(key == '__proto__' ||
|
|
193
|
+
(key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {
|
|
194
|
+
throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
|
|
191
195
|
}
|
|
192
196
|
if (validateOperation) {
|
|
193
197
|
if (existingPathFragment === undefined) {
|
|
@@ -208,10 +212,10 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
|
208
212
|
key = obj.length;
|
|
209
213
|
}
|
|
210
214
|
else {
|
|
211
|
-
if (validateOperation && !
|
|
215
|
+
if (validateOperation && !helpers_js_1.isInteger(key)) {
|
|
212
216
|
throw new exports.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document);
|
|
213
217
|
} // only parse key when it's an integer for `arr.prop` to work
|
|
214
|
-
else if (
|
|
218
|
+
else if (helpers_js_1.isInteger(key)) {
|
|
215
219
|
key = ~~key;
|
|
216
220
|
}
|
|
217
221
|
}
|
|
@@ -227,9 +231,6 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
|
227
231
|
}
|
|
228
232
|
}
|
|
229
233
|
else {
|
|
230
|
-
if (key && key.indexOf('~') != -1) {
|
|
231
|
-
key = helpers_1.unescapePathComponent(key);
|
|
232
|
-
}
|
|
233
234
|
if (t >= len) {
|
|
234
235
|
var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
235
236
|
if (returnValue.test === false) {
|
|
@@ -239,6 +240,11 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
obj = obj[key];
|
|
243
|
+
// If we have more keys in the path, but the next value isn't a non-null object,
|
|
244
|
+
// throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
|
|
245
|
+
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
|
|
246
|
+
throw new exports.JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
247
|
+
}
|
|
242
248
|
}
|
|
243
249
|
}
|
|
244
250
|
}
|
|
@@ -266,7 +272,7 @@ function applyPatch(document, patch, validateOperation, mutateDocument, banProto
|
|
|
266
272
|
}
|
|
267
273
|
}
|
|
268
274
|
if (!mutateDocument) {
|
|
269
|
-
document =
|
|
275
|
+
document = helpers_js_1._deepClone(document);
|
|
270
276
|
}
|
|
271
277
|
var results = new Array(patch.length);
|
|
272
278
|
for (var i = 0, length_1 = patch.length; i < length_1; i++) {
|
|
@@ -322,7 +328,7 @@ function validator(operation, index, document, existingPathFragment) {
|
|
|
322
328
|
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {
|
|
323
329
|
throw new exports.JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);
|
|
324
330
|
}
|
|
325
|
-
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') &&
|
|
331
|
+
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && helpers_js_1.hasUndefined(operation.value)) {
|
|
326
332
|
throw new exports.JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);
|
|
327
333
|
}
|
|
328
334
|
else if (document) {
|
|
@@ -362,7 +368,7 @@ function validate(sequence, document, externalValidator) {
|
|
|
362
368
|
}
|
|
363
369
|
if (document) {
|
|
364
370
|
//clone document and sequence so that we can safely try applying operations
|
|
365
|
-
applyPatch(
|
|
371
|
+
applyPatch(helpers_js_1._deepClone(document), helpers_js_1._deepClone(sequence), externalValidator || true);
|
|
366
372
|
}
|
|
367
373
|
else {
|
|
368
374
|
externalValidator = externalValidator || validator;
|
|
@@ -381,16 +387,55 @@ function validate(sequence, document, externalValidator) {
|
|
|
381
387
|
}
|
|
382
388
|
}
|
|
383
389
|
exports.validate = validate;
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
390
|
+
// based on https://github.com/epoberezkin/fast-deep-equal
|
|
391
|
+
// MIT License
|
|
392
|
+
// Copyright (c) 2017 Evgeny Poberezkin
|
|
393
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
394
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
395
|
+
// in the Software without restriction, including without limitation the rights
|
|
396
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
397
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
398
|
+
// furnished to do so, subject to the following conditions:
|
|
399
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
400
|
+
// copies or substantial portions of the Software.
|
|
401
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
402
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
403
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
404
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
405
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
406
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
407
|
+
// SOFTWARE.
|
|
408
|
+
function _areEquals(a, b) {
|
|
409
|
+
if (a === b)
|
|
410
|
+
return true;
|
|
411
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
412
|
+
var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;
|
|
413
|
+
if (arrA && arrB) {
|
|
414
|
+
length = a.length;
|
|
415
|
+
if (length != b.length)
|
|
416
|
+
return false;
|
|
417
|
+
for (i = length; i-- !== 0;)
|
|
418
|
+
if (!_areEquals(a[i], b[i]))
|
|
419
|
+
return false;
|
|
420
|
+
return true;
|
|
421
|
+
}
|
|
422
|
+
if (arrA != arrB)
|
|
423
|
+
return false;
|
|
424
|
+
var keys = Object.keys(a);
|
|
425
|
+
length = keys.length;
|
|
426
|
+
if (length !== Object.keys(b).length)
|
|
427
|
+
return false;
|
|
428
|
+
for (i = length; i-- !== 0;)
|
|
429
|
+
if (!b.hasOwnProperty(keys[i]))
|
|
430
|
+
return false;
|
|
431
|
+
for (i = length; i-- !== 0;) {
|
|
432
|
+
key = keys[i];
|
|
433
|
+
if (!_areEquals(a[key], b[key]))
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
return a !== a && b !== b;
|
|
439
|
+
}
|
|
440
|
+
exports._areEquals = _areEquals;
|
|
441
|
+
;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Operation } from './core.js';
|
|
2
|
+
export interface Observer<T> {
|
|
3
|
+
object: T;
|
|
4
|
+
patches: Operation[];
|
|
5
|
+
unobserve: () => void;
|
|
6
|
+
callback: (patches: Operation[]) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Detach an observer from an object
|
|
10
|
+
*/
|
|
11
|
+
export declare function unobserve<T>(root: T, observer: Observer<T>): void;
|
|
12
|
+
/**
|
|
13
|
+
* Observes changes made to an object, which can then be retrieved using generate
|
|
14
|
+
*/
|
|
15
|
+
export declare function observe<T>(obj: Object | Array<T>, callback?: (patches: Operation[]) => void): Observer<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Generate an array of patches from an observer
|
|
18
|
+
*/
|
|
19
|
+
export declare function generate<T>(observer: Observer<Object>, invertible?: boolean): Operation[];
|
|
20
|
+
/**
|
|
21
|
+
* Create an array of patches from the differences in two objects
|
|
22
|
+
*/
|
|
23
|
+
export declare function compare(tree1: Object | Array<any>, tree2: Object | Array<any>, invertible?: boolean): Operation[];
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
2
|
/*!
|
|
14
3
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
15
|
-
* (c) 2017 Joachim Wester
|
|
4
|
+
* (c) 2017-2021 Joachim Wester
|
|
16
5
|
* MIT license
|
|
17
6
|
*/
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
/* export all core functions and types */
|
|
21
|
-
var core_2 = require("./core");
|
|
22
|
-
exports.applyOperation = core_2.applyOperation;
|
|
23
|
-
exports.applyPatch = core_2.applyPatch;
|
|
24
|
-
exports.applyReducer = core_2.applyReducer;
|
|
25
|
-
exports.getValueByPointer = core_2.getValueByPointer;
|
|
26
|
-
exports.validate = core_2.validate;
|
|
27
|
-
exports.validator = core_2.validator;
|
|
28
|
-
/* export some helpers */
|
|
29
|
-
var helpers_2 = require("./helpers");
|
|
30
|
-
exports.JsonPatchError = helpers_2.PatchError;
|
|
31
|
-
exports.deepClone = helpers_2._deepClone;
|
|
32
|
-
exports.escapePathComponent = helpers_2.escapePathComponent;
|
|
33
|
-
exports.unescapePathComponent = helpers_2.unescapePathComponent;
|
|
7
|
+
var helpers_js_1 = require("./helpers.js");
|
|
8
|
+
var core_js_1 = require("./core.js");
|
|
34
9
|
var beforeDict = new WeakMap();
|
|
35
10
|
var Mirror = /** @class */ (function () {
|
|
36
11
|
function Mirror(obj) {
|
|
@@ -81,7 +56,7 @@ function observe(obj, callback) {
|
|
|
81
56
|
return observer;
|
|
82
57
|
}
|
|
83
58
|
observer = {};
|
|
84
|
-
mirror.value =
|
|
59
|
+
mirror.value = helpers_js_1._deepClone(obj);
|
|
85
60
|
if (callback) {
|
|
86
61
|
observer.callback = callback;
|
|
87
62
|
observer.next = null;
|
|
@@ -126,7 +101,7 @@ function generate(observer, invertible) {
|
|
|
126
101
|
var mirror = beforeDict.get(observer.object);
|
|
127
102
|
_generate(mirror.value, observer.object, observer.patches, "", invertible);
|
|
128
103
|
if (observer.patches.length) {
|
|
129
|
-
|
|
104
|
+
core_js_1.applyPatch(mirror.value, observer.patches);
|
|
130
105
|
}
|
|
131
106
|
var temp = observer.patches;
|
|
132
107
|
if (temp.length > 0) {
|
|
@@ -146,34 +121,34 @@ function _generate(mirror, obj, patches, path, invertible) {
|
|
|
146
121
|
if (typeof obj.toJSON === "function") {
|
|
147
122
|
obj = obj.toJSON();
|
|
148
123
|
}
|
|
149
|
-
var newKeys =
|
|
150
|
-
var oldKeys =
|
|
124
|
+
var newKeys = helpers_js_1._objectKeys(obj);
|
|
125
|
+
var oldKeys = helpers_js_1._objectKeys(mirror);
|
|
151
126
|
var changed = false;
|
|
152
127
|
var deleted = false;
|
|
153
128
|
//if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
|
|
154
129
|
for (var t = oldKeys.length - 1; t >= 0; t--) {
|
|
155
130
|
var key = oldKeys[t];
|
|
156
131
|
var oldVal = mirror[key];
|
|
157
|
-
if (
|
|
132
|
+
if (helpers_js_1.hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
|
|
158
133
|
var newVal = obj[key];
|
|
159
|
-
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null) {
|
|
160
|
-
_generate(oldVal, newVal, patches, path + "/" +
|
|
134
|
+
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
|
|
135
|
+
_generate(oldVal, newVal, patches, path + "/" + helpers_js_1.escapePathComponent(key), invertible);
|
|
161
136
|
}
|
|
162
137
|
else {
|
|
163
138
|
if (oldVal !== newVal) {
|
|
164
139
|
changed = true;
|
|
165
140
|
if (invertible) {
|
|
166
|
-
patches.push({ op: "test", path: path + "/" +
|
|
141
|
+
patches.push({ op: "test", path: path + "/" + helpers_js_1.escapePathComponent(key), value: helpers_js_1._deepClone(oldVal) });
|
|
167
142
|
}
|
|
168
|
-
patches.push({ op: "replace", path: path + "/" +
|
|
143
|
+
patches.push({ op: "replace", path: path + "/" + helpers_js_1.escapePathComponent(key), value: helpers_js_1._deepClone(newVal) });
|
|
169
144
|
}
|
|
170
145
|
}
|
|
171
146
|
}
|
|
172
147
|
else if (Array.isArray(mirror) === Array.isArray(obj)) {
|
|
173
148
|
if (invertible) {
|
|
174
|
-
patches.push({ op: "test", path: path + "/" +
|
|
149
|
+
patches.push({ op: "test", path: path + "/" + helpers_js_1.escapePathComponent(key), value: helpers_js_1._deepClone(oldVal) });
|
|
175
150
|
}
|
|
176
|
-
patches.push({ op: "remove", path: path + "/" +
|
|
151
|
+
patches.push({ op: "remove", path: path + "/" + helpers_js_1.escapePathComponent(key) });
|
|
177
152
|
deleted = true; // property has been deleted
|
|
178
153
|
}
|
|
179
154
|
else {
|
|
@@ -189,8 +164,8 @@ function _generate(mirror, obj, patches, path, invertible) {
|
|
|
189
164
|
}
|
|
190
165
|
for (var t = 0; t < newKeys.length; t++) {
|
|
191
166
|
var key = newKeys[t];
|
|
192
|
-
if (!
|
|
193
|
-
patches.push({ op: "add", path: path + "/" +
|
|
167
|
+
if (!helpers_js_1.hasOwnProperty(mirror, key) && obj[key] !== undefined) {
|
|
168
|
+
patches.push({ op: "add", path: path + "/" + helpers_js_1.escapePathComponent(key), value: helpers_js_1._deepClone(obj[key]) });
|
|
194
169
|
}
|
|
195
170
|
}
|
|
196
171
|
}
|
|
@@ -204,18 +179,3 @@ function compare(tree1, tree2, invertible) {
|
|
|
204
179
|
return patches;
|
|
205
180
|
}
|
|
206
181
|
exports.compare = compare;
|
|
207
|
-
/**
|
|
208
|
-
* Default export for backwards compat
|
|
209
|
-
*/
|
|
210
|
-
// import just to re-export as default
|
|
211
|
-
var core = require("./core");
|
|
212
|
-
var helpers_3 = require("./helpers");
|
|
213
|
-
exports.default = __assign({}, core, {
|
|
214
|
-
// duplex
|
|
215
|
-
unobserve: unobserve,
|
|
216
|
-
observe: observe,
|
|
217
|
-
generate: generate,
|
|
218
|
-
compare: compare,
|
|
219
|
-
// helpers
|
|
220
|
-
JsonPatchError: helpers_3.PatchError, deepClone: helpers_1._deepClone, escapePathComponent: helpers_1.escapePathComponent,
|
|
221
|
-
unescapePathComponent: helpers_3.unescapePathComponent });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
|
-
* (c) 2017 Joachim Wester
|
|
4
|
-
* MIT
|
|
3
|
+
* (c) 2017-2022 Joachim Wester
|
|
4
|
+
* MIT licensed
|
|
5
5
|
*/
|
|
6
6
|
export declare function hasOwnProperty(obj: any, key: any): any;
|
|
7
7
|
export declare function _objectKeys(obj: any): any[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
|
-
* (c) 2017 Joachim Wester
|
|
4
|
-
* MIT
|
|
3
|
+
* (c) 2017-2022 Joachim Wester
|
|
4
|
+
* MIT licensed
|
|
5
5
|
*/
|
|
6
6
|
var __extends = (this && this.__extends) || (function () {
|
|
7
7
|
var extendStatics = function (d, b) {
|
|
@@ -24,11 +24,11 @@ function hasOwnProperty(obj, key) {
|
|
|
24
24
|
exports.hasOwnProperty = hasOwnProperty;
|
|
25
25
|
function _objectKeys(obj) {
|
|
26
26
|
if (Array.isArray(obj)) {
|
|
27
|
-
var
|
|
28
|
-
for (var k = 0; k <
|
|
29
|
-
|
|
27
|
+
var keys_1 = new Array(obj.length);
|
|
28
|
+
for (var k = 0; k < keys_1.length; k++) {
|
|
29
|
+
keys_1[k] = "" + k;
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return keys_1;
|
|
32
32
|
}
|
|
33
33
|
if (Object.keys) {
|
|
34
34
|
return Object.keys(obj);
|
|
@@ -122,7 +122,7 @@ function getPath(root, obj) {
|
|
|
122
122
|
if (path === '') {
|
|
123
123
|
throw new Error("Object not found in root");
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return "/" + path;
|
|
126
126
|
}
|
|
127
127
|
exports.getPath = getPath;
|
|
128
128
|
/**
|
|
@@ -134,8 +134,8 @@ function hasUndefined(obj) {
|
|
|
134
134
|
}
|
|
135
135
|
if (obj) {
|
|
136
136
|
if (Array.isArray(obj)) {
|
|
137
|
-
for (var
|
|
138
|
-
if (hasUndefined(obj[
|
|
137
|
+
for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
|
|
138
|
+
if (hasUndefined(obj[i_1])) {
|
|
139
139
|
return true;
|
|
140
140
|
}
|
|
141
141
|
}
|