mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-18 06:43:22 +00:00
Reorganize src/ directory into feature/domain-based structure
Restructure flat src/ directory (17 files) into organized folders:
Structure:
- src/core/ - Main API (rondevu.ts, offer-pool.ts, types.ts, index.ts)
- src/connections/ - WebRTC connections (base.ts, offerer.ts, answerer.ts, config.ts, events.ts)
- src/api/ - HTTP layer (client.ts, batcher.ts)
- src/crypto/ - Crypto adapters (adapter.ts, node.ts, web.ts)
- src/utils/ - Utilities (async-lock.ts, exponential-backoff.ts, message-buffer.ts)
Changes:
- Move all 17 files to appropriate feature folders
- Update all import paths to reflect new structure
- Update package.json main/types to point to dist/core/index.js
- Preserve git history with git mv
Benefits:
- Clear separation of concerns
- Easier navigation and maintenance
- Better scalability for future features
- Logical grouping of related files
🤖 Generated with Claude Code
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
"version": "0.20.0",
|
||||
"description": "TypeScript client for Rondevu with durable WebRTC connections, automatic reconnection, and message queuing",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"main": "dist/core/index.js",
|
||||
"types": "dist/core/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
* Rondevu API Client - RPC interface
|
||||
*/
|
||||
|
||||
import { CryptoAdapter, Keypair } from './crypto-adapter.js'
|
||||
import { WebCryptoAdapter } from './web-crypto-adapter.js'
|
||||
import { RpcBatcher, BatcherOptions } from './rpc-batcher.js'
|
||||
import { CryptoAdapter, Keypair } from '../crypto/adapter.js'
|
||||
import { WebCryptoAdapter } from '../crypto/web.js'
|
||||
import { RpcBatcher, BatcherOptions } from './batcher.js'
|
||||
|
||||
export type { Keypair } from './crypto-adapter.js'
|
||||
export type { BatcherOptions } from './rpc-batcher.js'
|
||||
export type { Keypair } from '../crypto/adapter.js'
|
||||
export type { BatcherOptions } from './batcher.js'
|
||||
|
||||
export interface OfferRequest {
|
||||
sdp: string
|
||||
@@ -2,10 +2,10 @@
|
||||
* Answerer-side WebRTC connection with answer creation and offer processing
|
||||
*/
|
||||
|
||||
import { RondevuConnection } from './connection.js'
|
||||
import { ConnectionState } from './connection-events.js'
|
||||
import { RondevuAPI } from './api.js'
|
||||
import { ConnectionConfig } from './connection-config.js'
|
||||
import { RondevuConnection } from './base.js'
|
||||
import { ConnectionState } from './events.js'
|
||||
import { RondevuAPI } from '../api/client.js'
|
||||
import { ConnectionConfig } from './config.js'
|
||||
|
||||
export interface AnswererOptions {
|
||||
api: RondevuAPI
|
||||
@@ -3,16 +3,16 @@
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'eventemitter3'
|
||||
import { ConnectionConfig, mergeConnectionConfig } from './connection-config.js'
|
||||
import { ConnectionConfig, mergeConnectionConfig } from './config.js'
|
||||
import {
|
||||
ConnectionState,
|
||||
ConnectionEventMap,
|
||||
ConnectionEventName,
|
||||
ConnectionEventArgs,
|
||||
BufferedMessage,
|
||||
} from './connection-events.js'
|
||||
import { ExponentialBackoff } from './exponential-backoff.js'
|
||||
import { MessageBuffer } from './message-buffer.js'
|
||||
} from './events.js'
|
||||
import { ExponentialBackoff } from '../utils/exponential-backoff.js'
|
||||
import { MessageBuffer } from '../utils/message-buffer.js'
|
||||
|
||||
/**
|
||||
* Abstract base class for WebRTC connections with durability features
|
||||
@@ -2,11 +2,11 @@
|
||||
* Offerer-side WebRTC connection with offer creation and answer processing
|
||||
*/
|
||||
|
||||
import { RondevuConnection } from './connection.js'
|
||||
import { ConnectionState } from './connection-events.js'
|
||||
import { RondevuAPI } from './api.js'
|
||||
import { ConnectionConfig } from './connection-config.js'
|
||||
import { AsyncLock } from './async-lock.js'
|
||||
import { RondevuConnection } from './base.js'
|
||||
import { ConnectionState } from './events.js'
|
||||
import { RondevuAPI } from '../api/client.js'
|
||||
import { ConnectionConfig } from './config.js'
|
||||
import { AsyncLock } from '../utils/async-lock.js'
|
||||
|
||||
export interface OffererOptions {
|
||||
api: RondevuAPI
|
||||
@@ -4,21 +4,21 @@
|
||||
*/
|
||||
|
||||
export { Rondevu, RondevuError, NetworkError, ValidationError, ConnectionError } from './rondevu.js'
|
||||
export { RondevuAPI } from './api.js'
|
||||
export { RpcBatcher } from './rpc-batcher.js'
|
||||
export { RondevuAPI } from '../api/client.js'
|
||||
export { RpcBatcher } from '../api/batcher.js'
|
||||
|
||||
// Export connection classes
|
||||
export { RondevuConnection } from './connection.js'
|
||||
export { OffererConnection } from './offerer-connection.js'
|
||||
export { AnswererConnection } from './answerer-connection.js'
|
||||
export { RondevuConnection } from '../connections/base.js'
|
||||
export { OffererConnection } from '../connections/offerer.js'
|
||||
export { AnswererConnection } from '../connections/answerer.js'
|
||||
|
||||
// Export utilities
|
||||
export { ExponentialBackoff } from './exponential-backoff.js'
|
||||
export { MessageBuffer } from './message-buffer.js'
|
||||
export { ExponentialBackoff } from '../utils/exponential-backoff.js'
|
||||
export { MessageBuffer } from '../utils/message-buffer.js'
|
||||
|
||||
// Export crypto adapters
|
||||
export { WebCryptoAdapter } from './web-crypto-adapter.js'
|
||||
export { NodeCryptoAdapter } from './node-crypto-adapter.js'
|
||||
export { WebCryptoAdapter } from '../crypto/web.js'
|
||||
export { NodeCryptoAdapter } from '../crypto/node.js'
|
||||
|
||||
// Export types
|
||||
export type {
|
||||
@@ -33,7 +33,7 @@ export type {
|
||||
Service,
|
||||
ServiceOffer,
|
||||
IceCandidate,
|
||||
} from './api.js'
|
||||
} from '../api/client.js'
|
||||
|
||||
export type {
|
||||
RondevuOptions,
|
||||
@@ -48,12 +48,12 @@ export type {
|
||||
PaginatedServiceResult
|
||||
} from './rondevu.js'
|
||||
|
||||
export type { CryptoAdapter } from './crypto-adapter.js'
|
||||
export type { CryptoAdapter } from '../crypto/adapter.js'
|
||||
|
||||
// Export connection types
|
||||
export type {
|
||||
ConnectionConfig,
|
||||
} from './connection-config.js'
|
||||
} from '../connections/config.js'
|
||||
|
||||
export type {
|
||||
ConnectionState,
|
||||
@@ -63,13 +63,13 @@ export type {
|
||||
ConnectionEventMap,
|
||||
ConnectionEventName,
|
||||
ConnectionEventArgs,
|
||||
} from './connection-events.js'
|
||||
} from '../connections/events.js'
|
||||
|
||||
export type {
|
||||
OffererOptions,
|
||||
} from './offerer-connection.js'
|
||||
} from '../connections/offerer.js'
|
||||
|
||||
export type {
|
||||
AnswererOptions,
|
||||
} from './answerer-connection.js'
|
||||
} from '../connections/answerer.js'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { EventEmitter } from 'eventemitter3'
|
||||
import { RondevuAPI } from './api.js'
|
||||
import { OffererConnection } from './offerer-connection.js'
|
||||
import { ConnectionConfig } from './connection-config.js'
|
||||
import { AsyncLock } from './async-lock.js'
|
||||
import { RondevuAPI } from '../api/client.js'
|
||||
import { OffererConnection } from '../connections/offerer.js'
|
||||
import { ConnectionConfig } from '../connections/config.js'
|
||||
import { AsyncLock } from '../utils/async-lock.js'
|
||||
|
||||
export type OfferFactory = (pc: RTCPeerConnection) => Promise<{
|
||||
dc?: RTCDataChannel
|
||||
@@ -1,9 +1,9 @@
|
||||
import { RondevuAPI, Keypair, IceCandidate, BatcherOptions } from './api.js'
|
||||
import { CryptoAdapter } from './crypto-adapter.js'
|
||||
import { RondevuAPI, Keypair, IceCandidate, BatcherOptions } from '../api/client.js'
|
||||
import { CryptoAdapter } from '../crypto/adapter.js'
|
||||
import { EventEmitter } from 'eventemitter3'
|
||||
import { OffererConnection } from './offerer-connection.js'
|
||||
import { AnswererConnection } from './answerer-connection.js'
|
||||
import { ConnectionConfig } from './connection-config.js'
|
||||
import { OffererConnection } from '../connections/offerer.js'
|
||||
import { AnswererConnection } from '../connections/answerer.js'
|
||||
import { ConnectionConfig } from '../connections/config.js'
|
||||
import { OfferPool } from './offer-pool.js'
|
||||
|
||||
// ICE server preset names
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import * as ed25519 from '@noble/ed25519'
|
||||
import { CryptoAdapter, Keypair } from './crypto-adapter.js'
|
||||
import { CryptoAdapter, Keypair } from './adapter.js'
|
||||
|
||||
/**
|
||||
* Node.js Crypto implementation using Node.js built-in APIs
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import * as ed25519 from '@noble/ed25519'
|
||||
import { CryptoAdapter, Keypair } from './crypto-adapter.js'
|
||||
import { CryptoAdapter, Keypair } from './adapter.js'
|
||||
|
||||
// Set SHA-512 hash function for ed25519 (required in @noble/ed25519 v3+)
|
||||
ed25519.hashes.sha512Async = async (message: Uint8Array) => {
|
||||
@@ -2,7 +2,7 @@
|
||||
* Message buffering system for storing messages during disconnections
|
||||
*/
|
||||
|
||||
import { BufferedMessage } from './connection-events.js'
|
||||
import { BufferedMessage } from '../connections/events.js'
|
||||
|
||||
export interface MessageBufferConfig {
|
||||
maxSize: number // Maximum number of messages to buffer
|
||||
Reference in New Issue
Block a user