From 99d8c4fee9a2d7913a8c67b57cf1937079dfd363 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:41:21 +0700 Subject: [PATCH 01/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..90116fa6a --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726483278353}} \ No newline at end of file From cda97f4f53d951e164496c4599283f1ee0dcae1b Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:41:23 +0700 Subject: [PATCH 02/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 90116fa6a..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726483278353}} \ No newline at end of file From 60e947cad0a58d4d9233bdba6c01c813f14c4d97 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:12:10 +0700 Subject: [PATCH 03/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..daceb515b --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726485127205}} \ No newline at end of file From 62d82d7f94f04d341264c99313f3a167983a399f Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:12:12 +0700 Subject: [PATCH 04/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index daceb515b..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726485127205}} \ No newline at end of file From f949634fcef392251afefe2de21ed9e755bbf31c Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:17:29 +0700 Subject: [PATCH 05/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..d44a9da78 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726485445735}} \ No newline at end of file From 0eadbe6c8142632cc46341df476138840beeafce Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:17:31 +0700 Subject: [PATCH 06/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index d44a9da78..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726485445735}} \ No newline at end of file From 72c9c800c86d3a8d1f26a3d10a0303fb6818fb35 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:32:25 +0700 Subject: [PATCH 07/53] chore: store, add comments --- core/map/map.test.ts | 12 +-- core/map/map.ts | 177 ++++++++++++++++++++++++++----------------- core/server/mod.ts | 4 +- 3 files changed, 113 insertions(+), 80 deletions(-) diff --git a/core/map/map.test.ts b/core/map/map.test.ts index 55be3ab73..2304b2047 100644 --- a/core/map/map.test.ts +++ b/core/map/map.test.ts @@ -58,14 +58,12 @@ Deno.test("Store: size method returns correct count", () => { const d = new Date(); const time = d.getTime(); Deno.test("Store: save it to github", async () => { - const token = Deno.env.get("GITHUB_TOKEN"); - if (!token) return; const expiringMap = new Store({ owner: "fastrodev", repo: "fastro", path: "modules/store/records.json", branch: "store", - token, + token: Deno.env.get("GITHUB_TOKEN"), }); expiringMap.set("key1", time); const r = await expiringMap.commit(); @@ -73,14 +71,12 @@ Deno.test("Store: save it to github", async () => { }); Deno.test("Store: get value from github", async () => { - const token = Deno.env.get("GITHUB_TOKEN"); - if (!token) return; const expiringMap = new Store({ owner: "fastrodev", repo: "fastro", path: "modules/store/records.json", branch: "store", - token, + token: Deno.env.get("GITHUB_TOKEN"), }); // get kv from github const g = await expiringMap.get("key1"); @@ -88,14 +84,12 @@ Deno.test("Store: get value from github", async () => { }); Deno.test("Store: destroy map", async () => { - const token = Deno.env.get("GITHUB_TOKEN"); - if (!token) return; const expiringMap = new Store({ owner: "fastrodev", repo: "fastro", path: "modules/store/records.json", branch: "store", - token, + token: Deno.env.get("GITHUB_TOKEN"), }); await expiringMap.destroy(); const g = await expiringMap.get("key1"); diff --git a/core/map/map.ts b/core/map/map.ts index 13870863b..cfa755638 100644 --- a/core/map/map.ts +++ b/core/map/map.ts @@ -5,7 +5,7 @@ type StoreOptions = { owner: string; repo: string; path: string; - token: string; + token?: string; branch?: string; } | null; @@ -20,25 +20,21 @@ export class Store { this.options = options; } + /** + * Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated. + * @param key + * @param value + * @param ttl + */ set(key: K, value: V, ttl?: number): void { const expiry = ttl ? Date.now() + ttl : undefined; this.map.set(key, { value, expiry }); } - async refresh() { - if (this.map.size === 0 && this.options) { - const map = await getMap({ - token: this.options.token, - owner: this.options.owner, - repo: this.options.repo, - path: this.options.path, - branch: this.options.branch, - }); - if (!map) return; - this.map = map; - } - } - + /** + * Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map. + * @returns - Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned. + */ async get(key: K): Promise { await this.refresh(); const entry = this.map.get(key); @@ -52,6 +48,10 @@ export class Store { return undefined; } + /** + * @param key + * @returns boolean indicating whether an element with the specified key exists or not. + */ async has(key: K): Promise { await this.refresh(); const entry = this.map.get(key); @@ -65,6 +65,10 @@ export class Store { return false; } + /** + * @param key + * @returns true if an element in the Map existed and has been removed, or false if the element does not exist. + */ delete(key: K): boolean { return this.map.delete(key); } @@ -73,26 +77,42 @@ export class Store { this.map.clear(); } + /** + * @returns the number of elements in the Map. + */ size(): number { this.cleanUpExpiredEntries(); return this.map.size; } + /** + * @returns an iterable of key, value pairs for every entry in the map. + */ entries() { this.cleanUpExpiredEntries(); return this.map.entries(); } + /** + * @returns an iterable of values in the map + */ values() { this.cleanUpExpiredEntries(); return this.map.values(); } + /** + * @returns an iterable of keys in the map + */ keys() { this.cleanUpExpiredEntries(); return this.map.keys(); } + /** + * Executes a provided function once per each key/value pair in the Map, in insertion order. + * @param callback + */ forEach(callback: (value: V, key: K) => void): void { this.cleanUpExpiredEntries(); this.map.forEach((entry, key) => { @@ -132,9 +152,9 @@ export class Store { if (!this.options) throw new Error("Options is needed."); return await deleteGithubFile({ token: this.options.token, - repoOwner: this.options.owner, - repoName: this.options.repo, - filePath: this.options.path, + owner: this.options.owner, + repo: this.options.repo, + path: this.options.path, branch: this.options.branch, }); } @@ -156,9 +176,23 @@ export class Store { }, interval); } + private async refresh() { + if (this.map.size === 0 && this.options) { + const map = await getMap({ + token: this.options.token, + owner: this.options.owner, + repo: this.options.repo, + path: this.options.path, + branch: this.options.branch, + }); + if (!map) return; + this.map = map; + } + } + private async saveToGitHub( options: { - token: string; + token?: string; owner: string; repo: string; path: string; @@ -166,16 +200,17 @@ export class Store { }, ) { try { + if (!options.token) throw new Error("GITHUB_TOKEN is needed"); if (this.options) { const record = mapToRecord(this.map); const data = JSON.stringify(record); return await uploadFileToGitHub( { token: options.token, - repoOwner: options.owner, - repoName: options.repo, - filePath: options.path, - fileContent: data, + owner: options.owner, + repo: options.repo, + path: options.path, + content: data, branch: options.branch, }, ); @@ -214,19 +249,20 @@ function mapToRecord( async function getSHA( options: { - token: string; - repoOwner: string; - repoName: string; - filePath: string; + token?: string; + owner: string; + repo: string; + path: string; branch?: string; }, ): Promise { + if (!options.token) throw new Error("GITHUB_TOKEN is needed"); const octokit = new Octokit({ auth: options.token }); try { const response = await octokit.repos.getContent({ - owner: options.repoOwner, - repo: options.repoName, - path: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, ref: options.branch, }) as any; @@ -238,11 +274,11 @@ async function getSHA( async function uploadFileToGitHub( options: { - token: string; - repoOwner: string; - repoName: string; - filePath: string; - fileContent: string; + token?: string; + owner: string; + repo: string; + path: string; + content: string; branch?: string; }, ) { @@ -251,9 +287,9 @@ async function uploadFileToGitHub( const res = await getFileFromGithub( { token: options.token, - repoOwner: options.repoOwner, - repoName: options.repoName, - filePath: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, branch: options.branch, }, ) as any; @@ -261,22 +297,22 @@ async function uploadFileToGitHub( const sha = res ? await getSHA({ token: options.token, - repoOwner: options.repoOwner, - repoName: options.repoName, - filePath: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, branch: options.branch, }) : undefined; const message = res - ? `Update ${options.filePath}` - : `Create ${options.filePath}`; + ? `Update ${options.path}` + : `Create ${options.path}`; return await octokit.repos.createOrUpdateFileContents({ - owner: options.repoOwner, - repo: options.repoName, - path: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, message, - content: btoa(options.fileContent), + content: btoa(options.content), sha, branch: options.branch, }); @@ -287,19 +323,20 @@ async function uploadFileToGitHub( async function getMap( options: { - token: string; + token?: string; owner: string; repo: string; path: string; branch?: string; }, ) { + if (!options.token) throw new Error("GITHUB_TOKEN is needed"); const rr = await getFileFromGithub( { token: options.token, - repoOwner: options.owner, - repoName: options.repo, - filePath: options.path, + owner: options.owner, + repo: options.repo, + path: options.path, branch: options.branch, }, ) as any; @@ -309,18 +346,19 @@ async function getMap( } async function getFileFromGithub(options: { - token: string; - repoOwner: string; - repoName: string; - filePath: string; + token?: string; + owner: string; + repo: string; + path: string; branch?: string; }) { + if (!options.token) throw new Error("GITHUB_TOKEN is needed"); const octokit = new Octokit({ auth: options.token }); try { const res = await octokit.repos.getContent({ - owner: options.repoOwner, - repo: options.repoName, - path: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, ref: options.branch, }); return res.data; @@ -331,30 +369,31 @@ async function getFileFromGithub(options: { async function deleteGithubFile( options: { - token: string; - repoOwner: string; - repoName: string; - filePath: string; + token?: string; + owner: string; + repo: string; + path: string; branch?: string; }, ) { + if (!options.token) throw new Error("GITHUB_TOKEN is needed"); const octokit = new Octokit({ auth: options.token }); try { const sha = await getSHA({ token: options.token, - repoOwner: options.repoOwner, - repoName: options.repoName, - filePath: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, branch: options.branch, }); if (!sha) throw new Error("SHA is needed"); const res = await octokit.repos.deleteFile({ - owner: options.repoOwner, - repo: options.repoName, - path: options.filePath, + owner: options.owner, + repo: options.repo, + path: options.path, sha, branch: options.branch, - message: `Delete ${options.filePath}`, + message: `Delete ${options.path}`, }); return res.data; } catch (error) { diff --git a/core/server/mod.ts b/core/server/mod.ts index 9f57852e7..e9f800455 100644 --- a/core/server/mod.ts +++ b/core/server/mod.ts @@ -677,7 +677,7 @@ if (root) fetchProps(root); owner: Deno.env.get("GITHUB_OWNER") || "fastrodev", repo: Deno.env.get("GITHUB_REPO") || "fastro", path: Deno.env.get("GITHUB_PATH") || "modules/store/records.json", - branch: Deno.env.get("GITHUB_PATH") || "store", - token: Deno.env.get("GITHUB_TOKEN") || "INVALID", + branch: Deno.env.get("GITHUB_BRANCH") || "store", + token: Deno.env.get("GITHUB_TOKEN"), }); } From 602240aea801b60431f6ed2088e0e924b0c0b585 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:41:54 +0700 Subject: [PATCH 08/53] chore: update commit --- core/map/map.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/map/map.ts b/core/map/map.ts index cfa755638..f381a1d52 100644 --- a/core/map/map.ts +++ b/core/map/map.ts @@ -127,12 +127,11 @@ export class Store { if (this.isCommitting) { throw new Error("Commit in progress, please wait."); } - + if (!this.options) throw new Error("Options is needed."); this.isCommitting = true; + this.cleanUpExpiredEntries(); try { - this.cleanUpExpiredEntries(); - if (!this.options) throw new Error("Options is needed."); - const x = await this.saveToGitHub( + return await this.saveToGitHub( { token: this.options.token, owner: this.options.owner, @@ -141,7 +140,6 @@ export class Store { branch: this.options.branch, }, ); - return x; } finally { this.isCommitting = false; } From 3d48186b59dc6a8923ba71d527ae40f0ea6efb9f Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:42:28 +0700 Subject: [PATCH 09/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..c03525239 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726486944810}} \ No newline at end of file From 38bf71d0b651708a083a5c95e6864621e4b98fee Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:42:31 +0700 Subject: [PATCH 10/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index c03525239..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726486944810}} \ No newline at end of file From 48781414271ddf16140c73264e797ed5b945c9b6 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:54:07 +0700 Subject: [PATCH 11/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..0f17a803c --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726487642743}} \ No newline at end of file From cb4b1d1e6a170aff93475eee703b0cfd96545685 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:54:12 +0700 Subject: [PATCH 12/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 0f17a803c..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726487642743}} \ No newline at end of file From ca76cf224a1a24aa1253758d87b0bf0052619e79 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:59:50 +0700 Subject: [PATCH 13/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..c4a8c4e59 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726487987010}} \ No newline at end of file From 7523a5c8cdc6fb7bc1eb098e6bc2528c0a034bf1 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:59:53 +0700 Subject: [PATCH 14/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index c4a8c4e59..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726487987010}} \ No newline at end of file From ccff17310ac92c36da8609cf87709ec849a15615 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:00:45 +0700 Subject: [PATCH 15/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..f7edf9d4d --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488041833}} \ No newline at end of file From 26af5957aad387d99c20c1c1b5ed5b1888e74fb3 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:00:47 +0700 Subject: [PATCH 16/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index f7edf9d4d..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488041833}} \ No newline at end of file From 2abe0c8ab5390e011bba2bd8154e16c46a23bc61 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:01:04 +0700 Subject: [PATCH 17/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..40ead0a22 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488060731}} \ No newline at end of file From 86e257ea8eac94960d5a8affcce29dc8459bf4e9 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:01:08 +0700 Subject: [PATCH 18/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 40ead0a22..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488060731}} \ No newline at end of file From 656238fde6d51dab01d82f36b540132482b5c7b3 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:01:37 +0700 Subject: [PATCH 19/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..dfdeb324c --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488094314}} \ No newline at end of file From f5dab56891b1843bfce931f5a0a5cd2e3c5bacee Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:01:40 +0700 Subject: [PATCH 20/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index dfdeb324c..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488094314}} \ No newline at end of file From 8e94d7cba04519e3b2ae1dda612e3293620b845c Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:01:53 +0700 Subject: [PATCH 21/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..8d5913f94 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488110762}} \ No newline at end of file From 3387f279607b9bdf57823ccd5118bd206a0e8bb3 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:01:56 +0700 Subject: [PATCH 22/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 8d5913f94..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488110762}} \ No newline at end of file From db79ca6bb3a775a6dad584add40585184b6d2df4 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:02:11 +0700 Subject: [PATCH 23/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..ea2421f71 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488127847}} \ No newline at end of file From ff023c4cd5474ce94d19df5f1f144d260722f94b Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:02:13 +0700 Subject: [PATCH 24/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index ea2421f71..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488127847}} \ No newline at end of file From 625ae0dfbe86a61720a413de080ae20d7dafe8ad Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:03:07 +0700 Subject: [PATCH 25/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..e3b41bb5e --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488184168}} \ No newline at end of file From a238496e1eeb5f08cae5ef54f2c42cf8444ec266 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:03:10 +0700 Subject: [PATCH 26/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index e3b41bb5e..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488184168}} \ No newline at end of file From f7ddf44f635cfa871eecf26f9b835f056abcd7bc Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:03:43 +0700 Subject: [PATCH 27/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..1072d8bc4 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488219540}} \ No newline at end of file From bba450bb13ffe5dab9d443c51f5f4f304305904b Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:03:45 +0700 Subject: [PATCH 28/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 1072d8bc4..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488219540}} \ No newline at end of file From 169a8d2478610519be94b189bd49946c73c91aac Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:04:18 +0700 Subject: [PATCH 29/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..a4d0bd448 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488255196}} \ No newline at end of file From fae9ef2d26975dff11a13f1e3176c16ecd1e3bd5 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:04:20 +0700 Subject: [PATCH 30/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index a4d0bd448..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488255196}} \ No newline at end of file From f5ffe0bbeb497b2c2732e9c5b867f894157fe675 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:06:57 +0700 Subject: [PATCH 31/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..cbe9070ad --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488413764}} \ No newline at end of file From 162975f012682a14bb9120dbc86ab1b9321c05f1 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:07:00 +0700 Subject: [PATCH 32/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index cbe9070ad..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488413764}} \ No newline at end of file From a4e94d5b933a9dad7ab997be22c8395fb04d45af Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:08:10 +0700 Subject: [PATCH 33/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..940e504dd --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488486221}} \ No newline at end of file From 4c96a1b63f86732922236240445c5e719eeedabf Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:08:12 +0700 Subject: [PATCH 34/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 940e504dd..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488486221}} \ No newline at end of file From 694951368daa3edbdd7272a6b4b0851d68cfbbf5 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:11:40 +0700 Subject: [PATCH 35/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..368b4b07f --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726488696499}} \ No newline at end of file From 2258562c32f2cc44d4512c3aedb49dbf88bcf128 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:11:42 +0700 Subject: [PATCH 36/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 368b4b07f..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726488696499}} \ No newline at end of file From 2761a48569a726f7a52b94a6a7d516b090ed926a Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:20:53 +0700 Subject: [PATCH 37/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..d4f28a6a2 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726489250159}} \ No newline at end of file From 94574b75fa9ed1fd9cbcb1e560ab6337d0938336 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:20:56 +0700 Subject: [PATCH 38/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index d4f28a6a2..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726489250159}} \ No newline at end of file From acbfc99de6439cf66fafc6c8daa31b88f4c39e11 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:25:56 +0700 Subject: [PATCH 39/53] chore: update options params --- core/map/map.ts | 121 ++++++++++-------------------------------------- 1 file changed, 25 insertions(+), 96 deletions(-) diff --git a/core/map/map.ts b/core/map/map.ts index f381a1d52..0f510eef5 100644 --- a/core/map/map.ts +++ b/core/map/map.ts @@ -2,10 +2,10 @@ import { Octokit } from "npm:@octokit/rest"; type StoreOptions = { + token?: string; owner: string; repo: string; path: string; - token?: string; branch?: string; } | null; @@ -188,31 +188,20 @@ export class Store { } } - private async saveToGitHub( - options: { - token?: string; - owner: string; - repo: string; - path: string; - branch?: string; - }, - ) { + private async saveToGitHub(options: StoreOptions) { try { - if (!options.token) throw new Error("GITHUB_TOKEN is needed"); - if (this.options) { - const record = mapToRecord(this.map); - const data = JSON.stringify(record); - return await uploadFileToGitHub( - { - token: options.token, - owner: options.owner, - repo: options.repo, - path: options.path, - content: data, - branch: options.branch, - }, - ); + if (!options || !options.token) { + throw new Error("GITHUB_TOKEN is needed"); } + const opt = { + token: options.token, + owner: options.owner, + repo: options.repo, + path: options.path, + branch: options.branch, + content: JSON.stringify(mapToRecord(this.map)), + }; + return await uploadFileToGitHub(opt); } catch (error) { throw error; } @@ -245,16 +234,8 @@ function mapToRecord( return Object.fromEntries(map) as Record; } -async function getSHA( - options: { - token?: string; - owner: string; - repo: string; - path: string; - branch?: string; - }, -): Promise { - if (!options.token) throw new Error("GITHUB_TOKEN is needed"); +async function getSHA(options: StoreOptions): Promise { + if (!options || !options.token) throw new Error("GITHUB_TOKEN is needed"); const octokit = new Octokit({ auth: options.token }); try { const response = await octokit.repos.getContent({ @@ -282,26 +263,8 @@ async function uploadFileToGitHub( ) { const octokit = new Octokit({ auth: options.token }); try { - const res = await getFileFromGithub( - { - token: options.token, - owner: options.owner, - repo: options.repo, - path: options.path, - branch: options.branch, - }, - ) as any; - - const sha = res - ? await getSHA({ - token: options.token, - owner: options.owner, - repo: options.repo, - path: options.path, - branch: options.branch, - }) - : undefined; - + const res = await getFileFromGithub(options); + const sha = res ? await getSHA(options) : undefined; const message = res ? `Update ${options.path}` : `Create ${options.path}`; @@ -320,37 +283,17 @@ async function uploadFileToGitHub( } async function getMap( - options: { - token?: string; - owner: string; - repo: string; - path: string; - branch?: string; - }, + options: StoreOptions, ) { - if (!options.token) throw new Error("GITHUB_TOKEN is needed"); - const rr = await getFileFromGithub( - { - token: options.token, - owner: options.owner, - repo: options.repo, - path: options.path, - branch: options.branch, - }, - ) as any; + if (!options || !options.token) throw new Error("GITHUB_TOKEN is needed"); + const rr = await getFileFromGithub(options) as any; if (!rr) return; const data = atob(rr.content); return recordToMap(JSON.parse(data)); } -async function getFileFromGithub(options: { - token?: string; - owner: string; - repo: string; - path: string; - branch?: string; -}) { - if (!options.token) throw new Error("GITHUB_TOKEN is needed"); +async function getFileFromGithub(options: StoreOptions) { + if (!options || !options.token) throw new Error("GITHUB_TOKEN is needed"); const octokit = new Octokit({ auth: options.token }); try { const res = await octokit.repos.getContent({ @@ -365,25 +308,11 @@ async function getFileFromGithub(options: { } } -async function deleteGithubFile( - options: { - token?: string; - owner: string; - repo: string; - path: string; - branch?: string; - }, -) { - if (!options.token) throw new Error("GITHUB_TOKEN is needed"); +async function deleteGithubFile(options: StoreOptions) { + if (!options || !options.token) throw new Error("GITHUB_TOKEN is needed"); const octokit = new Octokit({ auth: options.token }); try { - const sha = await getSHA({ - token: options.token, - owner: options.owner, - repo: options.repo, - path: options.path, - branch: options.branch, - }); + const sha = await getSHA(options); if (!sha) throw new Error("SHA is needed"); const res = await octokit.repos.deleteFile({ owner: options.owner, From 60b65fd82d53ce83335691605cbfc32e49cc8097 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:32:03 +0700 Subject: [PATCH 40/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..3838fb400 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726489920166}} \ No newline at end of file From af8f35ef3107729fef2fb63547d0a93b99d766d3 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:32:05 +0700 Subject: [PATCH 41/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 3838fb400..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726489920166}} \ No newline at end of file From 730f45c263446e709459a064bafce169fe764036 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:35:33 +0700 Subject: [PATCH 42/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..4c09e5d2f --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726490129244}} \ No newline at end of file From 915366b4459d7df2692fce8e7e76e665c247d631 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:35:35 +0700 Subject: [PATCH 43/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 4c09e5d2f..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726490129244}} \ No newline at end of file From 372eb18c052f48d546dce8285cb9b9337fe2e6fa Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:36:58 +0700 Subject: [PATCH 44/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..203b01b51 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726490214179}} \ No newline at end of file From bb07c58ef3c37fa6c8c5c701abc93b3f4df0fae1 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:37:00 +0700 Subject: [PATCH 45/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 203b01b51..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726490214179}} \ No newline at end of file From 7796b7624509510203209fa1c6cfafa34e6f8331 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:41:31 +0700 Subject: [PATCH 46/53] chore: use GH_TOKEN as alternative of GITHUB_TOKEN --- core/map/map.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/map/map.ts b/core/map/map.ts index 0f510eef5..bd300fb6d 100644 --- a/core/map/map.ts +++ b/core/map/map.ts @@ -190,6 +190,7 @@ export class Store { private async saveToGitHub(options: StoreOptions) { try { + console.log("options ==>", options); if (!options || !options.token) { throw new Error("GITHUB_TOKEN is needed"); } From f12ffc72b6ec23d9b95506e8c01c836913ee49e1 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:50:27 +0700 Subject: [PATCH 47/53] chore: use GH_TOKEN as alternative of GITHUB_TOKEN --- .github/workflows/build.yml | 2 ++ core/map/map.test.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d18c18c81..01b3da42c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,8 @@ jobs: deno-version: vx.x.x - name: Run tests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: deno task test - name: Generate report diff --git a/core/map/map.test.ts b/core/map/map.test.ts index 9a46315e7..5c96c6c3d 100644 --- a/core/map/map.test.ts +++ b/core/map/map.test.ts @@ -57,7 +57,7 @@ Deno.test("Store: size method returns correct count", () => { const d = new Date(); const time = d.getTime(); -const token = Deno.env.get("GITHUB_TOKEN") || Deno.env.get("GH_TOKEN"); +const token = Deno.env.get("GITHUB_TOKEN"); Deno.test("Store: save it to github", async () => { const expiringMap = new Store({ owner: "fastrodev", From 2ea150efb926d6078cf7c55d44f4db3b2ba7ccd0 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:54:11 +0700 Subject: [PATCH 48/53] chore: use GH_TOKEN as alternative of GITHUB_TOKEN --- .github/workflows/build.yml | 4 +--- .github/workflows/merge.yml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01b3da42c..b7693dcd0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,9 +21,7 @@ jobs: deno-version: vx.x.x - name: Run tests - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: deno task test + run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} deno task test - name: Generate report run: deno task coverage diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index b2aaca912..f61b1c8e3 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -24,7 +24,7 @@ jobs: - run: deno lint --unstable-kv examples - name: Run tests - run: deno task test + run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} deno task test - name: Generate report run: deno task coverage From eb9871bca3299dcec6b6a9dc75f5c608c3baf6ad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:54:51 +0000 Subject: [PATCH 49/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..09a453b50 --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726491289509}} \ No newline at end of file From 9d1ff08f6c86522258e4cdb9b3a18d7f3fe4c640 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:54:53 +0000 Subject: [PATCH 50/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 09a453b50..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726491289509}} \ No newline at end of file From 9d9b8e3af6329468294714ed611caadcc46d0c59 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:55:28 +0700 Subject: [PATCH 51/53] chore: remove debug --- core/map/map.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/core/map/map.ts b/core/map/map.ts index bd300fb6d..0f510eef5 100644 --- a/core/map/map.ts +++ b/core/map/map.ts @@ -190,7 +190,6 @@ export class Store { private async saveToGitHub(options: StoreOptions) { try { - console.log("options ==>", options); if (!options || !options.token) { throw new Error("GITHUB_TOKEN is needed"); } From 3e563a9a54f3b9930f177f81e5deb518cdb60449 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:56:52 +0000 Subject: [PATCH 52/53] Create modules/store/records.json --- modules/store/records.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json new file mode 100644 index 000000000..478a4141b --- /dev/null +++ b/modules/store/records.json @@ -0,0 +1 @@ +{"key1":{"value":1726491410157}} \ No newline at end of file From 7048dacfdd228d3f53499021a221f31091800cbf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:56:54 +0000 Subject: [PATCH 53/53] Delete modules/store/records.json --- modules/store/records.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 modules/store/records.json diff --git a/modules/store/records.json b/modules/store/records.json deleted file mode 100644 index 478a4141b..000000000 --- a/modules/store/records.json +++ /dev/null @@ -1 +0,0 @@ -{"key1":{"value":1726491410157}} \ No newline at end of file