Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@coast-team/mute-core

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coast-team/mute-core - npm Package Compare versions

Comparing version 10.0.0-1 to 10.0.0-2.0

14

CHANGELOG.md

@@ -5,2 +5,16 @@ # Change Log

<a name="10.0.0-2.0"></a>
# [10.0.0-2.0](https://github.com/coast-team/mute-core/compare/v10.0.0-1...v10.0.0-2.0) (2019-07-05)
### Bug Fixes
- **test:** fix LSSyncMessage test with the new streamid ([120d9ee](https://github.com/coast-team/mute-core/commit/120d9ee))
### Features
- **export:** export StreamID and StreamsSubtype ([7bdcbb4](https://github.com/coast-team/mute-core/commit/7bdcbb4))
- **streamid:** add subtype in streamid ([ea77f53](https://github.com/coast-team/mute-core/commit/ea77f53))
- **streams:** add CURSOR and CRYPTO in Streams and StreamsSubtype ([f4fa80c](https://github.com/coast-team/mute-core/commit/f4fa80c))
<a name="10.0.0-1"></a>

@@ -7,0 +21,0 @@

2

dist/types/src/index.common.d.ts

@@ -6,4 +6,4 @@ export { ICollaborator } from './collaborators';

export { TextInsert, TextDelete } from 'mute-structs';
export { Streams } from './Streams';
export { Streams, StreamId, StreamsSubtype } from './Streams';
export { Position, RichOperation, State } from './core';
export { StateTypes, StateStrategy, Strategy, RichOperationStrategy, RichOperationTypes, } from './crdtImpl';

@@ -0,3 +1,4 @@

import { StreamId } from '../Streams';
interface IMessage {
streamId: number;
streamId: StreamId;
content: Uint8Array;

@@ -4,0 +5,0 @@ }

import { Observable, Subject } from 'rxjs';
import { Streams } from '../Streams';
import { Streams, StreamsSubtype } from '../Streams';
import { Disposable } from './Disposable';

@@ -21,3 +21,3 @@ import { IMessageIn, IMessageOut } from './IMessage';

constructor(messageIn: Observable<IMessageIn>, messageOut: Subject<IMessageOut>, myStreamId: Streams, proto: IMessageFactory<OutMsg, InMsg>);
protected send(msg: OutMsg, recipientId?: number): void;
protected send(msg: OutMsg, subtype: StreamsSubtype, recipientId?: number): void;
}
export declare enum Streams {
COLLABORATORS = 400,
METADATA = 401,
DOCUMENT_CONTENT = 402
DOCUMENT_CONTENT = 402,
CURSOR = 403
}
export declare enum StreamsSubtype {
COLLABORATORS_JOIN = 100,
COLLABORATORS_LOCAL_UPDATE = 101,
DOCUMENT_OPERATION = 102,
DOCUMENT_QUERY = 103,
DOCUMENT_REPLY = 104,
METADATA_TITLE = 105,
METADATA_FIXDATA = 106,
METADATA_LOGS = 107,
CRYPTO = 108,
CURSOR = 109
}
export interface StreamId {
type: Streams;
subtype: StreamsSubtype;
}
{
"name": "@coast-team/mute-core",
"description": "Core component of MUTE collaborative editor",
"version": "10.0.0-1",
"version": "10.0.0-2.0",
"main": "./dist/mute-core.node.es5.cjs.js",

@@ -56,4 +56,4 @@ "module": "./dist/mutecore.node.es5.esm.js",

"dotted-logootsplit": "^0.1.0",
"mute-structs": "^1.0.0",
"rxjs": "^6.3.3",
"mute-structs": "^1.1.0",
"rxjs": "^6.5.2",
"safe-any": "^1.0.2"

@@ -84,3 +84,3 @@ },

"tslint-config-prettier": "^1.17.0",
"typescript": "^3.2.4"
"typescript": "^3.4.5"
},

@@ -87,0 +87,0 @@ "ava": {

@@ -5,3 +5,3 @@ import { Observable, Subject } from 'rxjs'

import { collaborator as proto } from '../proto'
import { Streams } from '../Streams'
import { Streams, StreamsSubtype } from '../Streams'
import { ICollaborator } from './ICollaborator'

@@ -69,3 +69,5 @@

set memberJoin$(source: Observable<number>) {
this.newSub = source.subscribe((id: number) => this.emitUpdate(id))
this.newSub = source.subscribe((id: number) =>
this.emitUpdate(StreamsSubtype.COLLABORATORS_JOIN, id)
)
}

@@ -86,3 +88,3 @@

Object.assign(this.me, data)
this.emitUpdate()
this.emitUpdate(StreamsSubtype.COLLABORATORS_LOCAL_UPDATE)
})

@@ -98,6 +100,6 @@ }

private emitUpdate(recipientId?: number) {
private emitUpdate(subtype: StreamsSubtype, recipientId?: number) {
const { id, ...rest } = this.me
super.send(rest, recipientId)
super.send(rest, subtype, recipientId)
}
}
import { Observable, Subject, zip } from 'rxjs'
import { IMessageIn, IMessageOut, Service } from '../misc'
import { sync as proto } from '../proto'
import { Streams } from '../Streams'
import { Streams, StreamsSubtype } from '../Streams'
import { Interval } from './Interval'

@@ -55,3 +55,6 @@ import { ReplySyncEvent } from './ReplySyncEvent'

this.newSub = source.subscribe((richOp) => {
super.send({ richOpMsg: this.serializeRichOperation(richOp) })
super.send(
{ richOpMsg: this.serializeRichOperation(richOp) },
StreamsSubtype.DOCUMENT_OPERATION
)
})

@@ -68,3 +71,3 @@ }

})
super.send({ querySync })
super.send({ querySync }, StreamsSubtype.DOCUMENT_QUERY)
})

@@ -85,3 +88,3 @@ }

)
super.send({ replySync }, id)
super.send({ replySync }, StreamsSubtype.DOCUMENT_REPLY, id)
})

@@ -88,0 +91,0 @@ }

@@ -5,3 +5,3 @@ import { Observable, Subject } from 'rxjs'

import { metadata as proto } from '../proto'
import { Streams } from '../Streams'
import { Streams, StreamsSubtype } from '../Streams'
import { FixData, FixDataState } from './FixData'

@@ -94,3 +94,6 @@ import { Logs, LogState } from './Logs'

this.title.handleLocalState({ title, titleModified })
super.send({ type: MetaDataType.Title, data: JSON.stringify(this.title.state) })
super.send(
{ type: MetaDataType.Title, data: JSON.stringify(this.title.state) },
StreamsSubtype.METADATA_TITLE
)
break

@@ -107,10 +110,13 @@ case MetaDataType.FixData:

const state = this.logs.state
super.send({
type: MetaDataType.Logs,
data: JSON.stringify({
id: this.logs.id,
share: state.share,
vector: Array.from(state.vector || new Map<number, number>()),
}),
})
super.send(
{
type: MetaDataType.Logs,
data: JSON.stringify({
id: this.logs.id,
share: state.share,
vector: Array.from(state.vector || new Map<number, number>()),
}),
},
StreamsSubtype.METADATA_LOGS
)
break

@@ -125,4 +131,12 @@ default:

this.newSub = source.subscribe((id) => {
super.send({ type: MetaDataType.FixData, data: JSON.stringify(this.fixData.state) }, id)
super.send({ type: MetaDataType.Title, data: JSON.stringify(this.title.state) }, id)
super.send(
{ type: MetaDataType.FixData, data: JSON.stringify(this.fixData.state) },
StreamsSubtype.METADATA_FIXDATA,
id
)
super.send(
{ type: MetaDataType.Title, data: JSON.stringify(this.title.state) },
StreamsSubtype.METADATA_TITLE,
id
)
const state = this.logs.stateWithVectorAsArray

@@ -134,2 +148,3 @@ super.send(

},
StreamsSubtype.METADATA_LOGS,
id

@@ -136,0 +151,0 @@ )

@@ -6,3 +6,3 @@ export { ICollaborator } from './collaborators'

export { TextInsert, TextDelete } from 'mute-structs'
export { Streams } from './Streams'
export { Streams, StreamId, StreamsSubtype } from './Streams'
export { Position, RichOperation, State } from './core'

@@ -9,0 +9,0 @@ export {

@@ -0,3 +1,5 @@

import { StreamId } from '../Streams'
interface IMessage {
streamId: number
streamId: StreamId
content: Uint8Array

@@ -4,0 +6,0 @@ }

import { Observable, Subject } from 'rxjs'
import { filter, map } from 'rxjs/operators'
import { Streams } from '../Streams'
import { Streams, StreamsSubtype } from '../Streams'
import { Disposable } from './Disposable'

@@ -33,3 +33,3 @@ import { IMessageIn, IMessageOut } from './IMessage'

this.messageIn$ = messageIn.pipe(
filter(({ streamId }) => streamId === myStreamId),
filter(({ streamId }) => streamId.type === myStreamId),
map(({ senderId, content }) => ({ senderId, msg: proto.decode(content) }))

@@ -41,5 +41,5 @@ )

protected send(msg: OutMsg, recipientId?: number) {
protected send(msg: OutMsg, subtype: StreamsSubtype, recipientId?: number) {
this.messageOut$.next({
streamId: this.streamId,
streamId: { type: this.streamId, subtype },
recipientId,

@@ -46,0 +46,0 @@ content: this.proto.encode(this.proto.create(msg)).finish(),

@@ -5,2 +5,21 @@ export enum Streams {

DOCUMENT_CONTENT,
CURSOR,
}
export enum StreamsSubtype {
COLLABORATORS_JOIN = 100,
COLLABORATORS_LOCAL_UPDATE,
DOCUMENT_OPERATION,
DOCUMENT_QUERY,
DOCUMENT_REPLY,
METADATA_TITLE,
METADATA_FIXDATA,
METADATA_LOGS,
CRYPTO,
CURSOR,
}
export interface StreamId {
type: Streams
subtype: StreamsSubtype
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc