@shuji-bonji/rxjs-mcp 0.1.2 → 0.2.0
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/CHANGELOG.md +90 -0
- package/README.ja.md +39 -3
- package/README.md +64 -10
- package/dist/data/cleanup-examples.d.ts +9 -0
- package/dist/data/cleanup-examples.d.ts.map +1 -0
- package/dist/data/cleanup-examples.js +87 -0
- package/dist/data/cleanup-examples.js.map +1 -0
- package/dist/data/creation-functions.d.ts +7 -0
- package/dist/data/creation-functions.d.ts.map +1 -0
- package/dist/data/creation-functions.js +135 -0
- package/dist/data/creation-functions.js.map +1 -0
- package/dist/data/operators.d.ts +7 -0
- package/dist/data/operators.d.ts.map +1 -0
- package/dist/data/operators.js +500 -0
- package/dist/data/operators.js.map +1 -0
- package/dist/data/patterns.d.ts +10 -0
- package/dist/data/patterns.d.ts.map +1 -0
- package/dist/data/patterns.js +482 -0
- package/dist/data/patterns.js.map +1 -0
- package/dist/data/rxjs-context.d.ts +169 -0
- package/dist/data/rxjs-context.d.ts.map +1 -0
- package/dist/data/rxjs-context.js +209 -0
- package/dist/data/rxjs-context.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/tools/analyze-operators.d.ts.map +1 -1
- package/dist/tools/analyze-operators.js +34 -129
- package/dist/tools/analyze-operators.js.map +1 -1
- package/dist/tools/execute-stream-worker.d.ts +15 -1
- package/dist/tools/execute-stream-worker.d.ts.map +1 -1
- package/dist/tools/execute-stream-worker.js +128 -151
- package/dist/tools/execute-stream-worker.js.map +1 -1
- package/dist/tools/execute-stream.d.ts.map +1 -1
- package/dist/tools/execute-stream.js +33 -67
- package/dist/tools/execute-stream.js.map +1 -1
- package/dist/tools/memory-leak.d.ts.map +1 -1
- package/dist/tools/memory-leak.js +2 -82
- package/dist/tools/memory-leak.js.map +1 -1
- package/dist/tools/suggest-pattern.d.ts.map +1 -1
- package/dist/tools/suggest-pattern.js +1 -477
- package/dist/tools/suggest-pattern.js.map +1 -1
- package/dist/types.d.ts +40 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - 2026-04-22
|
|
9
|
+
|
|
10
|
+
### BREAKING
|
|
11
|
+
- **Minimum Node.js version is now 22.** `engines.node` was raised from
|
|
12
|
+
`>=18.0.0` to `>=22.0.0`. Node 18 / 20 are EOL or in Maintenance and are
|
|
13
|
+
no longer supported. If you are on an older Node, stay on `0.1.x`
|
|
14
|
+
(`npm install @shuji-bonji/rxjs-mcp@0.1` ) until you can upgrade.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- `execute_stream`: README examples and natural snippets like
|
|
18
|
+
`interval(100).pipe(take(5))` or `const s$ = ...; s$` now run without
|
|
19
|
+
requiring an explicit `return`. The tool auto-wraps the final top-level
|
|
20
|
+
expression when no `return` is present. Explicit `return` keeps working
|
|
21
|
+
(backward compatible).
|
|
22
|
+
- `execute_stream`: error message when the result is not an Observable now
|
|
23
|
+
tells users both supported styles ("end with an Observable expression" or
|
|
24
|
+
"add an explicit `return`").
|
|
25
|
+
- `analyze_operators`: the displayed operator chain now reflects the order
|
|
26
|
+
operators actually appear in the source code. Previously they were listed
|
|
27
|
+
in `operatorDatabase` insertion order, so
|
|
28
|
+
`pipe(map, filter, switchMap, retry)` was rendered as
|
|
29
|
+
`map → switchMap → filter → retry`.
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- README updated with the three supported `execute_stream` snippet styles.
|
|
33
|
+
- Additional tests covering implicit-return behavior and chain-order
|
|
34
|
+
preservation.
|
|
35
|
+
|
|
36
|
+
### Infrastructure
|
|
37
|
+
- GitHub Actions CI workflow (`.github/workflows/ci.yml`) running
|
|
38
|
+
build + unit tests on Node 22 (current LTS) and 24 (current Active LTS)
|
|
39
|
+
for every push and PR. Matches `engines.node >= 22`.
|
|
40
|
+
- GitHub Actions Release workflow (`.github/workflows/release.yml`)
|
|
41
|
+
publishing to npm via **Trusted Publisher (OIDC)** with provenance.
|
|
42
|
+
No `NPM_TOKEN` secret required. Also auto-creates a GitHub Release
|
|
43
|
+
using the matching `CHANGELOG.md` section.
|
|
44
|
+
- `RELEASING.md` documenting the one-time npm Trusted Publisher setup
|
|
45
|
+
and the regular release procedure.
|
|
46
|
+
|
|
47
|
+
## [0.1.3] - 2025-12-27
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
- Refactored codebase for better maintainability
|
|
51
|
+
- Separated data (patterns, operators, RxJS context) from logic
|
|
52
|
+
- Centralized RxJS execution context in `rxjs-context.ts`
|
|
53
|
+
- Moved shared types to `types.ts`
|
|
54
|
+
- Reduced code duplication in worker files
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
- `src/data/` directory for data-only modules
|
|
58
|
+
- `patterns.ts` - RxJS pattern templates
|
|
59
|
+
- `operators.ts` - Operator definitions
|
|
60
|
+
- `creation-functions.ts` - Creation function definitions
|
|
61
|
+
- `cleanup-examples.ts` - Framework-specific cleanup examples
|
|
62
|
+
- `rxjs-context.ts` - RxJS execution context for Worker
|
|
63
|
+
|
|
64
|
+
## [0.1.2] - 2025-12-26
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
- Use `zod-to-json-schema` for proper JSON Schema conversion (MCP SDK compatibility)
|
|
68
|
+
- Added unofficial community notice to Japanese README
|
|
69
|
+
|
|
70
|
+
## [0.1.1] - 2025-12-25
|
|
71
|
+
|
|
72
|
+
### Added
|
|
73
|
+
- Unofficial community project notice in README
|
|
74
|
+
|
|
75
|
+
### Security
|
|
76
|
+
- Code execution now runs in isolated Worker threads
|
|
77
|
+
- Dangerous globals (process, require, fs, etc.) are explicitly blocked
|
|
78
|
+
- Hard timeout with forced worker termination prevents resource leaks
|
|
79
|
+
|
|
80
|
+
## [0.1.0] - 2025-12-25
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
- Initial release
|
|
84
|
+
- `execute_stream` - Execute RxJS code and capture emissions
|
|
85
|
+
- `generate_marble` - Generate ASCII marble diagrams
|
|
86
|
+
- `analyze_operators` - Analyze operator chains for performance
|
|
87
|
+
- `detect_memory_leak` - Detect potential memory leaks
|
|
88
|
+
- `suggest_pattern` - Suggest RxJS patterns for common use cases
|
|
89
|
+
- Support for Angular, React, Vue frameworks
|
|
90
|
+
- Comprehensive test suite (181 unit tests, 7 integration tests)
|
package/README.ja.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# RxJS MCP Server
|
|
2
2
|
|
|
3
|
+
<!-- Package meta -->
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@shuji-bonji/rxjs-mcp)
|
|
6
|
+
[](https://www.npmjs.com/package/@shuji-bonji/rxjs-mcp)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
|
|
10
|
+
<!-- Build / trust -->
|
|
11
|
+
|
|
12
|
+
[](https://github.com/shuji-bonji/rxjs-mcp-server/actions/workflows/ci.yml)
|
|
13
|
+
[](https://github.com/shuji-bonji/rxjs-mcp-server/actions/workflows/release.yml)
|
|
14
|
+
[](https://docs.npmjs.com/generating-provenance-statements)
|
|
15
|
+
[](https://docs.npmjs.com/trusted-publishers)
|
|
16
|
+
|
|
17
|
+
<!-- Tech stack -->
|
|
18
|
+
|
|
19
|
+
[](https://www.typescriptlang.org/)
|
|
20
|
+
[](https://rxjs.dev)
|
|
21
|
+
[](https://modelcontextprotocol.io)
|
|
22
|
+
[](./README.ja.md#コントリビューション)
|
|
23
|
+
|
|
3
24
|
> ⚠️ これは非公式のコミュニティプロジェクトです。RxJSチームとは関係ありません。
|
|
4
25
|
|
|
5
26
|
ClaudeなどのAIアシスタントから直接RxJSストリームを実行、デバッグ、可視化できます。
|
|
@@ -104,12 +125,21 @@ npx @shuji-bonji/rxjs-mcp
|
|
|
104
125
|
|
|
105
126
|
RxJSコードを実行し、タイムライン付きでストリームの発行をキャプチャします。
|
|
106
127
|
|
|
128
|
+
Observable に評価される式、または末尾がそのような式で終わるスニペットを受け付けます。`return` の記述は任意です。
|
|
129
|
+
|
|
107
130
|
```typescript
|
|
108
|
-
//
|
|
109
|
-
|
|
131
|
+
// ✅ 末尾の式で返す(v0.2.0 以降、自動的に return されます)
|
|
132
|
+
interval(100).pipe(
|
|
110
133
|
take(5),
|
|
111
134
|
map(x => x * 2)
|
|
112
|
-
)
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
// ✅ 宣言 + 末尾で参照
|
|
138
|
+
const stream$ = interval(100).pipe(take(5), map(x => x * 2));
|
|
139
|
+
stream$
|
|
140
|
+
|
|
141
|
+
// ✅ 明示的な return(従来通り動作します)
|
|
142
|
+
return interval(100).pipe(take(5), map(x => x * 2));
|
|
113
143
|
```
|
|
114
144
|
|
|
115
145
|
### generate_marble
|
|
@@ -237,6 +267,12 @@ npm run dev
|
|
|
237
267
|
npm test
|
|
238
268
|
```
|
|
239
269
|
|
|
270
|
+
## リリース
|
|
271
|
+
|
|
272
|
+
リリースは GitHub Actions で自動化されており、npm への publish は
|
|
273
|
+
**Trusted Publisher (OIDC)** を使用します(静的トークン不要、
|
|
274
|
+
provenance attestation 付き)。手順は [RELEASING.md](./RELEASING.md) を参照してください。
|
|
275
|
+
|
|
240
276
|
## 他のMCPサーバーとの連携
|
|
241
277
|
|
|
242
278
|
RxJS MCP Serverは以下と組み合わせて使用できます:
|
package/README.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# RxJS MCP Server
|
|
2
2
|
|
|
3
|
+
**[日本語版 README はこちら](README.ja.md)**
|
|
4
|
+
|
|
5
|
+
<!-- Package meta -->
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@shuji-bonji/rxjs-mcp)
|
|
8
|
+
[](https://www.npmjs.com/package/@shuji-bonji/rxjs-mcp)
|
|
9
|
+
[](./LICENSE)
|
|
10
|
+
[](https://nodejs.org/)
|
|
11
|
+
|
|
12
|
+
<!-- Build / trust -->
|
|
13
|
+
|
|
14
|
+
[](https://github.com/shuji-bonji/rxjs-mcp-server/actions/workflows/ci.yml)
|
|
15
|
+
[](https://github.com/shuji-bonji/rxjs-mcp-server/actions/workflows/release.yml)
|
|
16
|
+
[](https://docs.npmjs.com/generating-provenance-statements)
|
|
17
|
+
[](https://docs.npmjs.com/trusted-publishers)
|
|
18
|
+
|
|
19
|
+
<!-- Tech stack -->
|
|
20
|
+
|
|
21
|
+
[](https://www.typescriptlang.org/)
|
|
22
|
+
[](https://rxjs.dev)
|
|
23
|
+
[](https://modelcontextprotocol.io)
|
|
24
|
+
[](./README.md#contributing)
|
|
25
|
+
|
|
3
26
|
> ⚠️ This is an unofficial community project, not affiliated with RxJS team.
|
|
4
27
|
|
|
5
28
|
Execute, debug, and visualize RxJS streams directly from AI assistants like Claude.
|
|
@@ -7,30 +30,35 @@ Execute, debug, and visualize RxJS streams directly from AI assistants like Clau
|
|
|
7
30
|
## Features
|
|
8
31
|
|
|
9
32
|
### 🚀 Stream Execution
|
|
33
|
+
|
|
10
34
|
- Execute RxJS code and capture emissions
|
|
11
|
-
- Timeline visualization with timestamps
|
|
35
|
+
- Timeline visualization with timestamps
|
|
12
36
|
- Memory usage tracking
|
|
13
37
|
- Support for all major RxJS operators
|
|
14
38
|
|
|
15
39
|
### 📊 Marble Diagrams
|
|
40
|
+
|
|
16
41
|
- Generate ASCII marble diagrams
|
|
17
42
|
- Visualize stream behavior over time
|
|
18
43
|
- Automatic pattern detection
|
|
19
44
|
- Clear legend and explanations
|
|
20
45
|
|
|
21
46
|
### 🔍 Operator Analysis
|
|
47
|
+
|
|
22
48
|
- Analyze operator chains for performance
|
|
23
49
|
- Detect potential issues and bottlenecks
|
|
24
50
|
- Suggest alternative approaches
|
|
25
51
|
- Categorize operators by function
|
|
26
52
|
|
|
27
53
|
### 🛡️ Memory Leak Detection
|
|
54
|
+
|
|
28
55
|
- Identify unsubscribed subscriptions
|
|
29
56
|
- Detect missing cleanup patterns
|
|
30
57
|
- Framework-specific recommendations (Angular, React, Vue)
|
|
31
58
|
- Provide proper cleanup examples
|
|
32
59
|
|
|
33
60
|
### 💡 Pattern Suggestions
|
|
61
|
+
|
|
34
62
|
- Get battle-tested RxJS patterns
|
|
35
63
|
- Framework-specific implementations
|
|
36
64
|
- Common use cases covered:
|
|
@@ -104,11 +132,27 @@ Add to `~/.cursor/mcp.json`:
|
|
|
104
132
|
|
|
105
133
|
Execute RxJS code and capture stream emissions with timeline.
|
|
106
134
|
|
|
135
|
+
The tool accepts either an expression that evaluates to an Observable, or a
|
|
136
|
+
snippet ending in such an expression — `return` is optional.
|
|
137
|
+
|
|
107
138
|
```typescript
|
|
108
|
-
//
|
|
139
|
+
// ✅ Trailing expression (v0.2.0+): the last expression is returned implicitly
|
|
140
|
+
interval(100).pipe(
|
|
141
|
+
take(5),
|
|
142
|
+
map((x) => x * 2),
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// ✅ Declaration + trailing reference
|
|
109
146
|
const stream$ = interval(100).pipe(
|
|
110
147
|
take(5),
|
|
111
|
-
map(x => x * 2)
|
|
148
|
+
map((x) => x * 2),
|
|
149
|
+
);
|
|
150
|
+
stream$;
|
|
151
|
+
|
|
152
|
+
// ✅ Explicit return (always works)
|
|
153
|
+
return interval(100).pipe(
|
|
154
|
+
take(5),
|
|
155
|
+
map((x) => x * 2),
|
|
112
156
|
);
|
|
113
157
|
```
|
|
114
158
|
|
|
@@ -121,8 +165,8 @@ Generate ASCII marble diagrams from event data.
|
|
|
121
165
|
[
|
|
122
166
|
{ time: 0, value: 'A' },
|
|
123
167
|
{ time: 50, value: 'B' },
|
|
124
|
-
{ time: 100, value: 'C' }
|
|
125
|
-
]
|
|
168
|
+
{ time: 100, value: 'C' },
|
|
169
|
+
];
|
|
126
170
|
|
|
127
171
|
// Output: A----B----C--|
|
|
128
172
|
```
|
|
@@ -134,11 +178,11 @@ Analyze RxJS operator chains for performance and best practices.
|
|
|
134
178
|
```typescript
|
|
135
179
|
// Analyzes chains like:
|
|
136
180
|
source$.pipe(
|
|
137
|
-
map(x => x * 2),
|
|
138
|
-
filter(x => x > 10),
|
|
139
|
-
switchMap(x => fetchData(x)),
|
|
140
|
-
retry(3)
|
|
141
|
-
)
|
|
181
|
+
map((x) => x * 2),
|
|
182
|
+
filter((x) => x > 10),
|
|
183
|
+
switchMap((x) => fetchData(x)),
|
|
184
|
+
retry(3),
|
|
185
|
+
);
|
|
142
186
|
```
|
|
143
187
|
|
|
144
188
|
### detect_memory_leak
|
|
@@ -158,6 +202,7 @@ Detect potential memory leaks and missing cleanup.
|
|
|
158
202
|
Get production-ready patterns for common use cases.
|
|
159
203
|
|
|
160
204
|
Available patterns:
|
|
205
|
+
|
|
161
206
|
- `http-retry` - Resilient HTTP with retry
|
|
162
207
|
- `search-typeahead` - Debounced search
|
|
163
208
|
- `polling` - Smart polling with backoff
|
|
@@ -220,6 +265,7 @@ Claude: I'll show you the search typeahead pattern.
|
|
|
220
265
|
## Security
|
|
221
266
|
|
|
222
267
|
The `execute_stream` tool runs user-provided code in an **isolated Worker thread** to prevent:
|
|
268
|
+
|
|
223
269
|
- Main process pollution
|
|
224
270
|
- Resource leaks from infinite loops or timers
|
|
225
271
|
- Access to sensitive Node.js APIs (process, fs, etc.)
|
|
@@ -248,9 +294,17 @@ npm run test:inspector # MCP Inspector (GUI)
|
|
|
248
294
|
npm run dev
|
|
249
295
|
```
|
|
250
296
|
|
|
297
|
+
## Release
|
|
298
|
+
|
|
299
|
+
Releases are automated via GitHub Actions and published to npm using
|
|
300
|
+
**Trusted Publisher (OIDC)** — no static tokens are used, and every release
|
|
301
|
+
carries an npm provenance attestation. See [RELEASING.md](./RELEASING.md)
|
|
302
|
+
for the full workflow (and initial npm setup).
|
|
303
|
+
|
|
251
304
|
## Integration with Other MCP Servers
|
|
252
305
|
|
|
253
306
|
RxJS MCP Server works great alongside:
|
|
307
|
+
|
|
254
308
|
- **Angular MCP** - For Angular project scaffolding
|
|
255
309
|
- **TypeScript MCP** - For type checking
|
|
256
310
|
- **ESLint MCP** - For code quality
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-specific cleanup examples for memory leak detection
|
|
3
|
+
*/
|
|
4
|
+
export declare const cleanupExamples: Record<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
* Get cleanup example for a specific framework/lifecycle
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCleanupExample(lifecycle: string): string;
|
|
9
|
+
//# sourceMappingURL=cleanup-examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup-examples.d.ts","sourceRoot":"","sources":["../../src/data/cleanup-examples.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+ElD,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-specific cleanup examples for memory leak detection
|
|
3
|
+
*/
|
|
4
|
+
export const cleanupExamples = {
|
|
5
|
+
angular: `
|
|
6
|
+
// Angular Component with proper cleanup
|
|
7
|
+
export class MyComponent implements OnDestroy {
|
|
8
|
+
private destroy$ = new Subject<void>();
|
|
9
|
+
|
|
10
|
+
ngOnInit() {
|
|
11
|
+
// Method 1: takeUntil pattern
|
|
12
|
+
this.myService.getData()
|
|
13
|
+
.pipe(takeUntil(this.destroy$))
|
|
14
|
+
.subscribe(data => console.log(data));
|
|
15
|
+
|
|
16
|
+
// Method 2: Async pipe in template
|
|
17
|
+
this.data$ = this.myService.getData();
|
|
18
|
+
// Template: {{ data$ | async }}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ngOnDestroy() {
|
|
22
|
+
this.destroy$.next();
|
|
23
|
+
this.destroy$.complete();
|
|
24
|
+
}
|
|
25
|
+
}`,
|
|
26
|
+
react: `
|
|
27
|
+
// React Hook with proper cleanup
|
|
28
|
+
function MyComponent() {
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const subscription = dataStream$
|
|
31
|
+
.pipe(/* operators */)
|
|
32
|
+
.subscribe(data => setData(data));
|
|
33
|
+
|
|
34
|
+
// Cleanup function
|
|
35
|
+
return () => {
|
|
36
|
+
subscription.unsubscribe();
|
|
37
|
+
};
|
|
38
|
+
}, [/* dependencies */]);
|
|
39
|
+
}`,
|
|
40
|
+
vue: `
|
|
41
|
+
// Vue 3 Composition API with proper cleanup
|
|
42
|
+
import { onBeforeUnmount } from 'vue';
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
setup() {
|
|
46
|
+
const destroy$ = new Subject();
|
|
47
|
+
|
|
48
|
+
// Subscribe with takeUntil
|
|
49
|
+
dataStream$
|
|
50
|
+
.pipe(takeUntil(destroy$))
|
|
51
|
+
.subscribe(data => state.data = data);
|
|
52
|
+
|
|
53
|
+
onBeforeUnmount(() => {
|
|
54
|
+
destroy$.next();
|
|
55
|
+
destroy$.complete();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}`,
|
|
59
|
+
none: `
|
|
60
|
+
// Generic cleanup pattern
|
|
61
|
+
class StreamManager {
|
|
62
|
+
private subscriptions = new Subscription();
|
|
63
|
+
|
|
64
|
+
init() {
|
|
65
|
+
// Add subscriptions to composite
|
|
66
|
+
this.subscriptions.add(
|
|
67
|
+
stream1$.subscribe(/* ... */)
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
this.subscriptions.add(
|
|
71
|
+
stream2$.subscribe(/* ... */)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
cleanup() {
|
|
76
|
+
// Unsubscribe all at once
|
|
77
|
+
this.subscriptions.unsubscribe();
|
|
78
|
+
}
|
|
79
|
+
}`,
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Get cleanup example for a specific framework/lifecycle
|
|
83
|
+
*/
|
|
84
|
+
export function getCleanupExample(lifecycle) {
|
|
85
|
+
return cleanupExamples[lifecycle] || cleanupExamples.none;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=cleanup-examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup-examples.js","sourceRoot":"","sources":["../../src/data/cleanup-examples.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;EAoBT;IAEA,KAAK,EAAE;;;;;;;;;;;;;EAaP;IAEA,GAAG,EAAE;;;;;;;;;;;;;;;;;;EAkBL;IAEA,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;EAoBN;CACD,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,OAAO,eAAe,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreationFunctionInfo } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* RxJS Creation Functions Database
|
|
4
|
+
* Based on https://shuji-bonji.github.io/RxJS-with-TypeScript/
|
|
5
|
+
*/
|
|
6
|
+
export declare const creationFunctionDatabase: Record<string, CreationFunctionInfo>;
|
|
7
|
+
//# sourceMappingURL=creation-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creation-functions.d.ts","sourceRoot":"","sources":["../../src/data/creation-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAgB,MAAM,aAAa,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAsIzE,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { DOC_BASE_URL } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* RxJS Creation Functions Database
|
|
4
|
+
* Based on https://shuji-bonji.github.io/RxJS-with-TypeScript/
|
|
5
|
+
*/
|
|
6
|
+
export const creationFunctionDatabase = {
|
|
7
|
+
// basic
|
|
8
|
+
'of': {
|
|
9
|
+
name: 'of',
|
|
10
|
+
category: 'basic',
|
|
11
|
+
description: 'Emits the arguments you provide, then completes',
|
|
12
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/basic/of`,
|
|
13
|
+
},
|
|
14
|
+
'from': {
|
|
15
|
+
name: 'from',
|
|
16
|
+
category: 'basic',
|
|
17
|
+
description: 'Creates an Observable from an Array, Promise, or Iterable',
|
|
18
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/basic/from`,
|
|
19
|
+
},
|
|
20
|
+
'fromEvent': {
|
|
21
|
+
name: 'fromEvent',
|
|
22
|
+
category: 'basic',
|
|
23
|
+
description: 'Creates an Observable from DOM events',
|
|
24
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/basic/fromEvent`,
|
|
25
|
+
},
|
|
26
|
+
'interval': {
|
|
27
|
+
name: 'interval',
|
|
28
|
+
category: 'basic',
|
|
29
|
+
description: 'Emits incremental numbers at specified intervals',
|
|
30
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/basic/interval`,
|
|
31
|
+
},
|
|
32
|
+
'timer': {
|
|
33
|
+
name: 'timer',
|
|
34
|
+
category: 'basic',
|
|
35
|
+
description: 'Emits after a delay, then optionally at intervals',
|
|
36
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/basic/timer`,
|
|
37
|
+
},
|
|
38
|
+
// loop
|
|
39
|
+
'range': {
|
|
40
|
+
name: 'range',
|
|
41
|
+
category: 'loop',
|
|
42
|
+
description: 'Emits a sequence of numbers within a range',
|
|
43
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/loop/range`,
|
|
44
|
+
},
|
|
45
|
+
'generate': {
|
|
46
|
+
name: 'generate',
|
|
47
|
+
category: 'loop',
|
|
48
|
+
description: 'Creates an Observable with custom iteration logic',
|
|
49
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/loop/generate`,
|
|
50
|
+
},
|
|
51
|
+
// http
|
|
52
|
+
'ajax': {
|
|
53
|
+
name: 'ajax',
|
|
54
|
+
category: 'http',
|
|
55
|
+
description: 'Creates an Observable for AJAX requests',
|
|
56
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/http/ajax`,
|
|
57
|
+
},
|
|
58
|
+
'fromFetch': {
|
|
59
|
+
name: 'fromFetch',
|
|
60
|
+
category: 'http',
|
|
61
|
+
description: 'Creates an Observable from Fetch API',
|
|
62
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/http/fromFetch`,
|
|
63
|
+
},
|
|
64
|
+
// combination
|
|
65
|
+
'concat': {
|
|
66
|
+
name: 'concat',
|
|
67
|
+
category: 'combination',
|
|
68
|
+
description: 'Concatenates Observables in sequence',
|
|
69
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/combination/concat`,
|
|
70
|
+
},
|
|
71
|
+
'merge': {
|
|
72
|
+
name: 'merge',
|
|
73
|
+
category: 'combination',
|
|
74
|
+
description: 'Combines multiple Observables, emitting all values',
|
|
75
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/combination/merge`,
|
|
76
|
+
},
|
|
77
|
+
'combineLatest': {
|
|
78
|
+
name: 'combineLatest',
|
|
79
|
+
category: 'combination',
|
|
80
|
+
description: 'Combines latest values from all Observables',
|
|
81
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/combination/combineLatest`,
|
|
82
|
+
},
|
|
83
|
+
'zip': {
|
|
84
|
+
name: 'zip',
|
|
85
|
+
category: 'combination',
|
|
86
|
+
description: 'Combines values by index into arrays',
|
|
87
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/combination/zip`,
|
|
88
|
+
},
|
|
89
|
+
'forkJoin': {
|
|
90
|
+
name: 'forkJoin',
|
|
91
|
+
category: 'combination',
|
|
92
|
+
description: 'Waits for all to complete, emits final values',
|
|
93
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/combination/forkJoin`,
|
|
94
|
+
},
|
|
95
|
+
// selection
|
|
96
|
+
'race': {
|
|
97
|
+
name: 'race',
|
|
98
|
+
category: 'selection',
|
|
99
|
+
description: 'Emits from the Observable that emits first',
|
|
100
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/selection/race`,
|
|
101
|
+
},
|
|
102
|
+
'partition': {
|
|
103
|
+
name: 'partition',
|
|
104
|
+
category: 'selection',
|
|
105
|
+
description: 'Splits Observable into two based on predicate',
|
|
106
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/selection/partition`,
|
|
107
|
+
},
|
|
108
|
+
// conditional
|
|
109
|
+
'iif': {
|
|
110
|
+
name: 'iif',
|
|
111
|
+
category: 'conditional',
|
|
112
|
+
description: 'Subscribes to one of two Observables based on condition',
|
|
113
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/conditional/iif`,
|
|
114
|
+
},
|
|
115
|
+
'defer': {
|
|
116
|
+
name: 'defer',
|
|
117
|
+
category: 'conditional',
|
|
118
|
+
description: 'Creates Observable lazily at subscription time',
|
|
119
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/conditional/defer`,
|
|
120
|
+
},
|
|
121
|
+
// control
|
|
122
|
+
'scheduled': {
|
|
123
|
+
name: 'scheduled',
|
|
124
|
+
category: 'control',
|
|
125
|
+
description: 'Creates an Observable with a specific scheduler',
|
|
126
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/control/scheduled`,
|
|
127
|
+
},
|
|
128
|
+
'using': {
|
|
129
|
+
name: 'using',
|
|
130
|
+
category: 'control',
|
|
131
|
+
description: 'Creates Observable with resource management',
|
|
132
|
+
docUrl: `${DOC_BASE_URL}/creation-functions/control/using`,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=creation-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creation-functions.js","sourceRoot":"","sources":["../../src/data/creation-functions.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OperatorInfo } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* RxJS Pipeable Operators Database
|
|
4
|
+
* Based on https://shuji-bonji.github.io/RxJS-with-TypeScript/
|
|
5
|
+
*/
|
|
6
|
+
export declare const operatorDatabase: Record<string, OperatorInfo>;
|
|
7
|
+
//# sourceMappingURL=operators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/data/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,aAAa,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAofzD,CAAC"}
|