@auth/fauna-adapter 3.0.0 → 3.2.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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <img src="https://img.shields.io/npm/dm/@auth/fauna-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
19
19
  </a>
20
20
  <a href="https://github.com/nextauthjs/next-auth/stargazers">
21
- <img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
21
+ <img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="GitHub Stars" />
22
22
  </a>
23
23
  </p>
24
24
  </p>
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * <div style={{display: "flex", justifyContent: "space-between", alignItems: "center", padding: "16px"}}>
3
- * <p style={{fontWeight: "300"}}>Official <a href="https://docs.fauna.com/fauna/current/">Fauna</a> adapter for Auth.js / NextAuth.js.</p>
3
+ * <p>Official <a href="https://docs.fauna.com/fauna/current/">Fauna</a> adapter for Auth.js / NextAuth.js.</p>
4
4
  * <a href="https://fauna.com/features">
5
- * <img style={{display: "block"}} src="https://authjs.dev/img/adapters/fauna.svg" height="30"/>
5
+ * <img style={{display: "block"}} src="https://authjs.dev/img/adapters/fauna.svg" width="64" />
6
6
  * </a>
7
7
  * </div>
8
8
  *
@@ -33,179 +33,6 @@ type AdapterConfig = {
33
33
  verificationToken: string;
34
34
  };
35
35
  };
36
- /**
37
- *
38
- * ## Setup
39
- *
40
- * This is the Fauna Adapter for [Auth.js](https://authjs.dev). This package can only be used in conjunction with the primary `next-auth` and other framework packages. It is not a standalone package.
41
- *
42
- * You can find the Fauna schema and seed information in the docs at [authjs.dev/reference/adapter/fauna](https://authjs.dev/reference/adapter/fauna).
43
- *
44
- * ### Configure Auth.js
45
- *
46
- * ```js title="pages/api/auth/[...nextauth].js"
47
- * import NextAuth from "next-auth"
48
- * import { Client } from "fauna"
49
- * import { FaunaAdapter } from "@auth/fauna-adapter"
50
- *
51
- * const client = new Client({
52
- * secret: "secret",
53
- * endpoint: new URL('http://localhost:8443')
54
- * })
55
- *
56
- * // For more information on each option (and a full list of options) go to
57
- * // https://authjs.dev/reference/core/types#authconfig
58
- * export default NextAuth({
59
- * // https://authjs.dev/getting-started/authentication/oauth
60
- * providers: [],
61
- * adapter: FaunaAdapter(client)
62
- * })
63
- * ```
64
- *
65
- * ### Schema
66
- *
67
- * Run the following FQL code inside the `Shell` tab in the Fauna dashboard to set up the appropriate collections and indexes.
68
- *
69
- * ```javascript
70
- * Collection.create({
71
- * name: "Account",
72
- * indexes: {
73
- * byUserId: {
74
- * terms: [
75
- * { field: "userId" }
76
- * ]
77
- * },
78
- * byProviderAndProviderAccountId: {
79
- * terms [
80
- * { field: "provider" },
81
- * { field: "providerAccountId" }
82
- * ]
83
- * },
84
- * }
85
- * })
86
- * Collection.create({
87
- * name: "Session",
88
- * constraints: [
89
- * {
90
- * unique: ["sessionToken"],
91
- * status: "active",
92
- * }
93
- * ],
94
- * indexes: {
95
- * bySessionToken: {
96
- * terms: [
97
- * { field: "sessionToken" }
98
- * ]
99
- * },
100
- * byUserId: {
101
- * terms [
102
- * { field: "userId" }
103
- * ]
104
- * },
105
- * }
106
- * })
107
- * Collection.create({
108
- * name: "User",
109
- * constraints: [
110
- * {
111
- * unique: ["email"],
112
- * status: "active",
113
- * }
114
- * ],
115
- * indexes: {
116
- * byEmail: {
117
- * terms [
118
- * { field: "email" }
119
- * ]
120
- * },
121
- * }
122
- * })
123
- * Collection.create({
124
- * name: "VerificationToken",
125
- * indexes: {
126
- * byIdentifierAndToken: {
127
- * terms [
128
- * { field: "identifier" },
129
- * { field: "token" }
130
- * ]
131
- * },
132
- * }
133
- * })
134
- * ```
135
- *
136
- * > This schema is adapted for use in Fauna and based upon our main [schema](https://authjs.dev/reference/core/adapters#models)
137
- *
138
- * #### Custom collection names
139
- * If you want to use custom collection names, you can pass them as an option to the adapter, like this:
140
- *
141
- * ```javascript
142
- * FaunaAdapter(client, {
143
- * collectionNames: {
144
- * user: "CustomUser",
145
- * account: "CustomAccount",
146
- * session: "CustomSession",
147
- * verificationToken: "CustomVerificationToken",
148
- * }
149
- * })
150
- * ```
151
- *
152
- * Make sure the collection names you pass to the provider match the collection names of your Fauna database.
153
- *
154
- * ### Migrating from v1
155
- * In v2, we've renamed the collections to use uppercase naming, in accordance with Fauna best practices. If you're migrating from v1, you'll need to rename your collections to match the new naming scheme.
156
- * Additionally, we've renamed the indexes to match the new method-like index names.
157
- *
158
- * #### Migration script
159
- * Run this FQL script inside a Fauna shell for the database you're migrating from v1 to v2 (it will rename your collections and indexes to match):
160
- *
161
- * ```javascript
162
- * Collection.byName("accounts")!.update({
163
- * name: "Account"
164
- * indexes: {
165
- * byUserId: {
166
- * terms: [{ field: "userId" }]
167
- * },
168
- * byProviderAndProviderAccountId: {
169
- * terms: [{ field: "provider" }, { field: "providerAccountId" }]
170
- * },
171
- * account_by_provider_and_provider_account_id: null,
172
- * accounts_by_user_id: null
173
- * }
174
- * })
175
- * Collection.byName("sessions")!.update({
176
- * name: "Session",
177
- * indexes: {
178
- * bySessionToken: {
179
- * terms: [{ field: "sessionToken" }]
180
- * },
181
- * byUserId: {
182
- * terms: [{ field: "userId" }]
183
- * },
184
- * session_by_session_token: null,
185
- * sessions_by_user_id: null
186
- * }
187
- * })
188
- * Collection.byName("users")!.update({
189
- * name: "User",
190
- * indexes: {
191
- * byEmail: {
192
- * terms: [{ field: "email" }]
193
- * },
194
- * user_by_email: null
195
- * }
196
- * })
197
- * Collection.byName("verification_tokens")!.update({
198
- * name: "VerificationToken",
199
- * indexes: {
200
- * byIdentifierAndToken: {
201
- * terms: [{ field: "identifier" }, { field: "token" }]
202
- * },
203
- * verification_token_by_identifier_and_token: null
204
- * }
205
- * })
206
- * ```
207
- *
208
- **/
209
36
  export declare function FaunaAdapter(client: Client, config?: AdapterConfig): Adapter;
210
37
  export declare const format: {
211
38
  /** Takes an object that's coming from the database and converts it to plain JavaScript. */
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,MAAM,EACN,QAAQ,EAGR,UAAU,EACV,gBAAgB,EAEjB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,qBAAqB,CAAA;AAE5B,KAAK,OAAO,CAAC,CAAC,IAAI;KACf,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GACpC,QAAQ,GAAG,IAAI,GACf,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACpB,IAAI,GACJ,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,GACrB,CAAC,CAAC,CAAC,CAAC,GACJ,gBAAgB;CACzB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAC5C,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAClD,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAElD,KAAK,aAAa,GAAG;IACnB,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,iBAAiB,EAAE,MAAM,CAAA;KAC1B,CAAA;CACF,CAAA;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4KI;AACJ,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAsI5E;AAED,eAAO,MAAM,MAAM;IACjB,2FAA2F;qBAC3E,OAAO,MAAM,EAAE,GAAG,CAAC;IASnC,gGAAgG;oBAClF,OAAO,MAAM,EAAE,GAAG,CAAC;CAUlC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,MAAM,EACN,QAAQ,EAGR,UAAU,EACV,gBAAgB,EAEjB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,qBAAqB,CAAA;AAE5B,KAAK,OAAO,CAAC,CAAC,IAAI;KACf,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GACpC,QAAQ,GAAG,IAAI,GACf,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACpB,IAAI,GACJ,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,GACrB,CAAC,CAAC,CAAC,CAAC,GACJ,gBAAgB;CACzB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAC5C,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAClD,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAElD,KAAK,aAAa,GAAG;IACnB,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,iBAAiB,EAAE,MAAM,CAAA;KAC1B,CAAA;CACF,CAAA;AASD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAsI5E;AAED,eAAO,MAAM,MAAM;IACjB,2FAA2F;qBAC3E,OAAO,MAAM,EAAE,GAAG,CAAC;IASnC,gGAAgG;oBAClF,OAAO,MAAM,EAAE,GAAG,CAAC;CAUlC,CAAA"}
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * <div style={{display: "flex", justifyContent: "space-between", alignItems: "center", padding: "16px"}}>
3
- * <p style={{fontWeight: "300"}}>Official <a href="https://docs.fauna.com/fauna/current/">Fauna</a> adapter for Auth.js / NextAuth.js.</p>
3
+ * <p>Official <a href="https://docs.fauna.com/fauna/current/">Fauna</a> adapter for Auth.js / NextAuth.js.</p>
4
4
  * <a href="https://fauna.com/features">
5
- * <img style={{display: "block"}} src="https://authjs.dev/img/adapters/fauna.svg" height="30"/>
5
+ * <img style={{display: "block"}} src="https://authjs.dev/img/adapters/fauna.svg" width="64" />
6
6
  * </a>
7
7
  * </div>
8
8
  *
@@ -21,179 +21,6 @@ const defaultCollectionNames = {
21
21
  account: "Account",
22
22
  verificationToken: "VerificationToken",
23
23
  };
24
- /**
25
- *
26
- * ## Setup
27
- *
28
- * This is the Fauna Adapter for [Auth.js](https://authjs.dev). This package can only be used in conjunction with the primary `next-auth` and other framework packages. It is not a standalone package.
29
- *
30
- * You can find the Fauna schema and seed information in the docs at [authjs.dev/reference/adapter/fauna](https://authjs.dev/reference/adapter/fauna).
31
- *
32
- * ### Configure Auth.js
33
- *
34
- * ```js title="pages/api/auth/[...nextauth].js"
35
- * import NextAuth from "next-auth"
36
- * import { Client } from "fauna"
37
- * import { FaunaAdapter } from "@auth/fauna-adapter"
38
- *
39
- * const client = new Client({
40
- * secret: "secret",
41
- * endpoint: new URL('http://localhost:8443')
42
- * })
43
- *
44
- * // For more information on each option (and a full list of options) go to
45
- * // https://authjs.dev/reference/core/types#authconfig
46
- * export default NextAuth({
47
- * // https://authjs.dev/getting-started/authentication/oauth
48
- * providers: [],
49
- * adapter: FaunaAdapter(client)
50
- * })
51
- * ```
52
- *
53
- * ### Schema
54
- *
55
- * Run the following FQL code inside the `Shell` tab in the Fauna dashboard to set up the appropriate collections and indexes.
56
- *
57
- * ```javascript
58
- * Collection.create({
59
- * name: "Account",
60
- * indexes: {
61
- * byUserId: {
62
- * terms: [
63
- * { field: "userId" }
64
- * ]
65
- * },
66
- * byProviderAndProviderAccountId: {
67
- * terms [
68
- * { field: "provider" },
69
- * { field: "providerAccountId" }
70
- * ]
71
- * },
72
- * }
73
- * })
74
- * Collection.create({
75
- * name: "Session",
76
- * constraints: [
77
- * {
78
- * unique: ["sessionToken"],
79
- * status: "active",
80
- * }
81
- * ],
82
- * indexes: {
83
- * bySessionToken: {
84
- * terms: [
85
- * { field: "sessionToken" }
86
- * ]
87
- * },
88
- * byUserId: {
89
- * terms [
90
- * { field: "userId" }
91
- * ]
92
- * },
93
- * }
94
- * })
95
- * Collection.create({
96
- * name: "User",
97
- * constraints: [
98
- * {
99
- * unique: ["email"],
100
- * status: "active",
101
- * }
102
- * ],
103
- * indexes: {
104
- * byEmail: {
105
- * terms [
106
- * { field: "email" }
107
- * ]
108
- * },
109
- * }
110
- * })
111
- * Collection.create({
112
- * name: "VerificationToken",
113
- * indexes: {
114
- * byIdentifierAndToken: {
115
- * terms [
116
- * { field: "identifier" },
117
- * { field: "token" }
118
- * ]
119
- * },
120
- * }
121
- * })
122
- * ```
123
- *
124
- * > This schema is adapted for use in Fauna and based upon our main [schema](https://authjs.dev/reference/core/adapters#models)
125
- *
126
- * #### Custom collection names
127
- * If you want to use custom collection names, you can pass them as an option to the adapter, like this:
128
- *
129
- * ```javascript
130
- * FaunaAdapter(client, {
131
- * collectionNames: {
132
- * user: "CustomUser",
133
- * account: "CustomAccount",
134
- * session: "CustomSession",
135
- * verificationToken: "CustomVerificationToken",
136
- * }
137
- * })
138
- * ```
139
- *
140
- * Make sure the collection names you pass to the provider match the collection names of your Fauna database.
141
- *
142
- * ### Migrating from v1
143
- * In v2, we've renamed the collections to use uppercase naming, in accordance with Fauna best practices. If you're migrating from v1, you'll need to rename your collections to match the new naming scheme.
144
- * Additionally, we've renamed the indexes to match the new method-like index names.
145
- *
146
- * #### Migration script
147
- * Run this FQL script inside a Fauna shell for the database you're migrating from v1 to v2 (it will rename your collections and indexes to match):
148
- *
149
- * ```javascript
150
- * Collection.byName("accounts")!.update({
151
- * name: "Account"
152
- * indexes: {
153
- * byUserId: {
154
- * terms: [{ field: "userId" }]
155
- * },
156
- * byProviderAndProviderAccountId: {
157
- * terms: [{ field: "provider" }, { field: "providerAccountId" }]
158
- * },
159
- * account_by_provider_and_provider_account_id: null,
160
- * accounts_by_user_id: null
161
- * }
162
- * })
163
- * Collection.byName("sessions")!.update({
164
- * name: "Session",
165
- * indexes: {
166
- * bySessionToken: {
167
- * terms: [{ field: "sessionToken" }]
168
- * },
169
- * byUserId: {
170
- * terms: [{ field: "userId" }]
171
- * },
172
- * session_by_session_token: null,
173
- * sessions_by_user_id: null
174
- * }
175
- * })
176
- * Collection.byName("users")!.update({
177
- * name: "User",
178
- * indexes: {
179
- * byEmail: {
180
- * terms: [{ field: "email" }]
181
- * },
182
- * user_by_email: null
183
- * }
184
- * })
185
- * Collection.byName("verification_tokens")!.update({
186
- * name: "VerificationToken",
187
- * indexes: {
188
- * byIdentifierAndToken: {
189
- * terms: [{ field: "identifier" }, { field: "token" }]
190
- * },
191
- * verification_token_by_identifier_and_token: null
192
- * }
193
- * })
194
- * ```
195
- *
196
- **/
197
24
  export function FaunaAdapter(client, config) {
198
25
  const { collectionNames = defaultCollectionNames } = config || {};
199
26
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth/fauna-adapter",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Fauna Adapter for Auth.js",
5
5
  "homepage": "https://authjs.dev",
6
6
  "repository": "https://github.com/nextauthjs/next-auth",
@@ -38,7 +38,7 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@auth/core": "0.30.0"
41
+ "@auth/core": "0.32.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "fauna": "^1.3.1"
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * <div style={{display: "flex", justifyContent: "space-between", alignItems: "center", padding: "16px"}}>
3
- * <p style={{fontWeight: "300"}}>Official <a href="https://docs.fauna.com/fauna/current/">Fauna</a> adapter for Auth.js / NextAuth.js.</p>
3
+ * <p>Official <a href="https://docs.fauna.com/fauna/current/">Fauna</a> adapter for Auth.js / NextAuth.js.</p>
4
4
  * <a href="https://fauna.com/features">
5
- * <img style={{display: "block"}} src="https://authjs.dev/img/adapters/fauna.svg" height="30"/>
5
+ * <img style={{display: "block"}} src="https://authjs.dev/img/adapters/fauna.svg" width="64" />
6
6
  * </a>
7
7
  * </div>
8
8
  *
@@ -63,179 +63,6 @@ const defaultCollectionNames = {
63
63
  verificationToken: "VerificationToken",
64
64
  }
65
65
 
66
- /**
67
- *
68
- * ## Setup
69
- *
70
- * This is the Fauna Adapter for [Auth.js](https://authjs.dev). This package can only be used in conjunction with the primary `next-auth` and other framework packages. It is not a standalone package.
71
- *
72
- * You can find the Fauna schema and seed information in the docs at [authjs.dev/reference/adapter/fauna](https://authjs.dev/reference/adapter/fauna).
73
- *
74
- * ### Configure Auth.js
75
- *
76
- * ```js title="pages/api/auth/[...nextauth].js"
77
- * import NextAuth from "next-auth"
78
- * import { Client } from "fauna"
79
- * import { FaunaAdapter } from "@auth/fauna-adapter"
80
- *
81
- * const client = new Client({
82
- * secret: "secret",
83
- * endpoint: new URL('http://localhost:8443')
84
- * })
85
- *
86
- * // For more information on each option (and a full list of options) go to
87
- * // https://authjs.dev/reference/core/types#authconfig
88
- * export default NextAuth({
89
- * // https://authjs.dev/getting-started/authentication/oauth
90
- * providers: [],
91
- * adapter: FaunaAdapter(client)
92
- * })
93
- * ```
94
- *
95
- * ### Schema
96
- *
97
- * Run the following FQL code inside the `Shell` tab in the Fauna dashboard to set up the appropriate collections and indexes.
98
- *
99
- * ```javascript
100
- * Collection.create({
101
- * name: "Account",
102
- * indexes: {
103
- * byUserId: {
104
- * terms: [
105
- * { field: "userId" }
106
- * ]
107
- * },
108
- * byProviderAndProviderAccountId: {
109
- * terms [
110
- * { field: "provider" },
111
- * { field: "providerAccountId" }
112
- * ]
113
- * },
114
- * }
115
- * })
116
- * Collection.create({
117
- * name: "Session",
118
- * constraints: [
119
- * {
120
- * unique: ["sessionToken"],
121
- * status: "active",
122
- * }
123
- * ],
124
- * indexes: {
125
- * bySessionToken: {
126
- * terms: [
127
- * { field: "sessionToken" }
128
- * ]
129
- * },
130
- * byUserId: {
131
- * terms [
132
- * { field: "userId" }
133
- * ]
134
- * },
135
- * }
136
- * })
137
- * Collection.create({
138
- * name: "User",
139
- * constraints: [
140
- * {
141
- * unique: ["email"],
142
- * status: "active",
143
- * }
144
- * ],
145
- * indexes: {
146
- * byEmail: {
147
- * terms [
148
- * { field: "email" }
149
- * ]
150
- * },
151
- * }
152
- * })
153
- * Collection.create({
154
- * name: "VerificationToken",
155
- * indexes: {
156
- * byIdentifierAndToken: {
157
- * terms [
158
- * { field: "identifier" },
159
- * { field: "token" }
160
- * ]
161
- * },
162
- * }
163
- * })
164
- * ```
165
- *
166
- * > This schema is adapted for use in Fauna and based upon our main [schema](https://authjs.dev/reference/core/adapters#models)
167
- *
168
- * #### Custom collection names
169
- * If you want to use custom collection names, you can pass them as an option to the adapter, like this:
170
- *
171
- * ```javascript
172
- * FaunaAdapter(client, {
173
- * collectionNames: {
174
- * user: "CustomUser",
175
- * account: "CustomAccount",
176
- * session: "CustomSession",
177
- * verificationToken: "CustomVerificationToken",
178
- * }
179
- * })
180
- * ```
181
- *
182
- * Make sure the collection names you pass to the provider match the collection names of your Fauna database.
183
- *
184
- * ### Migrating from v1
185
- * In v2, we've renamed the collections to use uppercase naming, in accordance with Fauna best practices. If you're migrating from v1, you'll need to rename your collections to match the new naming scheme.
186
- * Additionally, we've renamed the indexes to match the new method-like index names.
187
- *
188
- * #### Migration script
189
- * Run this FQL script inside a Fauna shell for the database you're migrating from v1 to v2 (it will rename your collections and indexes to match):
190
- *
191
- * ```javascript
192
- * Collection.byName("accounts")!.update({
193
- * name: "Account"
194
- * indexes: {
195
- * byUserId: {
196
- * terms: [{ field: "userId" }]
197
- * },
198
- * byProviderAndProviderAccountId: {
199
- * terms: [{ field: "provider" }, { field: "providerAccountId" }]
200
- * },
201
- * account_by_provider_and_provider_account_id: null,
202
- * accounts_by_user_id: null
203
- * }
204
- * })
205
- * Collection.byName("sessions")!.update({
206
- * name: "Session",
207
- * indexes: {
208
- * bySessionToken: {
209
- * terms: [{ field: "sessionToken" }]
210
- * },
211
- * byUserId: {
212
- * terms: [{ field: "userId" }]
213
- * },
214
- * session_by_session_token: null,
215
- * sessions_by_user_id: null
216
- * }
217
- * })
218
- * Collection.byName("users")!.update({
219
- * name: "User",
220
- * indexes: {
221
- * byEmail: {
222
- * terms: [{ field: "email" }]
223
- * },
224
- * user_by_email: null
225
- * }
226
- * })
227
- * Collection.byName("verification_tokens")!.update({
228
- * name: "VerificationToken",
229
- * indexes: {
230
- * byIdentifierAndToken: {
231
- * terms: [{ field: "identifier" }, { field: "token" }]
232
- * },
233
- * verification_token_by_identifier_and_token: null
234
- * }
235
- * })
236
- * ```
237
- *
238
- **/
239
66
  export function FaunaAdapter(client: Client, config?: AdapterConfig): Adapter {
240
67
  const { collectionNames = defaultCollectionNames } = config || {}
241
68