@terencesun/githubdb
Advanced tools
Comparing version 1.0.3 to 1.0.6
@@ -66,2 +66,5 @@ "use strict"; | ||
_a.sent(); | ||
return [4, this.github.checkCreate()]; | ||
case 2: | ||
_a.sent(); | ||
return [2]; | ||
@@ -68,0 +71,0 @@ } |
@@ -128,2 +128,38 @@ "use strict"; | ||
}; | ||
Github.prototype.checkCreate = function () { | ||
var _this = this; | ||
var timmer; | ||
var lock = false; | ||
var count = 0; | ||
return new Promise(function (resolve, reject) { | ||
timmer = setInterval(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var repoRet, repoPathRet; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!!lock) return [3, 3]; | ||
lock = true; | ||
count += 1; | ||
return [4, this.isRepoExist()]; | ||
case 1: | ||
repoRet = _a.sent(); | ||
return [4, this.isRepoPathExist()]; | ||
case 2: | ||
repoPathRet = _a.sent(); | ||
if (repoRet && repoPathRet) { | ||
clearInterval(timmer); | ||
resolve(true); | ||
} | ||
lock = false; | ||
_a.label = 3; | ||
case 3: | ||
if (count > 5) { | ||
reject(false); | ||
} | ||
return [2]; | ||
} | ||
}); | ||
}); }, 1000); | ||
}); | ||
}; | ||
Github.prototype.createRepo = function () { | ||
@@ -130,0 +166,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -11,2 +11,3 @@ import type { GithubOptions, GithubRepoPathCtx, GithubRepoUpdateInfo, GithubInter } from "./interface"; | ||
isRepoPathExist(): Promise<boolean>; | ||
checkCreate(): Promise<boolean>; | ||
createRepo(): Promise<void>; | ||
@@ -13,0 +14,0 @@ createPath(): Promise<void>; |
@@ -36,2 +36,3 @@ import type { OctokitOptions } from "@octokit/core/dist-types/types"; | ||
connect(): Promise<void>; | ||
checkCreate(): Promise<boolean>; | ||
getRepoFileCtx(): Promise<GithubRepoPathCtx>; | ||
@@ -38,0 +39,0 @@ updateFile(ctx: string, sha: string): Promise<GithubRepoUpdateInfo>; |
{ | ||
"name": "@terencesun/githubdb", | ||
"version": "1.0.3", | ||
"version": "1.0.6", | ||
"description": "operate with github like mongodb for nodejs", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
36994
18
599