11const assert = require ( 'assert' ) ;
2- const { deprecate } = require ( 'util' ) ;
32
43const uuid = require ( 'uuid/v4' ) ;
54const hash = require ( 'object-hash' ) ;
65
76const epochTime = require ( '../helpers/epoch_time' ) ;
87const instance = require ( '../helpers/weak_cache' ) ;
98
10- const deprecated = deprecate ( ( ) => { } , 'Session.find returning new sessions if none is found is deprecated' ) ;
11-
129const NON_REJECTABLE_CLAIMS = new Set ( [ 'sub' , 'sid' , 'auth_time' , 'acr' , 'amr' , 'iss' ] ) ;
1310const NON_REJECTABLE_SCOPES = new Set ( [ 'openid' ] ) ;
1411
@@ -169,7 +166,7 @@ module.exports = function getSession(provider) {
169166 return getterSetTransformation ( authorization . rejectedClaims ) ;
170167 }
171168
172- static async find ( id , { upsert = true } = { } ) {
169+ static async find ( id ) {
173170 assert ( id , 'id must be provided to Session#find' ) ;
174171 const data = await getAdapter ( ) . find ( id ) ;
175172 if ( data ) {
@@ -180,11 +177,7 @@ module.exports = function getSession(provider) {
180177 return new Session ( id , data ) ;
181178 }
182179 }
183- /* istanbul ignore if */
184- if ( upsert ) {
185- deprecated ( ) ;
186- return new Session ( id ) ;
187- }
180+
188181 return undefined ;
189182 }
190183
@@ -196,7 +189,7 @@ module.exports = function getSession(provider) {
196189
197190 let session ;
198191 if ( sessionId ) {
199- session = await this . find ( sessionId , { upsert : false } ) ;
192+ session = await this . find ( sessionId ) ;
200193 }
201194 if ( ! session ) {
202195 sessionId = uuid ( ) ;
0 commit comments