Skip to content

Commit

Permalink
fix: fix touch method
Browse files Browse the repository at this point in the history
  • Loading branch information
yutak23 committed Jan 10, 2024
1 parent d0094e4 commit 71be196
Show file tree
Hide file tree
Showing 5 changed files with 748 additions and 749 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-kit-connect-cloudflare-kv",
"version": "0.0.1",
"version": "0.0.2",
"description": "Cloudflare Workers KV session storage for svelte-kit-sessions.",
"author": "yutak23 <[email protected]> (https://github.com/yutak23)",
"repository": {
Expand Down Expand Up @@ -29,17 +29,17 @@
"ncu": "ncu"
},
"dependencies": {
"svelte-kit-sessions": "^0.0.6"
"svelte-kit-sessions": "^0.1.1"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231218.0",
"@tsconfig/node18": "^18.2.2",
"@tsconfig/recommended": "^1.0.3",
"@types/express": "^4.17.21",
"@types/node": "^18.19.4",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"@vitest/coverage-v8": "^1.1.2",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitest/coverage-v8": "^1.1.3",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
Expand All @@ -49,7 +49,7 @@
"npm-check-updates": "^16.14.12",
"prettier": "^3.1.1",
"typescript": "^5.3.3",
"vitest": "^1.1.2"
"vitest": "^1.1.3"
},
"files": [
"dist"
Expand Down
1 change: 0 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
{
"matchPackageNames": [
"@upstash/redis",
"svelte-kit-sessions",
"@tsconfig/node18",
"@tsconfig/recommended",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ export default class KvStore implements Store {
'ttl must be at least 60 * 1000. please refer to https://developers.cloudflare.com/workers/runtime-apis/kv#expiration-ttlhttps://developers.cloudflare.com/api/operations/workers-kv-namespace-write-multiple-key-value-pairs#request-body.'
);

const key = this.prefix + id;
const storeData = await this.get(key);
const storeData = await this.get(id);
if (storeData) {
const key = this.prefix + id;
const serialized = this.serializer.stringify(storeData);
await this.client.put(key, serialized, { expirationTtl: ttl / 1000 });
}
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const dumyCookieOptions: SessionCookieOptions = {
};

describe('Test RedisStore', () => {
describe('client is @upstash/redis', async () => {
describe('client is KVNamespace', async () => {
const ns = (await mf.getKVNamespace('TEST_NAMESPACE')) as KVNamespace;
const store = new KvStore({ client: ns });

Expand Down
Loading

0 comments on commit 71be196

Please sign in to comment.