(id: string, payload: AdapterPayload, expiresIn: number)
| 76 | } |
| 77 | |
| 78 | upsert(id: string, payload: AdapterPayload, expiresIn: number) { |
| 79 | const key = this.key(id); |
| 80 | |
| 81 | if (payload.grantId) { |
| 82 | const grantKey = grantKeyFor(payload.grantId); |
| 83 | const grant = (storage.get(grantKey) as string[]) || []; |
| 84 | if (!grant.includes(key)) grant.push(key); |
| 85 | storage.set(grantKey, grant); |
| 86 | } |
| 87 | |
| 88 | if (payload.userCode) { |
| 89 | storage.set(userCodeKeyFor(payload.userCode), id); |
| 90 | } |
| 91 | |
| 92 | storage.set(key, payload, {ttl: expiresIn * 1000}); |
| 93 | return Promise.resolve(); |
| 94 | } |
| 95 | |
| 96 | findByUid(uid: string): Promise<AdapterPayload | void | undefined> { |
| 97 | for (const [_, value] of storage.entries()) { |
no test coverage detected