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

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

@@ -0,0 +1,43 @@
# just-diff-apply
## 5.5.0
### Minor Changes
- Rename node module .js -> .cjs
## 5.4.1
### Patch Changes
- fix: reorder exports to set default last #488
## 5.4.0
### Minor Changes
- package.json updates to fix #467 and #483
## 5.3.1
### Patch Changes
- Fix README
## 5.3.0
### Minor Changes
- Update .mjs module and d.ts
## 5.2.0
### Minor Changes
- Add support for 'move' op (https://datatracker.ietf.org/doc/html/rfc6902#section-4.4)
## 5.0.0
### Major Changes
- Disallow prototype updates

21
spa/node_modules/just-diff-apply/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.

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

@@ -0,0 +1,69 @@
<!-- 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-apply
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-apply)
```shell
npm install just-diff-apply
```
```shell
yarn add just-diff-apply
```
Apply a diff object to an object. Pass converter to apply a http://jsonpatch.com standard patch
```js
import {diffApply} from 'just-diff-apply';
const obj1 = {a: 3, b: 5};
diffApply(obj1,
[
{ "op": "remove", "path": ['b'] },
{ "op": "replace", "path": ['a'], "value": 4 },
{ "op": "add", "path": ['c'], "value": 5 }
]
);
obj1; // {a: 4, c: 5}
const obj2 = {a: 3, b: 5};
diffApply(obj2,
[
{ "op": "move", "from": ['a'], "path": ['c']},
]
);
obj2; // {b: 5, c: 3}
// using converter to apply jsPatch standard paths
// see http://jsonpatch.com
import {diffApply, jsonPatchPathConverter} from 'just-diff-apply'
const obj3 = {a: 3, b: 5};
diffApply(obj3, [
{ "op": "remove", "path": '/b' },
{ "op": "replace", "path": '/a', "value": 4 }
{ "op": "add", "path": '/c', "value": 5 }
], jsonPatchPathConverter);
obj3; // {a: 4, c: 5}
// arrays (array key can be string or numeric)
const obj4 = {a: 4, b: [1, 2, 3]};
diffApply(obj4, [
{ "op": "replace", "path": ['a'], "value": 3 }
{ "op": "replace", "path": ['b', 2], "value": 4 }
{ "op": "add", "path": ['b', 3], "value": 9 }
]);
obj4; // {a: 3, b: [1, 2, 4, 9]}
// nested paths
const obj5 = {a: 4, b: {c: 3}};
diffApply(obj5, [
{ "op": "replace", "path": ['a'], "value": 5 }
{ "op": "remove", "path": ['b', 'c']}
{ "op": "add", "path": ['b', 'd'], "value": 4 }
]);
obj5; // {a: 5, b: {d: 4}}
```

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

@@ -0,0 +1,161 @@
module.exports = {
diffApply: diffApply,
jsonPatchPathConverter: jsonPatchPathConverter,
};
/*
const obj1 = {a: 3, b: 5};
diffApply(obj1,
[
{ "op": "remove", "path": ['b'] },
{ "op": "replace", "path": ['a'], "value": 4 },
{ "op": "add", "path": ['c'], "value": 5 }
]
);
obj1; // {a: 4, c: 5}
// using converter to apply jsPatch standard paths
// see http://jsonpatch.com
import {diff, jsonPatchPathConverter} from 'just-diff'
const obj2 = {a: 3, b: 5};
diffApply(obj2, [
{ "op": "remove", "path": '/b' },
{ "op": "replace", "path": '/a', "value": 4 }
{ "op": "add", "path": '/c', "value": 5 }
], jsonPatchPathConverter);
obj2; // {a: 4, c: 5}
// arrays
const obj3 = {a: 4, b: [1, 2, 3]};
diffApply(obj3, [
{ "op": "replace", "path": ['a'], "value": 3 }
{ "op": "replace", "path": ['b', 2], "value": 4 }
{ "op": "add", "path": ['b', 3], "value": 9 }
]);
obj3; // {a: 3, b: [1, 2, 4, 9]}
// nested paths
const obj4 = {a: 4, b: {c: 3}};
diffApply(obj4, [
{ "op": "replace", "path": ['a'], "value": 5 }
{ "op": "remove", "path": ['b', 'c']}
{ "op": "add", "path": ['b', 'd'], "value": 4 }
]);
obj4; // {a: 5, b: {d: 4}}
*/
var REMOVE = 'remove';
var REPLACE = 'replace';
var ADD = 'add';
var MOVE = 'move';
function diffApply(obj, diff, pathConverter) {
if (!obj || typeof obj != 'object') {
throw new Error('base object must be an object or an array');
}
if (!Array.isArray(diff)) {
throw new Error('diff must be an array');
}
var diffLength = diff.length;
for (var i = 0; i < diffLength; i++) {
var thisDiff = diff[i];
var subObject = obj;
var thisOp = thisDiff.op;
var thisPath = transformPath(pathConverter, thisDiff.path);
var thisFromPath = thisDiff.from && transformPath(pathConverter, thisDiff.from);
var toPath, toPathCopy, lastToProp, subToObject, valueToMove;
if (thisFromPath) {
// MOVE only, "fromPath" is effectively path and "path" is toPath
toPath = thisPath;
thisPath = thisFromPath;
toPathCopy = toPath.slice();
lastToProp = toPathCopy.pop();
prototypeCheck(lastToProp);
if (lastToProp == null) {
return false;
}
var thisToProp;
while (((thisToProp = toPathCopy.shift())) != null) {
prototypeCheck(thisToProp);
if (!(thisToProp in subToObject)) {
subToObject[thisToProp] = {};
}
subToObject = subToObject[thisToProp];
}
}
var pathCopy = thisPath.slice();
var lastProp = pathCopy.pop();
prototypeCheck(lastProp);
if (lastProp == null) {
return false;
}
var thisProp;
while (((thisProp = pathCopy.shift())) != null) {
prototypeCheck(thisProp);
if (!(thisProp in subObject)) {
subObject[thisProp] = {};
}
subObject = subObject[thisProp];
}
if (thisOp === REMOVE || thisOp === REPLACE || thisOp === MOVE) {
var path = thisOp === MOVE ? thisDiff.from : thisDiff.path;
if (!subObject.hasOwnProperty(lastProp)) {
throw new Error(['expected to find property', path, 'in object', obj].join(' '));
}
}
if (thisOp === REMOVE || thisOp === MOVE) {
if (thisOp === MOVE) {
valueToMove = subObject[lastProp];
}
Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp];
}
if (thisOp === REPLACE || thisOp === ADD) {
subObject[lastProp] = thisDiff.value;
}
if (thisOp === MOVE) {
subObject[lastToProp] = valueToMove;
}
}
return subObject;
}
function transformPath(pathConverter, thisPath) {
if(pathConverter) {
thisPath = pathConverter(thisPath);
if(!Array.isArray(thisPath)) {
throw new Error([
'pathConverter must return an array, returned:',
thisPath,
].join(' '));
}
} else {
if(!Array.isArray(thisPath)) {
throw new Error([
'diff path',
thisPath,
'must be an array, consider supplying a path converter']
.join(' '));
}
}
return thisPath;
}
function jsonPatchPathConverter(stringPath) {
return stringPath.split('/').slice(1);
}
function prototypeCheck(prop) {
// coercion is intentional to catch prop values like `['__proto__']`
if (prop == '__proto__' || prop == 'constructor' || prop == 'prototype') {
throw new Error('setting of prototype values not supported');
}
}

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

@@ -0,0 +1,17 @@
// Definitions by: Eddie Atkinson <https://github.com/eddie-atkinson>
type Operation = "add" | "replace" | "remove" | "move";
type DiffOps = Array<{
op: Operation;
path: Array<string | number>;
value?: any;
}>;
type PathConverter = (path: string) => string[];
export function diffApply<T extends object>(
obj: T,
diff: DiffOps,
pathConverter?: PathConverter
): T;
export const jsonPatchPathConverter: PathConverter;

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

@@ -0,0 +1,158 @@
/*
const obj1 = {a: 3, b: 5};
diffApply(obj1,
[
{ "op": "remove", "path": ['b'] },
{ "op": "replace", "path": ['a'], "value": 4 },
{ "op": "add", "path": ['c'], "value": 5 }
]
);
obj1; // {a: 4, c: 5}
// using converter to apply jsPatch standard paths
// see http://jsonpatch.com
import {diff, jsonPatchPathConverter} from 'just-diff'
const obj2 = {a: 3, b: 5};
diffApply(obj2, [
{ "op": "remove", "path": '/b' },
{ "op": "replace", "path": '/a', "value": 4 }
{ "op": "add", "path": '/c', "value": 5 }
], jsonPatchPathConverter);
obj2; // {a: 4, c: 5}
// arrays
const obj3 = {a: 4, b: [1, 2, 3]};
diffApply(obj3, [
{ "op": "replace", "path": ['a'], "value": 3 }
{ "op": "replace", "path": ['b', 2], "value": 4 }
{ "op": "add", "path": ['b', 3], "value": 9 }
]);
obj3; // {a: 3, b: [1, 2, 4, 9]}
// nested paths
const obj4 = {a: 4, b: {c: 3}};
diffApply(obj4, [
{ "op": "replace", "path": ['a'], "value": 5 }
{ "op": "remove", "path": ['b', 'c']}
{ "op": "add", "path": ['b', 'd'], "value": 4 }
]);
obj4; // {a: 5, b: {d: 4}}
*/
var REMOVE = 'remove';
var REPLACE = 'replace';
var ADD = 'add';
var MOVE = 'move';
function diffApply(obj, diff, pathConverter) {
if (!obj || typeof obj != 'object') {
throw new Error('base object must be an object or an array');
}
if (!Array.isArray(diff)) {
throw new Error('diff must be an array');
}
var diffLength = diff.length;
for (var i = 0; i < diffLength; i++) {
var thisDiff = diff[i];
var subObject = obj;
var thisOp = thisDiff.op;
var thisPath = transformPath(pathConverter, thisDiff.path);
var thisFromPath = thisDiff.from && transformPath(pathConverter, thisDiff.from);
var toPath, toPathCopy, lastToProp, subToObject, valueToMove;
if (thisFromPath) {
// MOVE only, "fromPath" is effectively path and "path" is toPath
toPath = thisPath;
thisPath = thisFromPath;
toPathCopy = toPath.slice();
lastToProp = toPathCopy.pop();
prototypeCheck(lastToProp);
if (lastToProp == null) {
return false;
}
var thisToProp;
while (((thisToProp = toPathCopy.shift())) != null) {
prototypeCheck(thisToProp);
if (!(thisToProp in subToObject)) {
subToObject[thisToProp] = {};
}
subToObject = subToObject[thisToProp];
}
}
var pathCopy = thisPath.slice();
var lastProp = pathCopy.pop();
prototypeCheck(lastProp);
if (lastProp == null) {
return false;
}
var thisProp;
while (((thisProp = pathCopy.shift())) != null) {
prototypeCheck(thisProp);
if (!(thisProp in subObject)) {
subObject[thisProp] = {};
}
subObject = subObject[thisProp];
}
if (thisOp === REMOVE || thisOp === REPLACE || thisOp === MOVE) {
var path = thisOp === MOVE ? thisDiff.from : thisDiff.path;
if (!subObject.hasOwnProperty(lastProp)) {
throw new Error(['expected to find property', path, 'in object', obj].join(' '));
}
}
if (thisOp === REMOVE || thisOp === MOVE) {
if (thisOp === MOVE) {
valueToMove = subObject[lastProp];
}
Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp];
}
if (thisOp === REPLACE || thisOp === ADD) {
subObject[lastProp] = thisDiff.value;
}
if (thisOp === MOVE) {
subObject[lastToProp] = valueToMove;
}
}
return subObject;
}
function transformPath(pathConverter, thisPath) {
if(pathConverter) {
thisPath = pathConverter(thisPath);
if(!Array.isArray(thisPath)) {
throw new Error([
'pathConverter must return an array, returned:',
thisPath,
].join(' '));
}
} else {
if(!Array.isArray(thisPath)) {
throw new Error([
'diff path',
thisPath,
'must be an array, consider supplying a path converter']
.join(' '));
}
}
return thisPath;
}
function jsonPatchPathConverter(stringPath) {
return stringPath.split('/').slice(1);
}
function prototypeCheck(prop) {
// coercion is intentional to catch prop values like `['__proto__']`
if (prop == '__proto__' || prop == 'constructor' || prop == 'prototype') {
throw new Error('setting of prototype values not supported');
}
}
export {diffApply, jsonPatchPathConverter};

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

@@ -0,0 +1,108 @@
import * as diffObj from "./index";
const { diffApply, jsonPatchPathConverter } = diffObj;
const obj1 = {
a: 2,
b: 3,
c: {
d: 5
}
};
const arr1 = [1, "bee"];
const objOps: diffObj.DiffOps = [
{
op: "replace",
path: ["a"],
value: 10
},
{
op: "remove",
path: ["b"]
},
{
op: "add",
path: ["e"],
value: 15
},
{
op: "remove",
path: ["c", "d"]
}
];
const arrOps: diffObj.DiffOps = [
{
op: "replace",
path: [1],
value: 10
},
{
op: "remove",
path: [2]
},
{
op: "add",
path: [7],
value: 15
}
];
//OK
diffApply(obj1, objOps);
diffApply(obj1, []);
diffApply(arr1, arrOps);
diffApply(arr1, []);
diffApply(obj1, objOps, jsonPatchPathConverter);
diffApply(arr1, arrOps, jsonPatchPathConverter);
// not OK
// @ts-expect-error
diffApply(obj1);
// @ts-expect-error
diffApply(arr2);
// @ts-expect-error
diffApply("a");
// @ts-expect-error
diffApply(true);
// @ts-expect-error
diffApply(obj1, 1);
// @ts-expect-error
diffApply(3, arr2);
// @ts-expect-error
diffApply(obj1, "a");
// @ts-expect-error
diffApply("b", arr2);
// @ts-expect-error
diffApply(obj1, [{ op: "delete", path: ["a"] }]);
// @ts-expect-error
diffApply(obj1, [{ op: "delete", path: ["a"] }], jsonPatchPathConverter);
// @ts-expect-error
diffApply(obj1, "a", jsonPatchPathConverter);
// @ts-expect-error
diffApply(obj1, ["a", "b", "c"], jsonPatchPathConverter);
// @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");

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

@@ -0,0 +1,34 @@
{
"name": "just-diff-apply",
"version": "5.5.0",
"description": "Apply a diff to an object. Optionally 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",
"apply",
"jsonPatch",
"no-dependencies",
"just"
],
"author": "Angus Croll",
"license": "MIT",
"bugs": {
"url": "https://github.com/angus-c/just/issues"
}
}

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

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