🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
198
node_modules/deepmerge-ts/CHANGELOG.md
generated
vendored
Normal file
198
node_modules/deepmerge-ts/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||
|
||||
# [4.3.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.2.2...v4.3.0) (2023-02-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* create deepmergeInto function ([9c350a0](https://github.com/RebeccaStevens/deepmerge-ts/commit/9c350a051c16534907da459ff466a353b90d5505)), closes [#51](https://github.com/RebeccaStevens/deepmerge-ts/issues/51)
|
||||
|
||||
## [4.2.2](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.2.1...v4.2.2) (2022-09-19)
|
||||
|
||||
## [4.2.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.2.0...v4.2.1) (2022-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* broken type info path ([#146](https://github.com/RebeccaStevens/deepmerge-ts/issues/146)) ([b875711](https://github.com/RebeccaStevens/deepmerge-ts/commit/b8757111ccff257e7403b5d91235b965b4542afd))
|
||||
|
||||
# [4.2.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.1.0...v4.2.0) (2022-06-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* export types for module resolution node 16 ([20241c5](https://github.com/RebeccaStevens/deepmerge-ts/commit/20241c5bdffcc77025ea778257193f1afbe40768))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **ts:** add variance annotations ([cecc9db](https://github.com/RebeccaStevens/deepmerge-ts/commit/cecc9dbcfc68335f04372e2fa339a347f71c90bc))
|
||||
* **ts:** use extends constraints on infer ([f053e76](https://github.com/RebeccaStevens/deepmerge-ts/commit/f053e76221fb790f1dead0b2b5c9a9f4432cb1d8))
|
||||
|
||||
# [4.1.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.4...v4.1.0) (2022-06-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* treat module imports as records ([20c0dfb](https://github.com/RebeccaStevens/deepmerge-ts/commit/20c0dfb82e4273b10e5a02ba0e74aada42b9bb7a)), closes [#133](https://github.com/RebeccaStevens/deepmerge-ts/issues/133)
|
||||
|
||||
## [4.0.4](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.3...v4.0.4) (2022-06-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* drop keys that have no enumerable properties ([3363570](https://github.com/RebeccaStevens/deepmerge-ts/commit/3363570fcc53488d22a2d4b778b558173c7ee5c9))
|
||||
|
||||
## [4.0.3](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.2...v4.0.3) (2022-04-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use explict return types for function that return a HKT ([eb4183e](https://github.com/RebeccaStevens/deepmerge-ts/commit/eb4183e5441ea8b36bbb8f24ffa38ba850eb389c)), closes [#94](https://github.com/RebeccaStevens/deepmerge-ts/issues/94)
|
||||
|
||||
## [4.0.2](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.1...v4.0.2) (2022-03-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* protect against prototype pollution ([d637db7](https://github.com/RebeccaStevens/deepmerge-ts/commit/d637db7e4fb2bfb113cb4bc1c85a125936d7081b))
|
||||
|
||||
## [4.0.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.0...v4.0.1) (2022-03-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** fix broken import in deno dist files ([#85](https://github.com/RebeccaStevens/deepmerge-ts/issues/85)) ([86faf2a](https://github.com/RebeccaStevens/deepmerge-ts/commit/86faf2a047488be2fbb1ff6a1edd005b5d4670cb))
|
||||
|
||||
# [4.0.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v3.0.1...v4.0.0) (2022-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* improve meta data typings ([#61](https://github.com/RebeccaStevens/deepmerge-ts/issues/61)) ([9a881d3](https://github.com/RebeccaStevens/deepmerge-ts/commit/9a881d3e55762da03b0d0f465d7e958d81fd0958))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow for default merging via a special return value ([658d1fd](https://github.com/RebeccaStevens/deepmerge-ts/commit/658d1fd454fe095e6c7f2be22ccf4823fe0ea6ef))
|
||||
* allow for implicit default merging ([1d5e617](https://github.com/RebeccaStevens/deepmerge-ts/commit/1d5e617bc4980f64a75fa9da1397979b2310fc06))
|
||||
* allow for skipping properties completely via a special return value ([#64](https://github.com/RebeccaStevens/deepmerge-ts/issues/64)) ([676f2f6](https://github.com/RebeccaStevens/deepmerge-ts/commit/676f2f6593d6baf0e1b31f29c83bac7c392e7ce2))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* MetaMetaData now must extends DeepMergeBuiltInMetaData
|
||||
|
||||
## [3.0.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v3.0.0...v3.0.1) (2022-02-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allows readonly records in DeepMergeRecordsDefaultHKTInternalPropValueHelper ([#60](https://github.com/RebeccaStevens/deepmerge-ts/issues/60)) ([fc85dfa](https://github.com/RebeccaStevens/deepmerge-ts/commit/fc85dfa0cc579de127c8458e808f81cbca84d090))
|
||||
|
||||
# [3.0.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v2.0.1...v3.0.0) (2022-02-19)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* unrequire unused types and values ([c78e373](https://github.com/RebeccaStevens/deepmerge-ts/commit/c78e3736fe725008b745a302233afacb2155db94))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* lone values will now be passed to mergeOthers rather than just returned ([#57](https://github.com/RebeccaStevens/deepmerge-ts/issues/57)) ([9c24584](https://github.com/RebeccaStevens/deepmerge-ts/commit/9c245846f8afbd8bc0fbe2a28626e6461f41ea53))
|
||||
* provide customizable meta data to custom merge functions ([3d96692](https://github.com/RebeccaStevens/deepmerge-ts/commit/3d96692386c363e3f4250b267cac1d78231457ff)), closes [#33](https://github.com/RebeccaStevens/deepmerge-ts/issues/33)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* some types have changed for `deepmergeCustom`
|
||||
|
||||
## [2.0.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v2.0.0...v2.0.1) (2021-12-22)
|
||||
|
||||
# [2.0.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.7...v2.0.0) (2021-11-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add better support for readonly types ([#17](https://github.com/RebeccaStevens/deepmerge-ts/issues/17)) ([ee59064](https://github.com/RebeccaStevens/deepmerge-ts/commit/ee5906448bcc0fabef2a2b8e215d4c309d30b4db))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* interface DeepMergeMergeFunctionURItoKind's signature has changed
|
||||
|
||||
## [1.1.7](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.6...v1.1.7) (2021-11-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* incorrect resulting type when merging 3+ readonly tuples ([#20](https://github.com/RebeccaStevens/deepmerge-ts/issues/20)) ([696a1b2](https://github.com/RebeccaStevens/deepmerge-ts/commit/696a1b21ce225e11e38ee9ef3b92a28cf3ed6a4c))
|
||||
|
||||
## [1.1.6](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.5...v1.1.6) (2021-11-22)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* convert recursive types to tail-recursive versions ([#15](https://github.com/RebeccaStevens/deepmerge-ts/issues/15)) ([4401ac2](https://github.com/RebeccaStevens/deepmerge-ts/commit/4401ac2d1651093ab855d3d4bdf6c9628c0767ab))
|
||||
|
||||
## [1.1.5](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.4...v1.1.5) (2021-10-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** deno release fixup ([4b8ca98](https://github.com/RebeccaStevens/deepmerge-ts/commit/4b8ca9868de78228244b099dc2040c4cb16a649d))
|
||||
|
||||
## [1.1.4](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.3...v1.1.4) (2021-10-18)
|
||||
|
||||
## [1.1.3](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.2...v1.1.3) (2021-09-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* order of package exports ([#12](https://github.com/RebeccaStevens/deepmerge-ts/issues/12)) ([4117460](https://github.com/RebeccaStevens/deepmerge-ts/commit/41174607ee57568f123e1a5661f635d5d54f7c0c))
|
||||
|
||||
## [1.1.2](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.1...v1.1.2) (2021-09-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* current and legacy types trying to using the same file resulting in one being overridden ([#10](https://github.com/RebeccaStevens/deepmerge-ts/issues/10)) ([a5f334b](https://github.com/RebeccaStevens/deepmerge-ts/commit/a5f334b2c4f6735383ea419dd6d3206bcc0afe4a))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* add early escapes to loos when merging unknown types ([17a92e1](https://github.com/RebeccaStevens/deepmerge-ts/commit/17a92e1676a6b6c20f7e3fb1cc966ed5673dccf6))
|
||||
* directly request enumerable keys so that they don't need to then be filtered ([04a2a5f](https://github.com/RebeccaStevens/deepmerge-ts/commit/04a2a5fb24b1086c8130203451c2836f196e92c6))
|
||||
* use imperative loops when building merged result of records ([b36f7bc](https://github.com/RebeccaStevens/deepmerge-ts/commit/b36f7bcec43858658c06f8f4ac6deb17a9d7b2fe))
|
||||
|
||||
## [1.1.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.0...v1.1.1) (2021-09-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add legacy type information ([#6](https://github.com/RebeccaStevens/deepmerge-ts/issues/6)) ([c7e1019](https://github.com/RebeccaStevens/deepmerge-ts/commit/c7e1019f86818fe95b9f6291f2a09f077337a7f9))
|
||||
* only merge enumerable properties ([#8](https://github.com/RebeccaStevens/deepmerge-ts/issues/8)) ([0967070](https://github.com/RebeccaStevens/deepmerge-ts/commit/0967070d30427bb33f0c78793d61a9411dde3b49))
|
||||
|
||||
# [1.1.0](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.0.1...v1.1.0) (2021-09-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for custom merging ([#4](https://github.com/RebeccaStevens/deepmerge-ts/issues/4)) ([5413b81](https://github.com/RebeccaStevens/deepmerge-ts/commit/5413b81c0a568c798ff70081966dd9a0ace5fe3f))
|
||||
|
||||
## [1.0.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.0.0...v1.0.1) (2021-08-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* husky install no longer runs on postinstall ([7102229](https://github.com/RebeccaStevens/deepmerge-ts/commit/7102229a7078fef17ba2a24c9814a844fb525c67))
|
||||
|
||||
# 1.0.0 (2021-08-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add "module" property to package.json ([168747d](https://github.com/RebeccaStevens/deepmerge-ts/commit/168747daef0b49ab8ac3b0491fda965776eef2c2))
|
||||
* add basic functionality ([8e3ba66](https://github.com/RebeccaStevens/deepmerge-ts/commit/8e3ba66973d6e35cc421149a00a45b7c55c1de45))
|
||||
29
node_modules/deepmerge-ts/LICENSE
generated
vendored
Normal file
29
node_modules/deepmerge-ts/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, Rebecca Stevens
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
154
node_modules/deepmerge-ts/README.md
generated
vendored
Normal file
154
node_modules/deepmerge-ts/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
<div align="center">
|
||||
|
||||
# DeepmergeTS
|
||||
|
||||
[](https://www.npmjs.com/package/deepmerge-ts)
|
||||
[](https://deno.land/x/deepmergets)
|
||||
[](https://github.com/RebeccaStevens/deepmerge-ts/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/RebeccaStevens/deepmerge-ts)\
|
||||
[](https://github.com/prettier/prettier)
|
||||
[](https://github.com/RebeccaStevens/deepmerge-ts/discussions)
|
||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
||||
[](https://commitizen.github.io/cz-cli/)
|
||||
[](https://github.com/semantic-release/semantic-release)
|
||||
|
||||
Deeply merge 2 or more objects respecting type information.
|
||||
|
||||

|
||||
|
||||
</div>
|
||||
|
||||
## Donate
|
||||
|
||||
[Any donations would be much appreciated](./DONATIONS.md). 😄
|
||||
|
||||
## Installation
|
||||
|
||||
### Node
|
||||
|
||||
```sh
|
||||
# Install with npm
|
||||
npm install deepmerge-ts
|
||||
|
||||
# Install with pnpm
|
||||
pnpm add deepmerge-ts
|
||||
|
||||
# Install with yarn
|
||||
yarn add deepmerge-ts
|
||||
```
|
||||
|
||||
### Deno
|
||||
|
||||
```jsonc
|
||||
// import_map.json
|
||||
{
|
||||
"imports": {
|
||||
"deepmerge-ts": "https://deno.land/x/deepmergets@__version__/dist/deno/index.ts"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Smart merging - High performance.
|
||||
- Merged output has correct typing.
|
||||
- Record merging support.
|
||||
- Array merging support.
|
||||
- Map and Set merging support.
|
||||
- Customized merging.
|
||||
|
||||
## Usage
|
||||
|
||||
### Example using default config
|
||||
|
||||
```js
|
||||
import { deepmerge } from "deepmerge-ts";
|
||||
|
||||
const x = {
|
||||
record: {
|
||||
prop1: "value1",
|
||||
prop2: "value2",
|
||||
},
|
||||
array: [1, 2, 3],
|
||||
set: new Set([1, 2, 3]),
|
||||
map: new Map([
|
||||
["key1", "value1"],
|
||||
["key2", "value2"],
|
||||
]),
|
||||
};
|
||||
|
||||
const y = {
|
||||
record: {
|
||||
prop1: "changed",
|
||||
prop3: "value3",
|
||||
},
|
||||
array: [2, 3, 4],
|
||||
set: new Set([2, 3, 4]),
|
||||
map: new Map([
|
||||
["key2", "changed"],
|
||||
["key3", "value3"],
|
||||
]),
|
||||
};
|
||||
|
||||
const merged = deepmerge(x, y);
|
||||
|
||||
console.log(merged);
|
||||
|
||||
// Prettierfied output:
|
||||
//
|
||||
// Object {
|
||||
// "record": Object {
|
||||
// "prop1": "changed",
|
||||
// "prop2": "value2",
|
||||
// "prop3": "value3",
|
||||
// },
|
||||
// "array": Array [1, 2, 3, 2, 3, 4],
|
||||
// "set": Set { 1, 2, 3, 4 },
|
||||
// "map": Map {
|
||||
// "key1" => "value1",
|
||||
// "key2" => "changed",
|
||||
// "key3" => "value3",
|
||||
// },
|
||||
// }
|
||||
```
|
||||
|
||||
You can try out this example at [codesandbox.io](https://codesandbox.io/s/deepmerge-ts-example-iltxby?file=/src/example.ts).
|
||||
|
||||
### Merging into a Target
|
||||
|
||||
You can use `deepmergeInto` if you want to update a target object with the merge result instead of creating a new object.
|
||||
|
||||
This function is best used with objects that are all of the same type.
|
||||
|
||||
Note: If the target object's type is different to the input objects, we'll assert that the target's type has changed (this is not done automatically with `deepmergeIntoCustom`).
|
||||
|
||||
### Customized the Merging Process
|
||||
|
||||
We provide a customizer function for each of our main deepmerge functions: `deepmergeCustom` and `deepmergeIntoCustom`.
|
||||
You can use these to customize the details of how values should be merged together.
|
||||
|
||||
See [deepmerge custom docs](./docs/deepmergeCustom.md) for more details.
|
||||
|
||||
## Performance
|
||||
|
||||
We use smart merging instead of the classic merging strategy which some alternative libraries use. This vastly improves performance, both in execution time and memory usage.
|
||||
|
||||
### Classic Merge (not what we do)
|
||||
|
||||
With classic merging, each input is merged with the next input until all inputs are merged.
|
||||
|
||||
This strategy has large performance issues when lots of items need to be merged.
|
||||
|
||||

|
||||
|
||||
### Smart Merge (what we do)
|
||||
|
||||
With our smart merging, we look ahead to see what can be merged and only merge those things.
|
||||
|
||||
In addition to performance improvements, this strategy merges multiple inputs at once; allowing for benefits such as taking averages of the inputs.
|
||||
|
||||

|
||||
|
||||
## API
|
||||
|
||||
See [API docs](./docs/API.md).
|
||||
605
node_modules/deepmerge-ts/dist/node/index.cjs
generated
vendored
Normal file
605
node_modules/deepmerge-ts/dist/node/index.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,605 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* Special values that tell deepmerge to perform a certain action.
|
||||
*/
|
||||
const actions = {
|
||||
defaultMerge: Symbol("deepmerge-ts: default merge"),
|
||||
skip: Symbol("deepmerge-ts: skip"),
|
||||
};
|
||||
/**
|
||||
* Special values that tell deepmergeInto to perform a certain action.
|
||||
*/
|
||||
const actionsInto = {
|
||||
defaultMerge: actions.defaultMerge,
|
||||
};
|
||||
|
||||
/**
|
||||
* The default function to update meta data.
|
||||
*/
|
||||
function defaultMetaDataUpdater(previousMeta, metaMeta) {
|
||||
return metaMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the given object.
|
||||
*
|
||||
* @param object - The object to get the type of.
|
||||
* @returns The type of the given object.
|
||||
*/
|
||||
function getObjectType(object) {
|
||||
if (typeof object !== "object" || object === null) {
|
||||
return 0 /* ObjectType.NOT */;
|
||||
}
|
||||
if (Array.isArray(object)) {
|
||||
return 2 /* ObjectType.ARRAY */;
|
||||
}
|
||||
if (isRecord(object)) {
|
||||
return 1 /* ObjectType.RECORD */;
|
||||
}
|
||||
if (object instanceof Set) {
|
||||
return 3 /* ObjectType.SET */;
|
||||
}
|
||||
if (object instanceof Map) {
|
||||
return 4 /* ObjectType.MAP */;
|
||||
}
|
||||
return 5 /* ObjectType.OTHER */;
|
||||
}
|
||||
/**
|
||||
* Get the keys of the given objects including symbol keys.
|
||||
*
|
||||
* Note: Only keys to enumerable properties are returned.
|
||||
*
|
||||
* @param objects - An array of objects to get the keys of.
|
||||
* @returns A set containing all the keys of all the given objects.
|
||||
*/
|
||||
function getKeys(objects) {
|
||||
const keys = new Set();
|
||||
/* eslint-disable functional/no-loop-statements -- using a loop here is more efficient. */
|
||||
for (const object of objects) {
|
||||
for (const key of [
|
||||
...Object.keys(object),
|
||||
...Object.getOwnPropertySymbols(object),
|
||||
]) {
|
||||
keys.add(key);
|
||||
}
|
||||
}
|
||||
/* eslint-enable functional/no-loop-statements */
|
||||
return keys;
|
||||
}
|
||||
/**
|
||||
* Does the given object have the given property.
|
||||
*
|
||||
* @param object - The object to test.
|
||||
* @param property - The property to test.
|
||||
* @returns Whether the object has the property.
|
||||
*/
|
||||
function objectHasProperty(object, property) {
|
||||
return (typeof object === "object" &&
|
||||
Object.prototype.propertyIsEnumerable.call(object, property));
|
||||
}
|
||||
/**
|
||||
* Get an iterable object that iterates over the given iterables.
|
||||
*/
|
||||
function getIterableOfIterables(iterables) {
|
||||
return {
|
||||
*[Symbol.iterator]() {
|
||||
// eslint-disable-next-line functional/no-loop-statements
|
||||
for (const iterable of iterables) {
|
||||
// eslint-disable-next-line functional/no-loop-statements
|
||||
for (const value of iterable) {
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
const validRecordToStringValues = new Set([
|
||||
"[object Object]",
|
||||
"[object Module]",
|
||||
]);
|
||||
/**
|
||||
* Does the given object appear to be a record.
|
||||
*/
|
||||
function isRecord(value) {
|
||||
// All records are objects.
|
||||
if (!validRecordToStringValues.has(Object.prototype.toString.call(value))) {
|
||||
return false;
|
||||
}
|
||||
const { constructor } = value;
|
||||
// If has modified constructor.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (constructor === undefined) {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
const prototype = constructor.prototype;
|
||||
// If has modified prototype.
|
||||
if (prototype === null ||
|
||||
typeof prototype !== "object" ||
|
||||
!validRecordToStringValues.has(Object.prototype.toString.call(prototype))) {
|
||||
return false;
|
||||
}
|
||||
// If constructor does not have an Object-specific method.
|
||||
// eslint-disable-next-line sonarjs/prefer-single-boolean-return, no-prototype-builtins
|
||||
if (!prototype.hasOwnProperty("isPrototypeOf")) {
|
||||
return false;
|
||||
}
|
||||
// Most likely a record.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default strategy to merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
function mergeRecords$2(values, utils, meta) {
|
||||
const result = {};
|
||||
/* eslint-disable functional/no-loop-statements, functional/no-conditional-statements -- using a loop here is more performant. */
|
||||
for (const key of getKeys(values)) {
|
||||
const propValues = [];
|
||||
for (const value of values) {
|
||||
if (objectHasProperty(value, key)) {
|
||||
propValues.push(value[key]);
|
||||
}
|
||||
}
|
||||
if (propValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const updatedMeta = utils.metaDataUpdater(meta, {
|
||||
key,
|
||||
parents: values,
|
||||
});
|
||||
const propertyResult = mergeUnknowns(propValues, utils, updatedMeta);
|
||||
if (propertyResult === actions.skip) {
|
||||
continue;
|
||||
}
|
||||
if (key === "__proto__") {
|
||||
Object.defineProperty(result, key, {
|
||||
value: propertyResult,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result[key] = propertyResult;
|
||||
}
|
||||
}
|
||||
/* eslint-enable functional/no-loop-statements, functional/no-conditional-statements */
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
function mergeArrays$2(values) {
|
||||
return values.flat();
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
function mergeSets$2(values) {
|
||||
return new Set(getIterableOfIterables(values));
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
function mergeMaps$2(values) {
|
||||
return new Map(getIterableOfIterables(values));
|
||||
}
|
||||
/**
|
||||
* Get the last value in the given array.
|
||||
*/
|
||||
function mergeOthers$2(values) {
|
||||
return values[values.length - 1];
|
||||
}
|
||||
|
||||
var defaultMergeFunctions = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
mergeRecords: mergeRecords$2,
|
||||
mergeArrays: mergeArrays$2,
|
||||
mergeSets: mergeSets$2,
|
||||
mergeMaps: mergeMaps$2,
|
||||
mergeOthers: mergeOthers$2
|
||||
});
|
||||
|
||||
/**
|
||||
* Deeply merge objects.
|
||||
*
|
||||
* @param objects - The objects to merge.
|
||||
*/
|
||||
function deepmerge(...objects) {
|
||||
return deepmergeCustom({})(...objects);
|
||||
}
|
||||
function deepmergeCustom(options, rootMetaData) {
|
||||
const utils = getUtils(options, customizedDeepmerge);
|
||||
/**
|
||||
* The customized deepmerge function.
|
||||
*/
|
||||
function customizedDeepmerge(...objects) {
|
||||
return mergeUnknowns(objects, utils, rootMetaData);
|
||||
}
|
||||
return customizedDeepmerge;
|
||||
}
|
||||
/**
|
||||
* The the utils that are available to the merge functions.
|
||||
*
|
||||
* @param options - The options the user specified
|
||||
*/
|
||||
function getUtils(options, customizedDeepmerge) {
|
||||
var _a, _b;
|
||||
return {
|
||||
defaultMergeFunctions,
|
||||
mergeFunctions: {
|
||||
...defaultMergeFunctions,
|
||||
...Object.fromEntries(Object.entries(options)
|
||||
.filter(([key, option]) => Object.prototype.hasOwnProperty.call(defaultMergeFunctions, key))
|
||||
.map(([key, option]) => option === false
|
||||
? [key, mergeOthers$2]
|
||||
: [key, option])),
|
||||
},
|
||||
metaDataUpdater: ((_a = options.metaDataUpdater) !== null && _a !== void 0 ? _a : defaultMetaDataUpdater),
|
||||
deepmerge: customizedDeepmerge,
|
||||
useImplicitDefaultMerging: (_b = options.enableImplicitDefaultMerging) !== null && _b !== void 0 ? _b : false,
|
||||
actions,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Merge unknown things.
|
||||
*
|
||||
* @param values - The values.
|
||||
*/
|
||||
function mergeUnknowns(values, utils, meta) {
|
||||
if (values.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
if (values.length === 1) {
|
||||
return mergeOthers$1(values, utils, meta);
|
||||
}
|
||||
const type = getObjectType(values[0]);
|
||||
// eslint-disable-next-line functional/no-conditional-statements -- add an early escape for better performance.
|
||||
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
|
||||
// eslint-disable-next-line functional/no-loop-statements -- using a loop here is more performant than mapping every value and then testing every value.
|
||||
for (let m_index = 1; m_index < values.length; m_index++) {
|
||||
if (getObjectType(values[m_index]) === type) {
|
||||
continue;
|
||||
}
|
||||
return mergeOthers$1(values, utils, meta);
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case 1 /* ObjectType.RECORD */: {
|
||||
return mergeRecords$1(values, utils, meta);
|
||||
}
|
||||
case 2 /* ObjectType.ARRAY */: {
|
||||
return mergeArrays$1(values, utils, meta);
|
||||
}
|
||||
case 3 /* ObjectType.SET */: {
|
||||
return mergeSets$1(values, utils, meta);
|
||||
}
|
||||
case 4 /* ObjectType.MAP */: {
|
||||
return mergeMaps$1(values, utils, meta);
|
||||
}
|
||||
default: {
|
||||
return mergeOthers$1(values, utils, meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
function mergeRecords$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeRecords(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeRecords !==
|
||||
utils.defaultMergeFunctions.mergeRecords)) {
|
||||
return utils.defaultMergeFunctions.mergeRecords(values, utils, meta);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
function mergeArrays$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeArrays(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeArrays !==
|
||||
utils.defaultMergeFunctions.mergeArrays)) {
|
||||
return utils.defaultMergeFunctions.mergeArrays(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
function mergeSets$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeSets(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeSets !== utils.defaultMergeFunctions.mergeSets)) {
|
||||
return utils.defaultMergeFunctions.mergeSets(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
function mergeMaps$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeMaps(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeMaps !== utils.defaultMergeFunctions.mergeMaps)) {
|
||||
return utils.defaultMergeFunctions.mergeMaps(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge other things.
|
||||
*
|
||||
* @param values - The other things.
|
||||
*/
|
||||
function mergeOthers$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeOthers(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeOthers !==
|
||||
utils.defaultMergeFunctions.mergeOthers)) {
|
||||
return utils.defaultMergeFunctions.mergeOthers(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default strategy to merge records into a target record.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this record
|
||||
* @param values - The records (including the target's value if there is one).
|
||||
*/
|
||||
function mergeRecords(m_target, values, utils, meta) {
|
||||
/* eslint-disable functional/no-loop-statements, functional/no-conditional-statements -- using a loop here is more performant. */
|
||||
for (const key of getKeys(values)) {
|
||||
const propValues = [];
|
||||
for (const value of values) {
|
||||
if (objectHasProperty(value, key)) {
|
||||
propValues.push(value[key]);
|
||||
}
|
||||
}
|
||||
if (propValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const updatedMeta = utils.metaDataUpdater(meta, {
|
||||
key,
|
||||
parents: values,
|
||||
});
|
||||
const propertyTarget = { value: propValues[0] };
|
||||
mergeUnknownsInto(propertyTarget, propValues, utils, updatedMeta);
|
||||
if (key === "__proto__") {
|
||||
Object.defineProperty(m_target, key, {
|
||||
value: propertyTarget.value,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
else {
|
||||
m_target.value[key] = propertyTarget.value;
|
||||
}
|
||||
}
|
||||
/* eslint-enable functional/no-loop-statements, functional/no-conditional-statements */
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge arrays into a target array.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this array
|
||||
* @param values - The arrays (including the target's value if there is one).
|
||||
*/
|
||||
function mergeArrays(m_target, values) {
|
||||
m_target.value.push(...values.slice(1).flat());
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge sets into a target set.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this set
|
||||
* @param values - The sets (including the target's value if there is one).
|
||||
*/
|
||||
function mergeSets(m_target, values) {
|
||||
for (const value of getIterableOfIterables(values.slice(1))) {
|
||||
m_target.value.add(value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge maps into a target map.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this map
|
||||
* @param values - The maps (including the target's value if there is one).
|
||||
*/
|
||||
function mergeMaps(m_target, values) {
|
||||
for (const [key, value] of getIterableOfIterables(values.slice(1))) {
|
||||
m_target.value.set(key, value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set the target to the last value.
|
||||
*/
|
||||
function mergeOthers(m_target, values) {
|
||||
m_target.value = values[values.length - 1];
|
||||
}
|
||||
|
||||
var defaultMergeIntoFunctions = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
mergeRecords: mergeRecords,
|
||||
mergeArrays: mergeArrays,
|
||||
mergeSets: mergeSets,
|
||||
mergeMaps: mergeMaps,
|
||||
mergeOthers: mergeOthers
|
||||
});
|
||||
|
||||
function deepmergeInto(target, ...objects) {
|
||||
return void deepmergeIntoCustom({})(target, ...objects);
|
||||
}
|
||||
function deepmergeIntoCustom(options, rootMetaData) {
|
||||
const utils = getIntoUtils(options, customizedDeepmergeInto);
|
||||
/**
|
||||
* The customized deepmerge function.
|
||||
*/
|
||||
function customizedDeepmergeInto(target, ...objects) {
|
||||
mergeUnknownsInto({ value: target }, [target, ...objects], utils, rootMetaData);
|
||||
}
|
||||
return customizedDeepmergeInto;
|
||||
}
|
||||
/**
|
||||
* The the utils that are available to the merge functions.
|
||||
*
|
||||
* @param options - The options the user specified
|
||||
*/
|
||||
function getIntoUtils(options, customizedDeepmergeInto) {
|
||||
var _a;
|
||||
return {
|
||||
defaultMergeFunctions: defaultMergeIntoFunctions,
|
||||
mergeFunctions: {
|
||||
...defaultMergeIntoFunctions,
|
||||
...Object.fromEntries(Object.entries(options)
|
||||
.filter(([key, option]) => Object.prototype.hasOwnProperty.call(defaultMergeIntoFunctions, key))
|
||||
.map(([key, option]) => option === false
|
||||
? [key, mergeOthers]
|
||||
: [key, option])),
|
||||
},
|
||||
metaDataUpdater: ((_a = options.metaDataUpdater) !== null && _a !== void 0 ? _a : defaultMetaDataUpdater),
|
||||
deepmergeInto: customizedDeepmergeInto,
|
||||
actions: actionsInto,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Merge unknown things into a target.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The values.
|
||||
*/
|
||||
function mergeUnknownsInto(m_target, values, utils, meta
|
||||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||
) {
|
||||
if (values.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (values.length === 1) {
|
||||
return void mergeOthersInto(m_target, values, utils, meta);
|
||||
}
|
||||
const type = getObjectType(m_target.value);
|
||||
// eslint-disable-next-line functional/no-conditional-statements -- add an early escape for better performance.
|
||||
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
|
||||
// eslint-disable-next-line functional/no-loop-statements -- using a loop here is more performant than mapping every value and then testing every value.
|
||||
for (let m_index = 1; m_index < values.length; m_index++) {
|
||||
if (getObjectType(values[m_index]) === type) {
|
||||
continue;
|
||||
}
|
||||
return void mergeOthersInto(m_target, values, utils, meta);
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case 1 /* ObjectType.RECORD */: {
|
||||
return void mergeRecordsInto(m_target, values, utils, meta);
|
||||
}
|
||||
case 2 /* ObjectType.ARRAY */: {
|
||||
return void mergeArraysInto(m_target, values, utils, meta);
|
||||
}
|
||||
case 3 /* ObjectType.SET */: {
|
||||
return void mergeSetsInto(m_target, values, utils, meta);
|
||||
}
|
||||
case 4 /* ObjectType.MAP */: {
|
||||
return void mergeMapsInto(m_target, values, utils, meta);
|
||||
}
|
||||
default: {
|
||||
return void mergeOthersInto(m_target, values, utils, meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge records into a target record.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The records.
|
||||
*/
|
||||
function mergeRecordsInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeRecords(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeRecords(m_target, values, utils, meta);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge arrays into a target array.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
function mergeArraysInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeArrays(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeArrays(m_target, values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge sets into a target set.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The sets.
|
||||
*/
|
||||
function mergeSetsInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeSets(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeSets(m_target, values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge maps into a target map.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The maps.
|
||||
*/
|
||||
function mergeMapsInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeMaps(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeMaps(m_target, values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge other things into a target.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The other things.
|
||||
*/
|
||||
function mergeOthersInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeOthers(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge ||
|
||||
m_target.value === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeOthers(m_target, values);
|
||||
}
|
||||
}
|
||||
|
||||
exports.deepmerge = deepmerge;
|
||||
exports.deepmergeCustom = deepmergeCustom;
|
||||
exports.deepmergeInto = deepmergeInto;
|
||||
exports.deepmergeIntoCustom = deepmergeIntoCustom;
|
||||
598
node_modules/deepmerge-ts/dist/node/index.mjs
generated
vendored
Normal file
598
node_modules/deepmerge-ts/dist/node/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,598 @@
|
|||
/**
|
||||
* Special values that tell deepmerge to perform a certain action.
|
||||
*/
|
||||
const actions = {
|
||||
defaultMerge: Symbol("deepmerge-ts: default merge"),
|
||||
skip: Symbol("deepmerge-ts: skip"),
|
||||
};
|
||||
/**
|
||||
* Special values that tell deepmergeInto to perform a certain action.
|
||||
*/
|
||||
const actionsInto = {
|
||||
defaultMerge: actions.defaultMerge,
|
||||
};
|
||||
|
||||
/**
|
||||
* The default function to update meta data.
|
||||
*/
|
||||
function defaultMetaDataUpdater(previousMeta, metaMeta) {
|
||||
return metaMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the given object.
|
||||
*
|
||||
* @param object - The object to get the type of.
|
||||
* @returns The type of the given object.
|
||||
*/
|
||||
function getObjectType(object) {
|
||||
if (typeof object !== "object" || object === null) {
|
||||
return 0 /* ObjectType.NOT */;
|
||||
}
|
||||
if (Array.isArray(object)) {
|
||||
return 2 /* ObjectType.ARRAY */;
|
||||
}
|
||||
if (isRecord(object)) {
|
||||
return 1 /* ObjectType.RECORD */;
|
||||
}
|
||||
if (object instanceof Set) {
|
||||
return 3 /* ObjectType.SET */;
|
||||
}
|
||||
if (object instanceof Map) {
|
||||
return 4 /* ObjectType.MAP */;
|
||||
}
|
||||
return 5 /* ObjectType.OTHER */;
|
||||
}
|
||||
/**
|
||||
* Get the keys of the given objects including symbol keys.
|
||||
*
|
||||
* Note: Only keys to enumerable properties are returned.
|
||||
*
|
||||
* @param objects - An array of objects to get the keys of.
|
||||
* @returns A set containing all the keys of all the given objects.
|
||||
*/
|
||||
function getKeys(objects) {
|
||||
const keys = new Set();
|
||||
/* eslint-disable functional/no-loop-statements -- using a loop here is more efficient. */
|
||||
for (const object of objects) {
|
||||
for (const key of [
|
||||
...Object.keys(object),
|
||||
...Object.getOwnPropertySymbols(object),
|
||||
]) {
|
||||
keys.add(key);
|
||||
}
|
||||
}
|
||||
/* eslint-enable functional/no-loop-statements */
|
||||
return keys;
|
||||
}
|
||||
/**
|
||||
* Does the given object have the given property.
|
||||
*
|
||||
* @param object - The object to test.
|
||||
* @param property - The property to test.
|
||||
* @returns Whether the object has the property.
|
||||
*/
|
||||
function objectHasProperty(object, property) {
|
||||
return (typeof object === "object" &&
|
||||
Object.prototype.propertyIsEnumerable.call(object, property));
|
||||
}
|
||||
/**
|
||||
* Get an iterable object that iterates over the given iterables.
|
||||
*/
|
||||
function getIterableOfIterables(iterables) {
|
||||
return {
|
||||
*[Symbol.iterator]() {
|
||||
// eslint-disable-next-line functional/no-loop-statements
|
||||
for (const iterable of iterables) {
|
||||
// eslint-disable-next-line functional/no-loop-statements
|
||||
for (const value of iterable) {
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
const validRecordToStringValues = new Set([
|
||||
"[object Object]",
|
||||
"[object Module]",
|
||||
]);
|
||||
/**
|
||||
* Does the given object appear to be a record.
|
||||
*/
|
||||
function isRecord(value) {
|
||||
// All records are objects.
|
||||
if (!validRecordToStringValues.has(Object.prototype.toString.call(value))) {
|
||||
return false;
|
||||
}
|
||||
const { constructor } = value;
|
||||
// If has modified constructor.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (constructor === undefined) {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
const prototype = constructor.prototype;
|
||||
// If has modified prototype.
|
||||
if (prototype === null ||
|
||||
typeof prototype !== "object" ||
|
||||
!validRecordToStringValues.has(Object.prototype.toString.call(prototype))) {
|
||||
return false;
|
||||
}
|
||||
// If constructor does not have an Object-specific method.
|
||||
// eslint-disable-next-line sonarjs/prefer-single-boolean-return, no-prototype-builtins
|
||||
if (!prototype.hasOwnProperty("isPrototypeOf")) {
|
||||
return false;
|
||||
}
|
||||
// Most likely a record.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default strategy to merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
function mergeRecords$2(values, utils, meta) {
|
||||
const result = {};
|
||||
/* eslint-disable functional/no-loop-statements, functional/no-conditional-statements -- using a loop here is more performant. */
|
||||
for (const key of getKeys(values)) {
|
||||
const propValues = [];
|
||||
for (const value of values) {
|
||||
if (objectHasProperty(value, key)) {
|
||||
propValues.push(value[key]);
|
||||
}
|
||||
}
|
||||
if (propValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const updatedMeta = utils.metaDataUpdater(meta, {
|
||||
key,
|
||||
parents: values,
|
||||
});
|
||||
const propertyResult = mergeUnknowns(propValues, utils, updatedMeta);
|
||||
if (propertyResult === actions.skip) {
|
||||
continue;
|
||||
}
|
||||
if (key === "__proto__") {
|
||||
Object.defineProperty(result, key, {
|
||||
value: propertyResult,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result[key] = propertyResult;
|
||||
}
|
||||
}
|
||||
/* eslint-enable functional/no-loop-statements, functional/no-conditional-statements */
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
function mergeArrays$2(values) {
|
||||
return values.flat();
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
function mergeSets$2(values) {
|
||||
return new Set(getIterableOfIterables(values));
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
function mergeMaps$2(values) {
|
||||
return new Map(getIterableOfIterables(values));
|
||||
}
|
||||
/**
|
||||
* Get the last value in the given array.
|
||||
*/
|
||||
function mergeOthers$2(values) {
|
||||
return values[values.length - 1];
|
||||
}
|
||||
|
||||
var defaultMergeFunctions = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
mergeRecords: mergeRecords$2,
|
||||
mergeArrays: mergeArrays$2,
|
||||
mergeSets: mergeSets$2,
|
||||
mergeMaps: mergeMaps$2,
|
||||
mergeOthers: mergeOthers$2
|
||||
});
|
||||
|
||||
/**
|
||||
* Deeply merge objects.
|
||||
*
|
||||
* @param objects - The objects to merge.
|
||||
*/
|
||||
function deepmerge(...objects) {
|
||||
return deepmergeCustom({})(...objects);
|
||||
}
|
||||
function deepmergeCustom(options, rootMetaData) {
|
||||
const utils = getUtils(options, customizedDeepmerge);
|
||||
/**
|
||||
* The customized deepmerge function.
|
||||
*/
|
||||
function customizedDeepmerge(...objects) {
|
||||
return mergeUnknowns(objects, utils, rootMetaData);
|
||||
}
|
||||
return customizedDeepmerge;
|
||||
}
|
||||
/**
|
||||
* The the utils that are available to the merge functions.
|
||||
*
|
||||
* @param options - The options the user specified
|
||||
*/
|
||||
function getUtils(options, customizedDeepmerge) {
|
||||
var _a, _b;
|
||||
return {
|
||||
defaultMergeFunctions,
|
||||
mergeFunctions: {
|
||||
...defaultMergeFunctions,
|
||||
...Object.fromEntries(Object.entries(options)
|
||||
.filter(([key, option]) => Object.prototype.hasOwnProperty.call(defaultMergeFunctions, key))
|
||||
.map(([key, option]) => option === false
|
||||
? [key, mergeOthers$2]
|
||||
: [key, option])),
|
||||
},
|
||||
metaDataUpdater: ((_a = options.metaDataUpdater) !== null && _a !== void 0 ? _a : defaultMetaDataUpdater),
|
||||
deepmerge: customizedDeepmerge,
|
||||
useImplicitDefaultMerging: (_b = options.enableImplicitDefaultMerging) !== null && _b !== void 0 ? _b : false,
|
||||
actions,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Merge unknown things.
|
||||
*
|
||||
* @param values - The values.
|
||||
*/
|
||||
function mergeUnknowns(values, utils, meta) {
|
||||
if (values.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
if (values.length === 1) {
|
||||
return mergeOthers$1(values, utils, meta);
|
||||
}
|
||||
const type = getObjectType(values[0]);
|
||||
// eslint-disable-next-line functional/no-conditional-statements -- add an early escape for better performance.
|
||||
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
|
||||
// eslint-disable-next-line functional/no-loop-statements -- using a loop here is more performant than mapping every value and then testing every value.
|
||||
for (let m_index = 1; m_index < values.length; m_index++) {
|
||||
if (getObjectType(values[m_index]) === type) {
|
||||
continue;
|
||||
}
|
||||
return mergeOthers$1(values, utils, meta);
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case 1 /* ObjectType.RECORD */: {
|
||||
return mergeRecords$1(values, utils, meta);
|
||||
}
|
||||
case 2 /* ObjectType.ARRAY */: {
|
||||
return mergeArrays$1(values, utils, meta);
|
||||
}
|
||||
case 3 /* ObjectType.SET */: {
|
||||
return mergeSets$1(values, utils, meta);
|
||||
}
|
||||
case 4 /* ObjectType.MAP */: {
|
||||
return mergeMaps$1(values, utils, meta);
|
||||
}
|
||||
default: {
|
||||
return mergeOthers$1(values, utils, meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
function mergeRecords$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeRecords(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeRecords !==
|
||||
utils.defaultMergeFunctions.mergeRecords)) {
|
||||
return utils.defaultMergeFunctions.mergeRecords(values, utils, meta);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
function mergeArrays$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeArrays(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeArrays !==
|
||||
utils.defaultMergeFunctions.mergeArrays)) {
|
||||
return utils.defaultMergeFunctions.mergeArrays(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
function mergeSets$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeSets(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeSets !== utils.defaultMergeFunctions.mergeSets)) {
|
||||
return utils.defaultMergeFunctions.mergeSets(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
function mergeMaps$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeMaps(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeMaps !== utils.defaultMergeFunctions.mergeMaps)) {
|
||||
return utils.defaultMergeFunctions.mergeMaps(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Merge other things.
|
||||
*
|
||||
* @param values - The other things.
|
||||
*/
|
||||
function mergeOthers$1(values, utils, meta) {
|
||||
const result = utils.mergeFunctions.mergeOthers(values, utils, meta);
|
||||
if (result === actions.defaultMerge ||
|
||||
(utils.useImplicitDefaultMerging &&
|
||||
result === undefined &&
|
||||
utils.mergeFunctions.mergeOthers !==
|
||||
utils.defaultMergeFunctions.mergeOthers)) {
|
||||
return utils.defaultMergeFunctions.mergeOthers(values);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default strategy to merge records into a target record.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this record
|
||||
* @param values - The records (including the target's value if there is one).
|
||||
*/
|
||||
function mergeRecords(m_target, values, utils, meta) {
|
||||
/* eslint-disable functional/no-loop-statements, functional/no-conditional-statements -- using a loop here is more performant. */
|
||||
for (const key of getKeys(values)) {
|
||||
const propValues = [];
|
||||
for (const value of values) {
|
||||
if (objectHasProperty(value, key)) {
|
||||
propValues.push(value[key]);
|
||||
}
|
||||
}
|
||||
if (propValues.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const updatedMeta = utils.metaDataUpdater(meta, {
|
||||
key,
|
||||
parents: values,
|
||||
});
|
||||
const propertyTarget = { value: propValues[0] };
|
||||
mergeUnknownsInto(propertyTarget, propValues, utils, updatedMeta);
|
||||
if (key === "__proto__") {
|
||||
Object.defineProperty(m_target, key, {
|
||||
value: propertyTarget.value,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
else {
|
||||
m_target.value[key] = propertyTarget.value;
|
||||
}
|
||||
}
|
||||
/* eslint-enable functional/no-loop-statements, functional/no-conditional-statements */
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge arrays into a target array.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this array
|
||||
* @param values - The arrays (including the target's value if there is one).
|
||||
*/
|
||||
function mergeArrays(m_target, values) {
|
||||
m_target.value.push(...values.slice(1).flat());
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge sets into a target set.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this set
|
||||
* @param values - The sets (including the target's value if there is one).
|
||||
*/
|
||||
function mergeSets(m_target, values) {
|
||||
for (const value of getIterableOfIterables(values.slice(1))) {
|
||||
m_target.value.add(value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The default strategy to merge maps into a target map.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this map
|
||||
* @param values - The maps (including the target's value if there is one).
|
||||
*/
|
||||
function mergeMaps(m_target, values) {
|
||||
for (const [key, value] of getIterableOfIterables(values.slice(1))) {
|
||||
m_target.value.set(key, value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set the target to the last value.
|
||||
*/
|
||||
function mergeOthers(m_target, values) {
|
||||
m_target.value = values[values.length - 1];
|
||||
}
|
||||
|
||||
var defaultMergeIntoFunctions = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
mergeRecords: mergeRecords,
|
||||
mergeArrays: mergeArrays,
|
||||
mergeSets: mergeSets,
|
||||
mergeMaps: mergeMaps,
|
||||
mergeOthers: mergeOthers
|
||||
});
|
||||
|
||||
function deepmergeInto(target, ...objects) {
|
||||
return void deepmergeIntoCustom({})(target, ...objects);
|
||||
}
|
||||
function deepmergeIntoCustom(options, rootMetaData) {
|
||||
const utils = getIntoUtils(options, customizedDeepmergeInto);
|
||||
/**
|
||||
* The customized deepmerge function.
|
||||
*/
|
||||
function customizedDeepmergeInto(target, ...objects) {
|
||||
mergeUnknownsInto({ value: target }, [target, ...objects], utils, rootMetaData);
|
||||
}
|
||||
return customizedDeepmergeInto;
|
||||
}
|
||||
/**
|
||||
* The the utils that are available to the merge functions.
|
||||
*
|
||||
* @param options - The options the user specified
|
||||
*/
|
||||
function getIntoUtils(options, customizedDeepmergeInto) {
|
||||
var _a;
|
||||
return {
|
||||
defaultMergeFunctions: defaultMergeIntoFunctions,
|
||||
mergeFunctions: {
|
||||
...defaultMergeIntoFunctions,
|
||||
...Object.fromEntries(Object.entries(options)
|
||||
.filter(([key, option]) => Object.prototype.hasOwnProperty.call(defaultMergeIntoFunctions, key))
|
||||
.map(([key, option]) => option === false
|
||||
? [key, mergeOthers]
|
||||
: [key, option])),
|
||||
},
|
||||
metaDataUpdater: ((_a = options.metaDataUpdater) !== null && _a !== void 0 ? _a : defaultMetaDataUpdater),
|
||||
deepmergeInto: customizedDeepmergeInto,
|
||||
actions: actionsInto,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Merge unknown things into a target.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The values.
|
||||
*/
|
||||
function mergeUnknownsInto(m_target, values, utils, meta
|
||||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||
) {
|
||||
if (values.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (values.length === 1) {
|
||||
return void mergeOthersInto(m_target, values, utils, meta);
|
||||
}
|
||||
const type = getObjectType(m_target.value);
|
||||
// eslint-disable-next-line functional/no-conditional-statements -- add an early escape for better performance.
|
||||
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
|
||||
// eslint-disable-next-line functional/no-loop-statements -- using a loop here is more performant than mapping every value and then testing every value.
|
||||
for (let m_index = 1; m_index < values.length; m_index++) {
|
||||
if (getObjectType(values[m_index]) === type) {
|
||||
continue;
|
||||
}
|
||||
return void mergeOthersInto(m_target, values, utils, meta);
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case 1 /* ObjectType.RECORD */: {
|
||||
return void mergeRecordsInto(m_target, values, utils, meta);
|
||||
}
|
||||
case 2 /* ObjectType.ARRAY */: {
|
||||
return void mergeArraysInto(m_target, values, utils, meta);
|
||||
}
|
||||
case 3 /* ObjectType.SET */: {
|
||||
return void mergeSetsInto(m_target, values, utils, meta);
|
||||
}
|
||||
case 4 /* ObjectType.MAP */: {
|
||||
return void mergeMapsInto(m_target, values, utils, meta);
|
||||
}
|
||||
default: {
|
||||
return void mergeOthersInto(m_target, values, utils, meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge records into a target record.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The records.
|
||||
*/
|
||||
function mergeRecordsInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeRecords(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeRecords(m_target, values, utils, meta);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge arrays into a target array.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
function mergeArraysInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeArrays(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeArrays(m_target, values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge sets into a target set.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The sets.
|
||||
*/
|
||||
function mergeSetsInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeSets(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeSets(m_target, values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge maps into a target map.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The maps.
|
||||
*/
|
||||
function mergeMapsInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeMaps(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeMaps(m_target, values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Merge other things into a target.
|
||||
*
|
||||
* @param m_target - The target to merge into.
|
||||
* @param values - The other things.
|
||||
*/
|
||||
function mergeOthersInto(m_target, values, utils, meta) {
|
||||
const action = utils.mergeFunctions.mergeOthers(m_target, values, utils, meta);
|
||||
if (action === actionsInto.defaultMerge ||
|
||||
m_target.value === actionsInto.defaultMerge) {
|
||||
utils.defaultMergeFunctions.mergeOthers(m_target, values);
|
||||
}
|
||||
}
|
||||
|
||||
export { deepmerge, deepmergeCustom, deepmergeInto, deepmergeIntoCustom };
|
||||
531
node_modules/deepmerge-ts/dist/node/types/current/index.d.cts
generated
vendored
Normal file
531
node_modules/deepmerge-ts/dist/node/types/current/index.d.cts
generated
vendored
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
/**
|
||||
* Flatten a complex type such as a union or intersection of objects into a
|
||||
* single object.
|
||||
*/
|
||||
type FlatternAlias<T> = Is<T, unknown> extends true ? T : {
|
||||
[P in keyof T]: T[P];
|
||||
} & {};
|
||||
/**
|
||||
* Get the value of the given key in the given object.
|
||||
*/
|
||||
type ValueOfKey<T extends Record<PropertyKey, unknown>, K extends PropertyKey> = K extends keyof T ? T[K] : never;
|
||||
/**
|
||||
* Safely test whether or not the first given types extends the second.
|
||||
*
|
||||
* Needed in particular for testing if a type is "never".
|
||||
*/
|
||||
type Is<T1, T2> = [T1] extends [T2] ? true : false;
|
||||
/**
|
||||
* Safely test whether or not the given type is "never".
|
||||
*/
|
||||
type IsNever<T> = Is<T, never>;
|
||||
/**
|
||||
* Returns whether or not the given type a record.
|
||||
*/
|
||||
type IsRecord<T> = And<Not<IsNever<T>>, T extends Readonly<Record<PropertyKey, unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are records.
|
||||
*/
|
||||
type EveryIsRecord<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [infer Head, ...infer Rest] ? IsRecord<Head> extends true ? Rest extends ReadonlyArray<unknown> ? EveryIsRecord<Rest> : true : false : true;
|
||||
/**
|
||||
* Returns whether or not the given type is an array.
|
||||
*/
|
||||
type IsArray<T> = And<Not<IsNever<T>>, T extends ReadonlyArray<unknown> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are arrays.
|
||||
*/
|
||||
type EveryIsArray<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [infer T1] ? IsArray<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsArray<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsArray<Rest> : false : false : false;
|
||||
/**
|
||||
* Returns whether or not the given type is an set.
|
||||
*
|
||||
* Note: This may also return true for Maps.
|
||||
*/
|
||||
type IsSet<T> = And<Not<IsNever<T>>, T extends Readonly<ReadonlySet<unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are sets.
|
||||
*
|
||||
* Note: This may also return true if all are maps.
|
||||
*/
|
||||
type EveryIsSet<Ts extends ReadonlyArray<unknown>> = Ts extends Readonly<readonly [infer T1]> ? IsSet<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsSet<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsSet<Rest> : false : false : false;
|
||||
/**
|
||||
* Returns whether or not the given type is an map.
|
||||
*/
|
||||
type IsMap<T> = And<Not<IsNever<T>>, T extends Readonly<ReadonlyMap<unknown, unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are maps.
|
||||
*/
|
||||
type EveryIsMap<Ts extends ReadonlyArray<unknown>> = Ts extends Readonly<readonly [infer T1]> ? IsMap<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsMap<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsMap<Rest> : false : false : false;
|
||||
/**
|
||||
* And operator for types.
|
||||
*/
|
||||
type And<T1 extends boolean, T2 extends boolean> = T1 extends false ? false : T2;
|
||||
/**
|
||||
* Not operator for types.
|
||||
*/
|
||||
type Not<T extends boolean> = T extends true ? false : true;
|
||||
/**
|
||||
* Union of the sets' values' types
|
||||
*/
|
||||
type UnionSetValues<Ts extends ReadonlyArray<unknown>> = UnionSetValuesHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionSetValues.
|
||||
*/
|
||||
type UnionSetValuesHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlySet<infer V1>> ? Rest extends ReadonlyArray<unknown> ? UnionSetValuesHelper<Rest, Acc | V1> : Acc | V1 : never : Acc;
|
||||
/**
|
||||
* Union of the maps' values' types
|
||||
*/
|
||||
type UnionMapKeys<Ts extends ReadonlyArray<unknown>> = UnionMapKeysHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionMapKeys.
|
||||
*/
|
||||
type UnionMapKeysHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlyMap<infer K1, unknown>> ? Rest extends readonly [] ? Acc | K1 : UnionMapKeysHelper<Rest, Acc | K1> : never : Acc;
|
||||
/**
|
||||
* Union of the maps' keys' types
|
||||
*/
|
||||
type UnionMapValues<Ts extends ReadonlyArray<unknown>> = UnionMapValuesHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionMapValues.
|
||||
*/
|
||||
type UnionMapValuesHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlyMap<unknown, infer V1>> ? Rest extends readonly [] ? Acc | V1 : UnionMapValuesHelper<Rest, Acc | V1> : never : Acc;
|
||||
/**
|
||||
* Get the keys of the type what match a certain criteria.
|
||||
*/
|
||||
type KeysOfType<T, U> = {
|
||||
[K in keyof T]: T[K] extends U ? K : never;
|
||||
}[keyof T];
|
||||
/**
|
||||
* Get the required keys of the type.
|
||||
*/
|
||||
type RequiredKeys<T> = Exclude<KeysOfType<T, Exclude<T[keyof T], undefined>>, undefined>;
|
||||
/**
|
||||
* Get all the required keys on the types in the tuple.
|
||||
*/
|
||||
type RequiredKeysOf<Ts extends readonly [unknown, ...ReadonlyArray<unknown>]> = RequiredKeysOfHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for RequiredKeysOf.
|
||||
*/
|
||||
type RequiredKeysOfHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record<PropertyKey, unknown> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? RequiredKeysOfHelper<Rest, Acc | RequiredKeys<Head>> : Acc | RequiredKeys<Head> : never : Acc;
|
||||
/**
|
||||
* Get the optional keys of the type.
|
||||
*/
|
||||
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
||||
/**
|
||||
* Get all the optional keys on the types in the tuple.
|
||||
*/
|
||||
type OptionalKeysOf<Ts extends readonly [unknown, ...ReadonlyArray<unknown>]> = OptionalKeysOfHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for OptionalKeysOf.
|
||||
*/
|
||||
type OptionalKeysOfHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record<PropertyKey, unknown> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? OptionalKeysOfHelper<Rest, Acc | OptionalKeys<Head>> : Acc | OptionalKeys<Head> : never : Acc;
|
||||
/**
|
||||
* Filter out nevers from a tuple.
|
||||
*/
|
||||
type FilterOutNever<T extends ReadonlyArray<unknown>> = FilterOutNeverHelper<T, []>;
|
||||
/**
|
||||
* Tail-recursive helper type for FilterOutNever.
|
||||
*/
|
||||
type FilterOutNeverHelper<T extends ReadonlyArray<unknown>, Acc extends ReadonlyArray<unknown>> = T extends readonly [] ? Acc : T extends readonly [infer Head, ...infer Rest] ? IsNever<Head> extends true ? FilterOutNeverHelper<Rest, Acc> : FilterOutNeverHelper<Rest, [...Acc, Head]> : T;
|
||||
/**
|
||||
* Is the type a tuple?
|
||||
*/
|
||||
type IsTuple<T extends ReadonlyArray<unknown>> = T extends readonly [] ? true : T extends readonly [unknown, ...ReadonlyArray<unknown>] ? true : false;
|
||||
|
||||
/**
|
||||
* Mapping of merge function URIs to the merge function type.
|
||||
*/
|
||||
interface DeepMergeMergeFunctionURItoKind<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, in out M> {
|
||||
readonly DeepMergeLeafURI: DeepMergeLeaf<Ts>;
|
||||
readonly DeepMergeRecordsDefaultURI: DeepMergeRecordsDefaultHKT<Ts, MF, M>;
|
||||
readonly DeepMergeArraysDefaultURI: DeepMergeArraysDefaultHKT<Ts, MF, M>;
|
||||
readonly DeepMergeSetsDefaultURI: DeepMergeSetsDefaultHKT<Ts>;
|
||||
readonly DeepMergeMapsDefaultURI: DeepMergeMapsDefaultHKT<Ts>;
|
||||
}
|
||||
/**
|
||||
* Get the type of the given merge function via its URI.
|
||||
*/
|
||||
type DeepMergeMergeFunctionKind<URI extends DeepMergeMergeFunctionURIs, Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionURItoKind<Ts, MF, M>[URI];
|
||||
/**
|
||||
* A union of all valid merge function URIs.
|
||||
*/
|
||||
type DeepMergeMergeFunctionURIs = keyof DeepMergeMergeFunctionURItoKind<ReadonlyArray<unknown>, DeepMergeMergeFunctionsURIs, unknown>;
|
||||
/**
|
||||
* The merge functions to use when deep merging.
|
||||
*/
|
||||
type DeepMergeMergeFunctionsURIs = Readonly<{
|
||||
/**
|
||||
* The merge function to merge records with.
|
||||
*/
|
||||
DeepMergeRecordsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge arrays with.
|
||||
*/
|
||||
DeepMergeArraysURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge sets with.
|
||||
*/
|
||||
DeepMergeSetsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge maps with.
|
||||
*/
|
||||
DeepMergeMapsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge other things with.
|
||||
*/
|
||||
DeepMergeOthersURI: DeepMergeMergeFunctionURIs;
|
||||
}>;
|
||||
/**
|
||||
* Deep merge types.
|
||||
*/
|
||||
type DeepMergeHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = IsTuple<Ts> extends true ? Ts extends readonly [] ? undefined : Ts extends readonly [infer T1] ? T1 : EveryIsArray<Ts> extends true ? DeepMergeArraysHKT<Ts, MF, M> : EveryIsMap<Ts> extends true ? DeepMergeMapsHKT<Ts, MF, M> : EveryIsSet<Ts> extends true ? DeepMergeSetsHKT<Ts, MF, M> : EveryIsRecord<Ts> extends true ? DeepMergeRecordsHKT<Ts, MF, M> : DeepMergeOthersHKT<Ts, MF, M> : unknown;
|
||||
/**
|
||||
* Deep merge records.
|
||||
*/
|
||||
type DeepMergeRecordsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeRecordsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge arrays.
|
||||
*/
|
||||
type DeepMergeArraysHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeArraysURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge sets.
|
||||
*/
|
||||
type DeepMergeSetsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeSetsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge maps.
|
||||
*/
|
||||
type DeepMergeMapsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeMapsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge other things.
|
||||
*/
|
||||
type DeepMergeOthersHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeOthersURI"], Ts, MF, M>;
|
||||
/**
|
||||
* The merge function that returns a leaf.
|
||||
*/
|
||||
type DeepMergeLeafURI = "DeepMergeLeafURI";
|
||||
/**
|
||||
* Get the leaf type from many types that can't be merged.
|
||||
*
|
||||
* @deprecated Use `DeepMergeLeaf` instead.
|
||||
*/
|
||||
type DeepMergeLeafHKT<Ts extends ReadonlyArray<unknown>> = DeepMergeLeaf<Ts>;
|
||||
/**
|
||||
* Get the leaf type from many types that can't be merged.
|
||||
*/
|
||||
type DeepMergeLeaf<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [] ? never : Ts extends readonly [infer T] ? T : Ts extends readonly [...infer Rest, infer Tail] ? IsNever<Tail> extends true ? Rest extends ReadonlyArray<unknown> ? DeepMergeLeaf<Rest> : never : Tail : never;
|
||||
/**
|
||||
* The meta data deepmerge is able to provide.
|
||||
*/
|
||||
type DeepMergeBuiltInMetaData = Readonly<{
|
||||
key: PropertyKey;
|
||||
parents: ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The default merge function to merge records with.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultURI = "DeepMergeRecordsDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge arrays with.
|
||||
*/
|
||||
type DeepMergeArraysDefaultURI = "DeepMergeArraysDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge sets with.
|
||||
*/
|
||||
type DeepMergeSetsDefaultURI = "DeepMergeSetsDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge maps with.
|
||||
*/
|
||||
type DeepMergeMapsDefaultURI = "DeepMergeMapsDefaultURI";
|
||||
/**
|
||||
* The default merge functions to use when deep merging.
|
||||
*/
|
||||
type DeepMergeMergeFunctionsDefaultURIs = Readonly<{
|
||||
DeepMergeRecordsURI: DeepMergeRecordsDefaultURI;
|
||||
DeepMergeArraysURI: DeepMergeArraysDefaultURI;
|
||||
DeepMergeSetsURI: DeepMergeSetsDefaultURI;
|
||||
DeepMergeMapsURI: DeepMergeMapsDefaultURI;
|
||||
DeepMergeOthersURI: DeepMergeLeafURI;
|
||||
}>;
|
||||
/**
|
||||
* A union of all the props that should not be included in type information for
|
||||
* merged records.
|
||||
*/
|
||||
type BlacklistedRecordProps = "__proto__";
|
||||
/**
|
||||
* Deep merge records.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = Ts extends Readonly<readonly [unknown, ...Readonly<ReadonlyArray<unknown>>]> ? FlatternAlias<Omit<DeepMergeRecordsDefaultHKTInternalProps<Ts, MF, M>, BlacklistedRecordProps>> : {};
|
||||
/**
|
||||
* Deep merge record props.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKTInternalProps<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], MF extends DeepMergeMergeFunctionsURIs, M> = {
|
||||
[K in OptionalKeysOf<Ts>]?: DeepMergeHKT<DeepMergeRecordsDefaultHKTInternalPropValue<Ts, K, M>, MF, M>;
|
||||
} & {
|
||||
[K in RequiredKeysOf<Ts>]: DeepMergeHKT<DeepMergeRecordsDefaultHKTInternalPropValue<Ts, K, M>, MF, M>;
|
||||
};
|
||||
/**
|
||||
* Get the value of the property.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKTInternalPropValue<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], K extends PropertyKey, M> = FilterOutNever<DeepMergeRecordsDefaultHKTInternalPropValueHelper<Ts, K, M, readonly []>>;
|
||||
/**
|
||||
* Tail-recursive helper type for DeepMergeRecordsDefaultHKTInternalPropValue.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKTInternalPropValueHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], K extends PropertyKey, M, Acc extends ReadonlyArray<unknown>> = Ts extends readonly [
|
||||
infer Head extends Readonly<Record<PropertyKey, unknown>>,
|
||||
...infer Rest
|
||||
] ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? DeepMergeRecordsDefaultHKTInternalPropValueHelper<Rest, K, M, [
|
||||
...Acc,
|
||||
ValueOfKey<Head, K>
|
||||
]> : [...Acc, ValueOfKey<Head, K>] : never;
|
||||
/**
|
||||
* Deep merge 2 arrays.
|
||||
*/
|
||||
type DeepMergeArraysDefaultHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeArraysDefaultHKTHelper<Ts, MF, M, []>;
|
||||
/**
|
||||
* Tail-recursive helper type for DeepMergeArraysDefaultHKT.
|
||||
*/
|
||||
type DeepMergeArraysDefaultHKTHelper<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M, Acc extends ReadonlyArray<unknown>> = Ts extends readonly [
|
||||
infer Head extends ReadonlyArray<unknown>,
|
||||
...infer Rest
|
||||
] ? Rest extends readonly [
|
||||
ReadonlyArray<unknown>,
|
||||
...ReadonlyArray<ReadonlyArray<unknown>>
|
||||
] ? DeepMergeArraysDefaultHKTHelper<Rest, MF, M, [...Acc, ...Head]> : [...Acc, ...Head] : never;
|
||||
/**
|
||||
* Deep merge 2 sets.
|
||||
*/
|
||||
type DeepMergeSetsDefaultHKT<Ts extends ReadonlyArray<unknown>> = Set<UnionSetValues<Ts>>;
|
||||
/**
|
||||
* Deep merge 2 maps.
|
||||
*/
|
||||
type DeepMergeMapsDefaultHKT<Ts extends ReadonlyArray<unknown>> = Map<UnionMapKeys<Ts>, UnionMapValues<Ts>>;
|
||||
/**
|
||||
* Get the merge functions with defaults apply from the given subset.
|
||||
*/
|
||||
type GetDeepMergeMergeFunctionsURIs<PMF extends Partial<DeepMergeMergeFunctionsURIs>> = Readonly<{
|
||||
DeepMergeRecordsURI: PMF["DeepMergeRecordsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeRecordsURI"] : DeepMergeRecordsDefaultURI;
|
||||
DeepMergeArraysURI: PMF["DeepMergeArraysURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeArraysURI"] : DeepMergeArraysDefaultURI;
|
||||
DeepMergeSetsURI: PMF["DeepMergeSetsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeSetsURI"] : DeepMergeSetsDefaultURI;
|
||||
DeepMergeMapsURI: PMF["DeepMergeMapsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeMapsURI"] : DeepMergeMapsDefaultURI;
|
||||
DeepMergeOthersURI: PMF["DeepMergeOthersURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeOthersURI"] : DeepMergeLeafURI;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The default merge functions.
|
||||
*/
|
||||
type MergeFunctions$1 = {
|
||||
mergeRecords: typeof mergeRecords$1;
|
||||
mergeArrays: typeof mergeArrays$1;
|
||||
mergeSets: typeof mergeSets$1;
|
||||
mergeMaps: typeof mergeMaps$1;
|
||||
mergeOthers: typeof mergeOthers$1;
|
||||
};
|
||||
/**
|
||||
* The default strategy to merge records into a target record.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this record
|
||||
* @param values - The records (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeRecords$1<Ts extends ReadonlyArray<Record<PropertyKey, unknown>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>, M, MM extends DeepMergeBuiltInMetaData>(m_target: Reference<Record<PropertyKey, unknown>>, values: Ts, utils: U, meta: M | undefined): void;
|
||||
/**
|
||||
* The default strategy to merge arrays into a target array.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this array
|
||||
* @param values - The arrays (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeArrays$1<Ts extends ReadonlyArray<ReadonlyArray<unknown>>>(m_target: Reference<unknown[]>, values: Ts): void;
|
||||
/**
|
||||
* The default strategy to merge sets into a target set.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this set
|
||||
* @param values - The sets (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeSets$1<Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>>(m_target: Reference<Set<unknown>>, values: Ts): void;
|
||||
/**
|
||||
* The default strategy to merge maps into a target map.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this map
|
||||
* @param values - The maps (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeMaps$1<Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>>(m_target: Reference<Map<unknown, unknown>>, values: Ts): void;
|
||||
/**
|
||||
* Set the target to the last value.
|
||||
*/
|
||||
declare function mergeOthers$1<Ts extends ReadonlyArray<unknown>>(m_target: Reference<unknown>, values: Ts): void;
|
||||
|
||||
/**
|
||||
* The default merge functions.
|
||||
*/
|
||||
type MergeFunctions = {
|
||||
mergeRecords: typeof mergeRecords;
|
||||
mergeArrays: typeof mergeArrays;
|
||||
mergeSets: typeof mergeSets;
|
||||
mergeMaps: typeof mergeMaps;
|
||||
mergeOthers: typeof mergeOthers;
|
||||
};
|
||||
/**
|
||||
* The default strategy to merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
declare function mergeRecords<Ts extends ReadonlyArray<Record<PropertyKey, unknown>>, U extends DeepMergeMergeFunctionUtils<M, MM>, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT<Ts, MF, M>;
|
||||
/**
|
||||
* The default strategy to merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
declare function mergeArrays<Ts extends ReadonlyArray<ReadonlyArray<unknown>>, MF extends DeepMergeMergeFunctionsURIs, M>(values: Ts): DeepMergeArraysDefaultHKT<Ts, MF, M>;
|
||||
/**
|
||||
* The default strategy to merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
declare function mergeSets<Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>>(values: Ts): DeepMergeSetsDefaultHKT<Ts>;
|
||||
/**
|
||||
* The default strategy to merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
declare function mergeMaps<Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>>(values: Ts): DeepMergeMapsDefaultHKT<Ts>;
|
||||
/**
|
||||
* Get the last value in the given array.
|
||||
*/
|
||||
declare function mergeOthers<Ts extends ReadonlyArray<unknown>>(values: Ts): unknown;
|
||||
|
||||
/**
|
||||
* The options the user can pass to customize deepmerge.
|
||||
*/
|
||||
type DeepMergeOptions<in out M, MM extends Readonly<Record<PropertyKey, unknown>> = DeepMergeBuiltInMetaData> = Partial<DeepMergeOptionsFull<M, MM & DeepMergeBuiltInMetaData>>;
|
||||
/**
|
||||
* The options the user can pass to customize deepmergeInto.
|
||||
*/
|
||||
type DeepMergeIntoOptions<in out M, MM extends Readonly<Record<PropertyKey, unknown>> = DeepMergeBuiltInMetaData> = Partial<DeepMergeIntoOptionsFull<M, MM & DeepMergeBuiltInMetaData>>;
|
||||
type MetaDataUpdater<in out M, MM extends DeepMergeBuiltInMetaData> = (previousMeta: M | undefined, metaMeta: Readonly<Partial<MM>>) => M;
|
||||
/**
|
||||
* All the options the user can pass to customize deepmerge.
|
||||
*/
|
||||
type DeepMergeOptionsFull<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: DeepMergeMergeFunctions<M, MM>["mergeRecords"] | false;
|
||||
mergeArrays: DeepMergeMergeFunctions<M, MM>["mergeArrays"] | false;
|
||||
mergeMaps: DeepMergeMergeFunctions<M, MM>["mergeMaps"] | false;
|
||||
mergeSets: DeepMergeMergeFunctions<M, MM>["mergeSets"] | false;
|
||||
mergeOthers: DeepMergeMergeFunctions<M, MM>["mergeOthers"];
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
enableImplicitDefaultMerging: boolean;
|
||||
}>;
|
||||
/**
|
||||
* All the options the user can pass to customize deepmergeInto.
|
||||
*/
|
||||
type DeepMergeIntoOptionsFull<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: DeepMergeMergeIntoFunctions<M, MM>["mergeRecords"] | false;
|
||||
mergeArrays: DeepMergeMergeIntoFunctions<M, MM>["mergeArrays"] | false;
|
||||
mergeMaps: DeepMergeMergeIntoFunctions<M, MM>["mergeMaps"] | false;
|
||||
mergeSets: DeepMergeMergeIntoFunctions<M, MM>["mergeSets"] | false;
|
||||
mergeOthers: DeepMergeMergeIntoFunctions<M, MM>["mergeOthers"];
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
}>;
|
||||
/**
|
||||
* An object that has a reference to a value.
|
||||
*/
|
||||
type Reference<T> = {
|
||||
value: T;
|
||||
};
|
||||
/**
|
||||
* All the merge functions that deepmerge uses.
|
||||
*/
|
||||
type DeepMergeMergeFunctions<in M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: <Ts extends ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeArrays: <Ts extends ReadonlyArray<ReadonlyArray<unknown>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeMaps: <Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeSets: <Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeOthers: <Ts extends ReadonlyArray<unknown>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
}>;
|
||||
type DeepMergeMergeIntoFunctionsReturnType = void | symbol;
|
||||
/**
|
||||
* All the merge functions that deepmerge uses.
|
||||
*/
|
||||
type DeepMergeMergeIntoFunctions<in M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: <Ts extends ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<Record<PropertyKey, unknown>>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeArrays: <Ts extends ReadonlyArray<ReadonlyArray<unknown>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<unknown[]>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeMaps: <Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<Map<unknown, unknown>>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeSets: <Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<Set<unknown>>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeOthers: <Ts extends ReadonlyArray<unknown>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<unknown>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
}>;
|
||||
/**
|
||||
* The utils provided to the merge functions.
|
||||
*/
|
||||
type DeepMergeMergeFunctionUtils<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeFunctions: DeepMergeMergeFunctions<M, MM>;
|
||||
defaultMergeFunctions: MergeFunctions;
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
deepmerge: <Ts extends ReadonlyArray<unknown>>(...values: Ts) => unknown;
|
||||
useImplicitDefaultMerging: boolean;
|
||||
actions: Readonly<{
|
||||
defaultMerge: symbol;
|
||||
skip: symbol;
|
||||
}>;
|
||||
}>;
|
||||
/**
|
||||
* The utils provided to the merge functions.
|
||||
*/
|
||||
type DeepMergeMergeIntoFunctionUtils<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeFunctions: DeepMergeMergeIntoFunctions<M, MM>;
|
||||
defaultMergeFunctions: MergeFunctions$1;
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
deepmergeInto: <Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...values: Ts) => void;
|
||||
actions: Readonly<{
|
||||
defaultMerge: symbol;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Deeply merge objects.
|
||||
*
|
||||
* @param objects - The objects to merge.
|
||||
*/
|
||||
declare function deepmerge<Ts extends Readonly<ReadonlyArray<unknown>>>(...objects: readonly [...Ts]): DeepMergeHKT<Ts, DeepMergeMergeFunctionsDefaultURIs, DeepMergeBuiltInMetaData>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
*/
|
||||
declare function deepmergeCustom<PMF extends Partial<DeepMergeMergeFunctionsURIs>>(options: DeepMergeOptions<DeepMergeBuiltInMetaData, DeepMergeBuiltInMetaData>): <Ts extends ReadonlyArray<unknown>>(...objects: Ts) => DeepMergeHKT<Ts, GetDeepMergeMergeFunctionsURIs<PMF>, DeepMergeBuiltInMetaData>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options and meta data.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
* @param rootMetaData - The meta data passed to the root items' being merged.
|
||||
*/
|
||||
declare function deepmergeCustom<PMF extends Partial<DeepMergeMergeFunctionsURIs>, MetaData, MetaMetaData extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(options: DeepMergeOptions<MetaData, MetaMetaData>, rootMetaData?: MetaData): <Ts extends ReadonlyArray<unknown>>(...objects: Ts) => DeepMergeHKT<Ts, GetDeepMergeMergeFunctionsURIs<PMF>, MetaData>;
|
||||
|
||||
/**
|
||||
* Deeply merge objects into a target.
|
||||
*
|
||||
* @param target - This object will be mutated with the merge result.
|
||||
* @param objects - The objects to merge into the target.
|
||||
*/
|
||||
declare function deepmergeInto<T extends object>(target: T, ...objects: ReadonlyArray<T>): void;
|
||||
/**
|
||||
* Deeply merge objects into a target.
|
||||
*
|
||||
* @param target - This object will be mutated with the merge result.
|
||||
* @param objects - The objects to merge into the target.
|
||||
*/
|
||||
declare function deepmergeInto<Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...objects: Ts): asserts target is FlatternAlias<Target & DeepMergeHKT<[
|
||||
Target,
|
||||
...Ts
|
||||
], DeepMergeMergeFunctionsDefaultURIs, DeepMergeBuiltInMetaData>>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
*/
|
||||
declare function deepmergeIntoCustom(options: DeepMergeIntoOptions<DeepMergeBuiltInMetaData, DeepMergeBuiltInMetaData>): <Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...objects: Ts) => void;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options and meta data.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
* @param rootMetaData - The meta data passed to the root items' being merged.
|
||||
*/
|
||||
declare function deepmergeIntoCustom<MetaData, MetaMetaData extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(options: DeepMergeIntoOptions<MetaData, MetaMetaData>, rootMetaData?: MetaData): <Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...objects: Ts) => void;
|
||||
|
||||
export { DeepMergeArraysDefaultHKT, DeepMergeBuiltInMetaData, DeepMergeHKT, DeepMergeIntoOptions, DeepMergeLeaf, DeepMergeLeafHKT, DeepMergeLeafURI, DeepMergeMapsDefaultHKT, DeepMergeMergeFunctionURItoKind, DeepMergeMergeFunctionUtils, DeepMergeMergeFunctionsDefaultURIs, MergeFunctions as DeepMergeMergeFunctionsDefaults, DeepMergeMergeFunctionsURIs, DeepMergeMergeIntoFunctionUtils, MergeFunctions$1 as DeepMergeMergeIntoFunctionsDefaults, DeepMergeOptions, DeepMergeRecordsDefaultHKT, DeepMergeSetsDefaultHKT, Reference as DeepMergeValueReference, deepmerge, deepmergeCustom, deepmergeInto, deepmergeIntoCustom };
|
||||
531
node_modules/deepmerge-ts/dist/node/types/current/index.d.mts
generated
vendored
Normal file
531
node_modules/deepmerge-ts/dist/node/types/current/index.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
/**
|
||||
* Flatten a complex type such as a union or intersection of objects into a
|
||||
* single object.
|
||||
*/
|
||||
type FlatternAlias<T> = Is<T, unknown> extends true ? T : {
|
||||
[P in keyof T]: T[P];
|
||||
} & {};
|
||||
/**
|
||||
* Get the value of the given key in the given object.
|
||||
*/
|
||||
type ValueOfKey<T extends Record<PropertyKey, unknown>, K extends PropertyKey> = K extends keyof T ? T[K] : never;
|
||||
/**
|
||||
* Safely test whether or not the first given types extends the second.
|
||||
*
|
||||
* Needed in particular for testing if a type is "never".
|
||||
*/
|
||||
type Is<T1, T2> = [T1] extends [T2] ? true : false;
|
||||
/**
|
||||
* Safely test whether or not the given type is "never".
|
||||
*/
|
||||
type IsNever<T> = Is<T, never>;
|
||||
/**
|
||||
* Returns whether or not the given type a record.
|
||||
*/
|
||||
type IsRecord<T> = And<Not<IsNever<T>>, T extends Readonly<Record<PropertyKey, unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are records.
|
||||
*/
|
||||
type EveryIsRecord<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [infer Head, ...infer Rest] ? IsRecord<Head> extends true ? Rest extends ReadonlyArray<unknown> ? EveryIsRecord<Rest> : true : false : true;
|
||||
/**
|
||||
* Returns whether or not the given type is an array.
|
||||
*/
|
||||
type IsArray<T> = And<Not<IsNever<T>>, T extends ReadonlyArray<unknown> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are arrays.
|
||||
*/
|
||||
type EveryIsArray<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [infer T1] ? IsArray<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsArray<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsArray<Rest> : false : false : false;
|
||||
/**
|
||||
* Returns whether or not the given type is an set.
|
||||
*
|
||||
* Note: This may also return true for Maps.
|
||||
*/
|
||||
type IsSet<T> = And<Not<IsNever<T>>, T extends Readonly<ReadonlySet<unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are sets.
|
||||
*
|
||||
* Note: This may also return true if all are maps.
|
||||
*/
|
||||
type EveryIsSet<Ts extends ReadonlyArray<unknown>> = Ts extends Readonly<readonly [infer T1]> ? IsSet<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsSet<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsSet<Rest> : false : false : false;
|
||||
/**
|
||||
* Returns whether or not the given type is an map.
|
||||
*/
|
||||
type IsMap<T> = And<Not<IsNever<T>>, T extends Readonly<ReadonlyMap<unknown, unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are maps.
|
||||
*/
|
||||
type EveryIsMap<Ts extends ReadonlyArray<unknown>> = Ts extends Readonly<readonly [infer T1]> ? IsMap<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsMap<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsMap<Rest> : false : false : false;
|
||||
/**
|
||||
* And operator for types.
|
||||
*/
|
||||
type And<T1 extends boolean, T2 extends boolean> = T1 extends false ? false : T2;
|
||||
/**
|
||||
* Not operator for types.
|
||||
*/
|
||||
type Not<T extends boolean> = T extends true ? false : true;
|
||||
/**
|
||||
* Union of the sets' values' types
|
||||
*/
|
||||
type UnionSetValues<Ts extends ReadonlyArray<unknown>> = UnionSetValuesHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionSetValues.
|
||||
*/
|
||||
type UnionSetValuesHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlySet<infer V1>> ? Rest extends ReadonlyArray<unknown> ? UnionSetValuesHelper<Rest, Acc | V1> : Acc | V1 : never : Acc;
|
||||
/**
|
||||
* Union of the maps' values' types
|
||||
*/
|
||||
type UnionMapKeys<Ts extends ReadonlyArray<unknown>> = UnionMapKeysHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionMapKeys.
|
||||
*/
|
||||
type UnionMapKeysHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlyMap<infer K1, unknown>> ? Rest extends readonly [] ? Acc | K1 : UnionMapKeysHelper<Rest, Acc | K1> : never : Acc;
|
||||
/**
|
||||
* Union of the maps' keys' types
|
||||
*/
|
||||
type UnionMapValues<Ts extends ReadonlyArray<unknown>> = UnionMapValuesHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionMapValues.
|
||||
*/
|
||||
type UnionMapValuesHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlyMap<unknown, infer V1>> ? Rest extends readonly [] ? Acc | V1 : UnionMapValuesHelper<Rest, Acc | V1> : never : Acc;
|
||||
/**
|
||||
* Get the keys of the type what match a certain criteria.
|
||||
*/
|
||||
type KeysOfType<T, U> = {
|
||||
[K in keyof T]: T[K] extends U ? K : never;
|
||||
}[keyof T];
|
||||
/**
|
||||
* Get the required keys of the type.
|
||||
*/
|
||||
type RequiredKeys<T> = Exclude<KeysOfType<T, Exclude<T[keyof T], undefined>>, undefined>;
|
||||
/**
|
||||
* Get all the required keys on the types in the tuple.
|
||||
*/
|
||||
type RequiredKeysOf<Ts extends readonly [unknown, ...ReadonlyArray<unknown>]> = RequiredKeysOfHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for RequiredKeysOf.
|
||||
*/
|
||||
type RequiredKeysOfHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record<PropertyKey, unknown> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? RequiredKeysOfHelper<Rest, Acc | RequiredKeys<Head>> : Acc | RequiredKeys<Head> : never : Acc;
|
||||
/**
|
||||
* Get the optional keys of the type.
|
||||
*/
|
||||
type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
||||
/**
|
||||
* Get all the optional keys on the types in the tuple.
|
||||
*/
|
||||
type OptionalKeysOf<Ts extends readonly [unknown, ...ReadonlyArray<unknown>]> = OptionalKeysOfHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for OptionalKeysOf.
|
||||
*/
|
||||
type OptionalKeysOfHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record<PropertyKey, unknown> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? OptionalKeysOfHelper<Rest, Acc | OptionalKeys<Head>> : Acc | OptionalKeys<Head> : never : Acc;
|
||||
/**
|
||||
* Filter out nevers from a tuple.
|
||||
*/
|
||||
type FilterOutNever<T extends ReadonlyArray<unknown>> = FilterOutNeverHelper<T, []>;
|
||||
/**
|
||||
* Tail-recursive helper type for FilterOutNever.
|
||||
*/
|
||||
type FilterOutNeverHelper<T extends ReadonlyArray<unknown>, Acc extends ReadonlyArray<unknown>> = T extends readonly [] ? Acc : T extends readonly [infer Head, ...infer Rest] ? IsNever<Head> extends true ? FilterOutNeverHelper<Rest, Acc> : FilterOutNeverHelper<Rest, [...Acc, Head]> : T;
|
||||
/**
|
||||
* Is the type a tuple?
|
||||
*/
|
||||
type IsTuple<T extends ReadonlyArray<unknown>> = T extends readonly [] ? true : T extends readonly [unknown, ...ReadonlyArray<unknown>] ? true : false;
|
||||
|
||||
/**
|
||||
* Mapping of merge function URIs to the merge function type.
|
||||
*/
|
||||
interface DeepMergeMergeFunctionURItoKind<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, in out M> {
|
||||
readonly DeepMergeLeafURI: DeepMergeLeaf<Ts>;
|
||||
readonly DeepMergeRecordsDefaultURI: DeepMergeRecordsDefaultHKT<Ts, MF, M>;
|
||||
readonly DeepMergeArraysDefaultURI: DeepMergeArraysDefaultHKT<Ts, MF, M>;
|
||||
readonly DeepMergeSetsDefaultURI: DeepMergeSetsDefaultHKT<Ts>;
|
||||
readonly DeepMergeMapsDefaultURI: DeepMergeMapsDefaultHKT<Ts>;
|
||||
}
|
||||
/**
|
||||
* Get the type of the given merge function via its URI.
|
||||
*/
|
||||
type DeepMergeMergeFunctionKind<URI extends DeepMergeMergeFunctionURIs, Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionURItoKind<Ts, MF, M>[URI];
|
||||
/**
|
||||
* A union of all valid merge function URIs.
|
||||
*/
|
||||
type DeepMergeMergeFunctionURIs = keyof DeepMergeMergeFunctionURItoKind<ReadonlyArray<unknown>, DeepMergeMergeFunctionsURIs, unknown>;
|
||||
/**
|
||||
* The merge functions to use when deep merging.
|
||||
*/
|
||||
type DeepMergeMergeFunctionsURIs = Readonly<{
|
||||
/**
|
||||
* The merge function to merge records with.
|
||||
*/
|
||||
DeepMergeRecordsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge arrays with.
|
||||
*/
|
||||
DeepMergeArraysURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge sets with.
|
||||
*/
|
||||
DeepMergeSetsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge maps with.
|
||||
*/
|
||||
DeepMergeMapsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge other things with.
|
||||
*/
|
||||
DeepMergeOthersURI: DeepMergeMergeFunctionURIs;
|
||||
}>;
|
||||
/**
|
||||
* Deep merge types.
|
||||
*/
|
||||
type DeepMergeHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = IsTuple<Ts> extends true ? Ts extends readonly [] ? undefined : Ts extends readonly [infer T1] ? T1 : EveryIsArray<Ts> extends true ? DeepMergeArraysHKT<Ts, MF, M> : EveryIsMap<Ts> extends true ? DeepMergeMapsHKT<Ts, MF, M> : EveryIsSet<Ts> extends true ? DeepMergeSetsHKT<Ts, MF, M> : EveryIsRecord<Ts> extends true ? DeepMergeRecordsHKT<Ts, MF, M> : DeepMergeOthersHKT<Ts, MF, M> : unknown;
|
||||
/**
|
||||
* Deep merge records.
|
||||
*/
|
||||
type DeepMergeRecordsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeRecordsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge arrays.
|
||||
*/
|
||||
type DeepMergeArraysHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeArraysURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge sets.
|
||||
*/
|
||||
type DeepMergeSetsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeSetsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge maps.
|
||||
*/
|
||||
type DeepMergeMapsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeMapsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge other things.
|
||||
*/
|
||||
type DeepMergeOthersHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeOthersURI"], Ts, MF, M>;
|
||||
/**
|
||||
* The merge function that returns a leaf.
|
||||
*/
|
||||
type DeepMergeLeafURI = "DeepMergeLeafURI";
|
||||
/**
|
||||
* Get the leaf type from many types that can't be merged.
|
||||
*
|
||||
* @deprecated Use `DeepMergeLeaf` instead.
|
||||
*/
|
||||
type DeepMergeLeafHKT<Ts extends ReadonlyArray<unknown>> = DeepMergeLeaf<Ts>;
|
||||
/**
|
||||
* Get the leaf type from many types that can't be merged.
|
||||
*/
|
||||
type DeepMergeLeaf<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [] ? never : Ts extends readonly [infer T] ? T : Ts extends readonly [...infer Rest, infer Tail] ? IsNever<Tail> extends true ? Rest extends ReadonlyArray<unknown> ? DeepMergeLeaf<Rest> : never : Tail : never;
|
||||
/**
|
||||
* The meta data deepmerge is able to provide.
|
||||
*/
|
||||
type DeepMergeBuiltInMetaData = Readonly<{
|
||||
key: PropertyKey;
|
||||
parents: ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The default merge function to merge records with.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultURI = "DeepMergeRecordsDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge arrays with.
|
||||
*/
|
||||
type DeepMergeArraysDefaultURI = "DeepMergeArraysDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge sets with.
|
||||
*/
|
||||
type DeepMergeSetsDefaultURI = "DeepMergeSetsDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge maps with.
|
||||
*/
|
||||
type DeepMergeMapsDefaultURI = "DeepMergeMapsDefaultURI";
|
||||
/**
|
||||
* The default merge functions to use when deep merging.
|
||||
*/
|
||||
type DeepMergeMergeFunctionsDefaultURIs = Readonly<{
|
||||
DeepMergeRecordsURI: DeepMergeRecordsDefaultURI;
|
||||
DeepMergeArraysURI: DeepMergeArraysDefaultURI;
|
||||
DeepMergeSetsURI: DeepMergeSetsDefaultURI;
|
||||
DeepMergeMapsURI: DeepMergeMapsDefaultURI;
|
||||
DeepMergeOthersURI: DeepMergeLeafURI;
|
||||
}>;
|
||||
/**
|
||||
* A union of all the props that should not be included in type information for
|
||||
* merged records.
|
||||
*/
|
||||
type BlacklistedRecordProps = "__proto__";
|
||||
/**
|
||||
* Deep merge records.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = Ts extends Readonly<readonly [unknown, ...Readonly<ReadonlyArray<unknown>>]> ? FlatternAlias<Omit<DeepMergeRecordsDefaultHKTInternalProps<Ts, MF, M>, BlacklistedRecordProps>> : {};
|
||||
/**
|
||||
* Deep merge record props.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKTInternalProps<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], MF extends DeepMergeMergeFunctionsURIs, M> = {
|
||||
[K in OptionalKeysOf<Ts>]?: DeepMergeHKT<DeepMergeRecordsDefaultHKTInternalPropValue<Ts, K, M>, MF, M>;
|
||||
} & {
|
||||
[K in RequiredKeysOf<Ts>]: DeepMergeHKT<DeepMergeRecordsDefaultHKTInternalPropValue<Ts, K, M>, MF, M>;
|
||||
};
|
||||
/**
|
||||
* Get the value of the property.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKTInternalPropValue<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], K extends PropertyKey, M> = FilterOutNever<DeepMergeRecordsDefaultHKTInternalPropValueHelper<Ts, K, M, readonly []>>;
|
||||
/**
|
||||
* Tail-recursive helper type for DeepMergeRecordsDefaultHKTInternalPropValue.
|
||||
*/
|
||||
type DeepMergeRecordsDefaultHKTInternalPropValueHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], K extends PropertyKey, M, Acc extends ReadonlyArray<unknown>> = Ts extends readonly [
|
||||
infer Head extends Readonly<Record<PropertyKey, unknown>>,
|
||||
...infer Rest
|
||||
] ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? DeepMergeRecordsDefaultHKTInternalPropValueHelper<Rest, K, M, [
|
||||
...Acc,
|
||||
ValueOfKey<Head, K>
|
||||
]> : [...Acc, ValueOfKey<Head, K>] : never;
|
||||
/**
|
||||
* Deep merge 2 arrays.
|
||||
*/
|
||||
type DeepMergeArraysDefaultHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeArraysDefaultHKTHelper<Ts, MF, M, []>;
|
||||
/**
|
||||
* Tail-recursive helper type for DeepMergeArraysDefaultHKT.
|
||||
*/
|
||||
type DeepMergeArraysDefaultHKTHelper<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M, Acc extends ReadonlyArray<unknown>> = Ts extends readonly [
|
||||
infer Head extends ReadonlyArray<unknown>,
|
||||
...infer Rest
|
||||
] ? Rest extends readonly [
|
||||
ReadonlyArray<unknown>,
|
||||
...ReadonlyArray<ReadonlyArray<unknown>>
|
||||
] ? DeepMergeArraysDefaultHKTHelper<Rest, MF, M, [...Acc, ...Head]> : [...Acc, ...Head] : never;
|
||||
/**
|
||||
* Deep merge 2 sets.
|
||||
*/
|
||||
type DeepMergeSetsDefaultHKT<Ts extends ReadonlyArray<unknown>> = Set<UnionSetValues<Ts>>;
|
||||
/**
|
||||
* Deep merge 2 maps.
|
||||
*/
|
||||
type DeepMergeMapsDefaultHKT<Ts extends ReadonlyArray<unknown>> = Map<UnionMapKeys<Ts>, UnionMapValues<Ts>>;
|
||||
/**
|
||||
* Get the merge functions with defaults apply from the given subset.
|
||||
*/
|
||||
type GetDeepMergeMergeFunctionsURIs<PMF extends Partial<DeepMergeMergeFunctionsURIs>> = Readonly<{
|
||||
DeepMergeRecordsURI: PMF["DeepMergeRecordsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeRecordsURI"] : DeepMergeRecordsDefaultURI;
|
||||
DeepMergeArraysURI: PMF["DeepMergeArraysURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeArraysURI"] : DeepMergeArraysDefaultURI;
|
||||
DeepMergeSetsURI: PMF["DeepMergeSetsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeSetsURI"] : DeepMergeSetsDefaultURI;
|
||||
DeepMergeMapsURI: PMF["DeepMergeMapsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeMapsURI"] : DeepMergeMapsDefaultURI;
|
||||
DeepMergeOthersURI: PMF["DeepMergeOthersURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeOthersURI"] : DeepMergeLeafURI;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The default merge functions.
|
||||
*/
|
||||
type MergeFunctions$1 = {
|
||||
mergeRecords: typeof mergeRecords$1;
|
||||
mergeArrays: typeof mergeArrays$1;
|
||||
mergeSets: typeof mergeSets$1;
|
||||
mergeMaps: typeof mergeMaps$1;
|
||||
mergeOthers: typeof mergeOthers$1;
|
||||
};
|
||||
/**
|
||||
* The default strategy to merge records into a target record.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this record
|
||||
* @param values - The records (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeRecords$1<Ts extends ReadonlyArray<Record<PropertyKey, unknown>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>, M, MM extends DeepMergeBuiltInMetaData>(m_target: Reference<Record<PropertyKey, unknown>>, values: Ts, utils: U, meta: M | undefined): void;
|
||||
/**
|
||||
* The default strategy to merge arrays into a target array.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this array
|
||||
* @param values - The arrays (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeArrays$1<Ts extends ReadonlyArray<ReadonlyArray<unknown>>>(m_target: Reference<unknown[]>, values: Ts): void;
|
||||
/**
|
||||
* The default strategy to merge sets into a target set.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this set
|
||||
* @param values - The sets (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeSets$1<Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>>(m_target: Reference<Set<unknown>>, values: Ts): void;
|
||||
/**
|
||||
* The default strategy to merge maps into a target map.
|
||||
*
|
||||
* @param m_target - The result will be mutated into this map
|
||||
* @param values - The maps (including the target's value if there is one).
|
||||
*/
|
||||
declare function mergeMaps$1<Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>>(m_target: Reference<Map<unknown, unknown>>, values: Ts): void;
|
||||
/**
|
||||
* Set the target to the last value.
|
||||
*/
|
||||
declare function mergeOthers$1<Ts extends ReadonlyArray<unknown>>(m_target: Reference<unknown>, values: Ts): void;
|
||||
|
||||
/**
|
||||
* The default merge functions.
|
||||
*/
|
||||
type MergeFunctions = {
|
||||
mergeRecords: typeof mergeRecords;
|
||||
mergeArrays: typeof mergeArrays;
|
||||
mergeSets: typeof mergeSets;
|
||||
mergeMaps: typeof mergeMaps;
|
||||
mergeOthers: typeof mergeOthers;
|
||||
};
|
||||
/**
|
||||
* The default strategy to merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
declare function mergeRecords<Ts extends ReadonlyArray<Record<PropertyKey, unknown>>, U extends DeepMergeMergeFunctionUtils<M, MM>, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT<Ts, MF, M>;
|
||||
/**
|
||||
* The default strategy to merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
declare function mergeArrays<Ts extends ReadonlyArray<ReadonlyArray<unknown>>, MF extends DeepMergeMergeFunctionsURIs, M>(values: Ts): DeepMergeArraysDefaultHKT<Ts, MF, M>;
|
||||
/**
|
||||
* The default strategy to merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
declare function mergeSets<Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>>(values: Ts): DeepMergeSetsDefaultHKT<Ts>;
|
||||
/**
|
||||
* The default strategy to merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
declare function mergeMaps<Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>>(values: Ts): DeepMergeMapsDefaultHKT<Ts>;
|
||||
/**
|
||||
* Get the last value in the given array.
|
||||
*/
|
||||
declare function mergeOthers<Ts extends ReadonlyArray<unknown>>(values: Ts): unknown;
|
||||
|
||||
/**
|
||||
* The options the user can pass to customize deepmerge.
|
||||
*/
|
||||
type DeepMergeOptions<in out M, MM extends Readonly<Record<PropertyKey, unknown>> = DeepMergeBuiltInMetaData> = Partial<DeepMergeOptionsFull<M, MM & DeepMergeBuiltInMetaData>>;
|
||||
/**
|
||||
* The options the user can pass to customize deepmergeInto.
|
||||
*/
|
||||
type DeepMergeIntoOptions<in out M, MM extends Readonly<Record<PropertyKey, unknown>> = DeepMergeBuiltInMetaData> = Partial<DeepMergeIntoOptionsFull<M, MM & DeepMergeBuiltInMetaData>>;
|
||||
type MetaDataUpdater<in out M, MM extends DeepMergeBuiltInMetaData> = (previousMeta: M | undefined, metaMeta: Readonly<Partial<MM>>) => M;
|
||||
/**
|
||||
* All the options the user can pass to customize deepmerge.
|
||||
*/
|
||||
type DeepMergeOptionsFull<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: DeepMergeMergeFunctions<M, MM>["mergeRecords"] | false;
|
||||
mergeArrays: DeepMergeMergeFunctions<M, MM>["mergeArrays"] | false;
|
||||
mergeMaps: DeepMergeMergeFunctions<M, MM>["mergeMaps"] | false;
|
||||
mergeSets: DeepMergeMergeFunctions<M, MM>["mergeSets"] | false;
|
||||
mergeOthers: DeepMergeMergeFunctions<M, MM>["mergeOthers"];
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
enableImplicitDefaultMerging: boolean;
|
||||
}>;
|
||||
/**
|
||||
* All the options the user can pass to customize deepmergeInto.
|
||||
*/
|
||||
type DeepMergeIntoOptionsFull<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: DeepMergeMergeIntoFunctions<M, MM>["mergeRecords"] | false;
|
||||
mergeArrays: DeepMergeMergeIntoFunctions<M, MM>["mergeArrays"] | false;
|
||||
mergeMaps: DeepMergeMergeIntoFunctions<M, MM>["mergeMaps"] | false;
|
||||
mergeSets: DeepMergeMergeIntoFunctions<M, MM>["mergeSets"] | false;
|
||||
mergeOthers: DeepMergeMergeIntoFunctions<M, MM>["mergeOthers"];
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
}>;
|
||||
/**
|
||||
* An object that has a reference to a value.
|
||||
*/
|
||||
type Reference<T> = {
|
||||
value: T;
|
||||
};
|
||||
/**
|
||||
* All the merge functions that deepmerge uses.
|
||||
*/
|
||||
type DeepMergeMergeFunctions<in M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: <Ts extends ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeArrays: <Ts extends ReadonlyArray<ReadonlyArray<unknown>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeMaps: <Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeSets: <Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeOthers: <Ts extends ReadonlyArray<unknown>, U extends DeepMergeMergeFunctionUtils<M, MM>>(values: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
}>;
|
||||
type DeepMergeMergeIntoFunctionsReturnType = void | symbol;
|
||||
/**
|
||||
* All the merge functions that deepmerge uses.
|
||||
*/
|
||||
type DeepMergeMergeIntoFunctions<in M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: <Ts extends ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<Record<PropertyKey, unknown>>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeArrays: <Ts extends ReadonlyArray<ReadonlyArray<unknown>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<unknown[]>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeMaps: <Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<Map<unknown, unknown>>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeSets: <Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<Set<unknown>>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
mergeOthers: <Ts extends ReadonlyArray<unknown>, U extends DeepMergeMergeIntoFunctionUtils<M, MM>>(m_target: Reference<unknown>, values: Ts, utils: U, meta: M | undefined) => DeepMergeMergeIntoFunctionsReturnType;
|
||||
}>;
|
||||
/**
|
||||
* The utils provided to the merge functions.
|
||||
*/
|
||||
type DeepMergeMergeFunctionUtils<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeFunctions: DeepMergeMergeFunctions<M, MM>;
|
||||
defaultMergeFunctions: MergeFunctions;
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
deepmerge: <Ts extends ReadonlyArray<unknown>>(...values: Ts) => unknown;
|
||||
useImplicitDefaultMerging: boolean;
|
||||
actions: Readonly<{
|
||||
defaultMerge: symbol;
|
||||
skip: symbol;
|
||||
}>;
|
||||
}>;
|
||||
/**
|
||||
* The utils provided to the merge functions.
|
||||
*/
|
||||
type DeepMergeMergeIntoFunctionUtils<in out M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeFunctions: DeepMergeMergeIntoFunctions<M, MM>;
|
||||
defaultMergeFunctions: MergeFunctions$1;
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
deepmergeInto: <Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...values: Ts) => void;
|
||||
actions: Readonly<{
|
||||
defaultMerge: symbol;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Deeply merge objects.
|
||||
*
|
||||
* @param objects - The objects to merge.
|
||||
*/
|
||||
declare function deepmerge<Ts extends Readonly<ReadonlyArray<unknown>>>(...objects: readonly [...Ts]): DeepMergeHKT<Ts, DeepMergeMergeFunctionsDefaultURIs, DeepMergeBuiltInMetaData>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
*/
|
||||
declare function deepmergeCustom<PMF extends Partial<DeepMergeMergeFunctionsURIs>>(options: DeepMergeOptions<DeepMergeBuiltInMetaData, DeepMergeBuiltInMetaData>): <Ts extends ReadonlyArray<unknown>>(...objects: Ts) => DeepMergeHKT<Ts, GetDeepMergeMergeFunctionsURIs<PMF>, DeepMergeBuiltInMetaData>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options and meta data.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
* @param rootMetaData - The meta data passed to the root items' being merged.
|
||||
*/
|
||||
declare function deepmergeCustom<PMF extends Partial<DeepMergeMergeFunctionsURIs>, MetaData, MetaMetaData extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(options: DeepMergeOptions<MetaData, MetaMetaData>, rootMetaData?: MetaData): <Ts extends ReadonlyArray<unknown>>(...objects: Ts) => DeepMergeHKT<Ts, GetDeepMergeMergeFunctionsURIs<PMF>, MetaData>;
|
||||
|
||||
/**
|
||||
* Deeply merge objects into a target.
|
||||
*
|
||||
* @param target - This object will be mutated with the merge result.
|
||||
* @param objects - The objects to merge into the target.
|
||||
*/
|
||||
declare function deepmergeInto<T extends object>(target: T, ...objects: ReadonlyArray<T>): void;
|
||||
/**
|
||||
* Deeply merge objects into a target.
|
||||
*
|
||||
* @param target - This object will be mutated with the merge result.
|
||||
* @param objects - The objects to merge into the target.
|
||||
*/
|
||||
declare function deepmergeInto<Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...objects: Ts): asserts target is FlatternAlias<Target & DeepMergeHKT<[
|
||||
Target,
|
||||
...Ts
|
||||
], DeepMergeMergeFunctionsDefaultURIs, DeepMergeBuiltInMetaData>>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
*/
|
||||
declare function deepmergeIntoCustom(options: DeepMergeIntoOptions<DeepMergeBuiltInMetaData, DeepMergeBuiltInMetaData>): <Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...objects: Ts) => void;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options and meta data.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
* @param rootMetaData - The meta data passed to the root items' being merged.
|
||||
*/
|
||||
declare function deepmergeIntoCustom<MetaData, MetaMetaData extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(options: DeepMergeIntoOptions<MetaData, MetaMetaData>, rootMetaData?: MetaData): <Target extends object, Ts extends ReadonlyArray<unknown>>(target: Target, ...objects: Ts) => void;
|
||||
|
||||
export { DeepMergeArraysDefaultHKT, DeepMergeBuiltInMetaData, DeepMergeHKT, DeepMergeIntoOptions, DeepMergeLeaf, DeepMergeLeafHKT, DeepMergeLeafURI, DeepMergeMapsDefaultHKT, DeepMergeMergeFunctionURItoKind, DeepMergeMergeFunctionUtils, DeepMergeMergeFunctionsDefaultURIs, MergeFunctions as DeepMergeMergeFunctionsDefaults, DeepMergeMergeFunctionsURIs, DeepMergeMergeIntoFunctionUtils, MergeFunctions$1 as DeepMergeMergeIntoFunctionsDefaults, DeepMergeOptions, DeepMergeRecordsDefaultHKT, DeepMergeSetsDefaultHKT, Reference as DeepMergeValueReference, deepmerge, deepmergeCustom, deepmergeInto, deepmergeIntoCustom };
|
||||
80
node_modules/deepmerge-ts/dist/node/types/legacy/v4_0.d.ts
generated
vendored
Normal file
80
node_modules/deepmerge-ts/dist/node/types/legacy/v4_0.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* @file
|
||||
*
|
||||
* These types are a more simplified version of this library's types
|
||||
* designed to work with versions of TypeScript < 4.1
|
||||
*/
|
||||
|
||||
declare type MetaDataUpdater = (previousMeta: any, metaMeta: any) => any;
|
||||
|
||||
/**
|
||||
* All the options the user can pass to customize deepmerge.
|
||||
*/
|
||||
declare type DeepMergeOptionsFull = Readonly<{
|
||||
mergeRecords: DeepMergeMergeFunctions["mergeRecords"] | false;
|
||||
mergeArrays: DeepMergeMergeFunctions["mergeArrays"] | false;
|
||||
mergeMaps: DeepMergeMergeFunctions["mergeMaps"] | false;
|
||||
mergeSets: DeepMergeMergeFunctions["mergeSets"] | false;
|
||||
mergeOthers: DeepMergeMergeFunctions["mergeOthers"];
|
||||
metaDataUpdater: MetaDataUpdater;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* All the merge functions that deepmerge uses.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctions = Readonly<{
|
||||
mergeRecords: <Ts extends ReadonlyArray<Readonly<Record<keyof any, any>>>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any;
|
||||
mergeArrays: <Ts extends ReadonlyArray<ReadonlyArray<any>>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any;
|
||||
mergeMaps: <Ts extends ReadonlyArray<Readonly<ReadonlyMap<any, any>>>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any;
|
||||
mergeSets: <Ts extends ReadonlyArray<Readonly<ReadonlySet<any>>>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any;
|
||||
mergeOthers: <Ts extends ReadonlyArray<any>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The utils provided to the merge functions.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionUtils = Readonly<{
|
||||
mergeFunctions: DeepMergeMergeFunctions;
|
||||
defaultMergeFunctions: DeepMergeMergeFunctionsDefaults;
|
||||
metaDataUpdater: MetaDataUpdater;
|
||||
deepmerge: <Ts extends ReadonlyArray<any>>(...values: Ts) => any;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The default merge functions.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionsDefaults = Readonly<{
|
||||
mergeMaps: (values: Record<keyof any, any>[]) => any;
|
||||
mergeSets: (values: any[][]) => any;
|
||||
mergeArrays: (values: Set<any>[]) => any;
|
||||
mergeRecords: (values: Map<any, any>[], utils: DeepMergeMergeFunctionUtils, meta: any) => any;
|
||||
mergeOthers: (values: any[]) => any;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Deeply merge objects.
|
||||
*
|
||||
* @param objects - The objects to merge.
|
||||
*/
|
||||
declare function deepmerge(): undefined;
|
||||
declare function deepmerge<T0>(arg0: T0): T0;
|
||||
declare function deepmerge<T0, T1>(arg0: T0, arg1: T1): T0 & T1;
|
||||
declare function deepmerge<T0, T1, T2>(arg0: T0, arg1: T1, arg2: T2): T0 & T1 & T2;
|
||||
declare function deepmerge<T0, T1, T2, T3>(arg0: T0, arg1: T1, arg2: T2, arg3: T3): T0 & T1 & T2 & T3;
|
||||
declare function deepmerge<T0, T1, T2, T3, T4>(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4): T0 & T1 & T2 & T3 & T4;
|
||||
declare function deepmerge<T0, T1, T2, T3, T4, T5>(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): T0 & T1 & T2 & T3 & T4 & T5;
|
||||
declare function deepmerge<T0, T1, T2, T3, T4, T5, T6>(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): T0 & T1 & T2 & T3 & T4 & T5 & T6;
|
||||
declare function deepmerge<T0, T1, T2, T3, T4, T5, T6, T7>(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7): T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7;
|
||||
declare function deepmerge<T0, T1, T2, T3, T4, T5, T6, T7, T8>(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8): T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8;
|
||||
declare function deepmerge<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9): T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 & T9;
|
||||
declare function deepmerge(...args: any[]): any;
|
||||
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options and meta data.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
* @param rootMetaData - The meta data passed to the root items' being merged.
|
||||
*/
|
||||
declare function deepmergeCustom(options: Partial<DeepMergeOptionsFull>, rootMetaData?: any): (...objects: any[]) => any;
|
||||
|
||||
export { deepmerge, deepmergeCustom };
|
||||
407
node_modules/deepmerge-ts/dist/node/types/legacy/v4_6.d.ts
generated
vendored
Normal file
407
node_modules/deepmerge-ts/dist/node/types/legacy/v4_6.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,407 @@
|
|||
/**
|
||||
* Flatten a complex type such as a union or intersection of objects into a
|
||||
* single object.
|
||||
*/
|
||||
declare type FlatternAlias<T> = {
|
||||
[P in keyof T]: T[P];
|
||||
} & {};
|
||||
/**
|
||||
* Get the value of the given key in the given object.
|
||||
*/
|
||||
declare type ValueOfKey<T extends Record<PropertyKey, unknown>, K extends PropertyKey> = K extends keyof T ? T[K] : never;
|
||||
/**
|
||||
* Safely test whether or not the first given types extends the second.
|
||||
*
|
||||
* Needed in particular for testing if a type is "never".
|
||||
*/
|
||||
declare type Is<T1, T2> = [T1] extends [T2] ? true : false;
|
||||
/**
|
||||
* Safely test whether or not the given type is "never".
|
||||
*/
|
||||
declare type IsNever<T> = Is<T, never>;
|
||||
/**
|
||||
* Returns whether or not the given type a record.
|
||||
*/
|
||||
declare type IsRecord<T> = And<Not<IsNever<T>>, T extends Readonly<Record<PropertyKey, unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are records.
|
||||
*/
|
||||
declare type EveryIsRecord<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [infer Head, ...infer Rest] ? IsRecord<Head> extends true ? Rest extends ReadonlyArray<unknown> ? EveryIsRecord<Rest> : true : false : true;
|
||||
/**
|
||||
* Returns whether or not the given type is an array.
|
||||
*/
|
||||
declare type IsArray<T> = And<Not<IsNever<T>>, T extends ReadonlyArray<unknown> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are arrays.
|
||||
*/
|
||||
declare type EveryIsArray<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [infer T1] ? IsArray<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsArray<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsArray<Rest> : false : false : false;
|
||||
/**
|
||||
* Returns whether or not the given type is an set.
|
||||
*
|
||||
* Note: This may also return true for Maps.
|
||||
*/
|
||||
declare type IsSet<T> = And<Not<IsNever<T>>, T extends Readonly<ReadonlySet<unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are sets.
|
||||
*
|
||||
* Note: This may also return true if all are maps.
|
||||
*/
|
||||
declare type EveryIsSet<Ts extends ReadonlyArray<unknown>> = Ts extends Readonly<readonly [infer T1]> ? IsSet<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsSet<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsSet<Rest> : false : false : false;
|
||||
/**
|
||||
* Returns whether or not the given type is an map.
|
||||
*/
|
||||
declare type IsMap<T> = And<Not<IsNever<T>>, T extends Readonly<ReadonlyMap<unknown, unknown>> ? true : false>;
|
||||
/**
|
||||
* Returns whether or not all the given types are maps.
|
||||
*/
|
||||
declare type EveryIsMap<Ts extends ReadonlyArray<unknown>> = Ts extends Readonly<readonly [infer T1]> ? IsMap<T1> : Ts extends readonly [infer Head, ...infer Rest] ? IsMap<Head> extends true ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? EveryIsMap<Rest> : false : false : false;
|
||||
/**
|
||||
* And operator for types.
|
||||
*/
|
||||
declare type And<T1 extends boolean, T2 extends boolean> = T1 extends false ? false : T2;
|
||||
/**
|
||||
* Not operator for types.
|
||||
*/
|
||||
declare type Not<T extends boolean> = T extends true ? false : true;
|
||||
/**
|
||||
* Union of the sets' values' types
|
||||
*/
|
||||
declare type UnionSetValues<Ts extends ReadonlyArray<unknown>> = UnionSetValuesHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionSetValues.
|
||||
*/
|
||||
declare type UnionSetValuesHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlySet<infer V1>> ? Rest extends ReadonlyArray<unknown> ? UnionSetValuesHelper<Rest, Acc | V1> : Acc | V1 : never : Acc;
|
||||
/**
|
||||
* Union of the maps' values' types
|
||||
*/
|
||||
declare type UnionMapKeys<Ts extends ReadonlyArray<unknown>> = UnionMapKeysHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionMapKeys.
|
||||
*/
|
||||
declare type UnionMapKeysHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlyMap<infer K1, unknown>> ? Rest extends readonly [] ? Acc | K1 : UnionMapKeysHelper<Rest, Acc | K1> : never : Acc;
|
||||
/**
|
||||
* Union of the maps' keys' types
|
||||
*/
|
||||
declare type UnionMapValues<Ts extends ReadonlyArray<unknown>> = UnionMapValuesHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for UnionMapValues.
|
||||
*/
|
||||
declare type UnionMapValuesHelper<Ts extends ReadonlyArray<unknown>, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<ReadonlyMap<unknown, infer V1>> ? Rest extends readonly [] ? Acc | V1 : UnionMapValuesHelper<Rest, Acc | V1> : never : Acc;
|
||||
/**
|
||||
* Get the keys of the type what match a certain criteria.
|
||||
*/
|
||||
declare type KeysOfType<T, U> = {
|
||||
[K in keyof T]: T[K] extends U ? K : never;
|
||||
}[keyof T];
|
||||
/**
|
||||
* Get the required keys of the type.
|
||||
*/
|
||||
declare type RequiredKeys<T> = Exclude<KeysOfType<T, Exclude<T[keyof T], undefined>>, undefined>;
|
||||
/**
|
||||
* Get all the required keys on the types in the tuple.
|
||||
*/
|
||||
declare type RequiredKeysOf<Ts extends readonly [unknown, ...ReadonlyArray<unknown>]> = RequiredKeysOfHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for RequiredKeysOf.
|
||||
*/
|
||||
declare type RequiredKeysOfHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record<PropertyKey, unknown> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? RequiredKeysOfHelper<Rest, Acc | RequiredKeys<Head>> : Acc | RequiredKeys<Head> : never : Acc;
|
||||
/**
|
||||
* Get the optional keys of the type.
|
||||
*/
|
||||
declare type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
|
||||
/**
|
||||
* Get all the optional keys on the types in the tuple.
|
||||
*/
|
||||
declare type OptionalKeysOf<Ts extends readonly [unknown, ...ReadonlyArray<unknown>]> = OptionalKeysOfHelper<Ts, never>;
|
||||
/**
|
||||
* Tail-recursive helper type for OptionalKeysOf.
|
||||
*/
|
||||
declare type OptionalKeysOfHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record<PropertyKey, unknown> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? OptionalKeysOfHelper<Rest, Acc | OptionalKeys<Head>> : Acc | OptionalKeys<Head> : never : Acc;
|
||||
/**
|
||||
* Filter out nevers from a tuple.
|
||||
*/
|
||||
declare type FilterOutNever<T extends ReadonlyArray<unknown>> = FilterOutNeverHelper<T, []>;
|
||||
/**
|
||||
* Tail-recursive helper type for FilterOutNever.
|
||||
*/
|
||||
declare type FilterOutNeverHelper<T extends ReadonlyArray<unknown>, Acc extends ReadonlyArray<unknown>> = T extends readonly [] ? Acc : T extends readonly [infer Head, ...infer Rest] ? IsNever<Head> extends true ? FilterOutNeverHelper<Rest, Acc> : FilterOutNeverHelper<Rest, [...Acc, Head]> : T;
|
||||
/**
|
||||
* Is the type a tuple?
|
||||
*/
|
||||
declare type IsTuple<T extends ReadonlyArray<unknown>> = T extends readonly [] ? true : T extends readonly [unknown, ...ReadonlyArray<unknown>] ? true : false;
|
||||
|
||||
/**
|
||||
* Mapping of merge function URIs to the merge function type.
|
||||
*/
|
||||
interface DeepMergeMergeFunctionURItoKind<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> {
|
||||
readonly DeepMergeLeafURI: DeepMergeLeaf<Ts>;
|
||||
readonly DeepMergeRecordsDefaultURI: DeepMergeRecordsDefaultHKT<Ts, MF, M>;
|
||||
readonly DeepMergeArraysDefaultURI: DeepMergeArraysDefaultHKT<Ts, MF, M>;
|
||||
readonly DeepMergeSetsDefaultURI: DeepMergeSetsDefaultHKT<Ts>;
|
||||
readonly DeepMergeMapsDefaultURI: DeepMergeMapsDefaultHKT<Ts>;
|
||||
}
|
||||
/**
|
||||
* Get the type of the given merge function via its URI.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionKind<URI extends DeepMergeMergeFunctionURIs, Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionURItoKind<Ts, MF, M>[URI];
|
||||
/**
|
||||
* A union of all valid merge function URIs.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionURIs = keyof DeepMergeMergeFunctionURItoKind<ReadonlyArray<unknown>, DeepMergeMergeFunctionsURIs, unknown>;
|
||||
/**
|
||||
* The merge functions to use when deep merging.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionsURIs = Readonly<{
|
||||
/**
|
||||
* The merge function to merge records with.
|
||||
*/
|
||||
DeepMergeRecordsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge arrays with.
|
||||
*/
|
||||
DeepMergeArraysURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge sets with.
|
||||
*/
|
||||
DeepMergeSetsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge maps with.
|
||||
*/
|
||||
DeepMergeMapsURI: DeepMergeMergeFunctionURIs;
|
||||
/**
|
||||
* The merge function to merge other things with.
|
||||
*/
|
||||
DeepMergeOthersURI: DeepMergeMergeFunctionURIs;
|
||||
}>;
|
||||
/**
|
||||
* Deep merge types.
|
||||
*/
|
||||
declare type DeepMergeHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = IsTuple<Ts> extends true ? Ts extends readonly [] ? undefined : Ts extends readonly [infer T1] ? T1 : EveryIsArray<Ts> extends true ? DeepMergeArraysHKT<Ts, MF, M> : EveryIsMap<Ts> extends true ? DeepMergeMapsHKT<Ts, MF, M> : EveryIsSet<Ts> extends true ? DeepMergeSetsHKT<Ts, MF, M> : EveryIsRecord<Ts> extends true ? DeepMergeRecordsHKT<Ts, MF, M> : DeepMergeOthersHKT<Ts, MF, M> : unknown;
|
||||
/**
|
||||
* Deep merge records.
|
||||
*/
|
||||
declare type DeepMergeRecordsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeRecordsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge arrays.
|
||||
*/
|
||||
declare type DeepMergeArraysHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeArraysURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge sets.
|
||||
*/
|
||||
declare type DeepMergeSetsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeSetsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge maps.
|
||||
*/
|
||||
declare type DeepMergeMapsHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeMapsURI"], Ts, MF, M>;
|
||||
/**
|
||||
* Deep merge other things.
|
||||
*/
|
||||
declare type DeepMergeOthersHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind<MF["DeepMergeOthersURI"], Ts, MF, M>;
|
||||
/**
|
||||
* The merge function that returns a leaf.
|
||||
*/
|
||||
declare type DeepMergeLeafURI = "DeepMergeLeafURI";
|
||||
/**
|
||||
* Get the leaf type from many types that can't be merged.
|
||||
*
|
||||
* @deprecated Use `DeepMergeLeaf` instead.
|
||||
*/
|
||||
declare type DeepMergeLeafHKT<Ts extends ReadonlyArray<unknown>> = DeepMergeLeaf<Ts>;
|
||||
/**
|
||||
* Get the leaf type from many types that can't be merged.
|
||||
*/
|
||||
declare type DeepMergeLeaf<Ts extends ReadonlyArray<unknown>> = Ts extends readonly [] ? never : Ts extends readonly [infer T] ? T : Ts extends readonly [...infer Rest, infer Tail] ? IsNever<Tail> extends true ? Rest extends ReadonlyArray<unknown> ? DeepMergeLeaf<Rest> : never : Tail : never;
|
||||
/**
|
||||
* The meta data deepmerge is able to provide.
|
||||
*/
|
||||
declare type DeepMergeBuiltInMetaData = Readonly<{
|
||||
key: PropertyKey;
|
||||
parents: ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The default merge function to merge records with.
|
||||
*/
|
||||
declare type DeepMergeRecordsDefaultURI = "DeepMergeRecordsDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge arrays with.
|
||||
*/
|
||||
declare type DeepMergeArraysDefaultURI = "DeepMergeArraysDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge sets with.
|
||||
*/
|
||||
declare type DeepMergeSetsDefaultURI = "DeepMergeSetsDefaultURI";
|
||||
/**
|
||||
* The default merge function to merge maps with.
|
||||
*/
|
||||
declare type DeepMergeMapsDefaultURI = "DeepMergeMapsDefaultURI";
|
||||
/**
|
||||
* The default merge functions to use when deep merging.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionsDefaultURIs = Readonly<{
|
||||
DeepMergeRecordsURI: DeepMergeRecordsDefaultURI;
|
||||
DeepMergeArraysURI: DeepMergeArraysDefaultURI;
|
||||
DeepMergeSetsURI: DeepMergeSetsDefaultURI;
|
||||
DeepMergeMapsURI: DeepMergeMapsDefaultURI;
|
||||
DeepMergeOthersURI: DeepMergeLeafURI;
|
||||
}>;
|
||||
/**
|
||||
* A union of all the props that should not be included in type information for
|
||||
* merged records.
|
||||
*/
|
||||
declare type BlacklistedRecordProps = "__proto__";
|
||||
/**
|
||||
* Deep merge records.
|
||||
*/
|
||||
declare type DeepMergeRecordsDefaultHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = Ts extends Readonly<readonly [unknown, ...Readonly<ReadonlyArray<unknown>>]> ? FlatternAlias<Omit<DeepMergeRecordsDefaultHKTInternalProps<Ts, MF, M>, BlacklistedRecordProps>> : {};
|
||||
/**
|
||||
* Deep merge record props.
|
||||
*/
|
||||
declare type DeepMergeRecordsDefaultHKTInternalProps<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], MF extends DeepMergeMergeFunctionsURIs, M> = {
|
||||
[K in OptionalKeysOf<Ts>]?: DeepMergeHKT<DeepMergeRecordsDefaultHKTInternalPropValue<Ts, K, M>, MF, M>;
|
||||
} & {
|
||||
[K in RequiredKeysOf<Ts>]: DeepMergeHKT<DeepMergeRecordsDefaultHKTInternalPropValue<Ts, K, M>, MF, M>;
|
||||
};
|
||||
/**
|
||||
* Get the value of the property.
|
||||
*/
|
||||
declare type DeepMergeRecordsDefaultHKTInternalPropValue<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], K extends PropertyKey, M> = FilterOutNever<DeepMergeRecordsDefaultHKTInternalPropValueHelper<Ts, K, M, readonly []>>;
|
||||
/**
|
||||
* Tail-recursive helper type for DeepMergeRecordsDefaultHKTInternalPropValue.
|
||||
*/
|
||||
declare type DeepMergeRecordsDefaultHKTInternalPropValueHelper<Ts extends readonly [unknown, ...ReadonlyArray<unknown>], K extends PropertyKey, M, Acc extends ReadonlyArray<unknown>> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly<Record<PropertyKey, unknown>> ? Rest extends readonly [unknown, ...ReadonlyArray<unknown>] ? DeepMergeRecordsDefaultHKTInternalPropValueHelper<Rest, K, M, [
|
||||
...Acc,
|
||||
ValueOfKey<Head, K>
|
||||
]> : [...Acc, ValueOfKey<Head, K>] : never : never;
|
||||
/**
|
||||
* Deep merge 2 arrays.
|
||||
*/
|
||||
declare type DeepMergeArraysDefaultHKT<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeArraysDefaultHKTHelper<Ts, MF, M, []>;
|
||||
/**
|
||||
* Tail-recursive helper type for DeepMergeArraysDefaultHKT.
|
||||
*/
|
||||
declare type DeepMergeArraysDefaultHKTHelper<Ts extends ReadonlyArray<unknown>, MF extends DeepMergeMergeFunctionsURIs, M, Acc extends ReadonlyArray<unknown>> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends ReadonlyArray<unknown> ? Rest extends readonly [
|
||||
ReadonlyArray<unknown>,
|
||||
...ReadonlyArray<ReadonlyArray<unknown>>
|
||||
] ? DeepMergeArraysDefaultHKTHelper<Rest, MF, M, [...Acc, ...Head]> : [...Acc, ...Head] : never : never;
|
||||
/**
|
||||
* Deep merge 2 sets.
|
||||
*/
|
||||
declare type DeepMergeSetsDefaultHKT<Ts extends ReadonlyArray<unknown>> = Set<UnionSetValues<Ts>>;
|
||||
/**
|
||||
* Deep merge 2 maps.
|
||||
*/
|
||||
declare type DeepMergeMapsDefaultHKT<Ts extends ReadonlyArray<unknown>> = Map<UnionMapKeys<Ts>, UnionMapValues<Ts>>;
|
||||
/**
|
||||
* Get the merge functions with defaults apply from the given subset.
|
||||
*/
|
||||
declare type GetDeepMergeMergeFunctionsURIs<PMF extends Partial<DeepMergeMergeFunctionsURIs>> = Readonly<{
|
||||
DeepMergeRecordsURI: PMF["DeepMergeRecordsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeRecordsURI"] : DeepMergeRecordsDefaultURI;
|
||||
DeepMergeArraysURI: PMF["DeepMergeArraysURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeArraysURI"] : DeepMergeArraysDefaultURI;
|
||||
DeepMergeSetsURI: PMF["DeepMergeSetsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeSetsURI"] : DeepMergeSetsDefaultURI;
|
||||
DeepMergeMapsURI: PMF["DeepMergeMapsURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeMapsURI"] : DeepMergeMapsDefaultURI;
|
||||
DeepMergeOthersURI: PMF["DeepMergeOthersURI"] extends keyof DeepMergeMergeFunctionURItoKind<any, any, any> ? PMF["DeepMergeOthersURI"] : DeepMergeLeafURI;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The options the user can pass to customize deepmerge.
|
||||
*/
|
||||
declare type DeepMergeOptions<M, MM extends Readonly<Record<PropertyKey, unknown>> = DeepMergeBuiltInMetaData> = Partial<DeepMergeOptionsFull<M, MM & DeepMergeBuiltInMetaData>>;
|
||||
declare type MetaDataUpdater<M, MM extends DeepMergeBuiltInMetaData> = (previousMeta: M | undefined, metaMeta: Readonly<Partial<MM>>) => M;
|
||||
/**
|
||||
* All the options the user can pass to customize deepmerge.
|
||||
*/
|
||||
declare type DeepMergeOptionsFull<M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: DeepMergeMergeFunctions<M, MM>["mergeRecords"] | false;
|
||||
mergeArrays: DeepMergeMergeFunctions<M, MM>["mergeArrays"] | false;
|
||||
mergeMaps: DeepMergeMergeFunctions<M, MM>["mergeMaps"] | false;
|
||||
mergeSets: DeepMergeMergeFunctions<M, MM>["mergeSets"] | false;
|
||||
mergeOthers: DeepMergeMergeFunctions<M, MM>["mergeOthers"];
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
enableImplicitDefaultMerging: boolean;
|
||||
}>;
|
||||
/**
|
||||
* All the merge functions that deepmerge uses.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctions<M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeRecords: <Ts extends ReadonlyArray<Readonly<Record<PropertyKey, unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(records: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeArrays: <Ts extends ReadonlyArray<ReadonlyArray<unknown>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(records: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeMaps: <Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(records: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeSets: <Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>, U extends DeepMergeMergeFunctionUtils<M, MM>>(records: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
mergeOthers: <Ts extends ReadonlyArray<unknown>, U extends DeepMergeMergeFunctionUtils<M, MM>>(records: Ts, utils: U, meta: M | undefined) => unknown;
|
||||
}>;
|
||||
/**
|
||||
* The utils provided to the merge functions.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionUtils<M, MM extends DeepMergeBuiltInMetaData> = Readonly<{
|
||||
mergeFunctions: DeepMergeMergeFunctions<M, MM>;
|
||||
defaultMergeFunctions: DeepMergeMergeFunctionsDefaults;
|
||||
metaDataUpdater: MetaDataUpdater<M, MM>;
|
||||
deepmerge: <Ts extends ReadonlyArray<unknown>>(...values: Ts) => unknown;
|
||||
useImplicitDefaultMerging: boolean;
|
||||
actions: Readonly<{
|
||||
defaultMerge: symbol;
|
||||
skip: symbol;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
declare const defaultMergeFunctions: {
|
||||
readonly mergeMaps: typeof defaultMergeMaps;
|
||||
readonly mergeSets: typeof defaultMergeSets;
|
||||
readonly mergeArrays: typeof defaultMergeArrays;
|
||||
readonly mergeRecords: typeof defaultMergeRecords;
|
||||
readonly mergeOthers: typeof leaf;
|
||||
};
|
||||
/**
|
||||
* The default merge functions.
|
||||
*/
|
||||
declare type DeepMergeMergeFunctionsDefaults = typeof defaultMergeFunctions;
|
||||
/**
|
||||
* Deeply merge objects.
|
||||
*
|
||||
* @param objects - The objects to merge.
|
||||
*/
|
||||
declare function deepmerge<Ts extends Readonly<ReadonlyArray<unknown>>>(...objects: readonly [...Ts]): DeepMergeHKT<Ts, DeepMergeMergeFunctionsDefaultURIs, DeepMergeBuiltInMetaData>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
*/
|
||||
declare function deepmergeCustom<PMF extends Partial<DeepMergeMergeFunctionsURIs>>(options: DeepMergeOptions<DeepMergeBuiltInMetaData, DeepMergeBuiltInMetaData>): <Ts extends ReadonlyArray<unknown>>(...objects: Ts) => DeepMergeHKT<Ts, GetDeepMergeMergeFunctionsURIs<PMF>, DeepMergeBuiltInMetaData>;
|
||||
/**
|
||||
* Deeply merge two or more objects using the given options and meta data.
|
||||
*
|
||||
* @param options - The options on how to customize the merge function.
|
||||
* @param rootMetaData - The meta data passed to the root items' being merged.
|
||||
*/
|
||||
declare function deepmergeCustom<PMF extends Partial<DeepMergeMergeFunctionsURIs>, MetaData, MetaMetaData extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(options: DeepMergeOptions<MetaData, MetaMetaData>, rootMetaData?: MetaData): <Ts extends ReadonlyArray<unknown>>(...objects: Ts) => DeepMergeHKT<Ts, GetDeepMergeMergeFunctionsURIs<PMF>, MetaData>;
|
||||
/**
|
||||
* The default strategy to merge records.
|
||||
*
|
||||
* @param values - The records.
|
||||
*/
|
||||
declare function defaultMergeRecords<Ts extends ReadonlyArray<Record<PropertyKey, unknown>>, U extends DeepMergeMergeFunctionUtils<M, MM>, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT<Ts, MF, M>;
|
||||
/**
|
||||
* The default strategy to merge arrays.
|
||||
*
|
||||
* @param values - The arrays.
|
||||
*/
|
||||
declare function defaultMergeArrays<Ts extends ReadonlyArray<ReadonlyArray<unknown>>, MF extends DeepMergeMergeFunctionsURIs, M>(values: Ts): DeepMergeArraysDefaultHKT<Ts, MF, M>;
|
||||
/**
|
||||
* The default strategy to merge sets.
|
||||
*
|
||||
* @param values - The sets.
|
||||
*/
|
||||
declare function defaultMergeSets<Ts extends ReadonlyArray<Readonly<ReadonlySet<unknown>>>>(values: Ts): DeepMergeSetsDefaultHKT<Ts>;
|
||||
/**
|
||||
* The default strategy to merge maps.
|
||||
*
|
||||
* @param values - The maps.
|
||||
*/
|
||||
declare function defaultMergeMaps<Ts extends ReadonlyArray<Readonly<ReadonlyMap<unknown, unknown>>>>(values: Ts): DeepMergeMapsDefaultHKT<Ts>;
|
||||
/**
|
||||
* Get the last value in the given array.
|
||||
*/
|
||||
declare function leaf<Ts extends ReadonlyArray<unknown>>(values: Ts): unknown;
|
||||
|
||||
export { DeepMergeArraysDefaultHKT, DeepMergeBuiltInMetaData, DeepMergeHKT, DeepMergeLeaf, DeepMergeLeafHKT, DeepMergeLeafURI, DeepMergeMapsDefaultHKT, DeepMergeMergeFunctionURItoKind, DeepMergeMergeFunctionUtils, DeepMergeMergeFunctionsDefaultURIs, DeepMergeMergeFunctionsDefaults, DeepMergeMergeFunctionsURIs, DeepMergeOptions, DeepMergeRecordsDefaultHKT, DeepMergeSetsDefaultHKT, deepmerge, deepmergeCustom };
|
||||
158
node_modules/deepmerge-ts/package.json
generated
vendored
Normal file
158
node_modules/deepmerge-ts/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
{
|
||||
"name": "deepmerge-ts",
|
||||
"version": "4.3.0",
|
||||
"description": "Deeply merge 2 or more objects respecting type information.",
|
||||
"keywords": [
|
||||
"merge",
|
||||
"deepmerge",
|
||||
"deep merge",
|
||||
"deep-merge",
|
||||
"inferred types",
|
||||
"inferred-types",
|
||||
"recursive merge",
|
||||
"recursive-merge",
|
||||
"ts",
|
||||
"ts merge",
|
||||
"ts-merge",
|
||||
"typescript",
|
||||
"typescript merge",
|
||||
"typescript-merge"
|
||||
],
|
||||
"homepage": "https://github.com/RebeccaStevens/deepmerge-ts#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/RebeccaStevens/deepmerge-ts/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/RebeccaStevens/deepmerge-ts"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"author": {
|
||||
"name": "Rebecca Stevens",
|
||||
"email": "rebecca.stevens@outlook.co.nz"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": {
|
||||
"import": "./dist/node/types/current/index.d.mts",
|
||||
"require": "./dist/node/types/current/index.d.cts"
|
||||
},
|
||||
"import": "./dist/node/index.mjs",
|
||||
"require": "./dist/node/index.cjs"
|
||||
},
|
||||
"main": "dist/node/index.cjs",
|
||||
"module": "dist/node/index.mjs",
|
||||
"types": "dist/node/types/legacy/v4_0.d.ts",
|
||||
"typesVersions": {
|
||||
"<4.1": {
|
||||
"*": [
|
||||
"dist/node/types/legacy/v4_0.d.ts"
|
||||
]
|
||||
},
|
||||
"<4.7": {
|
||||
"*": [
|
||||
"dist/node/types/legacy/v4_6.d.ts"
|
||||
]
|
||||
},
|
||||
">=4.7": {
|
||||
"*": [
|
||||
"dist/node/types/current/index.d.mts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist/node/",
|
||||
"package.json",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"benchmark": "npm run build && npm run link & cd benchmark && npm run benchmark; cd ..",
|
||||
"build": "rimraf build && npm run build:node && npm run build:deno && rimraf build && if-env-defined CI || npm run build:assume-unchanged",
|
||||
"build:assume-unchanged": "cd dist; git update-index --assume-unchanged $(git ls-files | tr '\n' ' '); cd ..",
|
||||
"build:deno": "rimraf dist/deno && tsc -p tsconfig.build.deno.json && denoify",
|
||||
"build:node": "rimraf dist/node && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
||||
"build:types": "rimraf types/current && BUILD_TYPES_ONLY=1 rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
||||
"check-format": "prettier --list-different \"./**/*.{md,ts,yml}\"",
|
||||
"check-spelling": "cspell --config=.cspell.json \"**/*.{md,ts}\"",
|
||||
"cz": "git-cz",
|
||||
"format": "prettier --write \"./**/*.{md,ts,yml}\"",
|
||||
"lint": "npm run lint:js && npm run lint:md",
|
||||
"lint:js": "eslint .",
|
||||
"lint:md": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
|
||||
"prepare": "husky install",
|
||||
"test": "npm run test:js && npm run test:types",
|
||||
"test:js": "c8 ava",
|
||||
"test:types": "npm run build:types && tsd -f 'tests/**/*.test-d.ts'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "17.4.2",
|
||||
"@commitlint/config-conventional": "17.4.2",
|
||||
"@cspell/dict-cryptocurrencies": "3.0.1",
|
||||
"@rebeccastevens/eslint-config": "1.5.2",
|
||||
"@rollup/plugin-json": "6.0.0",
|
||||
"@rollup/plugin-node-resolve": "15.0.1",
|
||||
"@rollup/plugin-typescript": "11.0.0",
|
||||
"@semantic-release/changelog": "6.0.2",
|
||||
"@semantic-release/commit-analyzer": "9.0.2",
|
||||
"@semantic-release/git": "10.0.1",
|
||||
"@semantic-release/github": "8.0.7",
|
||||
"@semantic-release/npm": "9.0.2",
|
||||
"@semantic-release/release-notes-generator": "10.0.3",
|
||||
"@types/lodash": "4.14.191",
|
||||
"@types/node": "18.11.18",
|
||||
"@types/rollup-plugin-auto-external": "2.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "5.50.0",
|
||||
"@typescript-eslint/parser": "5.50.0",
|
||||
"ava": "4.3.3",
|
||||
"c8": "7.12.0",
|
||||
"codecov": "3.8.3",
|
||||
"commitizen": "4.3.0",
|
||||
"cspell": "6.20.1",
|
||||
"denoify": "1.4.9",
|
||||
"eslint": "8.33.0",
|
||||
"eslint-config-prettier": "8.6.0",
|
||||
"eslint-import-resolver-typescript": "3.5.3",
|
||||
"eslint-plugin-ava": "14.0.0",
|
||||
"eslint-plugin-eslint-comments": "3.2.0",
|
||||
"eslint-plugin-functional": "5.0.4",
|
||||
"eslint-plugin-import": "2.27.5",
|
||||
"eslint-plugin-jsdoc": "39.7.5",
|
||||
"eslint-plugin-markdown": "3.0.0",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-optimize-regex": "1.2.1",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-promise": "6.1.1",
|
||||
"eslint-plugin-sonarjs": "0.18.0",
|
||||
"eslint-plugin-unicorn": "45.0.2",
|
||||
"husky": "8.0.3",
|
||||
"if-env-defined": "1.0.0",
|
||||
"lint-staged": "13.1.0",
|
||||
"lodash": "4.17.21",
|
||||
"markdownlint-cli": "0.33.0",
|
||||
"marked": "4.2.12",
|
||||
"prettier": "2.8.3",
|
||||
"prettier-plugin-packagejson": "2.4.2",
|
||||
"rimraf": "3.0.2",
|
||||
"rollup": "2.79.1",
|
||||
"rollup-plugin-auto-external": "2.0.0",
|
||||
"rollup-plugin-copy": "3.4.0",
|
||||
"rollup-plugin-dts": "4.2.3",
|
||||
"semantic-release": "20.1.0",
|
||||
"source-map-support": "0.5.21",
|
||||
"ts-node": "10.9.1",
|
||||
"tsd": "0.25.0",
|
||||
"tslib": "2.5.0",
|
||||
"typescript": "4.9.5"
|
||||
},
|
||||
"packageManager": "yarn@3.4.1",
|
||||
"engines": {
|
||||
"node": ">=12.4.0"
|
||||
},
|
||||
"denoify": {
|
||||
"out": "dist/deno",
|
||||
"index": "src/index.ts"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue