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

libzap

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libzap - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

lib/remote/ot.d.ts

2

lib/remote/handler.d.ts

@@ -19,3 +19,3 @@ import { WorkspaceOp } from "../ot/workspace";

register(connection: IConnection): void;
attachWorkspace(refID: RefIdentifier, workspace: Workspace | null): void;
attachWorkspace(refID: RefIdentifier, workspace: Workspace | null): Promise<void>;
repoWatch(params: RepoWatchParams): Thenable<void>;

@@ -22,0 +22,0 @@ private onRefUpdate(params);

@@ -22,3 +22,5 @@ "use strict";

attachWorkspace(refID, workspace) {
this.getRepo(refID.repo).getRef(refID.ref).setWorkspace(workspace);
return __awaiter(this, void 0, void 0, function* () {
yield this.getRepo(refID.repo).getRef(refID.ref).setWorkspace(workspace);
});
}

@@ -99,20 +101,20 @@ repoWatch(params) {

setWorkspace(newWorkspace) {
if (newWorkspace && this.ot.rev !== 0) {
console.log("buffering history is not yet implemented (workspace attached when the ref already has history); proceeding, but the results might be incorrect");
}
if (this.workspace) {
this.workspace.onOp(undefined);
this.workspace.onReset(undefined);
}
this.workspace = newWorkspace;
if (this.workspace) {
this.ot.apply = (op) => this.workspace.apply(op);
this.workspace.reset([]);
this.workspace.onOp(op => this.onWorkspaceOp(op));
this.workspace.onReset(newOp => this.onWorkspaceReset(newOp));
this.workspace.onWillSaveFile(params => this.onWorkspaceWillSaveFile(params));
}
else {
this.ot.apply = undefined;
}
return __awaiter(this, void 0, void 0, function* () {
if (this.workspace) {
this.workspace.onOp(undefined);
this.workspace.onReset(undefined);
}
this.workspace = newWorkspace;
if (this.workspace) {
this.ot.apply = (op) => this.workspace.apply(op);
this.ot.reset(this.state && this.state.history ? this.state.history : []);
this.workspace.reset(this.state && this.state.history ? this.state.history : []);
this.workspace.onOp(op => this.onWorkspaceOp(op));
this.workspace.onReset(newOp => this.onWorkspaceReset(newOp));
this.workspace.onWillSaveFile(params => this.onWorkspaceWillSaveFile(params));
}
else {
this.ot.apply = undefined;
}
});
}

@@ -126,3 +128,3 @@ onWorkspaceOp(op) {

if (!this.state) {
throw new Error(`attempt to send ref/update request from ref with uninitialized state: ${JSON.stringify(this.refID)}`);
throw new Error(`attempt to send ref/ update request from ref with uninitialized state: ${JSON.stringify(this.refID)} `);
}

@@ -140,3 +142,3 @@ this.remoteClient.sendRequest(protocol_1.RefUpdateUpstreamRequest.type, {

}).then(() => { }, (err) => {
console.error(`ERROR: ref ${JSON.stringify(this.refID)} reset failed: ${err}`);
console.error(`ERROR: ref ${JSON.stringify(this.refID)} reset failed: ${err} `);
});

@@ -148,3 +150,3 @@ }

}).then(() => { }, (err) => {
console.error(`ERROR: ref ${JSON.stringify(this.refID)} workspace/willSaveFile ${JSON.stringify(params)} failed: ${err}`);
console.error(`ERROR: ref ${JSON.stringify(this.refID)} workspace / willSaveFile ${JSON.stringify(params)} failed: ${err} `);
});

@@ -154,3 +156,3 @@ }

return __awaiter(this, void 0, void 0, function* () {
console.log(`client=${process.env.ZAP_E2E_NAME}: UPDATE: ${JSON.stringify(params)}`);
console.log(`client= ${process.env.ZAP_E2E_NAME}: UPDATE: ${JSON.stringify(params)} `);
if (params.ack) {

@@ -175,3 +177,3 @@ if (params.op) {

else {
throw new Error(`unhandled ref update: ${JSON.stringify(params)}`);
throw new Error(`unhandled ref update: ${JSON.stringify(params)} `);
}

@@ -178,0 +180,0 @@ return Promise.resolve({});

{
"name": "libzap",
"version": "0.0.14",
"version": "0.0.15",
"description": "JavaScript library for Zap",

@@ -5,0 +5,0 @@ "license": "none",

@@ -41,4 +41,4 @@ import { Client as OTClient } from "../ot/client";

public attachWorkspace(refID: RefIdentifier, workspace: Workspace | null): void {
this.getRepo(refID.repo).getRef(refID.ref).setWorkspace(workspace);
public async attachWorkspace(refID: RefIdentifier, workspace: Workspace | null): Promise<void> {
await this.getRepo(refID.repo).getRef(refID.ref).setWorkspace(workspace);
}

@@ -131,7 +131,3 @@

public setWorkspace(newWorkspace: Workspace | null): void {
if (newWorkspace && this.ot.rev !== 0) {
console.log("buffering history is not yet implemented (workspace attached when the ref already has history); proceeding, but the results might be incorrect");
}
public async setWorkspace(newWorkspace: Workspace | null): Promise<void> {
// Remove listeners from old workspace.

@@ -147,3 +143,4 @@ if (this.workspace) {

this.ot.apply = (op) => this.workspace!.apply(op);
this.workspace.reset([]);
this.ot.reset(this.state && this.state.history ? this.state.history : []);
this.workspace.reset(this.state && this.state.history ? this.state.history : []);
this.workspace.onOp(op => this.onWorkspaceOp(op));

@@ -165,3 +162,3 @@ this.workspace.onReset(newOp => this.onWorkspaceReset(newOp));

if (!this.state) {
throw new Error(`attempt to send ref/update request from ref with uninitialized state: ${JSON.stringify(this.refID)}`);
throw new Error(`attempt to send ref/ update request from ref with uninitialized state: ${JSON.stringify(this.refID)} `);
}

@@ -180,3 +177,3 @@ this.remoteClient.sendRequest(RefUpdateUpstreamRequest.type, {

// TODO@ handle ops that didn't send properly
console.error(`ERROR: ref ${JSON.stringify(this.refID)} reset failed: ${err}`);
console.error(`ERROR: ref ${JSON.stringify(this.refID)} reset failed: ${err} `);
});

@@ -190,3 +187,3 @@ }

// TODO@ handle ops that didn't send properly
console.error(`ERROR: ref ${JSON.stringify(this.refID)} workspace/willSaveFile ${JSON.stringify(params)} failed: ${err}`);
console.error(`ERROR: ref ${JSON.stringify(this.refID)} workspace / willSaveFile ${JSON.stringify(params)} failed: ${err} `);
});

@@ -196,3 +193,3 @@ }

public async onUpdateFromUpstream(params: RefUpdateDownstreamParams): Promise<any> {
console.log(`client=${process.env.ZAP_E2E_NAME}: UPDATE: ${JSON.stringify(params)}`);
console.log(`client= ${process.env.ZAP_E2E_NAME}: UPDATE: ${JSON.stringify(params)} `);
if (params.ack) {

@@ -213,3 +210,3 @@ if (params.op) {

} else {
throw new Error(`unhandled ref update: ${JSON.stringify(params)}`);
throw new Error(`unhandled ref update: ${JSON.stringify(params)} `);
}

@@ -216,0 +213,0 @@ return Promise.resolve({});

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