Skip to content

Commit

Permalink
Merge pull request #981 from US-Trustee-Program/dependency-updates-auto
Browse files Browse the repository at this point in the history
Update NPM packages
  • Loading branch information
jamesobrooks authored Oct 16, 2024
2 parents 9eeb146 + ed53810 commit 63e53e4
Show file tree
Hide file tree
Showing 10 changed files with 2,761 additions and 559 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { CamsSession } from '../../../../../common/src/cams/session';
import { UserSessionCacheRepository } from './user-session-cache.repository';
import { UnauthorizedError } from '../../common-errors/unauthorized-error';
import { CamsJwtClaims } from '../../../../../common/src/cams/jwt';
import { getCamsError } from '../../common-errors/error-utilities';
import { isConflictError } from '../../use-cases/user-session/user-session';

const MODULE_NAME: string = 'COSMOS_DB_REPOSITORY_USER_SESSION_CACHE';
const CONTAINER_NAME: string = 'user-session-cache';
Expand Down Expand Up @@ -38,7 +40,14 @@ export class UserSessionCacheCosmosDbRepository implements UserSessionCacheRepos
],
};

const cached = await this.repo.query(context, querySpec);
let cached;
try {
cached = await this.repo.query(context, querySpec);
} catch (error) {
if (isConflictError(error)) throw error;
throw getCamsError(error, MODULE_NAME);
}

if (cached && cached.length === 1) {
return toCamsSession(cached[0]);
} else {
Expand Down
15 changes: 9 additions & 6 deletions backend/functions/lib/use-cases/user-session/user-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,19 @@ export class UserSessionUseCase {
await sessionCacheRepository.put(context, session);

return session;
} catch (originalError) {
if (isConflictError(originalError)) {
} catch (error) {
const isConflict = error.originalError
? isConflictError(error.originalError)
: isConflictError(error);
if (isConflict) {
return await sessionCacheRepository.get(context, token);
}

throw isCamsError(originalError)
? originalError
throw isCamsError(error)
? error
: new UnauthorizedError(MODULE_NAME, {
message: originalError.message,
originalError,
message: error.message,
originalError: error,
});
}
}
Expand Down
1,095 changes: 920 additions & 175 deletions backend/functions/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@azure/functions": "^4.5.1",
"@azure/identity": "^4.4.1",
"@azure/keyvault-secrets": "^4.8.0",
"@launchdarkly/node-server-sdk": "^9.6.0",
"@launchdarkly/node-server-sdk": "^9.6.1",
"@okta/jwt-verifier": "^4.0.1",
"@okta/okta-sdk-nodejs": "^7.1.1",
"applicationinsights": "^3.3.0",
Expand Down
Loading

0 comments on commit 63e53e4

Please sign in to comment.