@auth/dynamodb-adapter 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -5
- package/package.json +2 -2
- package/src/index.ts +7 -13
package/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @module @auth/dynamodb-adapter
|
|
16
16
|
*/
|
|
17
17
|
import type { DynamoDBDocument } from "@aws-sdk/lib-dynamodb";
|
|
18
|
-
import type
|
|
18
|
+
import { type Adapter } from "@auth/core/adapters";
|
|
19
19
|
export interface DynamoDBAdapterOptions {
|
|
20
20
|
tableName?: string;
|
|
21
21
|
partitionKey?: string;
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,qBAAqB,CAAA;AAE5B,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CA+ST;AAED,QAAA,MAAM,MAAM;IACV,8EAA8E;eACnE,OAAO,MAAM,EAAE,GAAG,CAAC;IAY9B,sEAAsE;+CAC3B,OAAO,MAAM,EAAE,GAAG,CAAC;CAsB/D,CAAA;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC9D,gBAAgB,EAAE,MAAM,CAAA;IACxB,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChD,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnD,CAgBA;AAED,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAA"}
|
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module @auth/dynamodb-adapter
|
|
16
16
|
*/
|
|
17
|
+
import { isDate, } from "@auth/core/adapters";
|
|
17
18
|
export function DynamoDBAdapter(client, options) {
|
|
18
19
|
const TableName = options?.tableName ?? "next-auth";
|
|
19
20
|
const pk = options?.partitionKey ?? "pk";
|
|
@@ -309,11 +310,6 @@ export function DynamoDBAdapter(client, options) {
|
|
|
309
310
|
},
|
|
310
311
|
};
|
|
311
312
|
}
|
|
312
|
-
// https://github.com/honeinc/is-iso-date/blob/master/index.js
|
|
313
|
-
const isoDateRE = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;
|
|
314
|
-
function isDate(value) {
|
|
315
|
-
return value && isoDateRE.test(value) && !isNaN(Date.parse(value));
|
|
316
|
-
}
|
|
317
313
|
const format = {
|
|
318
314
|
/** Takes a plain old JavaScript object and turns it into a DynamoDB object */
|
|
319
315
|
to(object) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth/dynamodb-adapter",
|
|
3
3
|
"repository": "https://github.com/nextauthjs/next-auth",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"description": "AWS DynamoDB adapter for next-auth.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"next-auth",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/lib-dynamodb": "^3.36.1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@auth/core": "0.
|
|
47
|
+
"@auth/core": "0.33.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"test:default": "vitest -c ../utils/vitest.config.ts",
|
package/src/index.ts
CHANGED
|
@@ -19,12 +19,13 @@ import type {
|
|
|
19
19
|
BatchWriteCommandInput,
|
|
20
20
|
DynamoDBDocument,
|
|
21
21
|
} from "@aws-sdk/lib-dynamodb"
|
|
22
|
-
import
|
|
23
|
-
Adapter,
|
|
24
|
-
AdapterSession,
|
|
25
|
-
AdapterAccount,
|
|
26
|
-
AdapterUser,
|
|
27
|
-
VerificationToken,
|
|
22
|
+
import {
|
|
23
|
+
type Adapter,
|
|
24
|
+
type AdapterSession,
|
|
25
|
+
type AdapterAccount,
|
|
26
|
+
type AdapterUser,
|
|
27
|
+
type VerificationToken,
|
|
28
|
+
isDate,
|
|
28
29
|
} from "@auth/core/adapters"
|
|
29
30
|
|
|
30
31
|
export interface DynamoDBAdapterOptions {
|
|
@@ -344,13 +345,6 @@ export function DynamoDBAdapter(
|
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
347
|
|
|
347
|
-
// https://github.com/honeinc/is-iso-date/blob/master/index.js
|
|
348
|
-
const isoDateRE =
|
|
349
|
-
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
|
|
350
|
-
function isDate(value: any) {
|
|
351
|
-
return value && isoDateRE.test(value) && !isNaN(Date.parse(value))
|
|
352
|
-
}
|
|
353
|
-
|
|
354
348
|
const format = {
|
|
355
349
|
/** Takes a plain old JavaScript object and turns it into a DynamoDB object */
|
|
356
350
|
to(object: Record<string, any>) {
|