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

yjs

Package Overview
Dependencies
Maintainers
1
Versions
286
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yjs - npm Package Compare versions

Comparing version 12.1.0 to 12.1.1

testing/000011.ldb

2

dist/bower.json
{
"name": "yjs",
"version": "12.1.0",
"version": "12.1.1",
"homepage": "y-js.org",

@@ -5,0 +5,0 @@ "authors": [

@@ -201,10 +201,16 @@

* Try to reconnect to the other instances (needs to be supported by the connector)
* Not supported by y-xmpp
* y.destroy()
* Not supported by y-xmpp
* y.close()
* Destroy this object.
* Destroys all types (they will throw weird errors if you still use them)
* Disconnects from the other instances (via connector)
* Returns a promise
* y.destroy()
* calls y.close()
* Removes all data from the database
* Returns a promise
* y.db.stopGarbageCollector()
* Stop the garbage collector. Call y.db.garbageCollect() to continue garbage collection
* y.db.gc :: Boolean
* Whether gc is turned on
* y.db.gcTimeout :: Number (defaults to 50000 ms)

@@ -211,0 +217,0 @@ * Time interval between two garbage collect cycles

{
"name": "yjs",
"version": "12.1.0",
"version": "12.1.1",
"description": "A framework for real-time p2p shared editing on any data",

@@ -5,0 +5,0 @@ "main": "./src/y.js",

@@ -201,10 +201,16 @@

* Try to reconnect to the other instances (needs to be supported by the connector)
* Not supported by y-xmpp
* y.destroy()
* Not supported by y-xmpp
* y.close()
* Destroy this object.
* Destroys all types (they will throw weird errors if you still use them)
* Disconnects from the other instances (via connector)
* Returns a promise
* y.destroy()
* calls y.close()
* Removes all data from the database
* Returns a promise
* y.db.stopGarbageCollector()
* Stop the garbage collector. Call y.db.garbageCollect() to continue garbage collection
* y.db.gc :: Boolean
* Whether gc is turned on
* y.db.gcTimeout :: Number (defaults to 50000 ms)

@@ -211,0 +217,0 @@ * Time interval between two garbage collect cycles

@@ -147,9 +147,4 @@ /* @flow */

}
/*
returns false, if there is no sync target
true otherwise
*/
findNextSyncTarget () {
if (this.currentSyncTarget != null || this.isSynced) {
if (this.currentSyncTarget != null) {
return // "The current sync has not finished!"

@@ -180,12 +175,16 @@ }

} else {
this.y.db.requestTransaction(function *() {
// it is crucial that isSynced is set at the time garbageCollectAfterSync is called
conn.isSynced = true
yield* this.garbageCollectAfterSync()
// call whensynced listeners
for (var f of conn.whenSyncedListeners) {
f()
}
conn.whenSyncedListeners = []
})
if (!conn.isSynced) {
this.y.db.requestTransaction(function *() {
if (!conn.isSynced) {
// it is crucial that isSynced is set at the time garbageCollectAfterSync is called
conn.isSynced = true
yield* this.garbageCollectAfterSync()
// call whensynced listeners
for (var f of conn.whenSyncedListeners) {
f()
}
conn.whenSyncedListeners = []
}
})
}
}

@@ -192,0 +191,0 @@ }

@@ -78,8 +78,14 @@ /* @flow */

this.gc2 = [] // second stage -> after that, remove the op
this.gcTimeout = !opts.gcTimeout ? 50000 : opts.gcTimeouts
this.gc = opts.gc == null || opts.gc
if (this.gc) {
this.gcTimeout = !opts.gcTimeout ? 50000 : opts.gcTimeout
} else {
this.gcTimeout = -1
}
function garbageCollect () {
return os.whenTransactionsFinished().then(function () {
if (os.gc1.length > 0 || os.gc2.length > 0) {
if (!os.y.isConnected()) {
console.warn('gc should be empty when disconnected!')
if (!os.y.connector.isSynced) {
console.warn('gc should be empty when not synced!')
}

@@ -153,3 +159,3 @@ return new Promise((resolve) => {

queueGarbageCollector (id) {
if (this.y.isConnected()) {
if (this.y.connector.isSynced && this.gc) {
this.gc1.push(id)

@@ -209,3 +215,3 @@ }

Rulez:
* Only gc if this user is online
* Only gc if this user is online & gc turned on
* The most left element in a list must not be gc'd.

@@ -219,3 +225,5 @@ => There is at least one element in the list

op.gc == null &&
op.deleted === true
op.deleted === true &&
this.store.gc &&
this.store.y.connector.isSynced
) {

@@ -246,6 +254,3 @@ var gc = false

}
* destroy () {
clearInterval(this.gcInterval)
this.gcInterval = null
this.stopRepairCheck()
destroyTypes () {
for (var key in this.initializedTypes) {

@@ -260,2 +265,7 @@ var type = this.initializedTypes[key]

}
* destroy () {
clearInterval(this.gcInterval)
this.gcInterval = null
this.stopRepairCheck()
}
setUserId (userId) {

@@ -443,4 +453,3 @@ if (!this.userIdPromise.inProgress) {

if (op.struct === 'Delete') {
var target = yield* transaction.getInsertion(op.target)
var type = this.initializedTypes[JSON.stringify(target.parent)]
var type = this.initializedTypes[JSON.stringify(op.targetParent)]
if (type != null) {

@@ -513,6 +522,4 @@ yield* type._changed(transaction, op)

}
return promise
} else {
return this.transactionsFinished.promise
}
return this.transactionsFinished.promise
} else {

@@ -519,0 +526,0 @@ return Promise.resolve()

@@ -33,3 +33,7 @@ /* @flow */

encode: function (op) {
return op
return {
target: op.target,
length: op.length || 0,
struct: 'Delete'
}
},

@@ -36,0 +40,0 @@ requiredOps: function (op) {

@@ -99,3 +99,3 @@ /* @flow */

}
if (!this.store.y.connector.isDisconnected() && send.length > 0) { // TODO: && !this.store.forwardAppliedOperations (but then i don't send delete ops)
if (this.store.y.connector.isSynced && send.length > 0) { // TODO: && !this.store.forwardAppliedOperations (but then i don't send delete ops)
// is connected, and this is not going to be send in addOperation

@@ -210,3 +210,4 @@ this.store.y.connector.broadcastOps(send)

target: target.id,
length: targetLength
length: targetLength,
targetParent: target.parent
})

@@ -718,3 +719,3 @@ }

yield* this.os.put(op)
if (!this.store.y.connector.isDisconnected() && this.store.forwardAppliedOperations && typeof op.id[1] !== 'string') {
if (this.store.y.connector.isSynced && this.store.forwardAppliedOperations && typeof op.id[1] !== 'string') {
// is connected, and this is not going to be send in addOperation

@@ -721,0 +722,0 @@ this.store.y.connector.broadcastOps([op])

@@ -41,3 +41,8 @@ /* @flow */

function requestModules (modules) {
var sourceDir = Y.sourceDir || '/bower_components'
var sourceDir
if (Y.sourceDir === null) {
sourceDir = null
} else {
sourceDir = Y.sourceDir || '/bower_components'
}
// determine if this module was compiled for es5 or es6 (y.js vs. y.es6)

@@ -55,6 +60,7 @@ // if Insert.execute is a Function, then it isnt a generator..

if (typeof window !== 'undefined' && window.Y !== 'undefined') {
var imported = document.createElement('script')
imported.src = sourceDir + '/' + modulename + '/' + modulename + extention
document.head.appendChild(imported)
if (sourceDir != null) {
var imported = document.createElement('script')
imported.src = sourceDir + '/' + modulename + '/' + modulename + extention
document.head.appendChild(imported)
}
let requireModule = {}

@@ -108,3 +114,3 @@ requiringModules[module] = requireModule

function Y (opts/* :YOptions */) /* :Promise<YConfig> */ {
if (opts.sourceDir != null) {
if (opts.hasOwnProperty('sourceDir')) {
Y.sourceDir = opts.sourceDir

@@ -196,2 +202,14 @@ }

destroy () {
var self = this
return this.close().then(function () {
if (self.db.deleteDB != null) {
return self.db.deleteDB()
} else {
return Promise.resolve()
}
})
}
close () {
var self = this
this.share = null
if (this.connector.destroy != null) {

@@ -202,7 +220,9 @@ this.connector.destroy()

}
var self = this
this.db.requestTransaction(function * () {
yield* self.db.destroy()
self.connector = null
self.db = null
return this.db.whenTransactionsFinished(function () {
this.db.destroyTypes()
// make sure to wait for all transactions before destroying the db
this.db.requestTransaction(function * () {
yield* self.db.destroy()
})
return this.db.whenTransactionsFinished()
})

@@ -209,0 +229,0 @@ }

Sorry, the diff of this file is not supported yet

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