Comparing version 9.0.4 to 10.0.0
{ | ||
"name": "yjs", | ||
"version": "9.0.4", | ||
"version": "10.0.0", | ||
"homepage": "y-js.org", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -11,4 +11,3 @@ /* global Y, Quill */ | ||
name: 'websockets-client', | ||
room: 'richtext-example', | ||
debug: true | ||
room: 'richtext-example' | ||
// url: 'http://127.0.0.1:1234' | ||
@@ -15,0 +14,0 @@ }, |
@@ -180,5 +180,13 @@ | ||
### 10.0.0 | ||
* Support for more complex types (a type can be a composition of several types) | ||
* Fixes several memory leaks | ||
### 9.0.0 | ||
There were several rolling updates from 0.6 to 0.8. We'll now follow the semver versioning scheme. This is all what this jump from 0.8 to 9.0 is about. | ||
There were several rolling updates from 0.6 to 0.8. We consider Yjs stable since a long time, | ||
and intend to continue stable releases. From this release forward y-* modules will implement peer-dependencies for npm, and dependencies for bower. | ||
Furthermore, incompatible yjs instances will now throw errors when syncing - this feature was influenced by #48. The versioning jump was influenced by react (see [here](https://facebook.github.io/react/blog/2016/02/19/new-versioning-scheme.html)) | ||
### 0.6.0 | ||
@@ -185,0 +193,0 @@ This is a complete rewrite of the 0.5 version of Yjs. Since Yjs 0.6.0 it is possible to work asynchronously on a persistent database, which enables offline support. |
@@ -96,5 +96,6 @@ | ||
return browserify({ | ||
entries: files.specs, | ||
entries: files.specs, // .concat(files.distEs5), | ||
debug: true | ||
}).bundle() | ||
})// .transform('babelify', { presets: ['es2015'] }) | ||
.bundle() | ||
.pipe(source('specs.js')) | ||
@@ -101,0 +102,0 @@ .pipe(buffer()) |
{ | ||
"name": "yjs", | ||
"version": "9.0.4", | ||
"version": "10.0.0", | ||
"description": "A framework for real-time p2p shared editing on arbitrary complex data types", | ||
@@ -5,0 +5,0 @@ "main": "./src/y.js", |
@@ -180,5 +180,13 @@ | ||
### 10.0.0 | ||
* Support for more complex types (a type can be a composition of several types) | ||
* Fixes several memory leaks | ||
### 9.0.0 | ||
There were several rolling updates from 0.6 to 0.8. We'll now follow the semver versioning scheme. This is all what this jump from 0.8 to 9.0 is about. | ||
There were several rolling updates from 0.6 to 0.8. We consider Yjs stable since a long time, | ||
and intend to continue stable releases. From this release forward y-* modules will implement peer-dependencies for npm, and dependencies for bower. | ||
Furthermore, incompatible yjs instances will now throw errors when syncing - this feature was influenced by #48. The versioning jump was influenced by react (see [here](https://facebook.github.io/react/blog/2016/02/19/new-versioning-scheme.html)) | ||
### 0.6.0 | ||
@@ -185,0 +193,0 @@ This is a complete rewrite of the 0.5 version of Yjs. Since Yjs 0.6.0 it is possible to work asynchronously on a persistent database, which enables offline support. |
@@ -22,2 +22,4 @@ /* @flow */ | ||
broadcast: Function; | ||
broadcastOpBuffer: Array<Operation>; | ||
protocolVersion: number; | ||
*/ | ||
@@ -55,3 +57,3 @@ /* | ||
this.broadcastOpBuffer = [] | ||
this.protocolVersion = 8 | ||
this.protocolVersion = 10 | ||
} | ||
@@ -155,3 +157,4 @@ reconnect () { | ||
stateSet: stateSet, | ||
deleteSet: deleteSet | ||
deleteSet: deleteSet, | ||
protocolVersion: conn.protocolVersion | ||
}) | ||
@@ -240,3 +243,4 @@ }) | ||
stateSet: currentStateSet, | ||
deleteSet: ds | ||
deleteSet: ds, | ||
protocolVersion: this.protocolVersion | ||
}) | ||
@@ -243,0 +247,0 @@ if (this.forwardToSyncingClients) { |
@@ -113,2 +113,14 @@ /* @flow */ | ||
} | ||
emptyGarbageCollector () { | ||
return new Promise(resolve => { | ||
var check = () => { | ||
if (this.gc1.length > 0 || this.gc2.length > 0) { | ||
this.garbageCollect().then(check) | ||
} else { | ||
resolve() | ||
} | ||
} | ||
setTimeout(check, 0) | ||
}) | ||
} | ||
addToDebug () { | ||
@@ -209,5 +221,3 @@ if (typeof YConcurrency_TestingMode !== 'undefined') { | ||
getNextOpId () { | ||
if (this._nextUserId != null) { | ||
return this._nextUserId | ||
} else if (this.userId == null) { | ||
if (this.userId == null) { | ||
throw new Error('OperationStore not yet initialized!') | ||
@@ -231,2 +241,5 @@ } else { | ||
var required = Y.Struct[o.struct].requiredOps(o) | ||
if (o.requires != null) { | ||
required = required.concat(o.requires) | ||
} | ||
this.whenOperationsExist(required, o) | ||
@@ -344,11 +357,3 @@ } | ||
// increase SS | ||
var o = op | ||
var state = yield* transaction.getState(op.id[0]) | ||
while (o != null && o.id[1] === state.clock && op.id[0] === o.id[0]) { | ||
// either its a new operation (1. case), or it is an operation that was deleted, but is not yet in the OS | ||
state.clock++ | ||
yield* transaction.checkDeleteStoreForState(state) | ||
o = yield* transaction.os.findNext(o.id) | ||
} | ||
yield* transaction.setState(state) | ||
yield* transaction.updateState(op.id[0]) | ||
@@ -370,2 +375,11 @@ // notify whenOperation listeners (by id) | ||
// if parent is deleted, mark as gc'd and return | ||
if (op.parent != null) { | ||
var parentIsDeleted = yield* transaction.isDeleted(op.parent) | ||
if (parentIsDeleted) { | ||
yield* transaction.deleteList(op.id) | ||
return | ||
} | ||
} | ||
// Delete if DS says this is actually deleted | ||
@@ -383,3 +397,8 @@ var opIsDeleted = yield* transaction.isDeleted(op.id) | ||
if (t != null) { | ||
yield* t._changed(transaction, Y.utils.copyObject(op)) | ||
let o = Y.utils.copyObject(op) | ||
if (opIsDeleted && !o.deleted) { | ||
// op did not reflect the created delete op (happens when not using y-memory) | ||
o.deleted = true | ||
} | ||
yield* t._changed(transaction, o) | ||
} | ||
@@ -386,0 +405,0 @@ } |
@@ -28,3 +28,3 @@ /* eslint-env browser, jasmine */ | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000 | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000 | ||
@@ -143,5 +143,5 @@ g.describeManyTimes = function describeManyTimes (times, name, f) { | ||
// gc two times because of the two gc phases (really collect everything) | ||
yield wait(100) | ||
for (var i in users) { | ||
yield users[i].db.garbageCollect() | ||
yield users[i].db.garbageCollect() | ||
yield users[i].db.emptyGarbageCollector() | ||
} | ||
@@ -187,2 +187,6 @@ }) | ||
u.db.requestTransaction(function * () { | ||
var sv = yield* this.getStateVector() | ||
for (var s of sv) { | ||
yield* this.updateState(s.user) | ||
} | ||
// compare deleted ops against deleteStore | ||
@@ -227,6 +231,3 @@ yield* this.os.iterate(this, null, null, function * (o) { | ||
yield* t2.call(this) | ||
expect(s1).toEqual(s2) | ||
expect(allDels1).toEqual(allDels2) // inner structure | ||
expect(ds1).toEqual(ds2) // exported structure | ||
var count = 0 | ||
var db2 = [] | ||
yield* this.os.iterate(this, null, null, function * (o) { | ||
@@ -236,4 +237,10 @@ o = Y.utils.copyObject(o) | ||
delete o.originOf | ||
expect(db1[count++]).toEqual(o) | ||
db2.push(o) | ||
}) | ||
expect(s1).toEqual(s2) | ||
expect(allDels1).toEqual(allDels2) // inner structure | ||
expect(ds1).toEqual(ds2) // exported structure | ||
db2.forEach((o, i) => { | ||
expect(db1[i]).toEqual(o) | ||
}) | ||
}) | ||
@@ -245,3 +252,3 @@ } | ||
g.createUsers = async(function * createUsers (self, numberOfUsers, database) { | ||
g.createUsers = async(function * createUsers (self, numberOfUsers, database, initType) { | ||
if (Y.utils.globalRoom.users[0] != null) { | ||
@@ -255,2 +262,3 @@ yield Y.utils.globalRoom.flushAll() | ||
self.users = null | ||
yield wait() | ||
@@ -271,3 +279,3 @@ var promises = [] | ||
share: { | ||
root: 'Map' | ||
root: initType || 'Map' | ||
} | ||
@@ -274,0 +282,0 @@ })) |
@@ -67,3 +67,3 @@ /* @flow */ | ||
} | ||
if (op.opContent != null) { | ||
if (op.hasOwnProperty('opContent')) { | ||
e.opContent = op.opContent | ||
@@ -263,3 +263,3 @@ } else { | ||
encode: function (op) { | ||
return { | ||
var e = { | ||
struct: 'List', | ||
@@ -269,2 +269,9 @@ id: op.id, | ||
} | ||
if (op.requires != null) { | ||
e.requires = op.requires | ||
} | ||
if (op.info != null) { | ||
e.info = op.info | ||
} | ||
return e | ||
}, | ||
@@ -338,3 +345,3 @@ requiredOps: function () { | ||
encode: function (op) { | ||
return { | ||
var e = { | ||
struct: 'Map', | ||
@@ -345,2 +352,9 @@ type: op.type, | ||
} | ||
if (op.requires != null) { | ||
e.requires = op.requires | ||
} | ||
if (op.info != null) { | ||
e.info = op.info | ||
} | ||
return e | ||
}, | ||
@@ -347,0 +361,0 @@ requiredOps: function () { |
@@ -90,3 +90,3 @@ /* @flow */ | ||
*/ | ||
* getType (id) { | ||
* getType (id, args) { | ||
var sid = JSON.stringify(id) | ||
@@ -97,3 +97,3 @@ var t = this.store.initializedTypes[sid] | ||
if (op != null) { | ||
t = yield* Y[op.type].initType.call(this, this.store, op) | ||
t = yield* Y[op.type].typeDefinition.initType.call(this, this.store, op, args) | ||
this.store.initializedTypes[sid] = t | ||
@@ -104,10 +104,36 @@ } | ||
} | ||
* createType (typedefinition) { | ||
var structname = typedefinition.struct | ||
var id = this.store.getNextOpId() | ||
* createType (typedefinition, id) { | ||
var structname = typedefinition[0].struct | ||
id = id || this.store.getNextOpId() | ||
var op | ||
if (id[0] === '_') { | ||
op = yield* this.getOperation(id) | ||
} else { | ||
op = Y.Struct[structname].create(id) | ||
op.type = typedefinition[0].name | ||
} | ||
if (typedefinition[0].appendAdditionalInfo != null) { | ||
yield* typedefinition[0].appendAdditionalInfo.call(this, op, typedefinition[1]) | ||
} | ||
if (op[0] === '_') { | ||
yield* this.setOperation(op) | ||
} else { | ||
yield* this.applyCreatedOperations([op]) | ||
} | ||
return yield* this.getType(id, typedefinition[1]) | ||
} | ||
/* createType (typedefinition, id) { | ||
var structname = typedefinition[0].struct | ||
id = id || this.store.getNextOpId() | ||
var op = Y.Struct[structname].create(id) | ||
op.type = typedefinition.name | ||
yield* this.applyCreatedOperations([op]) | ||
return yield* this.getType(id) | ||
} | ||
op.type = typedefinition[0].name | ||
if (typedefinition[0].appendAdditionalInfo != null) { | ||
yield* typedefinition[0].appendAdditionalInfo.call(this, op, typedefinition[1]) | ||
} | ||
// yield* this.applyCreatedOperations([op]) | ||
yield* Y.Struct[op.struct].execute.call(this, op) | ||
yield* this.addOperation(op) | ||
yield* this.store.operationAdded(this, op) | ||
return yield* this.getType(id, typedefinition[1]) | ||
}*/ | ||
/* | ||
@@ -123,3 +149,3 @@ Apply operations that this user created (no remote ones!) | ||
yield* this.store.tryExecute.call(this, op) | ||
if (op.id == null || op.id[0] !== '_') { | ||
if (op.id == null || typeof op.id[1] !== 'string') { | ||
send.push(Y.Struct[op.struct].encode(op)) | ||
@@ -135,13 +161,17 @@ } | ||
* deleteList (start) { | ||
if (this.store.y.connector.isSynced) { | ||
while (start != null && this.store.y.connector.isSynced) { | ||
start = yield* this.getOperation(start) | ||
while (start != null) { | ||
start = yield* this.getOperation(start) | ||
if (!start.gc) { | ||
start.gc = true | ||
start.deleted = true | ||
yield* this.setOperation(start) | ||
// TODO: will always reset the parent.. | ||
this.store.gc1.push(start.id) | ||
start = start.right | ||
yield* this.markDeleted(start.id, 1) | ||
if (start.opContent != null) { | ||
yield* this.deleteOperation(start.opContent) | ||
} | ||
if (this.store.y.connector.isSynced) { | ||
this.store.gc1.push(start.id) | ||
} | ||
} | ||
} else { | ||
// TODO: when not possible??? do later in (gcWhenSynced) | ||
start = start.right | ||
} | ||
@@ -161,3 +191,3 @@ } | ||
if (target != null && target.gc == null) { | ||
if (target != null) { | ||
if (!target.deleted) { | ||
@@ -182,3 +212,3 @@ callType = true | ||
yield* this.deleteList(target.start) | ||
yield* this.deleteList(target.id) | ||
// yield* this.deleteList(target.id) -- do not gc itself because this may still get referenced | ||
} | ||
@@ -190,8 +220,13 @@ if (target.map != null) { | ||
// TODO: here to.. (see above) | ||
yield* this.deleteList(target.id) | ||
// yield* this.deleteList(target.id) -- see above | ||
} | ||
if (target.opContent != null) { | ||
yield* this.deleteOperation(target.opContent) | ||
target.opContent = null | ||
// target.opContent = null | ||
} | ||
if (target.requires != null) { | ||
for (var i = 0; i < target.requires.length; i++) { | ||
yield* this.deleteOperation(target.requires[i]) | ||
} | ||
} | ||
} | ||
@@ -362,5 +397,36 @@ var left | ||
yield* this.os.iterate(this, null, null, function * (op) { | ||
if (op.deleted && op.left != null) { | ||
var left = yield* this.getOperation(op.left) | ||
this.store.addToGarbageCollector(op, left) | ||
if (op.gc) { | ||
this.store.gc1.push(op.id) | ||
} else { | ||
if (op.parent != null) { | ||
var parentDeleted = yield* this.isDeleted(op.parent) | ||
if (parentDeleted) { | ||
op.gc = true | ||
if (!op.deleted) { | ||
yield* this.markDeleted(op.id, 1) | ||
op.deleted = true | ||
if (op.opContent != null) { | ||
yield* this.deleteOperation(op.opContent) | ||
/* | ||
var opContent = yield* this.getOperation(op.opContent) | ||
opContent.gc = true | ||
yield* this.setOperation(opContent) | ||
this.store.gc1.push(opContent.id) | ||
*/ | ||
} | ||
if (op.requires != null) { | ||
for (var i = 0; i < op.requires.length; i++) { | ||
yield* this.deleteOperation(op.requires[i]) | ||
} | ||
} | ||
} | ||
yield* this.setOperation(op) | ||
this.store.gc1.push(op.id) | ||
return | ||
} | ||
} | ||
if (op.deleted && op.left != null) { | ||
var left = yield* this.getOperation(op.left) | ||
this.store.addToGarbageCollector(op, left) | ||
} | ||
} | ||
@@ -391,2 +457,25 @@ }) | ||
var deps = [] | ||
if (o.opContent != null) { | ||
deps.push(o.opContent) | ||
} | ||
if (o.requires != null) { | ||
deps = deps.concat(o.requires) | ||
} | ||
for (var i = 0; i < deps.length; i++) { | ||
var dep = yield* this.getOperation(deps[i]) | ||
if (dep != null) { | ||
if (!dep.deleted) { | ||
yield* this.deleteOperation(dep.id) | ||
dep = yield* this.getOperation(dep.id) | ||
} | ||
dep.gc = true | ||
yield* this.setOperation(dep) | ||
this.store.gc1.push(dep.id) | ||
} else { | ||
yield* this.markGarbageCollected(deps[i], 1) | ||
yield* this.updateState(deps[i][0]) // TODO: unneccessary? | ||
} | ||
} | ||
// remove gc'd op from the left op, if it exists | ||
@@ -474,16 +563,18 @@ if (o.left != null) { | ||
} | ||
// o may originate in another operation. | ||
// Since o is deleted, we have to reset o.origin's `originOf` property | ||
if (o.origin != null) { | ||
var origin = yield* this.getOperation(o.origin) | ||
origin.originOf = origin.originOf.filter(function (_id) { | ||
return !Y.utils.compareIds(id, _id) | ||
}) | ||
yield* this.setOperation(origin) | ||
} | ||
} | ||
// o may originate in another operation. | ||
// Since o is deleted, we have to reset o.origin's `originOf` property | ||
if (o.origin != null) { | ||
var origin = yield* this.getOperation(o.origin) | ||
origin.originOf = origin.originOf.filter(function (_id) { | ||
return !Y.utils.compareIds(id, _id) | ||
}) | ||
yield* this.setOperation(origin) | ||
} | ||
var parent | ||
if (o.parent != null) { | ||
// remove gc'd op from parent, if it exists | ||
var parent /* MapOperation */ = yield* this.getOperation(o.parent) | ||
parent = yield* this.getOperation(o.parent) | ||
} | ||
// remove gc'd op from parent, if it exists | ||
if (parent != null) { | ||
var setParent = false // whether to save parent to the os | ||
@@ -521,2 +612,14 @@ if (o.parentSub != null) { | ||
} | ||
* updateState (user) { | ||
var state = yield* this.getState(user) | ||
yield* this.checkDeleteStoreForState(state) | ||
var o = yield* this.getOperation([user, state.clock]) | ||
while (o != null && o.id[1] === state.clock && user === o.id[0]) { | ||
// either its a new operation (1. case), or it is an operation that was deleted, but is not yet in the OS | ||
state.clock++ | ||
yield* this.checkDeleteStoreForState(state) | ||
o = yield* this.os.findNext(o.id) | ||
} | ||
yield* this.setState(state) | ||
} | ||
/* | ||
@@ -658,3 +761,3 @@ apply a delete set in order to get | ||
yield* this.os.put(op) | ||
if (!this.store.y.connector.isDisconnected() && this.store.forwardAppliedOperations && op.id[0] !== '_') { | ||
if (!this.store.y.connector.isDisconnected() && this.store.forwardAppliedOperations && typeof op.id[1] !== 'string') { | ||
// is connected, and this is not going to be send in addOperation | ||
@@ -669,14 +772,17 @@ this.store.y.connector.broadcastOps([op]) | ||
} else { | ||
// need to generate this operation | ||
if (this.store._nextUserId == null) { | ||
var struct = id[1].split('_')[0] | ||
// this.store._nextUserId = id | ||
// generate this operation? | ||
var comp = id[1].split('_') | ||
if (comp.length > 1) { | ||
var struct = comp[0] | ||
var op = Y.Struct[struct].create(id) | ||
op.type = comp[1] | ||
yield* this.setOperation(op) | ||
// delete this.store._nextUserId | ||
return op | ||
} else { | ||
// Can only generate one operation at a time | ||
// won't be called. but just in case.. | ||
console.error('Unexpected case. How can this happen?') | ||
debugger // eslint-disable-line | ||
return null | ||
} | ||
return null | ||
} | ||
@@ -683,0 +789,0 @@ } |
@@ -29,3 +29,36 @@ /* @flow */ | ||
class EventHandler { | ||
class EventListenerHandler { | ||
constructor () { | ||
this.eventListeners = [] | ||
} | ||
destroy () { | ||
this.eventListeners = null | ||
} | ||
/* | ||
Basic event listener boilerplate... | ||
*/ | ||
addEventListener (f) { | ||
this.eventListeners.push(f) | ||
} | ||
removeEventListener (f) { | ||
this.eventListeners = this.eventListeners.filter(function (g) { | ||
return f !== g | ||
}) | ||
} | ||
removeAllEventListeners () { | ||
this.eventListeners = [] | ||
} | ||
callEventListeners (event) { | ||
for (var i = 0; i < this.eventListeners.length; i++) { | ||
try { | ||
this.eventListeners[i](event) | ||
} catch (e) { | ||
console.error('User events must not throw Errors!') | ||
} | ||
} | ||
} | ||
} | ||
Y.utils.EventListenerHandler = EventListenerHandler | ||
class EventHandler extends EventListenerHandler { | ||
/* :: | ||
@@ -45,12 +78,12 @@ waiting: Array<Insertion | Deletion>; | ||
constructor (onevent /* : Function */) { | ||
super() | ||
this.waiting = [] | ||
this.awaiting = 0 | ||
this.onevent = onevent | ||
this.eventListeners = [] | ||
} | ||
destroy () { | ||
super.destroy() | ||
this.waiting = null | ||
this.awaiting = null | ||
this.onevent = null | ||
this.eventListeners = null | ||
} | ||
@@ -78,26 +111,2 @@ /* | ||
/* | ||
Basic event listener boilerplate... | ||
TODO: maybe put this in a different type.. | ||
*/ | ||
addEventListener (f) { | ||
this.eventListeners.push(f) | ||
} | ||
removeEventListener (f) { | ||
this.eventListeners = this.eventListeners.filter(function (g) { | ||
return f !== g | ||
}) | ||
} | ||
removeAllEventListeners () { | ||
this.eventListeners = [] | ||
} | ||
callEventListeners (event) { | ||
for (var i = 0; i < this.eventListeners.length; i++) { | ||
try { | ||
this.eventListeners[i](event) | ||
} catch (e) { | ||
console.log('User events must not throw Errors!') // eslint-disable-line | ||
} | ||
} | ||
} | ||
/* | ||
Call this when you successfully awaited the execution of n Insert operations | ||
@@ -198,2 +207,9 @@ */ | ||
this.name = def.name | ||
if (def.appendAdditionalInfo != null) { | ||
this.appendAdditionalInfo = def.appendAdditionalInfo | ||
} | ||
this.parseArguments = (def.parseArguments || function () { | ||
return [this] | ||
}).bind(this) | ||
this.parseArguments.typeDefinition = this | ||
} | ||
@@ -203,2 +219,11 @@ } | ||
Y.utils.isTypeDefinition = function isTypeDefinition (v) { | ||
if (v != null) { | ||
if (v instanceof Y.utils.CustomType) return [v] | ||
else if (v.constructor === Array && v[0] instanceof Y.utils.CustomType) return v | ||
else if (v instanceof Function && v.typeDefinition instanceof Y.utils.CustomType) return [v.typeDefinition] | ||
} | ||
return false | ||
} | ||
/* | ||
@@ -205,0 +230,0 @@ Make a flat copy of an object |
36
src/y.js
@@ -17,3 +17,7 @@ /* @flow */ | ||
Y.extend = function (name, value) { | ||
Y[name] = value | ||
if (value instanceof Y.utils.CustomType) { | ||
Y[name] = value.parseArguments | ||
} else { | ||
Y[name] = value | ||
} | ||
if (requiringModules[name] != null) { | ||
@@ -33,5 +37,6 @@ requiringModules[name].resolve() | ||
for (var i = 0; i < modules.length; i++) { | ||
var modulename = 'y-' + modules[i].toLowerCase() | ||
if (Y[modules[i]] == null) { | ||
if (requiringModules[modules[i]] == null) { | ||
var module = modules[i].split('(')[0] | ||
var modulename = 'y-' + module.toLowerCase() | ||
if (Y[module] == null) { | ||
if (requiringModules[module] == null) { | ||
// module does not exist | ||
@@ -44,3 +49,3 @@ if (typeof window !== 'undefined' && window.Y !== 'undefined') { | ||
let requireModule = {} | ||
requiringModules[modules[i]] = requireModule | ||
requiringModules[module] = requireModule | ||
requireModule.promise = new Promise(function (resolve) { | ||
@@ -136,11 +141,16 @@ requireModule.resolve = resolve | ||
for (var propertyname in opts.share) { | ||
var typename = opts.share[propertyname] | ||
var id = ['_', Y[typename].struct + '_' + propertyname] | ||
var op = yield* this.getOperation(id) | ||
if (op.type !== typename) { | ||
// not already in the db | ||
op.type = typename | ||
yield* this.setOperation(op) | ||
var typeConstructor = opts.share[propertyname].split('(') | ||
var typeName = typeConstructor.splice(0, 1) | ||
var args = [] | ||
if (typeConstructor.length === 1) { | ||
try { | ||
args = JSON.parse('[' + typeConstructor[0].split(')')[0] + ']') | ||
} catch (e) { | ||
throw new Error('Was not able to parse type definition! (share.' + propertyname + ')') | ||
} | ||
} | ||
share[propertyname] = yield* this.getType(id) | ||
var type = Y[typeName] | ||
var typedef = type.typeDefinition | ||
var id = ['_', typedef.struct + '_' + typeName + '_' + propertyname + '_' + typeConstructor] | ||
share[propertyname] = yield* this.createType(type.apply(typedef, args), id) | ||
} | ||
@@ -147,0 +157,0 @@ this.store.whenTransactionsFinished() |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
886027
42
4371
215