evg_observable 3.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evg_observable",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "Lightweight reactive Observable library (zero dependencies) — 2-7x faster than RxJS, 1.5-3x faster than observable-fns. Pipe operators: throttle, debounce, distinctUntilChanged, map, tap. Original hot-observable architecture, not a fork or wrapper.",
5
5
  "main": "./src/outLib/index.js",
6
6
  "module": "./src/outLib-esm/index.mjs",
package/.claudeignore DELETED
@@ -1,9 +0,0 @@
1
- .env
2
- .env.*
3
- *.pem
4
- *.key
5
- credentials.json
6
- service-account*.json
7
- **/secrets/**
8
- .npmrc
9
- .pypirc
@@ -1 +0,0 @@
1
- (()=>{"use strict";function s(s,r){return s.order>r.order?1:s.order<r.order?-1:0}function r(s,r){return s.order>r.order?-1:s.order<r.order?1:0}function e(s,r){const e=s.indexOf(r);return-1!==e&&(s.splice(e,1),!0)}function i(s){return"next"in s?r=>s.next(r):s}class t{pipe;counter;constructor(s){this.pipe=s,this.counter=s.chain.length?s.chain.length:0}or(s){this.counter++;const r=this.counter,e=this.pipe.chain;return e.push(i=>{i.isAvailable=!0,s(i.payload)&&(i.isBreak=!0),r!==e.length||i.isBreak||(i.isAvailable=!1)}),this}anyOf(s){if(!Array.isArray(s))return this;for(let r=0;r<s.length;r++)this.or(s[r]);return this}}class n{chain=[];flow={isBreak:!1,isUnsubscribe:!1,isAvailable:!1,payload:null};push(s){return this.chain.push(s),this}once(){return this.push(s=>{this.listener(s.payload),s.isUnsubscribe=!0})}unsubscribeBy(s){return this.push(r=>{r.isAvailable=!0,s(r.payload)&&(r.isUnsubscribe=!0)})}and(s){return this.push(r=>s(r.payload)&&(r.isAvailable=!0))}allOf(s){if(!Array.isArray(s))return this;for(let r=0;r<s.length;r++)this.and(s[r]);return this}choice(){return new h(this)}map(s){return this.push(r=>{r.payload=s(r.payload),r.isAvailable=!0})}toJson(){return this.push(s=>{s.payload=JSON.stringify(s.payload),s.isAvailable=!0})}fromJson(){return this.push(s=>{s.payload=JSON.parse(s.payload),s.isAvailable=!0})}group(){return this}processChain(s){const r=this.chain,e=this.flow,i=r.length;for(let s=0;s<i;s++){if(e.isUnsubscribe=!1,e.isAvailable=!1,r[s](e),e.isUnsubscribe)return this.unsubscribe();if(!e.isAvailable)return;if(e.isBreak)break}return s(e.payload)}}class h extends t{subscribe(s,r){return this.pipe.subscribe(s,r)}group(){return this.pipe}}class l extends n{observer;listener;errorHandler=(s,r)=>{console.log(`(Unit of SubscribeObject).send(${s}) ERROR:`,r)};_order=0;paused=!1;piped=!1;listeners;errorHandlers;constructor(s,r){super(),this.observer=s,this.piped=!!r}subscribe(s,r){return this.listener=function(s){if(Array.isArray(s)){const r=[];for(let e=0;e<s.length;e++)r.push(i(s[e]));return s=>{for(let e=0;e<r.length;e++)r[e](s)}}return i(s)}(s),r&&(this.errorHandler=r),this}add(s,r){if(this.listeners||(this.listeners=[],this.errorHandlers=[]),Array.isArray(s))for(let e=0;e<s.length;e++){this.listeners.push(s[e]);const i=r&&Array.isArray(r)?r[e]??this.errorHandler:r||this.errorHandler;this.errorHandlers.push(i)}else{this.listeners.push(s);const e=r&&!Array.isArray(r)?r:this.errorHandler;this.errorHandlers.push(e)}return this}unsubscribe(){this.observer&&(this.observer.unSubscribe(this),this.observer=null,this.listener=null,this.chain.length=0)}send(s){const r=this.listener,e=this.listeners&&this.listeners.length>0;if(r||e){if(this.observer&&!this.paused)if(this.piped)try{if(this.flow.payload=s,this.flow.isBreak=!1,r)this.processChain(r);else{const s=this.chain,r=this.flow,e=s.length;r.isAvailable=0===e;for(let i=0;i<e;i++){if(r.isUnsubscribe=!1,r.isAvailable=!1,s[i](r),r.isUnsubscribe)return void this.unsubscribe();if(!r.isAvailable)return;if(r.isBreak)break}}if(e){const s=this.flow.payload;for(let r=0;r<this.listeners.length;r++)try{this.listeners[r](s)}catch(e){this.errorHandlers[r](s,e)}}}catch(r){this.errorHandler(s,r)}else{if(r)try{r(s)}catch(r){this.errorHandler(s,r)}if(e)for(let r=0;r<this.listeners.length;r++)try{this.listeners[r](s)}catch(e){this.errorHandlers[r](s,e)}}}else this.unsubscribe()}resume(){this.paused=!1}pause(){this.paused=!0}get order(){return this._order}set order(s){this._order=s}}class a{chain=[];flow={isBreak:!1,isAvailable:!1,payload:null};response={isOK:!1,payload:void 0};errHandler;get isEmpty(){return!this.chain.length}push(s){return this.chain.push(s),this}and(s){return this.push(r=>s(r.payload)&&(r.isAvailable=!0))}allOf(s){if(!Array.isArray(s))return this;for(let r=0;r<s.length;r++)this.and(s[r]);return this}choice(){return new o(this)}processChain(s){const r=this.chain,e=this.flow,i=this.response;i.isOK=!1,i.payload=void 0,e.payload=s,e.isBreak=!1;try{const s=r.length;for(let t=0;t<s;t++){if(e.isAvailable=!1,r[t](e),!e.isAvailable)return i;if(e.isBreak)break}}catch(s){return this.errHandler?this.errHandler(s,"Filter.processChain ERROR:"):console.log("Filter.processChain ERROR:",s),i}return i.isOK=!0,i.payload=e.payload,i}addErrorHandler(s){this.errHandler=s}}class o extends t{}class u{subs=[];enabled=!0;killed=!1;process=!1;trash=[];filters=new a;_value;constructor(s){this._value=s}addFilter(s){return s&&this.filters.addErrorHandler(s),this.filters}disable(){this.enabled=!1}enable(){this.enabled=!0}get isEnable(){return this.enabled}next(s){if(this.killed)return;if(!this.enabled)return;if(!this.subs.length)return;if(!this.filters.isEmpty&&!this.filters.processChain(s).isOK)return;this.process=!0,this._value=s;const r=this.subs,e=r.length;for(let i=0;i<e;i++)r[i].send(s);this.process=!1,this.trash.length&&this.clearTrash()}of(s){if(!this.killed&&this.enabled)for(let r=0;r<s.length;r++)this.next(s[r])}in(s){if(!this.killed&&this.enabled)for(const r in s)Object.hasOwn(s,r)&&this.next([r,s[r]])}clearTrash(){const s=this.trash.length;for(let r=0;r<s;r++)this.unSubscribe(this.trash[r]);this.trash.length=0}unSubscribe(s){this.killed||(this.process&&s?this.trash.push(s):this.subs&&e(this.subs,s))}destroy(){if(!this.killed){if(this.killed=!0,!this.process)return this._value=null,void(this.subs.length=0);Promise.resolve().then(()=>{this._value=null,this.subs.length=0})}}unsubscribeAll(){if(!this.killed){if(this.process){const s=this.subs;for(let r=0;r<s.length;r++)this.trash.push(s[r]);return}this.subs.length=0}}getValue(){if(!this.killed)return this._value}size(){return this.killed?0:this.subs.length}subscribe(s,r){if(this.killed)return;if(!this.isListener(s))return;const e=new l(this,!1);return this.addObserver(e,s,r),e}addObserver(s,r,e){s.subscribe(r,e),this.subs.push(s)}isListener(s){return!this.killed&&!!s}pipe(){if(this.killed)return;const s=new l(this,!0);return this.subs.push(s),s}get isDestroyed(){return this.killed}}class d extends l{constructor(s,r){super(s,r)}get order(){return this._order}set order(s){!this.observer||this.observer&&this.observer.isDestroyed?this._order=void 0:(this._order=s,this.observer.sortByOrder())}subscribe(s,r){return super.subscribe(s,r),this}once(){return super.once()}}const c=window;c.Observable=u,c.Collector=class{arr=[];killed=!1;collect(...s){this.killed||this.arr.push(...s)}unsubscribe(s){this.killed||(s?.unsubscribe(),e(this.arr,s))}unsubscribeAll(){if(this.killed)return;const s=this.arr;for(let r=0;r<s.length;r++)s[r].unsubscribe();s.length=0}size(){return this.killed?0:this.arr.length}destroy(){this.unsubscribeAll(),this.arr.length=0,this.arr=0,this.killed=!0}get isDestroyed(){return this.killed}},c.OrderedObservable=class extends u{sortDirection=s;ascendingSort(){return this.sortDirection=s,this.sortByOrder()}descendingSort(){return this.sortDirection=r,this.sortByOrder()}sortByOrder(){return!this.killed&&(this.subs.sort(this.sortDirection),!0)}subscribe(s,r){if(!this.isListener(s))return;const e=new d(this,!1);return this.addObserver(e,s,r),e}pipe(){if(this.killed)return;const s=new d(this,!0);return this.subs.push(s),s}unSubscribe(s){this.killed||(this.process&&s?this.trash.push(s):this.subs&&e(this.subs,s))}}})();
package/scripts/README.md DELETED
@@ -1,69 +0,0 @@
1
- # Automation Scripts
2
-
3
- Scripts for automated code review and PR preparation using Claude Code in headless mode.
4
-
5
- ## Prerequisites
6
-
7
- - Claude Code CLI installed (`npm install -g @anthropic-ai/claude-code`)
8
- - Authenticated Claude session (API key or OAuth)
9
- - Git repository with at least one base branch (`dev`, `stage`, `main`, or `master`)
10
-
11
- ## Scripts
12
-
13
- ### claude-review-files.sh
14
-
15
- Code review of current branch changes against a base branch.
16
-
17
- **What it checks:**
18
- - Correctness and edge cases
19
- - TypeScript type safety
20
- - Naming conventions (PascalCase, camelCase, `I` prefix, `$` suffix)
21
- - Code style (2-space indent, JSDoc)
22
- - Resource cleanup (destroy/unsubscribe)
23
- - Regression risk
24
-
25
- **When to use:** After finishing implementation, before creating a PR. Helps catch problems early.
26
-
27
- ```bash
28
- ./scripts/claude-review-files.sh # auto-detect base branch
29
- ./scripts/claude-review-files.sh dev # review against dev
30
- ```
31
-
32
- ---
33
-
34
- ### claude-pr-prep.sh
35
-
36
- Runs tests and generates a PR description from commit history and test results.
37
-
38
- **What it does:**
39
- 1. Runs `npm test` and captures results
40
- 2. Collects commit log between current and base branch
41
- 3. Generates a structured PR description (Summary, Changes, Test plan)
42
-
43
- **When to use:** When the branch is ready for PR and you need a description.
44
-
45
- ```bash
46
- ./scripts/claude-pr-prep.sh # auto-detect base branch
47
- ./scripts/claude-pr-prep.sh dev # prepare PR against dev
48
- ```
49
-
50
- ---
51
-
52
- ### claude-full-check.sh
53
-
54
- Full pre-PR pipeline: runs review first, then PR preparation.
55
-
56
- **What it does:**
57
- 1. Runs `claude-review-files.sh` — review code for issues
58
- 2. Runs `claude-pr-prep.sh` — run tests and generate PR description
59
-
60
- **When to use:** Complete quality check before creating a PR. One command instead of two.
61
-
62
- ```bash
63
- ./scripts/claude-full-check.sh # auto-detect base branch
64
- ./scripts/claude-full-check.sh dev # full check against dev
65
- ```
66
-
67
- ## Base Branch Detection
68
-
69
- All scripts auto-detect the base branch in this order: `dev` → `stage` → `main` → `master`. The first existing branch is used. You can override by passing the branch name as an argument.
@@ -1,33 +0,0 @@
1
- #!/bin/bash
2
- # scripts/claude-full-check.sh
3
- # Full pre-PR pipeline: review code, then prepare PR description.
4
- # Runs claude-review-files.sh first, then claude-pr-prep.sh.
5
- #
6
- # Usage:
7
- # ./scripts/claude-full-check.sh # auto-detect base branch
8
- # ./scripts/claude-full-check.sh dev # explicit base branch
9
-
10
- set -e
11
-
12
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
13
- BASE="${1:-}"
14
-
15
- echo "========================================="
16
- echo " Step 1/2: Code Review"
17
- echo "========================================="
18
- echo ""
19
-
20
- "$SCRIPT_DIR/claude-review-files.sh" $BASE
21
-
22
- echo ""
23
- echo "========================================="
24
- echo " Step 2/2: PR Preparation"
25
- echo "========================================="
26
- echo ""
27
-
28
- "$SCRIPT_DIR/claude-pr-prep.sh" $BASE
29
-
30
- echo ""
31
- echo "========================================="
32
- echo " Done. Review the output above."
33
- echo "========================================="
@@ -1,73 +0,0 @@
1
- #!/bin/bash
2
- # scripts/claude-pr-prep.sh
3
- # Run tests and generate a PR description for the current branch.
4
- #
5
- # Usage:
6
- # ./scripts/claude-pr-prep.sh # auto-detect base branch
7
- # ./scripts/claude-pr-prep.sh dev # explicit base branch
8
-
9
- set -e
10
-
11
- # Determine base branch
12
- if [ -n "$1" ]; then
13
- BASE="$1"
14
- else
15
- for branch in dev stage main master; do
16
- if git rev-parse --verify "$branch" >/dev/null 2>&1; then
17
- BASE="$branch"
18
- break
19
- fi
20
- done
21
- fi
22
-
23
- if [ -z "$BASE" ]; then
24
- echo "Error: no base branch found (tried: dev, stage, main, master)"
25
- exit 1
26
- fi
27
-
28
- CURRENT=$(git branch --show-current)
29
-
30
- echo "Preparing branch '$CURRENT' for PR into '$BASE'..."
31
- echo ""
32
-
33
- # Run tests
34
- echo "=== Running tests ==="
35
- TEST_OUTPUT=$(npm test 2>&1) || true
36
- echo "$TEST_OUTPUT" | tail -5
37
- echo ""
38
-
39
- # Get commit log
40
- COMMITS=$(git log "$BASE".."$CURRENT" --oneline 2>/dev/null)
41
-
42
- if [ -z "$COMMITS" ]; then
43
- echo "No commits between '$CURRENT' and '$BASE'. Nothing to prepare."
44
- exit 0
45
- fi
46
-
47
- # Generate PR description
48
- echo "=== Generating PR description ==="
49
- echo ""
50
-
51
- claude -p "Generate a pull request description for the EVG Observable library.
52
-
53
- Branch: $CURRENT -> $BASE
54
-
55
- Commits:
56
- $COMMITS
57
-
58
- Test results (last 5 lines):
59
- $(echo "$TEST_OUTPUT" | tail -5)
60
-
61
- Write a PR description in this format:
62
- ## Summary
63
- <2-4 bullet points describing what changed and why>
64
-
65
- ## Changes
66
- <list of key changes grouped by category>
67
-
68
- ## Test plan
69
- <what was tested, test results summary>
70
-
71
- Be concise and specific to this library." \
72
- --print \
73
- --max-turns 3
@@ -1,61 +0,0 @@
1
- #!/bin/bash
2
- # scripts/claude-review-files.sh
3
- # Review current branch changes against base branch using Claude headless mode.
4
- # Checks: correctness, types, naming, resource cleanup, regression risk.
5
- #
6
- # Usage:
7
- # ./scripts/claude-review-files.sh # auto-detect base branch
8
- # ./scripts/claude-review-files.sh dev # explicit base branch
9
-
10
- set -e
11
-
12
- # Determine base branch
13
- if [ -n "$1" ]; then
14
- BASE="$1"
15
- else
16
- for branch in dev stage main master; do
17
- if git rev-parse --verify "$branch" >/dev/null 2>&1; then
18
- BASE="$branch"
19
- break
20
- fi
21
- done
22
- fi
23
-
24
- if [ -z "$BASE" ]; then
25
- echo "Error: no base branch found (tried: dev, stage, main, master)"
26
- exit 1
27
- fi
28
-
29
- CURRENT=$(git branch --show-current)
30
- DIFF=$(git diff "$BASE"..."$CURRENT" 2>/dev/null)
31
-
32
- if [ -z "$DIFF" ]; then
33
- echo "No changes between '$CURRENT' and '$BASE'. Nothing to review."
34
- exit 0
35
- fi
36
-
37
- echo "Reviewing branch '$CURRENT' against '$BASE'..."
38
- echo ""
39
-
40
- claude -p "You are reviewing a code diff for the EVG Observable library.
41
-
42
- Base branch: $BASE
43
- Current branch: $CURRENT
44
-
45
- Here is the diff:
46
-
47
- $DIFF
48
-
49
- Review this diff. For each changed file evaluate:
50
- - **Correctness**: Does the code do what it should?
51
- - **Edge cases**: Boundary conditions handled? (null, undefined, empty arrays)
52
- - **Type safety**: Proper TypeScript types, no unnecessary \`any\`
53
- - **Naming**: PascalCase classes, camelCase methods, \`I\` prefix for interfaces, \`\$\` suffix for observables
54
- - **Style**: 2-space indent, JSDoc on public methods
55
- - **Resource cleanup**: Are subscriptions cleaned up? destroy()/unsubscribe() where needed?
56
- - **Regression risk**: Could this break existing behavior?
57
-
58
- Output a table of issues found with severity (critical/major/minor), file, line, and description.
59
- If no issues found, say so. Be specific and concise." \
60
- --print \
61
- --max-turns 5