FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

2
node_modules/merge-options/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare function mergeOptions(...options: any[]): any;
export = mergeOptions;

171
node_modules/merge-options/index.js generated vendored Normal file
View File

@@ -0,0 +1,171 @@
'use strict';
const isOptionObject = require('is-plain-obj');
const {hasOwnProperty} = Object.prototype;
const {propertyIsEnumerable} = Object;
const defineProperty = (object, name, value) => Object.defineProperty(object, name, {
value,
writable: true,
enumerable: true,
configurable: true
});
const globalThis = this;
const defaultMergeOptions = {
concatArrays: false,
ignoreUndefined: false
};
const getEnumerableOwnPropertyKeys = value => {
const keys = [];
for (const key in value) {
if (hasOwnProperty.call(value, key)) {
keys.push(key);
}
}
/* istanbul ignore else */
if (Object.getOwnPropertySymbols) {
const symbols = Object.getOwnPropertySymbols(value);
for (const symbol of symbols) {
if (propertyIsEnumerable.call(value, symbol)) {
keys.push(symbol);
}
}
}
return keys;
};
function clone(value) {
if (Array.isArray(value)) {
return cloneArray(value);
}
if (isOptionObject(value)) {
return cloneOptionObject(value);
}
return value;
}
function cloneArray(array) {
const result = array.slice(0, 0);
getEnumerableOwnPropertyKeys(array).forEach(key => {
defineProperty(result, key, clone(array[key]));
});
return result;
}
function cloneOptionObject(object) {
const result = Object.getPrototypeOf(object) === null ? Object.create(null) : {};
getEnumerableOwnPropertyKeys(object).forEach(key => {
defineProperty(result, key, clone(object[key]));
});
return result;
}
/**
* @param {*} merged already cloned
* @param {*} source something to merge
* @param {string[]} keys keys to merge
* @param {Object} config Config Object
* @returns {*} cloned Object
*/
const mergeKeys = (merged, source, keys, config) => {
keys.forEach(key => {
if (typeof source[key] === 'undefined' && config.ignoreUndefined) {
return;
}
// Do not recurse into prototype chain of merged
if (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {
defineProperty(merged, key, merge(merged[key], source[key], config));
} else {
defineProperty(merged, key, clone(source[key]));
}
});
return merged;
};
/**
* @param {*} merged already cloned
* @param {*} source something to merge
* @param {Object} config Config Object
* @returns {*} cloned Object
*
* see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)
*/
const concatArrays = (merged, source, config) => {
let result = merged.slice(0, 0);
let resultIndex = 0;
[merged, source].forEach(array => {
const indices = [];
// `result.concat(array)` with cloning
for (let k = 0; k < array.length; k++) {
if (!hasOwnProperty.call(array, k)) {
continue;
}
indices.push(String(k));
if (array === merged) {
// Already cloned
defineProperty(result, resultIndex++, array[k]);
} else {
defineProperty(result, resultIndex++, clone(array[k]));
}
}
// Merge non-index keys
result = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);
});
return result;
};
/**
* @param {*} merged already cloned
* @param {*} source something to merge
* @param {Object} config Config Object
* @returns {*} cloned Object
*/
function merge(merged, source, config) {
if (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {
return concatArrays(merged, source, config);
}
if (!isOptionObject(source) || !isOptionObject(merged)) {
return clone(source);
}
return mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);
}
module.exports = function (...options) {
const config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions);
let merged = {_: {}};
for (const option of options) {
if (option === undefined) {
continue;
}
if (!isOptionObject(option)) {
throw new TypeError('`' + option + '` is not an Option Object');
}
merged = merge(merged, {_: option}, config);
}
return merged._;
};

8
node_modules/merge-options/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Thin ESM wrapper for CJS named exports.
*
* Ref: https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1
*/
import mergeOptions from './index.js';
export default mergeOptions;

21
node_modules/merge-options/license generated vendored Normal file
View File

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

59
node_modules/merge-options/package.json generated vendored Normal file
View File

@@ -0,0 +1,59 @@
{
"name": "merge-options",
"version": "3.0.4",
"description": "Merge Option Objects",
"license": "MIT",
"repository": "schnittstabil/merge-options",
"author": {
"name": "Michael Mayer",
"email": "michael@schnittstabil.de"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && tsd && nyc ava",
"lint": "xo",
"unit": "ava",
"typecheck": "tsd",
"clean": "rimraf .nyc_output/ coverage/",
"coverage-html": "nyc ava && nyc report --reporter=html"
},
"main": "./index.js",
"exports": {
"require": "./index.js",
"import": "./index.mjs"
},
"files": [
"index.d.ts",
"index.js",
"index.mjs"
],
"keywords": [
"merge",
"options",
"deep",
"plain",
"object",
"extend",
"clone"
],
"devDependencies": {
"ava": "^3.11.1",
"coveralls": "^3.1.0",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"tsd": "^0.13.1",
"xo": "^0.33.0"
},
"dependencies": {
"is-plain-obj": "^2.1.0"
},
"xo": {
"rules": {
"import/extensions": "off",
"import/no-useless-path-segments": "off",
"unicorn/import-index": "off"
}
}
}

130
node_modules/merge-options/readme.md generated vendored Normal file
View File

@@ -0,0 +1,130 @@
# merge-options [![Build Status](https://travis-ci.org/schnittstabil/merge-options.svg?branch=master)](https://travis-ci.org/schnittstabil/merge-options) [![Coverage Status](https://coveralls.io/repos/schnittstabil/merge-options/badge.svg?branch=master&service=github)](https://coveralls.io/github/schnittstabil/merge-options?branch=master) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
> Merge Option Objects
`merge-options` considers [plain objects](https://github.com/sindresorhus/is-plain-obj) as *Option Objects*, everything else as *Option Values*.
## Install
```
$ npm install --save merge-options
```
## Usage
```js
const mergeOptions = require('merge-options');
mergeOptions({foo: 0}, {bar: 1}, {baz: 2}, {bar: 3})
//=> {foo: 0, bar: 3, baz: 2}
mergeOptions({nested: {unicorns: 'none'}}, {nested: {unicorns: 'many'}})
//=> {nested: {unicorns: 'many'}}
mergeOptions({[Symbol.for('key')]: 0}, {[Symbol.for('key')]: 42})
//=> {Symbol(key): 42}
```
### Usage with custom config
```js
const mergeOptions = require('merge-options').bind({ignoreUndefined: true});
mergeOptions({foo: 'bar'}, {foo: undefined})
//=> {foo: 'bar'}
```
## API
### mergeOptions(option1, ...options)<br/>mergeOptions.call(config, option1, ...options)<br/>mergeOptions.apply(config, [option1, ...options])
`mergeOptions` recursively merges one or more *Option Objects* into a new one and returns that. The `options` are merged in order, thus *Option Values* of additional `options` take precedence over previous ones.
The merging does not alter the passed `option` arguments, taking roughly the following steps:
* recursively cloning<sup><a href="#note1">[1]</a></sup> *Option Objects* and [arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) until reaching *Option Values*
* copying<sup><a href="#note1">[1]</a></sup> references to *Option Values* to the result object
```js
const defaultOpts = {
fn: () => false, // functions are Option Values
promise: Promise.reject(new Error()), // all non-plain objects are Option Values
array: ['foo'], // arrays are Option Values
nested: {unicorns: 'none'} // {…} is plain, therefore an Option Object
};
const opts = {
fn: () => true, // [1]
promise: Promise.resolve('bar'), // [2]
array: ['baz'], // [3]
nested: {unicorns: 'many'} // [4]
};
mergeOptions(defaultOpts, opts)
//=>
{
fn: [Function], // === [1]
promise: Promise { 'bar' }, // === [2]
array: ['baz'], // !== [3] (arrays are cloned)
nested: {unicorns: 'many'} // !== [4] (Option Objects are cloned)
}
```
#### config
Type: `object`
##### config.concatArrays
Type: `boolean`<br/>Default: `false`
Concatenate arrays:
```js
mergeOptions({src: ['src/**']}, {src: ['test/**']})
//=> {src: ['test/**']}
// Via call
mergeOptions.call({concatArrays: true}, {src: ['src/**']}, {src: ['test/**']})
//=> {src: ['src/**', 'test/**']}
// Via apply
mergeOptions.apply({concatArrays: true}, [{src: ['src/**']}, {src: ['test/**']}])
//=> {src: ['src/**', 'test/**']}
```
##### config.ignoreUndefined
Type: `boolean`<br/>Default: `false`
Ignore undefined values:
```js
mergeOptions({foo: 'bar'}, {foo: undefined})
//=> {foo: undefined}
// Via call
mergeOptions.call({ignoreUndefined: true}, {foo: 'bar'}, {foo: undefined})
//=> {foo: 'bar'}
// Via apply
mergeOptions.apply({ignoreUndefined: true}, [{foo: 'bar'}, {foo: undefined}])
//=> {foo: 'bar'}
```
## Related
* See [object-assign](https://github.com/sindresorhus/object-assign) if you need a ES2015 Object.assign() ponyfill
* See [deep-assign](https://github.com/sindresorhus/deep-assign) if you need to do Object.assign() recursively
## Notes
<ol>
<li id="note1">copying and cloning take only enumerable own properties into account</li>
</ol>
## License
MIT © [Michael Mayer](http://schnittstabil.de)