Comparing version 0.0.15 to 0.0.16
@@ -38,2 +38,3 @@ "use strict"; | ||
} | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} ACK @${this.rev}, wait=${JSON.stringify(this.wait)} buf=${JSON.stringify(this.buf)}`); | ||
if (this.buf) { | ||
@@ -65,2 +66,3 @@ if (this.send) { | ||
} | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} >>> RECV @${this.rev}, transformed-op=${JSON.stringify(op)} wait=${JSON.stringify(this.wait)} buf=${JSON.stringify(this.buf)}`); | ||
this.rev++; | ||
@@ -67,0 +69,0 @@ if (!workspace_1.noop(op)) { |
@@ -105,3 +105,3 @@ "use strict"; | ||
if (reta + ins !== retb + del) { | ||
throw new Error(`compose requires consecutive ops (${reta + ins} != ${retb + del})`); | ||
throw new Error(`compose requires consecutive ops (${reta + ins} != ${retb + del}, a: ${JSON.stringify(a)}, b: ${JSON.stringify(b)} #js)`); | ||
} | ||
@@ -108,0 +108,0 @@ let { i: ia, o: oa } = geteditop(0, a); |
@@ -84,2 +84,3 @@ "use strict"; | ||
} | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} SEND:${this.refID.ref} @${rev} ${JSON.stringify(op)}`); | ||
this.remoteClient.sendRequest(protocol_1.RefUpdateUpstreamRequest.type, { | ||
@@ -152,3 +153,2 @@ repo: this.refID.repo, | ||
return __awaiter(this, void 0, void 0, function* () { | ||
console.log(`client= ${process.env.ZAP_E2E_NAME}: UPDATE: ${JSON.stringify(params)} `); | ||
if (params.ack) { | ||
@@ -167,2 +167,3 @@ if (params.op) { | ||
else if (params.op) { | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} RECV:${this.refID.ref} @${this.ot.rev} ${JSON.stringify(params.op)}`); | ||
yield this.ot.recv(params.op); | ||
@@ -169,0 +170,0 @@ } |
@@ -63,3 +63,7 @@ "use strict"; | ||
this.refState = params.state; | ||
throw new Error(`reset not yet implemented: ${JSON.stringify(params)}`); | ||
if (params.state.history) { | ||
for (const op of params.state.history) { | ||
this.otClient.recv(op); | ||
} | ||
} | ||
} | ||
@@ -66,0 +70,0 @@ else if (params.op) { |
{ | ||
"name": "libzap", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "JavaScript library for Zap", | ||
@@ -5,0 +5,0 @@ "license": "none", |
@@ -59,2 +59,3 @@ import { WorkspaceOp, compose, noop, transform } from "./workspace"; | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} ACK @${this.rev}, wait=${JSON.stringify(this.wait)} buf=${JSON.stringify(this.buf)}`); | ||
if (this.buf) { | ||
@@ -85,2 +86,3 @@ if (this.send) { this.send(this.rev + 1, this.buf); } | ||
} | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} >>> RECV @${this.rev}, transformed-op=${JSON.stringify(op)} wait=${JSON.stringify(this.wait)} buf=${JSON.stringify(this.buf)}`); | ||
this.rev++; | ||
@@ -87,0 +89,0 @@ if (!noop(op)) { |
@@ -93,3 +93,3 @@ export type EditOp = number | string; // number is retain/delete, string is insert | ||
if (reta + ins !== retb + del) { | ||
throw new Error(`compose requires consecutive ops (${reta + ins} != ${retb + del})`); | ||
throw new Error(`compose requires consecutive ops (${reta + ins} != ${retb + del}, a: ${JSON.stringify(a)}, b: ${JSON.stringify(b)} #js)`); | ||
} | ||
@@ -96,0 +96,0 @@ let {i: ia, o: oa} = geteditop(0, a); |
@@ -113,2 +113,3 @@ import { Client as OTClient } from "../ot/client"; | ||
} | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} SEND:${this.refID.ref} @${rev} ${JSON.stringify(op)}`); | ||
this.remoteClient.sendRequest(RefUpdateUpstreamRequest.type, { | ||
@@ -188,3 +189,2 @@ repo: this.refID.repo, | ||
public async onUpdateFromUpstream(params: RefUpdateDownstreamParams): Promise<any> { | ||
console.log(`client= ${process.env.ZAP_E2E_NAME}: UPDATE: ${JSON.stringify(params)} `); | ||
if (params.ack) { | ||
@@ -201,2 +201,3 @@ if (params.op) { | ||
} else if (params.op) { | ||
console.log(`Client=${process.env.ZAP_E2E_NAME} RECV:${this.refID.ref} @${this.ot.rev} ${JSON.stringify(params.op)}`); | ||
await this.ot.recv(params.op); | ||
@@ -203,0 +204,0 @@ } else if (params.delete) { |
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 not supported yet
Sorry, the diff of this file is not supported yet
241140
66
4651
7