Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

49
spa/node_modules/just-diff/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,49 @@
# just-diff
## 6.0.2
### Patch Changes
- Fixes #543. Remove recursing multiple permutations in favor of deciding upfront whether left or right trim is the most efficient.
## 6.0.1
### Patch Changes
- issue #544 Fix case that should be 'add' not 'replace'
## 6.0.0
### Major Changes
- 1669fd90: optimize diff path: trim from left and right (recursviely) and use shortest path, replace at root level if values are of different type. Addresses https://github.com/angus-c/just/issues/505
## 5.2.0
### Minor Changes
- Rename node module .js -> .cjs
## 5.1.1
### Patch Changes
- fix: reorder exports to set default last #488
## 5.1.0
### Minor Changes
- package.json updates to fix #467 and #483
## 5.0.3
### Patch Changes
- Keep ESMs in sync with commonJS modules
## 5.0.2
### Patch Changes
- Fixed issue where remove diffs were sometimes not reversed

21
spa/node_modules/just-diff/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 angus croll
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

86
spa/node_modules/just-diff/README.md generated vendored Normal file
View File

@@ -0,0 +1,86 @@
<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE -->
<!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template -->
## just-diff
Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.
[`🍦 Try it`](https://anguscroll.com/just/just-diff)
```shell
npm install just-diff
```
```shell
yarn add just-diff
```
Return an object representing the difference between two other objects
Pass converter to format as http://jsonpatch.com
```js
import {diff} from 'just-diff';
const obj1 = {a: 4, b: 5};
const obj2 = {a: 3, b: 5};
const obj3 = {a: 4, c: 5};
diff(obj1, obj2);
[
{ "op": "replace", "path": ['a'], "value": 3 }
]
diff(obj2, obj3);
[
{ "op": "remove", "path": ['b'] },
{ "op": "replace", "path": ['a'], "value": 4 }
{ "op": "add", "path": ['c'], "value": 5 }
]
// using converter to generate jsPatch standard paths
import {diff, jsonPatchPathConverter} from 'just-diff'
diff(obj1, obj2, jsonPatchPathConverter);
[
{ "op": "replace", "path": '/a', "value": 3 }
]
diff(obj2, obj3, jsonPatchPathConverter);
[
{ "op": "remove", "path": '/b' },
{ "op": "replace", "path": '/a', "value": 4 }
{ "op": "add", "path": '/c', "value": 5 }
]
// arrays
const obj4 = {a: 4, b: [1, 2, 3]};
const obj5 = {a: 3, b: [1, 2, 4]};
const obj6 = {a: 3, b: [1, 2, 4, 5]};
diff(obj4, obj5);
[
{ "op": "replace", "path": ['a'], "value": 3 }
{ "op": "replace", "path": ['b', 2], "value": 4 }
]
diff(obj5, obj6);
[
{ "op": "add", "path": ['b', 3], "value": 5 }
]
// nested paths
const obj7 = {a: 4, b: {c: 3}};
const obj8 = {a: 4, b: {c: 4}};
const obj9 = {a: 5, b: {d: 4}};
diff(obj7, obj8);
[
{ "op": "replace", "path": ['b', 'c'], "value": 4 }
]
diff(obj8, obj9);
[
{ "op": "replace", "path": ['a'], "value": 5 }
{ "op": "remove", "path": ['b', 'c']}
{ "op": "add", "path": ['b', 'd'], "value": 4 }
]
```

230
spa/node_modules/just-diff/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,230 @@
module.exports = {
diff: diff,
jsonPatchPathConverter: jsonPatchPathConverter,
};
/*
const obj1 = {a: 4, b: 5};
const obj2 = {a: 3, b: 5};
const obj3 = {a: 4, c: 5};
diff(obj1, obj2);
[
{ "op": "replace", "path": ['a'], "value": 3 }
]
diff(obj2, obj3);
[
{ "op": "remove", "path": ['b'] },
{ "op": "replace", "path": ['a'], "value": 4 }
{ "op": "add", "path": ['c'], "value": 5 }
]
// using converter to generate jsPatch standard paths
// see http://jsonpatch.com
import {diff, jsonPatchPathConverter} from 'just-diff'
diff(obj1, obj2, jsonPatchPathConverter);
[
{ "op": "replace", "path": '/a', "value": 3 }
]
diff(obj2, obj3, jsonPatchPathConverter);
[
{ "op": "remove", "path": '/b' },
{ "op": "replace", "path": '/a', "value": 4 }
{ "op": "add", "path": '/c', "value": 5 }
]
// arrays
const obj4 = {a: 4, b: [1, 2, 3]};
const obj5 = {a: 3, b: [1, 2, 4]};
const obj6 = {a: 3, b: [1, 2, 4, 5]};
diff(obj4, obj5);
[
{ "op": "replace", "path": ['a'], "value": 3 }
{ "op": "replace", "path": ['b', 2], "value": 4 }
]
diff(obj5, obj6);
[
{ "op": "add", "path": ['b', 3], "value": 5 }
]
// nested paths
const obj7 = {a: 4, b: {c: 3}};
const obj8 = {a: 4, b: {c: 4}};
const obj9 = {a: 5, b: {d: 4}};
diff(obj7, obj8);
[
{ "op": "replace", "path": ['b', 'c'], "value": 4 }
]
diff(obj8, obj9);
[
{ "op": "replace", "path": ['a'], "value": 5 }
{ "op": "remove", "path": ['b', 'c']}
{ "op": "add", "path": ['b', 'd'], "value": 4 }
]
*/
function diff(obj1, obj2, pathConverter) {
if (!obj1 || typeof obj1 != 'object' || !obj2 || typeof obj2 != 'object') {
throw new Error('both arguments must be objects or arrays');
}
pathConverter ||
(pathConverter = function(arr) {
return arr;
});
function getDiff({obj1, obj2, basePath, basePathForRemoves, diffs}) {
var obj1Keys = Object.keys(obj1);
var obj1KeysLength = obj1Keys.length;
var obj2Keys = Object.keys(obj2);
var obj2KeysLength = obj2Keys.length;
var path;
var lengthDelta = obj1.length - obj2.length;
if (trimFromRight(obj1, obj2)) {
for (var i = 0; i < obj1KeysLength; i++) {
var key = Array.isArray(obj1) ? Number(obj1Keys[i]) : obj1Keys[i];
if (!(key in obj2)) {
path = basePathForRemoves.concat(key);
diffs.remove.push({
op: 'remove',
path: pathConverter(path),
});
}
}
for (var i = 0; i < obj2KeysLength; i++) {
var key = Array.isArray(obj2) ? Number(obj2Keys[i]) : obj2Keys[i];
pushReplaces({
key,
obj1,
obj2,
path: basePath.concat(key),
pathForRemoves: basePath.concat(key),
diffs,
});
}
} else {
// trim from left, objects are both arrays
for (var i = 0; i < lengthDelta; i++) {
path = basePathForRemoves.concat(i);
diffs.remove.push({
op: 'remove',
path: pathConverter(path),
});
}
// now make a copy of obj1 with excess elements left trimmed and see if there any replaces
var obj1Trimmed = obj1.slice(lengthDelta);;
for (var i = 0; i < obj2KeysLength; i++) {
pushReplaces({
key: i,
obj1: obj1Trimmed,
obj2,
path: basePath.concat(i),
// since list of removes are reversed before presenting result,
// we need to ignore existing parent removes when doing nested removes
pathForRemoves: basePath.concat(i + lengthDelta),
diffs,
});
}
}
}
var diffs = {remove: [], replace: [], add: []};
getDiff({
obj1,
obj2,
basePath: [],
basePathForRemoves: [],
diffs,
});
// reverse removes since we want to maintain indexes
return diffs.remove
.reverse()
.concat(diffs.replace)
.concat(diffs.add);
function pushReplaces({key, obj1, obj2, path, pathForRemoves, diffs}) {
var obj1AtKey = obj1[key];
var obj2AtKey = obj2[key];
if(!(key in obj1) && (key in obj2)) {
var obj2Value = obj2AtKey;
diffs.add.push({
op: 'add',
path: pathConverter(path),
value: obj2Value,
});
} else if(obj1AtKey !== obj2AtKey) {
if(Object(obj1AtKey) !== obj1AtKey ||
Object(obj2AtKey) !== obj2AtKey || differentTypes(obj1AtKey, obj2AtKey)
) {
pushReplace(path, diffs, obj2AtKey);
} else {
if(!Object.keys(obj1AtKey).length &&
!Object.keys(obj2AtKey).length &&
String(obj1AtKey) != String(obj2AtKey)) {
pushReplace(path, diffs, obj2AtKey);
} else {
getDiff({
obj1: obj1[key],
obj2: obj2[key],
basePath: path,
basePathForRemoves: pathForRemoves,
diffs});
}
}
}
}
function pushReplace(path, diffs, newValue) {
diffs.replace.push({
op: 'replace',
path: pathConverter(path),
value: newValue,
});
}
}
function jsonPatchPathConverter(arrayPath) {
return [''].concat(arrayPath).join('/');
}
function differentTypes(a, b) {
return Object.prototype.toString.call(a) != Object.prototype.toString.call(b);
}
function trimFromRight(obj1, obj2) {
var lengthDelta = obj1.length - obj2.length;
if (Array.isArray(obj1) && Array.isArray(obj2) && lengthDelta > 0) {
var leftMatches = 0;
var rightMatches = 0;
for (var i = 0; i < obj2.length; i++) {
if (String(obj1[i]) === String(obj2[i])) {
leftMatches++;
} else {
break;
}
}
for (var j = obj2.length; j > 0; j--) {
if (String(obj1[j + lengthDelta]) === String(obj2[j])) {
rightMatches++;
} else {
break;
}
}
// bias to trim right becase it requires less index shifting
return leftMatches >= rightMatches;
}
return true;
}

20
spa/node_modules/just-diff/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
// Definitions by: Cameron Hunter <https://github.com/cameronhunter>
// Modified by: Angus Croll <https://github.com/angus-c>
type Operation = "add" | "replace" | "remove";
type JSONPatchPathConverter<OUTPUT> = (
arrayPath: Array<string | number>
) => OUTPUT;
export function diff(
a: object | Array<any>,
b: object | Array<any>,
): Array<{ op: Operation; path: Array<string | number>; value: any }>;
export function diff<PATH>(
a: object | Array<any>,
b: object | Array<any>,
jsonPatchPathConverter: JSONPatchPathConverter<PATH>
): Array<{ op: Operation; path: PATH; value: any }>;
export const jsonPatchPathConverter: JSONPatchPathConverter<string>;

227
spa/node_modules/just-diff/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,227 @@
/*
const obj1 = {a: 4, b: 5};
const obj2 = {a: 3, b: 5};
const obj3 = {a: 4, c: 5};
diff(obj1, obj2);
[
{ "op": "replace", "path": ['a'], "value": 3 }
]
diff(obj2, obj3);
[
{ "op": "remove", "path": ['b'] },
{ "op": "replace", "path": ['a'], "value": 4 }
{ "op": "add", "path": ['c'], "value": 5 }
]
// using converter to generate jsPatch standard paths
// see http://jsonpatch.com
import {diff, jsonPatchPathConverter} from 'just-diff'
diff(obj1, obj2, jsonPatchPathConverter);
[
{ "op": "replace", "path": '/a', "value": 3 }
]
diff(obj2, obj3, jsonPatchPathConverter);
[
{ "op": "remove", "path": '/b' },
{ "op": "replace", "path": '/a', "value": 4 }
{ "op": "add", "path": '/c', "value": 5 }
]
// arrays
const obj4 = {a: 4, b: [1, 2, 3]};
const obj5 = {a: 3, b: [1, 2, 4]};
const obj6 = {a: 3, b: [1, 2, 4, 5]};
diff(obj4, obj5);
[
{ "op": "replace", "path": ['a'], "value": 3 }
{ "op": "replace", "path": ['b', 2], "value": 4 }
]
diff(obj5, obj6);
[
{ "op": "add", "path": ['b', 3], "value": 5 }
]
// nested paths
const obj7 = {a: 4, b: {c: 3}};
const obj8 = {a: 4, b: {c: 4}};
const obj9 = {a: 5, b: {d: 4}};
diff(obj7, obj8);
[
{ "op": "replace", "path": ['b', 'c'], "value": 4 }
]
diff(obj8, obj9);
[
{ "op": "replace", "path": ['a'], "value": 5 }
{ "op": "remove", "path": ['b', 'c']}
{ "op": "add", "path": ['b', 'd'], "value": 4 }
]
*/
function diff(obj1, obj2, pathConverter) {
if (!obj1 || typeof obj1 != 'object' || !obj2 || typeof obj2 != 'object') {
throw new Error('both arguments must be objects or arrays');
}
pathConverter ||
(pathConverter = function(arr) {
return arr;
});
function getDiff({obj1, obj2, basePath, basePathForRemoves, diffs}) {
var obj1Keys = Object.keys(obj1);
var obj1KeysLength = obj1Keys.length;
var obj2Keys = Object.keys(obj2);
var obj2KeysLength = obj2Keys.length;
var path;
var lengthDelta = obj1.length - obj2.length;
if (trimFromRight(obj1, obj2)) {
for (var i = 0; i < obj1KeysLength; i++) {
var key = Array.isArray(obj1) ? Number(obj1Keys[i]) : obj1Keys[i];
if (!(key in obj2)) {
path = basePathForRemoves.concat(key);
diffs.remove.push({
op: 'remove',
path: pathConverter(path),
});
}
}
for (var i = 0; i < obj2KeysLength; i++) {
var key = Array.isArray(obj2) ? Number(obj2Keys[i]) : obj2Keys[i];
pushReplaces({
key,
obj1,
obj2,
path: basePath.concat(key),
pathForRemoves: basePath.concat(key),
diffs,
});
}
} else {
// trim from left, objects are both arrays
for (var i = 0; i < lengthDelta; i++) {
path = basePathForRemoves.concat(i);
diffs.remove.push({
op: 'remove',
path: pathConverter(path),
});
}
// now make a copy of obj1 with excess elements left trimmed and see if there any replaces
var obj1Trimmed = obj1.slice(lengthDelta);;
for (var i = 0; i < obj2KeysLength; i++) {
pushReplaces({
key: i,
obj1: obj1Trimmed,
obj2,
path: basePath.concat(i),
// since list of removes are reversed before presenting result,
// we need to ignore existing parent removes when doing nested removes
pathForRemoves: basePath.concat(i + lengthDelta),
diffs,
});
}
}
}
var diffs = {remove: [], replace: [], add: []};
getDiff({
obj1,
obj2,
basePath: [],
basePathForRemoves: [],
diffs,
});
// reverse removes since we want to maintain indexes
return diffs.remove
.reverse()
.concat(diffs.replace)
.concat(diffs.add);
function pushReplaces({key, obj1, obj2, path, pathForRemoves, diffs}) {
var obj1AtKey = obj1[key];
var obj2AtKey = obj2[key];
if(!(key in obj1) && (key in obj2)) {
var obj2Value = obj2AtKey;
diffs.add.push({
op: 'add',
path: pathConverter(path),
value: obj2Value,
});
} else if(obj1AtKey !== obj2AtKey) {
if(Object(obj1AtKey) !== obj1AtKey ||
Object(obj2AtKey) !== obj2AtKey || differentTypes(obj1AtKey, obj2AtKey)
) {
pushReplace(path, diffs, obj2AtKey);
} else {
if(!Object.keys(obj1AtKey).length &&
!Object.keys(obj2AtKey).length &&
String(obj1AtKey) != String(obj2AtKey)) {
pushReplace(path, diffs, obj2AtKey);
} else {
getDiff({
obj1: obj1[key],
obj2: obj2[key],
basePath: path,
basePathForRemoves: pathForRemoves,
diffs});
}
}
}
}
function pushReplace(path, diffs, newValue) {
diffs.replace.push({
op: 'replace',
path: pathConverter(path),
value: newValue,
});
}
}
function jsonPatchPathConverter(arrayPath) {
return [''].concat(arrayPath).join('/');
}
function differentTypes(a, b) {
return Object.prototype.toString.call(a) != Object.prototype.toString.call(b);
}
function trimFromRight(obj1, obj2) {
var lengthDelta = obj1.length - obj2.length;
if (Array.isArray(obj1) && Array.isArray(obj2) && lengthDelta > 0) {
var leftMatches = 0;
var rightMatches = 0;
for (var i = 0; i < obj2.length; i++) {
if (String(obj1[i]) === String(obj2[i])) {
leftMatches++;
} else {
break;
}
}
for (var j = obj2.length; j > 0; j--) {
if (String(obj1[j + lengthDelta]) === String(obj2[j])) {
rightMatches++;
} else {
break;
}
}
// bias to trim right becase it requires less index shifting
return leftMatches >= rightMatches;
}
return true;
}
export {diff, jsonPatchPathConverter};

65
spa/node_modules/just-diff/index.tests.ts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
import * as diffObj from './index'
const {diff, jsonPatchPathConverter} = diffObj;
const obj1 = {a: 2, b: 3};
const obj2 = {a: 2, c: 1};
const arr1 = [1, 'bee'];
const arr2 = [2, 'bee'];
//OK
diff(obj1, obj2);
diff(arr1, arr2);
diff(obj1, arr1);
diff(obj2, arr2);
diff(/yes/, arr1);
diff(new Date(), arr2);
diff(obj1, obj2, jsonPatchPathConverter);
diff(arr1, arr2, jsonPatchPathConverter);
diff(obj1, arr1, jsonPatchPathConverter);
diff(obj2, arr2, jsonPatchPathConverter);
// not OK
// @ts-expect-error
diff(obj1);
// @ts-expect-error
diff(arr2);
// @ts-expect-error
diff('a');
// @ts-expect-error
diff(true);
// @ts-expect-error
diff(obj1, 1);
// @ts-expect-error
diff(3, arr2);
// @ts-expect-error
diff(obj1, 'a');
// @ts-expect-error
diff('b', arr2);
// @ts-expect-error
diff('a', jsonPatchPathConverter);
// @ts-expect-error
diff(true, jsonPatchPathConverter);
// @ts-expect-error
diff(obj1, 1, jsonPatchPathConverter);
// @ts-expect-error
diff(3, arr2, jsonPatchPathConverter);
// @ts-expect-error
diff(obj1, 'a', jsonPatchPathConverter);
// @ts-expect-error
diff('b', arr2, jsonPatchPathConverter);
// @ts-expect-error
diff(obj1, obj2, 'a');
// @ts-expect-error
diff(arr1, arr2, 1);
// @ts-expect-error
diff(obj1, arr1, 'bee');
// @ts-expect-error
diff(obj2, arr2, 'nope');

33
spa/node_modules/just-diff/package.json generated vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "just-diff",
"version": "6.0.2",
"description": "Return an object representing the diffs between two objects. Supports jsonPatch protocol",
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"require": "./index.cjs",
"import": "./index.mjs"
},
"./package.json": "./package.json"
},
"main": "index.cjs",
"types": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c"
},
"repository": "https://github.com/angus-c/just",
"keywords": [
"object",
"diff",
"jsonPatch",
"no-dependencies",
"just"
],
"author": "Angus Croll",
"license": "MIT",
"bugs": {
"url": "https://github.com/angus-c/just/issues"
}
}

3
spa/node_modules/just-diff/rollup.config.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
const createRollupConfig = require('../../config/createRollupConfig');
module.exports = createRollupConfig(__dirname);