@@ -59,16 +59,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
59
59
}
60
60
} ;
61
61
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
62
- exports . Client = void 0 ;
62
+ exports . APIClient = void 0 ;
63
63
var axios_1 = __importStar ( require ( "axios" ) ) ;
64
64
var NullStorage_1 = require ( "./Storage/NullStorage" ) ;
65
65
var InvalidTokenError_1 = require ( "./Errors/InvalidTokenError" ) ;
66
66
var SignatureGenerator_1 = require ( "./SignatureGenerator" ) ;
67
67
var SignatureVerificationError_1 = require ( "./Errors/SignatureVerificationError" ) ;
68
68
var APIError_1 = require ( "./Errors/APIError" ) ;
69
69
var SignatureValidator_1 = require ( "./SignatureValidator" ) ;
70
- var Client = /** @class */ ( function ( ) {
71
- function Client ( config ) {
70
+ var APIClient = /** @class */ ( function ( ) {
71
+ function APIClient ( config ) {
72
72
this . config = config ;
73
73
this . config . cacheTtl = config . cacheTtl || 60 * 60 * 3 ;
74
74
this . config . secure = config . secure || false ;
@@ -80,7 +80,7 @@ var Client = /** @class */ (function () {
80
80
}
81
81
this . signatureGenerator = new SignatureGenerator_1 . SignatureGenerator ( ) ;
82
82
}
83
- Client . prototype . verifyAuthentication = function ( token ) {
83
+ APIClient . prototype . verifyAuthentication = function ( token ) {
84
84
return __awaiter ( this , void 0 , void 0 , function ( ) {
85
85
var path , response ;
86
86
return __generator ( this , function ( _a ) {
@@ -97,7 +97,7 @@ var Client = /** @class */ (function () {
97
97
} ) ;
98
98
} ) ;
99
99
} ;
100
- Client . prototype . authenticatedUser = function ( token , cache ) {
100
+ APIClient . prototype . authenticatedUser = function ( token , cache ) {
101
101
if ( cache === void 0 ) { cache = false ; }
102
102
return __awaiter ( this , void 0 , void 0 , function ( ) {
103
103
var path , response ;
@@ -116,7 +116,7 @@ var Client = /** @class */ (function () {
116
116
} ) ;
117
117
} ) ;
118
118
} ;
119
- Client . prototype . findUserById = function ( id , cache ) {
119
+ APIClient . prototype . findUserById = function ( id , cache ) {
120
120
if ( cache === void 0 ) { cache = false ; }
121
121
return __awaiter ( this , void 0 , void 0 , function ( ) {
122
122
var path , response ;
@@ -136,22 +136,22 @@ var Client = /** @class */ (function () {
136
136
} ) ;
137
137
} ) ;
138
138
} ;
139
- Client . prototype . invalidateTokenCache = function ( token ) {
139
+ APIClient . prototype . invalidateTokenCache = function ( token ) {
140
140
return __awaiter ( this , void 0 , void 0 , function ( ) {
141
141
return __generator ( this , function ( _a ) {
142
142
switch ( _a . label ) {
143
- case 0 : return [ 4 /*yield*/ , this . cache . delete ( "v1/authenticated/verify:" . concat ( token ) ) ] ;
143
+ case 0 : return [ 4 /*yield*/ , this . cache . delete ( "request: v1/authenticated/verify:" . concat ( token ) ) ] ;
144
144
case 1 :
145
145
_a . sent ( ) ;
146
- return [ 4 /*yield*/ , this . cache . delete ( "v1/authenticated/user:" . concat ( token ) ) ] ;
146
+ return [ 4 /*yield*/ , this . cache . delete ( "request: v1/authenticated/user:" . concat ( token ) ) ] ;
147
147
case 2 :
148
148
_a . sent ( ) ;
149
149
return [ 2 /*return*/ ] ;
150
150
}
151
151
} ) ;
152
152
} ) ;
153
153
} ;
154
- Client . prototype . purgeTokenCache = function ( ) {
154
+ APIClient . prototype . purgeTokenCache = function ( ) {
155
155
return __awaiter ( this , void 0 , void 0 , function ( ) {
156
156
return __generator ( this , function ( _a ) {
157
157
switch ( _a . label ) {
@@ -163,7 +163,7 @@ var Client = /** @class */ (function () {
163
163
} ) ;
164
164
} ) ;
165
165
} ;
166
- Client . prototype . requestAndCache = function ( path , token , fields , cache ) {
166
+ APIClient . prototype . requestAndCache = function ( path , token , fields , cache ) {
167
167
if ( fields === void 0 ) { fields = { } ; }
168
168
if ( cache === void 0 ) { cache = true ; }
169
169
return __awaiter ( this , void 0 , void 0 , function ( ) {
@@ -232,7 +232,7 @@ var Client = /** @class */ (function () {
232
232
} ) ;
233
233
} ) ;
234
234
} ;
235
- Client . prototype . request = function ( path , fields , post ) {
235
+ APIClient . prototype . request = function ( path , fields , post ) {
236
236
if ( path === void 0 ) { path = '/' ; }
237
237
if ( fields === void 0 ) { fields = { } ; }
238
238
if ( post === void 0 ) { post = false ; }
@@ -289,17 +289,17 @@ var Client = /** @class */ (function () {
289
289
} ) ;
290
290
} ) ;
291
291
} ;
292
- Client . prototype . sanitizeToken = function ( token ) {
292
+ APIClient . prototype . sanitizeToken = function ( token ) {
293
293
var arr = token . split ( ' ' ) ;
294
294
return arr [ arr . length - 1 ] ;
295
295
} ;
296
- Client . prototype . forceCast = function ( input ) {
296
+ APIClient . prototype . forceCast = function ( input ) {
297
297
if ( input . expires_at ) {
298
298
input . expires_at = new Date ( input . expires_at ) ;
299
299
}
300
300
// @ts -ignore
301
301
return input ;
302
302
} ;
303
- return Client ;
303
+ return APIClient ;
304
304
} ( ) ) ;
305
- exports . Client = Client ;
305
+ exports . APIClient = APIClient ;
0 commit comments