ogit
Version:
A lazy developer's Git CLI made simple. Makes using git on cloud IDEs (i.e. C9) a walk in the park.
52 lines (51 loc) • 1.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const json_object_mapper_1 = require("json-object-mapper");
class GitBranch {
constructor() {
this.isCurrent = false;
}
}
exports.GitBranch = GitBranch;
class GitBranchDeserializer {
constructor() {
this.deserialize = (obj) => {
const branchesMap = new Map();
for (let key of Object.keys(obj)) {
const gitBranch = new GitBranch();
gitBranch.isCurrent = obj[key].current;
gitBranch.name = obj[key].name;
gitBranch.commitHash = obj[key].commit;
gitBranch.label = obj[key].label;
branchesMap.set(gitBranch.name, gitBranch);
}
return branchesMap;
};
}
}
class GitBranchSummary {
constructor() {
this.currentBranch = undefined;
this.allBranches = undefined;
this.branches = new Map();
this.detached = undefined;
}
}
tslib_1.__decorate([
json_object_mapper_1.JsonProperty({ name: 'current' })
], GitBranchSummary.prototype, "currentBranch", void 0);
tslib_1.__decorate([
json_object_mapper_1.JsonProperty({ name: 'all', type: String })
], GitBranchSummary.prototype, "allBranches", void 0);
tslib_1.__decorate([
json_object_mapper_1.JsonProperty({
name: 'branches',
type: GitBranch,
deserializer: GitBranchDeserializer
})
], GitBranchSummary.prototype, "branches", void 0);
tslib_1.__decorate([
json_object_mapper_1.JsonProperty()
], GitBranchSummary.prototype, "detached", void 0);
exports.GitBranchSummary = GitBranchSummary;