Skip to content

Commit

Permalink
fix(*): fixed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri-Levy committed Nov 21, 2024
1 parent 0992cac commit ba28ff0
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 87 deletions.
2 changes: 1 addition & 1 deletion apps/backoffice-v2/src/common/utils/fetcher/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const fetcher: IFetcher = async ({
return await handlePromise(res.blob());
}

if (!res.headers.get('content-length') || res.headers.get('content-length') > '0') {
if (!res.headers.get('content-length') || Number(res.headers.get('content-length')) > 0) {
// TODO: make sure its json by checking the content-type in order to safe access to json method
return await handlePromise(res.json());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"react-phone-input-2": "^2.15.1",
"string-ts": "^1.2.0",
"tailwind-merge": "^1.10.0",
"zod": "^3.22.4"
"zod": "^3.23.4"
},
"devDependencies": {
"@ballerine/config": "^1.1.24",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export class ApiPlugin {
ok: boolean;
json: () => Promise<unknown>;
statusText: string;
headers: Headers;
}> {
let _url: string = url;

Expand Down Expand Up @@ -189,6 +190,7 @@ export class ApiPlugin {
ok: true,
json: () => Promise.resolve({ statusCode: res.status }),
statusText: 'OK',
headers: res.headers,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,21 @@ export class IndividualsSanctionsV2Plugin extends ApiPlugin {

const apiResponse = await this.makeApiRequest(url, this.method, requestPayload, {
...this.headers,
Authorization: `Bearer ${process.env.UNIFIED_API_TOKEN}`,
Authorization: `Bearer ${env.UNIFIED_API_TOKEN}`,
});

logger.log('Individuals Sanctions V2 Plugin - Received response', {
status: apiResponse.statusText,
url,
});

const contentLength = apiResponse.headers.get('content-length');

invariant(
!contentLength || Number(contentLength) > 0,
'Individuals Sanctions V2 Plugin - Received an empty response',
);

if (!apiResponse.ok) {
const errorResponse = await apiResponse.json();

Expand Down
135 changes: 52 additions & 83 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ export class AppLoggerService implements LoggerService, OnModuleDestroy {

error(error: unknown, logData: LogPayload = {}) {
const payload: any = { ...this.getLogMetadata(), logData };
const STACK_FRAMES_TO_REMOVE = 1;

if (typeof error === 'string') {
payload.stack = new Error().stack;
const stack = new Error().stack;
const stackFrames = stack?.split('\n');

stackFrames?.splice(1, STACK_FRAMES_TO_REMOVE);

payload.stack = stackFrames ? stackFrames.join('\n') : stack;
}

this.logger.error(error, payload);
Expand Down
4 changes: 4 additions & 0 deletions services/workflows-service/src/customer/customer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export class CustomerService {
return (await this.repository.findById(id, args)) as unknown as TCustomerWithFeatures;
}

async getByName(name: string, args?: Parameters<CustomerRepository['findById']>[1]) {
return (await this.repository.findByName(name, args)) as unknown as TCustomerWithFeatures;
}

async getByProjectId(projectId: string, args?: Omit<Prisma.CustomerFindFirstArgsBase, 'where'>) {
return (await this.repository.findByProjectId(
projectId,
Expand Down

0 comments on commit ba28ff0

Please sign in to comment.