bugfixes creating structs without loading type (e.g. for y-websockets-server)
This commit is contained in:
parent
c9c00b5a08
commit
f844dcbc1e
2
dist
2
dist
@ -1 +1 @@
|
||||
Subproject commit 51c8d3bdc6e9b4e485fcce88f50ab132f65db252
|
||||
Subproject commit 5cfe209688c31ae496b6c86db0dc5adbf15b8046
|
@ -91,10 +91,12 @@ module.exports = function (gulp, helperOptions) {
|
||||
var browserify = require('browserify')
|
||||
var source = require('vinyl-source-stream')
|
||||
var buffer = require('vinyl-buffer')
|
||||
|
||||
return browserify({
|
||||
entries: files.specs,
|
||||
entries: files.specs, // .concat(files.distEs5),
|
||||
debug: true
|
||||
}).bundle()
|
||||
})// .transform('babelify', { presets: ['es2015'] })
|
||||
.bundle()
|
||||
.pipe(source('specs.js'))
|
||||
.pipe(buffer())
|
||||
// .pipe($.sourcemaps.init({loadMaps: true}))
|
||||
|
@ -25,7 +25,7 @@ g.g = g
|
||||
|
||||
g.YConcurrency_TestingMode = true
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000
|
||||
|
||||
g.describeManyTimes = function describeManyTimes (times, name, f) {
|
||||
for (var i = 0; i < times; i++) {
|
||||
|
@ -100,6 +100,26 @@ module.exports = function (Y/* :any */) {
|
||||
return t
|
||||
}
|
||||
* 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)
|
||||
@ -107,9 +127,12 @@ module.exports = function (Y/* :any */) {
|
||||
if (typedefinition[0].appendAdditionalInfo != null) {
|
||||
yield* typedefinition[0].appendAdditionalInfo.call(this, op, typedefinition[1])
|
||||
}
|
||||
yield* this.applyCreatedOperations([op])
|
||||
// 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])
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
Apply operations that this user created (no remote ones!)
|
||||
* does not check for Struct.*.requiredOps()
|
||||
@ -156,7 +179,7 @@ module.exports = function (Y/* :any */) {
|
||||
yield* this.markDeleted(targetId, 1)
|
||||
}
|
||||
|
||||
if (target != null && target.gc == null) {
|
||||
if (target != null) {
|
||||
if (!target.deleted) {
|
||||
callType = true
|
||||
// set deleted & notify type
|
||||
@ -187,7 +210,7 @@ module.exports = function (Y/* :any */) {
|
||||
}
|
||||
if (target.opContent != null) {
|
||||
yield* this.deleteOperation(target.opContent)
|
||||
target.opContent = null
|
||||
// target.opContent = null
|
||||
}
|
||||
}
|
||||
var left
|
||||
@ -474,10 +497,12 @@ module.exports = function (Y/* :any */) {
|
||||
yield* this.setOperation(origin)
|
||||
}
|
||||
}
|
||||
|
||||
if (o.parent != null) {
|
||||
// remove gc'd op from parent, if it exists
|
||||
var parent /* MapOperation */ = yield* this.getOperation(o.parent)
|
||||
var parent
|
||||
if (o.parent != null){
|
||||
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
|
||||
if (o.parentSub != null) {
|
||||
if (Y.utils.compareIds(parent.map[o.parentSub], o.id)) {
|
||||
@ -656,23 +681,20 @@ module.exports = function (Y/* :any */) {
|
||||
if (o != null || id[0] !== '_') {
|
||||
return o
|
||||
} else {
|
||||
/* // generate this operation?
|
||||
if (typeof id[1] === 'string') {
|
||||
var comp = id[1].split('_')
|
||||
if (comp.length > 2 || id[0] === '_') {
|
||||
var struct = comp[0]
|
||||
var op = Y.Struct[struct].create(id)
|
||||
op.type = comp[1]
|
||||
yield* this.setOperation(op)
|
||||
return op
|
||||
} else {
|
||||
// won't be called. but just in case..
|
||||
console.error('Unexpected case. How can this happen?')
|
||||
debugger // eslint-disable-line
|
||||
return null
|
||||
}
|
||||
// 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)
|
||||
return op
|
||||
} else {
|
||||
*/
|
||||
// won't be called. but just in case..
|
||||
console.error('Unexpected case. How can this happen?')
|
||||
debugger // eslint-disable-line
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
5
src/y.js
5
src/y.js
@ -145,9 +145,10 @@ class YConfig {
|
||||
throw new Error('Was not able to parse type definition! (share.' + propertyname + ')')
|
||||
}
|
||||
}
|
||||
var id = ['_', propertyname + '_' + typeConstructor]
|
||||
var type = Y[typeName]
|
||||
share[propertyname] = yield* this.createType(type.apply(type.typeDefinition, args), id)
|
||||
var typedef = type.typeDefinition
|
||||
var id = ['_', typedef.struct + '_' + typeName + '_' + propertyname + '_' + typeConstructor]
|
||||
share[propertyname] = yield* this.createType(type.apply(typedef, args), id)
|
||||
}
|
||||
this.store.whenTransactionsFinished()
|
||||
.then(callback)
|
||||
|
Loading…
x
Reference in New Issue
Block a user