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
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
|
+
* (c) 2017-2021 Joachim Wester
|
|
4
|
+
* MIT license
|
|
5
|
+
*/
|
|
6
|
+
import { _deepClone, _objectKeys, escapePathComponent, hasOwnProperty } from './helpers.mjs';
|
|
7
|
+
import { applyPatch } from './core.mjs';
|
|
8
|
+
var beforeDict = new WeakMap();
|
|
9
|
+
var Mirror = /** @class */ (function () {
|
|
10
|
+
function Mirror(obj) {
|
|
11
|
+
this.observers = new Map();
|
|
12
|
+
this.obj = obj;
|
|
13
|
+
}
|
|
14
|
+
return Mirror;
|
|
15
|
+
}());
|
|
16
|
+
var ObserverInfo = /** @class */ (function () {
|
|
17
|
+
function ObserverInfo(callback, observer) {
|
|
18
|
+
this.callback = callback;
|
|
19
|
+
this.observer = observer;
|
|
20
|
+
}
|
|
21
|
+
return ObserverInfo;
|
|
22
|
+
}());
|
|
23
|
+
function getMirror(obj) {
|
|
24
|
+
return beforeDict.get(obj);
|
|
25
|
+
}
|
|
26
|
+
function getObserverFromMirror(mirror, callback) {
|
|
27
|
+
return mirror.observers.get(callback);
|
|
28
|
+
}
|
|
29
|
+
function removeObserverFromMirror(mirror, observer) {
|
|
30
|
+
mirror.observers.delete(observer.callback);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Detach an observer from an object
|
|
34
|
+
*/
|
|
35
|
+
export function unobserve(root, observer) {
|
|
36
|
+
observer.unobserve();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Observes changes made to an object, which can then be retrieved using generate
|
|
40
|
+
*/
|
|
41
|
+
export function observe(obj, callback) {
|
|
42
|
+
var patches = [];
|
|
43
|
+
var observer;
|
|
44
|
+
var mirror = getMirror(obj);
|
|
45
|
+
if (!mirror) {
|
|
46
|
+
mirror = new Mirror(obj);
|
|
47
|
+
beforeDict.set(obj, mirror);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
var observerInfo = getObserverFromMirror(mirror, callback);
|
|
51
|
+
observer = observerInfo && observerInfo.observer;
|
|
52
|
+
}
|
|
53
|
+
if (observer) {
|
|
54
|
+
return observer;
|
|
55
|
+
}
|
|
56
|
+
observer = {};
|
|
57
|
+
mirror.value = _deepClone(obj);
|
|
58
|
+
if (callback) {
|
|
59
|
+
observer.callback = callback;
|
|
60
|
+
observer.next = null;
|
|
61
|
+
var dirtyCheck = function () {
|
|
62
|
+
generate(observer);
|
|
63
|
+
};
|
|
64
|
+
var fastCheck = function () {
|
|
65
|
+
clearTimeout(observer.next);
|
|
66
|
+
observer.next = setTimeout(dirtyCheck);
|
|
67
|
+
};
|
|
68
|
+
if (typeof window !== 'undefined') { //not Node
|
|
69
|
+
window.addEventListener('mouseup', fastCheck);
|
|
70
|
+
window.addEventListener('keyup', fastCheck);
|
|
71
|
+
window.addEventListener('mousedown', fastCheck);
|
|
72
|
+
window.addEventListener('keydown', fastCheck);
|
|
73
|
+
window.addEventListener('change', fastCheck);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
observer.patches = patches;
|
|
77
|
+
observer.object = obj;
|
|
78
|
+
observer.unobserve = function () {
|
|
79
|
+
generate(observer);
|
|
80
|
+
clearTimeout(observer.next);
|
|
81
|
+
removeObserverFromMirror(mirror, observer);
|
|
82
|
+
if (typeof window !== 'undefined') {
|
|
83
|
+
window.removeEventListener('mouseup', fastCheck);
|
|
84
|
+
window.removeEventListener('keyup', fastCheck);
|
|
85
|
+
window.removeEventListener('mousedown', fastCheck);
|
|
86
|
+
window.removeEventListener('keydown', fastCheck);
|
|
87
|
+
window.removeEventListener('change', fastCheck);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
mirror.observers.set(callback, new ObserverInfo(callback, observer));
|
|
91
|
+
return observer;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Generate an array of patches from an observer
|
|
95
|
+
*/
|
|
96
|
+
export function generate(observer, invertible) {
|
|
97
|
+
if (invertible === void 0) { invertible = false; }
|
|
98
|
+
var mirror = beforeDict.get(observer.object);
|
|
99
|
+
_generate(mirror.value, observer.object, observer.patches, "", invertible);
|
|
100
|
+
if (observer.patches.length) {
|
|
101
|
+
applyPatch(mirror.value, observer.patches);
|
|
102
|
+
}
|
|
103
|
+
var temp = observer.patches;
|
|
104
|
+
if (temp.length > 0) {
|
|
105
|
+
observer.patches = [];
|
|
106
|
+
if (observer.callback) {
|
|
107
|
+
observer.callback(temp);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return temp;
|
|
111
|
+
}
|
|
112
|
+
// Dirty check if obj is different from mirror, generate patches and update mirror
|
|
113
|
+
function _generate(mirror, obj, patches, path, invertible) {
|
|
114
|
+
if (obj === mirror) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (typeof obj.toJSON === "function") {
|
|
118
|
+
obj = obj.toJSON();
|
|
119
|
+
}
|
|
120
|
+
var newKeys = _objectKeys(obj);
|
|
121
|
+
var oldKeys = _objectKeys(mirror);
|
|
122
|
+
var changed = false;
|
|
123
|
+
var deleted = false;
|
|
124
|
+
//if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
|
|
125
|
+
for (var t = oldKeys.length - 1; t >= 0; t--) {
|
|
126
|
+
var key = oldKeys[t];
|
|
127
|
+
var oldVal = mirror[key];
|
|
128
|
+
if (hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
|
|
129
|
+
var newVal = obj[key];
|
|
130
|
+
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
|
|
131
|
+
_generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if (oldVal !== newVal) {
|
|
135
|
+
changed = true;
|
|
136
|
+
if (invertible) {
|
|
137
|
+
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
138
|
+
}
|
|
139
|
+
patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: _deepClone(newVal) });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (Array.isArray(mirror) === Array.isArray(obj)) {
|
|
144
|
+
if (invertible) {
|
|
145
|
+
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
146
|
+
}
|
|
147
|
+
patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) });
|
|
148
|
+
deleted = true; // property has been deleted
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (invertible) {
|
|
152
|
+
patches.push({ op: "test", path: path, value: mirror });
|
|
153
|
+
}
|
|
154
|
+
patches.push({ op: "replace", path: path, value: obj });
|
|
155
|
+
changed = true;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (!deleted && newKeys.length == oldKeys.length) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
for (var t = 0; t < newKeys.length; t++) {
|
|
162
|
+
var key = newKeys[t];
|
|
163
|
+
if (!hasOwnProperty(mirror, key) && obj[key] !== undefined) {
|
|
164
|
+
patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: _deepClone(obj[key]) });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Create an array of patches from the differences in two objects
|
|
170
|
+
*/
|
|
171
|
+
export function compare(tree1, tree2, invertible) {
|
|
172
|
+
if (invertible === void 0) { invertible = false; }
|
|
173
|
+
var patches = [];
|
|
174
|
+
_generate(tree1, tree2, patches, '', invertible);
|
|
175
|
+
return patches;
|
|
176
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
|
+
* (c) 2017-2022 Joachim Wester
|
|
4
|
+
* MIT licensed
|
|
5
|
+
*/
|
|
6
|
+
export declare function hasOwnProperty(obj: any, key: any): any;
|
|
7
|
+
export declare function _objectKeys(obj: any): any[];
|
|
8
|
+
/**
|
|
9
|
+
* Deeply clone the object.
|
|
10
|
+
* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
|
|
11
|
+
* @param {any} obj value to clone
|
|
12
|
+
* @return {any} cloned obj
|
|
13
|
+
*/
|
|
14
|
+
export declare function _deepClone(obj: any): any;
|
|
15
|
+
export declare function isInteger(str: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Escapes a json pointer path
|
|
18
|
+
* @param path The raw pointer
|
|
19
|
+
* @return the Escaped path
|
|
20
|
+
*/
|
|
21
|
+
export declare function escapePathComponent(path: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Unescapes a json pointer path
|
|
24
|
+
* @param path The escaped pointer
|
|
25
|
+
* @return The unescaped path
|
|
26
|
+
*/
|
|
27
|
+
export declare function unescapePathComponent(path: string): string;
|
|
28
|
+
export declare function _getPathRecursive(root: Object, obj: Object): string;
|
|
29
|
+
export declare function getPath(root: Object, obj: Object): string;
|
|
30
|
+
/**
|
|
31
|
+
* Recursively checks whether an object has any undefined values inside.
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasUndefined(obj: any): boolean;
|
|
34
|
+
export declare type JsonPatchErrorName = 'SEQUENCE_NOT_AN_ARRAY' | 'OPERATION_NOT_AN_OBJECT' | 'OPERATION_OP_INVALID' | 'OPERATION_PATH_INVALID' | 'OPERATION_FROM_REQUIRED' | 'OPERATION_VALUE_REQUIRED' | 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED' | 'OPERATION_PATH_CANNOT_ADD' | 'OPERATION_PATH_UNRESOLVABLE' | 'OPERATION_FROM_UNRESOLVABLE' | 'OPERATION_PATH_ILLEGAL_ARRAY_INDEX' | 'OPERATION_VALUE_OUT_OF_BOUNDS' | 'TEST_OPERATION_FAILED';
|
|
35
|
+
export declare class PatchError extends Error {
|
|
36
|
+
name: JsonPatchErrorName;
|
|
37
|
+
index?: number;
|
|
38
|
+
operation?: any;
|
|
39
|
+
tree?: any;
|
|
40
|
+
constructor(message: string, name: JsonPatchErrorName, index?: number, operation?: any, tree?: any);
|
|
41
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
|
+
* (c) 2017-2022 Joachim Wester
|
|
4
|
+
* MIT licensed
|
|
5
|
+
*/
|
|
6
|
+
var __extends = (this && this.__extends) || (function () {
|
|
7
|
+
var extendStatics = function (d, b) {
|
|
8
|
+
extendStatics = Object.setPrototypeOf ||
|
|
9
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
11
|
+
return extendStatics(d, b);
|
|
12
|
+
};
|
|
13
|
+
return function (d, b) {
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
20
|
+
export function hasOwnProperty(obj, key) {
|
|
21
|
+
return _hasOwnProperty.call(obj, key);
|
|
22
|
+
}
|
|
23
|
+
export function _objectKeys(obj) {
|
|
24
|
+
if (Array.isArray(obj)) {
|
|
25
|
+
var keys_1 = new Array(obj.length);
|
|
26
|
+
for (var k = 0; k < keys_1.length; k++) {
|
|
27
|
+
keys_1[k] = "" + k;
|
|
28
|
+
}
|
|
29
|
+
return keys_1;
|
|
30
|
+
}
|
|
31
|
+
if (Object.keys) {
|
|
32
|
+
return Object.keys(obj);
|
|
33
|
+
}
|
|
34
|
+
var keys = [];
|
|
35
|
+
for (var i in obj) {
|
|
36
|
+
if (hasOwnProperty(obj, i)) {
|
|
37
|
+
keys.push(i);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
;
|
|
43
|
+
/**
|
|
44
|
+
* Deeply clone the object.
|
|
45
|
+
* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
|
|
46
|
+
* @param {any} obj value to clone
|
|
47
|
+
* @return {any} cloned obj
|
|
48
|
+
*/
|
|
49
|
+
export function _deepClone(obj) {
|
|
50
|
+
switch (typeof obj) {
|
|
51
|
+
case "object":
|
|
52
|
+
return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
|
|
53
|
+
case "undefined":
|
|
54
|
+
return null; //this is how JSON.stringify behaves for array items
|
|
55
|
+
default:
|
|
56
|
+
return obj; //no need to clone primitives
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//3x faster than cached /^\d+$/.test(str)
|
|
60
|
+
export function isInteger(str) {
|
|
61
|
+
var i = 0;
|
|
62
|
+
var len = str.length;
|
|
63
|
+
var charCode;
|
|
64
|
+
while (i < len) {
|
|
65
|
+
charCode = str.charCodeAt(i);
|
|
66
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
67
|
+
i++;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Escapes a json pointer path
|
|
76
|
+
* @param path The raw pointer
|
|
77
|
+
* @return the Escaped path
|
|
78
|
+
*/
|
|
79
|
+
export function escapePathComponent(path) {
|
|
80
|
+
if (path.indexOf('/') === -1 && path.indexOf('~') === -1)
|
|
81
|
+
return path;
|
|
82
|
+
return path.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Unescapes a json pointer path
|
|
86
|
+
* @param path The escaped pointer
|
|
87
|
+
* @return The unescaped path
|
|
88
|
+
*/
|
|
89
|
+
export function unescapePathComponent(path) {
|
|
90
|
+
return path.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
91
|
+
}
|
|
92
|
+
export function _getPathRecursive(root, obj) {
|
|
93
|
+
var found;
|
|
94
|
+
for (var key in root) {
|
|
95
|
+
if (hasOwnProperty(root, key)) {
|
|
96
|
+
if (root[key] === obj) {
|
|
97
|
+
return escapePathComponent(key) + '/';
|
|
98
|
+
}
|
|
99
|
+
else if (typeof root[key] === 'object') {
|
|
100
|
+
found = _getPathRecursive(root[key], obj);
|
|
101
|
+
if (found != '') {
|
|
102
|
+
return escapePathComponent(key) + '/' + found;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
export function getPath(root, obj) {
|
|
110
|
+
if (root === obj) {
|
|
111
|
+
return '/';
|
|
112
|
+
}
|
|
113
|
+
var path = _getPathRecursive(root, obj);
|
|
114
|
+
if (path === '') {
|
|
115
|
+
throw new Error("Object not found in root");
|
|
116
|
+
}
|
|
117
|
+
return "/" + path;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Recursively checks whether an object has any undefined values inside.
|
|
121
|
+
*/
|
|
122
|
+
export function hasUndefined(obj) {
|
|
123
|
+
if (obj === undefined) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
if (obj) {
|
|
127
|
+
if (Array.isArray(obj)) {
|
|
128
|
+
for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
|
|
129
|
+
if (hasUndefined(obj[i_1])) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (typeof obj === "object") {
|
|
135
|
+
var objKeys = _objectKeys(obj);
|
|
136
|
+
var objKeysLength = objKeys.length;
|
|
137
|
+
for (var i = 0; i < objKeysLength; i++) {
|
|
138
|
+
if (hasUndefined(obj[objKeys[i]])) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
function patchErrorMessageFormatter(message, args) {
|
|
147
|
+
var messageParts = [message];
|
|
148
|
+
for (var key in args) {
|
|
149
|
+
var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
|
|
150
|
+
if (typeof value !== 'undefined') {
|
|
151
|
+
messageParts.push(key + ": " + value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return messageParts.join('\n');
|
|
155
|
+
}
|
|
156
|
+
var PatchError = /** @class */ (function (_super) {
|
|
157
|
+
__extends(PatchError, _super);
|
|
158
|
+
function PatchError(message, name, index, operation, tree) {
|
|
159
|
+
var _newTarget = this.constructor;
|
|
160
|
+
var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;
|
|
161
|
+
_this.name = name;
|
|
162
|
+
_this.index = index;
|
|
163
|
+
_this.operation = operation;
|
|
164
|
+
_this.tree = tree;
|
|
165
|
+
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359
|
|
166
|
+
_this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });
|
|
167
|
+
return _this;
|
|
168
|
+
}
|
|
169
|
+
return PatchError;
|
|
170
|
+
}(Error));
|
|
171
|
+
export { PatchError };
|
|
@@ -1,69 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"fast-deep-equal": "^2.0.1"
|
|
68
|
-
}
|
|
2
|
+
"name": "fast-json-patch",
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"description": "Fast implementation of JSON-Patch (RFC-6902) with duplex (observe changes) capabilities",
|
|
5
|
+
"homepage": "https://github.com/Starcounter-Jack/JSON-Patch",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"json",
|
|
8
|
+
"patch",
|
|
9
|
+
"http",
|
|
10
|
+
"rest"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git://github.com/Starcounter-Jack/JSON-Patch.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Starcounter-Jack/JSON-Patch/issues"
|
|
18
|
+
},
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Joachim Wester",
|
|
21
|
+
"email": "joachimwester@me.com",
|
|
22
|
+
"url": "http://www.starcounter.com/"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"main": "index.js",
|
|
26
|
+
"module": "index.mjs",
|
|
27
|
+
"typings": "index.d.ts",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"benchmark": "^2.1.4",
|
|
30
|
+
"bluebird": "^3.5.5",
|
|
31
|
+
"bluebird-retry": "^0.11.0",
|
|
32
|
+
"chalk": "^2.4.2",
|
|
33
|
+
"event-target-shim": "^5.0.1",
|
|
34
|
+
"fast-deep-equal": "^2.0.1",
|
|
35
|
+
"http-server": "^0.12.3",
|
|
36
|
+
"jasmine": "^3.4.0",
|
|
37
|
+
"request": "^2.88.0",
|
|
38
|
+
"sauce-connect-launcher": "^1.2.7",
|
|
39
|
+
"saucelabs": "^2.1.9",
|
|
40
|
+
"selenium-webdriver": "^4.0.0-alpha.4",
|
|
41
|
+
"typescript": "~3.5.2",
|
|
42
|
+
"webpack": "^4.35.0",
|
|
43
|
+
"webpack-cli": "^3.3.5"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"tsc": "npm run tsc-common && npm run tsc-module",
|
|
47
|
+
"tsc-common": "tsc",
|
|
48
|
+
"tsc-module": "tsc --module esnext --moduleResolution node --outDir \"module/\" && npm run tsc-to-mjs",
|
|
49
|
+
"tsc-to-mjs": "bash tsc-to-mjs.sh",
|
|
50
|
+
"version": "npm run tsc && webpack && git add -A",
|
|
51
|
+
"build": "npm run tsc && webpack",
|
|
52
|
+
"serve": "http-server -p 5000 --silent",
|
|
53
|
+
"tsc-watch": "tsc -w",
|
|
54
|
+
"test": "npm run tsc && npm run test-core && npm run test-duplex && npm run test-commonjs && npm run test-webpack-import && npm run test-typings",
|
|
55
|
+
"test-sauce": "npm run build && node test/Sauce/Runner.js",
|
|
56
|
+
"test-commonjs": "jasmine test/spec/commonjs/requireSpec.js",
|
|
57
|
+
"test-webpack-import": "webpack --env.NODE_ENV=test && jasmine test/spec/webpack/importSpec.build.js",
|
|
58
|
+
"test-typings": "tsc test/spec/typings/typingsSpec.ts",
|
|
59
|
+
"test-duplex": "node --experimental-modules jasmine-run.mjs test/**/*[sS]pec.mjs",
|
|
60
|
+
"test-core": "node --experimental-modules jasmine-run.mjs 'test/spec/{jsonPatchTestsSpec,coreSpec,validateSpec}.mjs'",
|
|
61
|
+
"bench": "npm run bench-core && npm run bench-duplex",
|
|
62
|
+
"bench-core": "node test/spec/coreBenchmark.js",
|
|
63
|
+
"bench-duplex": "node test/spec/coreBenchmark.js && node test/spec/duplexBenchmark.js"
|
|
64
|
+
}
|
|
69
65
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
cd module
|
|
3
|
+
mv core.js core.mjs && mv duplex.js duplex.mjs && mv helpers.js helpers.mjs
|
|
4
|
+
# Unlike Ubuntu, OS X requires the extension to be explicitly specified
|
|
5
|
+
# https://myshittycode.com/2014/07/24/os-x-sed-extra-characters-at-the-end-of-l-command-error/
|
|
6
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
7
|
+
sed -i '' 's/\.js/\.mjs/g' duplex.mjs core.mjs
|
|
8
|
+
else
|
|
9
|
+
sed -i 's/\.js/\.mjs/g' duplex.mjs core.mjs
|
|
10
|
+
fi
|
|
@@ -22,7 +22,7 @@ module.exports = env => {
|
|
|
22
22
|
else {
|
|
23
23
|
return [
|
|
24
24
|
{
|
|
25
|
-
entry: './
|
|
25
|
+
entry: './index.js',
|
|
26
26
|
mode: 'production',
|
|
27
27
|
optimization: {
|
|
28
28
|
minimize: false
|
|
@@ -40,7 +40,7 @@ module.exports = env => {
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
entry: './
|
|
43
|
+
entry: './index.js',
|
|
44
44
|
mode: 'production',
|
|
45
45
|
output: {
|
|
46
46
|
filename: 'fast-json-patch.min.js',
|
|
@@ -61,4 +61,3 @@ module.exports = env => {
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
|
package/package.json
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"json-schema": "^0.4.0",
|
|
65
65
|
"json-schema-to-typescript": "^10.1.5",
|
|
66
66
|
"npm-check-updates": "^12",
|
|
67
|
-
"projen": "^0.56.
|
|
67
|
+
"projen": "^0.56.38",
|
|
68
68
|
"standard-version": "^9",
|
|
69
69
|
"ts-jest": "^27",
|
|
70
70
|
"typescript": "^4.7.2"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"constructs": "^10"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"fast-json-patch": "^
|
|
76
|
+
"fast-json-patch": "^3.1.1",
|
|
77
77
|
"follow-redirects": "^1.15.1",
|
|
78
78
|
"yaml": "2.0.0-7"
|
|
79
79
|
},
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"main": "lib/index.js",
|
|
98
98
|
"license": "Apache-2.0",
|
|
99
|
-
"version": "2.3.
|
|
99
|
+
"version": "2.3.12",
|
|
100
100
|
"jest": {
|
|
101
101
|
"testMatch": [
|
|
102
102
|
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
|
package/releasetag.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v2.3.
|
|
1
|
+
v2.3.12
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.12
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
|
-
* (c) 2017 Joachim Wester
|
|
4
|
-
* MIT license
|
|
5
|
-
*/
|
|
6
|
-
import { _deepClone, escapePathComponent } from './helpers';
|
|
7
|
-
import { applyPatch, Operation } from './core';
|
|
8
|
-
export { applyOperation, applyPatch, applyReducer, getValueByPointer, Operation, AddOperation, RemoveOperation, ReplaceOperation, MoveOperation, CopyOperation, TestOperation, GetOperation, validate, validator, OperationResult } from './core';
|
|
9
|
-
export { PatchError as JsonPatchError, _deepClone as deepClone, escapePathComponent, unescapePathComponent } from './helpers';
|
|
10
|
-
export interface Observer<T> {
|
|
11
|
-
object: T;
|
|
12
|
-
patches: Operation[];
|
|
13
|
-
unobserve: () => void;
|
|
14
|
-
callback: (patches: Operation[]) => void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Detach an observer from an object
|
|
18
|
-
*/
|
|
19
|
-
export declare function unobserve<T>(root: T, observer: Observer<T>): void;
|
|
20
|
-
/**
|
|
21
|
-
* Observes changes made to an object, which can then be retrieved using generate
|
|
22
|
-
*/
|
|
23
|
-
export declare function observe<T>(obj: Object | Array<T>, callback?: (patches: Operation[]) => void): Observer<T>;
|
|
24
|
-
/**
|
|
25
|
-
* Generate an array of patches from an observer
|
|
26
|
-
*/
|
|
27
|
-
export declare function generate<T>(observer: Observer<Object>, invertible?: boolean): Operation[];
|
|
28
|
-
/**
|
|
29
|
-
* Create an array of patches from the differences in two objects
|
|
30
|
-
*/
|
|
31
|
-
export declare function compare(tree1: Object | Array<any>, tree2: Object | Array<any>, invertible?: boolean): Operation[];
|
|
32
|
-
/**
|
|
33
|
-
* Default export for backwards compat
|
|
34
|
-
*/
|
|
35
|
-
import * as core from './core';
|
|
36
|
-
import { PatchError as JsonPatchError, unescapePathComponent } from './helpers';
|
|
37
|
-
declare const _default: {
|
|
38
|
-
unobserve: typeof unobserve;
|
|
39
|
-
observe: typeof observe;
|
|
40
|
-
generate: typeof generate;
|
|
41
|
-
compare: typeof compare;
|
|
42
|
-
JsonPatchError: typeof JsonPatchError;
|
|
43
|
-
deepClone: typeof _deepClone;
|
|
44
|
-
escapePathComponent: typeof escapePathComponent;
|
|
45
|
-
unescapePathComponent: typeof unescapePathComponent;
|
|
46
|
-
getValueByPointer(document: any, pointer: string): any;
|
|
47
|
-
applyOperation<T>(document: T, operation: Operation, validateOperation?: boolean | core.Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean, index?: number): core.OperationResult<T>;
|
|
48
|
-
applyPatch<T>(document: T, patch: Operation[], validateOperation?: boolean | core.Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean): core.PatchResult<T>;
|
|
49
|
-
applyReducer<T>(document: T, operation: Operation, index: number): T;
|
|
50
|
-
validator(operation: Operation, index: number, document?: any, existingPathFragment?: string): void;
|
|
51
|
-
validate<T>(sequence: Operation[], document?: T, externalValidator?: core.Validator<T>): JsonPatchError;
|
|
52
|
-
default: {
|
|
53
|
-
JsonPatchError: typeof JsonPatchError;
|
|
54
|
-
deepClone: typeof _deepClone;
|
|
55
|
-
getValueByPointer: typeof core.getValueByPointer;
|
|
56
|
-
applyOperation: typeof core.applyOperation;
|
|
57
|
-
applyPatch: typeof applyPatch;
|
|
58
|
-
applyReducer: typeof core.applyReducer;
|
|
59
|
-
validator: typeof core.validator;
|
|
60
|
-
validate: typeof core.validate;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
export default _default;
|