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.58 to 0.0.59

4

lib/remote/handler.d.ts

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

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

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

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

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

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

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

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

return __awaiter(this, void 0, void 0, function* () {
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`));
let refspecs = [refID.ref];
if (this.workspaceRefListener) {
this.workspaceRefListener.dispose();
}
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}`);
});
}
refspecs.push(info.target);
}
});
yield this.repoWatch({ repo: refID.repo, refspecs });

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

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

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

}
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.getRepo(params.repo).onRefUpdateFromUpstream(params, this.isDuringRepoWatchCall);
return this.serializeRefUpdate(() => this.getRepo(params.repo).onRefUpdateFromUpstream(params));
}
onSymbolicRefUpdate(params) {
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,
});
});
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,
}));
}

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

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

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

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

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

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

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

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

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

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

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

}
this.target = params.target;
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 oldTargetHandler = this.targetHandler;
this.targetHandler = newTargetHandler;
if (this.workspace && oldTargetHandler !== newTargetHandler) {
oldTargetHandler.detachWorkspace();
return this.targetHandler.attachWorkspace(this.workspace, this.mergeStrategy);
if (oldTargetHandler) {
oldTargetHandler.detachWorkspace();
}
if (this.targetHandler) {
return this.targetHandler.attachWorkspace(this.workspace, this.mergeStrategy);
}
}
return Promise.resolve(void 0);
return Promise.resolve();
}

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

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

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

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

@@ -194,2 +214,5 @@ 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);

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

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

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

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

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

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

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

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

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

{
"name": "libzap",
"version": "0.0.58",
"version": "0.0.59",
"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