New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

libzap

Package Overview
Dependencies
Maintainers
2
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.53 to 0.0.56

4

lib/remote/handler.d.ts

@@ -29,3 +29,3 @@ import { Event } from "vscode-jsonrpc";

private repos;
private workspaceRefListener?;
private isDuringRepoWatchCall;
constructor(remoteClient: Client);

@@ -39,4 +39,2 @@ register(connection: IConnection): void;

readonly onDidUpdateSymbolicRef: Event<SymbolicRefUpdateEvent>;
private handlingRefUpdate;
private serializeRefUpdate(f);
private onRefUpdate(params);

@@ -43,0 +41,0 @@ private onSymbolicRefUpdate(params);

@@ -24,2 +24,3 @@ "use strict";

this.repos = new Map();
this.isDuringRepoWatchCall = false;
this.symbolicRefUpdateEmitter = new vscode_jsonrpc_1.Emitter();

@@ -35,17 +36,10 @@ }

return __awaiter(this, void 0, void 0, function* () {
let refspecs = [refID.ref];
if (this.workspaceRefListener) {
this.workspaceRefListener.dispose();
const refspecs = [refID.ref];
if (refID.ref === "HEAD") {
const info = yield this.queryRefInfo(refID);
if (!info.target) {
return Promise.reject(new Error(`ref ${JSON.stringify(refID)} has no target`));
}
refspecs.push(info.target);
}
this.workspaceRefListener = this.onDidUpdateSymbolicRef((e) => {
if (e.ref === "HEAD" && refspecs.indexOf(e.newTarget) === -1) {
refspecs = e.newTarget ? [refID.ref, e.newTarget] : [refID.ref];
this.repoWatch({
repo: refID.repo,
refspecs,
}).then(() => { }, (err) => {
console.error(`attachWorkspace: workspaceRefListener: ${err}`);
});
}
});
yield this.repoWatch({ repo: refID.repo, refspecs });

@@ -63,3 +57,5 @@ yield this.getRepo(refID.repo).getRef(refID.ref).attachWorkspace(workspace, mergeStrategy);

return this.remoteClient.onReady().then(() => {
return this.remoteClient.sendRequest(protocol_1.RepoWatchRequest.type, params);
this.isDuringRepoWatchCall = true;
return this.remoteClient.sendRequest(protocol_1.RepoWatchRequest.type, params)
.then(() => { this.isDuringRepoWatchCall = false; }, (err) => { this.isDuringRepoWatchCall = false; throw err; });
});

@@ -73,22 +69,14 @@ }

}
serializeRefUpdate(f) {
return __awaiter(this, void 0, void 0, function* () {
while (this.handlingRefUpdate) {
yield this.handlingRefUpdate;
}
this.handlingRefUpdate = f();
this.handlingRefUpdate.then(() => { this.handlingRefUpdate = undefined; }, () => { this.handlingRefUpdate = undefined; });
return this.handlingRefUpdate;
});
}
onRefUpdate(params) {
return this.serializeRefUpdate(() => this.getRepo(params.repo).onRefUpdateFromUpstream(params));
return this.getRepo(params.repo).onRefUpdateFromUpstream(params, this.isDuringRepoWatchCall);
}
onSymbolicRefUpdate(params) {
return this.serializeRefUpdate(() => this.getRepo(params.repo).onSymbolicRefUpdateFromUpstream(params)).then(() => this.symbolicRefUpdateEmitter.fire({
repo: params.repo,
ref: params.ref,
newTarget: params.target,
oldTarget: params.oldTarget,
}));
return this.getRepo(params.repo).onSymbolicRefUpdateFromUpstream(params, this.isDuringRepoWatchCall).then(() => {
this.symbolicRefUpdateEmitter.fire({
repo: params.repo,
ref: params.ref,
newTarget: params.target,
oldTarget: params.oldTarget,
});
});
}

@@ -103,7 +91,3 @@ getRepo(repoName) {

}
dispose() {
if (this.workspaceRefListener) {
this.workspaceRefListener.dispose();
}
}
dispose() { }
}

@@ -125,3 +109,3 @@ Handler.id = "ot.handler";

}
onRefUpdateFromUpstream(params) {
onRefUpdateFromUpstream(params, isDuringRepoWatchCall) {
let ref = this.refs.get(params.ref);

@@ -138,5 +122,5 @@ if (!ref) {

}
return ref.onUpdateFromUpstream(params);
return ref.onUpdateFromUpstream(params, isDuringRepoWatchCall);
}
onSymbolicRefUpdateFromUpstream(params) {
onSymbolicRefUpdateFromUpstream(params, force) {
let ref = this.refs.get(params.ref);

@@ -150,6 +134,5 @@ if (!ref) {

}
return ref.onUpdateFromUpstream(params, this.refs);
return ref.onUpdateFromUpstream(params, this.refs, force);
}
}
const STRICT_CONSISTENCY_CHECKING_OF_SYMBOLIC_REF_STATE = false;
class SymbolicRefHandler {

@@ -159,9 +142,9 @@ constructor(refID) {

}
onUpdateFromUpstream(params, allRefs) {
onUpdateFromUpstream(params, allRefs, force) {
if (params.ack) {
return Promise.resolve(void 0);
}
if (STRICT_CONSISTENCY_CHECKING_OF_SYMBOLIC_REF_STATE) {
if (!force) {
if (typeof this.target === "string" && !params.oldTarget) {
throw new Error(`symbolic ref ${JSON.stringify(this.refID.ref)} update: no oldTarget value sent (target: ${JSON.stringify(this.target)})`);
throw new Error(`symbolic ref ${JSON.stringify(this.refID.ref)} update: no oldTarget value sent`);
}

@@ -172,15 +155,17 @@ if (this.target !== params.oldTarget) {

}
const newTargetHandler = allRefs.get(params.target);
if (!newTargetHandler) {
throw new Error(`symbolic ref ${JSON.stringify(this.refID.ref)} update: new target ref ${JSON.stringify(params.target)} does not exist`);
}
if (this.target === params.target) {
return Promise.resolve(void 0);
}
this.target = params.target;
const newTargetHandler = allRefs.get(params.target);
const oldTargetHandler = this.targetHandler;
this.targetHandler = newTargetHandler;
if (this.workspace && oldTargetHandler !== newTargetHandler) {
if (oldTargetHandler) {
oldTargetHandler.detachWorkspace();
}
if (this.targetHandler) {
return this.targetHandler.attachWorkspace(this.workspace, this.mergeStrategy);
}
oldTargetHandler.detachWorkspace();
return this.targetHandler.attachWorkspace(this.workspace, this.mergeStrategy);
}
return Promise.resolve();
return Promise.resolve(void 0);
}

@@ -195,5 +180,2 @@ attachWorkspace(newWorkspace, mergeStrategy) {

this.mergeStrategy = mergeStrategy;
if (!this.targetHandler) {
return Promise.resolve();
}
return this.targetHandler.attachWorkspace(newWorkspace, mergeStrategy);

@@ -206,5 +188,3 @@ });

}
if (this.targetHandler) {
this.targetHandler.detachWorkspace();
}
this.targetHandler.detachWorkspace();
this.workspace = undefined;

@@ -214,5 +194,2 @@ this.mergeStrategy = undefined;

resetWorkspaceRefState(workspace, mergeStrategy) {
if (!this.targetHandler) {
return Promise.reject(new Error(`resetting workspace ref state for symbolic ref ${this.refID.repo} failed: target ref ${this.target} does not exist`));
}
return this.targetHandler.resetWorkspaceRefState(workspace, mergeStrategy);

@@ -300,2 +277,3 @@ }

}
return Promise.resolve(void 0);
});

@@ -366,3 +344,3 @@ }

}
onUpdateFromUpstream(params) {
onUpdateFromUpstream(params, isDuringRepoWatchCall) {
return __awaiter(this, void 0, void 0, function* () {

@@ -375,3 +353,3 @@ if (params.ack) {

else if (params.state) {
if (this.mergeStrategy === MergeStrategy.LocalClobbersRemote && this.state) {
if (this.mergeStrategy === MergeStrategy.LocalClobbersRemote && this.state && isDuringRepoWatchCall) {
}

@@ -395,2 +373,3 @@ else {

}
return Promise.resolve({});
});

@@ -397,0 +376,0 @@ }

{
"name": "libzap",
"version": "0.0.53",
"version": "0.0.56",
"description": "JavaScript library for Zap",

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

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