Add comprehensive installation and setup documentation

- Add GETTING_STARTED.md with quick start guide and development modes
- Add INSTALL.sh automated installation script
- Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md
- Add QUICK_REFERENCE.md for common commands
- Add SETUP_GUIDE.md with detailed setup instructions
- Update README.md with improved project overview
- Add did-wallet app dependencies and node_modules
This commit is contained in:
Dorian
2026-01-27 17:18:21 +00:00
parent a81f655133
commit 0d073fa89e
22658 changed files with 4494151 additions and 6 deletions
+90
View File
@@ -0,0 +1,90 @@
# it-merge
[![codecov](https://img.shields.io/codecov/c/github/achingbrain/it.svg?style=flat-square)](https://codecov.io/gh/achingbrain/it)
[![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/it/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/achingbrain/it/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
> Treat one or more iterables as a single iterable
# About
<!--
!IMPORTANT!
Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.
To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts
To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.
-->
Merge several (async)iterables into one, yield values as they arrive.
Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.
## Example
```javascript
import merge from 'it-merge'
import all from 'it-all'
// This can also be an iterator, generator, etc
const values1 = [0, 1, 2, 3, 4]
const values2 = [5, 6, 7, 8, 9]
const arr = all(merge(values1, values2))
console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
```
Async sources must be awaited:
```javascript
import merge from 'it-merge'
import all from 'it-all'
// This can also be an iterator, async iterator, generator, etc
const values1 = async function * () {
yield * [0, 1, 2, 3, 4]
}
const values2 = async function * () {
yield * [5, 6, 7, 8, 9]
}
const arr = await all(merge(values1(), values2()))
console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed
```
# Install
```console
$ npm i it-merge
```
## Browser `<script>` tag
Loading this module through a script tag will make its exports available as `ItMerge` in the global namespace.
```html
<script src="https://unpkg.com/it-merge/dist/index.min.js"></script>
```
# API Docs
- <https://achingbrain.github.io/it/modules/it_merge.html>
# License
Licensed under either of
- Apache 2.0, ([LICENSE-APACHE](https://github.com/achingbrain/it/blob/main/packages/it-merge/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/achingbrain/it/blob/main/packages/it-merge/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
# Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
+4
View File
@@ -0,0 +1,4 @@
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ItMerge = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var ItMerge=(()=>{var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var w=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},m=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of f(e))!x.call(r,s)&&s!==t&&i(r,s,{get:()=>e[s],enumerable:!(n=c(e,s))||n.enumerable});return r};var y=r=>m(i({},"__esModule",{value:!0}),r);var P={};w(P,{default:()=>S});function o(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var a=class extends Error{type;code;constructor(e,t,n){super(e??"The operation was aborted"),this.type="aborted",this.name=n??"AbortError",this.code=t??"ABORT_ERR"}};async function l(r,e,t){if(e==null)return r;if(e.aborted)return r.catch(()=>{}),Promise.reject(new a(t?.errorMessage,t?.errorCode,t?.errorName));let n,s=new a(t?.errorMessage,t?.errorCode,t?.errorName);try{return await Promise.race([r,new Promise((E,d)=>{n=()=>{d(s)},e.addEventListener("abort",n)})])}finally{n!=null&&e.removeEventListener("abort",n)}}var u=class{readNext;haveNext;ended;nextResult;error;constructor(){this.ended=!1,this.readNext=o(),this.haveNext=o()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=o(),e}async throw(e){return this.ended=!0,this.error=e,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return this.ended=!0,this.nextResult=e,this.haveNext.resolve(),e}async push(e,t){await this._push(e,t)}async end(e,t){e!=null?await this.throw(e):await this._push(void 0,t)}async _push(e,t){if(e!=null&&this.ended)throw this.error??new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=o(),await l(this.readNext.promise,t?.signal,t)}};function h(){return new u}function v(r){return r[Symbol.asyncIterator]!=null}async function p(r,e,t){try{await Promise.all(r.map(async n=>{for await(let s of n)await e.push(s,{signal:t}),t.throwIfAborted()})),await e.end(void 0,{signal:t})}catch(n){await e.end(n,{signal:t}).catch(()=>{})}}async function*N(r){let e=new AbortController,t=h();p(r,t,e.signal).catch(()=>{});try{yield*t}finally{e.abort()}}function*b(r){for(let e of r)yield*e}function R(...r){let e=[];for(let t of r)v(t)||e.push(t);return e.length===r.length?b(e):N(r)}var S=R;return y(P);})();
return ItMerge}));
//# sourceMappingURL=index.min.js.map
File diff suppressed because one or more lines are too long
+51
View File
@@ -0,0 +1,51 @@
/**
* @packageDocumentation
*
* Merge several (async)iterables into one, yield values as they arrive.
*
* Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.
*
* @example
*
* ```javascript
* import merge from 'it-merge'
* import all from 'it-all'
*
* // This can also be an iterator, generator, etc
* const values1 = [0, 1, 2, 3, 4]
* const values2 = [5, 6, 7, 8, 9]
*
* const arr = all(merge(values1, values2))
*
* console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
* ```
*
* Async sources must be awaited:
*
* ```javascript
* import merge from 'it-merge'
* import all from 'it-all'
*
* // This can also be an iterator, async iterator, generator, etc
* const values1 = async function * () {
* yield * [0, 1, 2, 3, 4]
* }
* const values2 = async function * () {
* yield * [5, 6, 7, 8, 9]
* }
*
* const arr = await all(merge(values1(), values2()))
*
* console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed
* ```
*/
/**
* Treat one or more iterables as a single iterable.
*
* Nb. sources are iterated over in parallel so the
* order of emitted items is not guaranteed.
*/
declare function merge<T>(...sources: Array<Iterable<T>>): Generator<T, void, undefined>;
declare function merge<T>(...sources: Array<AsyncIterable<T> | Iterable<T>>): AsyncGenerator<T, void, undefined>;
export default merge;
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAqDH;;;;;GAKG;AACH,iBAAS,KAAK,CAAE,CAAC,EAAG,GAAG,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AAClF,iBAAS,KAAK,CAAE,CAAC,EAAG,GAAG,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AAkB1G,eAAe,KAAK,CAAA"}
+98
View File
@@ -0,0 +1,98 @@
/**
* @packageDocumentation
*
* Merge several (async)iterables into one, yield values as they arrive.
*
* Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.
*
* @example
*
* ```javascript
* import merge from 'it-merge'
* import all from 'it-all'
*
* // This can also be an iterator, generator, etc
* const values1 = [0, 1, 2, 3, 4]
* const values2 = [5, 6, 7, 8, 9]
*
* const arr = all(merge(values1, values2))
*
* console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
* ```
*
* Async sources must be awaited:
*
* ```javascript
* import merge from 'it-merge'
* import all from 'it-all'
*
* // This can also be an iterator, async iterator, generator, etc
* const values1 = async function * () {
* yield * [0, 1, 2, 3, 4]
* }
* const values2 = async function * () {
* yield * [5, 6, 7, 8, 9]
* }
*
* const arr = await all(merge(values1(), values2()))
*
* console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed
* ```
*/
import { queuelessPushable } from 'it-queueless-pushable';
function isAsyncIterable(thing) {
return thing[Symbol.asyncIterator] != null;
}
async function addAllToPushable(sources, output, signal) {
try {
await Promise.all(sources.map(async (source) => {
for await (const item of source) {
await output.push(item, {
signal
});
signal.throwIfAborted();
}
}));
await output.end(undefined, {
signal
});
}
catch (err) {
await output.end(err, {
signal
})
.catch(() => { });
}
}
async function* mergeSources(sources) {
const controller = new AbortController();
const output = queuelessPushable();
addAllToPushable(sources, output, controller.signal)
.catch(() => { });
try {
yield* output;
}
finally {
controller.abort();
}
}
function* mergeSyncSources(syncSources) {
for (const source of syncSources) {
yield* source;
}
}
function merge(...sources) {
const syncSources = [];
for (const source of sources) {
if (!isAsyncIterable(source)) {
syncSources.push(source);
}
}
if (syncSources.length === sources.length) {
// all sources are synchronous
return mergeSyncSources(syncSources);
}
return mergeSources(sources);
}
export default merge;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD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AAI,WAAW,EAAE,CAAC;QACjC,KAAM,CAAC,CAAC,MAAM,CAAA;IAChB,CAAC;AACH,CAAC;AAUD,SAAS,KAAK,CAAM,GAAG,OAA8C;IACnE,MAAM,WAAW,GAAuB,EAAE,CAAA;IAE1C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1C,8BAA8B;QAC9B,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC;AAED,eAAe,KAAK,CAAA"}
+147
View File
@@ -0,0 +1,147 @@
{
"name": "it-merge",
"version": "3.0.12",
"description": "Treat one or more iterables as a single iterable",
"author": "Alex Potsides <alex@achingbrain.net>",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/achingbrain/it/tree/main/packages/it-merge#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/achingbrain/it.git"
},
"bugs": {
"url": "https://github.com/achingbrain/it/issues"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json"
]
}
]
]
},
"scripts": {
"build": "aegir build",
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"clean": "aegir clean",
"test": "aegir test",
"test:node": "aegir test -t node --cov",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"release": "aegir release"
},
"dependencies": {
"it-queueless-pushable": "^2.0.0"
},
"devDependencies": {
"aegir": "^47.0.16",
"delay": "^6.0.0",
"it-all": "^3.0.0"
}
}
+119
View File
@@ -0,0 +1,119 @@
/**
* @packageDocumentation
*
* Merge several (async)iterables into one, yield values as they arrive.
*
* Nb. sources are iterated over in parallel so the order of emitted items is not guaranteed.
*
* @example
*
* ```javascript
* import merge from 'it-merge'
* import all from 'it-all'
*
* // This can also be an iterator, generator, etc
* const values1 = [0, 1, 2, 3, 4]
* const values2 = [5, 6, 7, 8, 9]
*
* const arr = all(merge(values1, values2))
*
* console.info(arr) // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
* ```
*
* Async sources must be awaited:
*
* ```javascript
* import merge from 'it-merge'
* import all from 'it-all'
*
* // This can also be an iterator, async iterator, generator, etc
* const values1 = async function * () {
* yield * [0, 1, 2, 3, 4]
* }
* const values2 = async function * () {
* yield * [5, 6, 7, 8, 9]
* }
*
* const arr = await all(merge(values1(), values2()))
*
* console.info(arr) // 0, 1, 5, 6, 2, 3, 4, 7, 8, 9 <- nb. order is not guaranteed
* ```
*/
import { queuelessPushable } from 'it-queueless-pushable'
import type { Pushable } from 'it-queueless-pushable'
function isAsyncIterable <T> (thing: any): thing is AsyncIterable<T> {
return thing[Symbol.asyncIterator] != null
}
async function addAllToPushable <T> (sources: Array<AsyncIterable<T> | Iterable<T>>, output: Pushable<T>, signal: AbortSignal): Promise<void> {
try {
await Promise.all(
sources.map(async (source) => {
for await (const item of source) {
await output.push(item, {
signal
})
signal.throwIfAborted()
}
})
)
await output.end(undefined, {
signal
})
} catch (err: any) {
await output.end(err, {
signal
})
.catch(() => {})
}
}
async function * mergeSources <T> (sources: Array<AsyncIterable<T> | Iterable<T>>): AsyncGenerator<T, void, undefined> {
const controller = new AbortController()
const output = queuelessPushable<T>()
addAllToPushable(sources, output, controller.signal)
.catch(() => {})
try {
yield * output
} finally {
controller.abort()
}
}
function * mergeSyncSources <T> (syncSources: Array<Iterable<T>>): Generator<T, void, undefined> {
for (const source of syncSources) {
yield * source
}
}
/**
* Treat one or more iterables as a single iterable.
*
* Nb. sources are iterated over in parallel so the
* order of emitted items is not guaranteed.
*/
function merge <T> (...sources: Array<Iterable<T>>): Generator<T, void, undefined>
function merge <T> (...sources: Array<AsyncIterable<T> | Iterable<T>>): AsyncGenerator<T, void, undefined>
function merge <T> (...sources: Array<AsyncIterable<T> | Iterable<T>>): AsyncGenerator<T, void, undefined> | Generator<T, void, undefined> {
const syncSources: Array<Iterable<T>> = []
for (const source of sources) {
if (!isAsyncIterable(source)) {
syncSources.push(source)
}
}
if (syncSources.length === sources.length) {
// all sources are synchronous
return mergeSyncSources(syncSources)
}
return mergeSources(sources)
}
export default merge