Skip to content

Commit

Permalink
chore : feedback and merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
R11manish committed Dec 1, 2023
1 parent 468ead9 commit 055491b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 38 deletions.
23 changes: 9 additions & 14 deletions src/data-model/data-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
dataModels_queryQueryVariables,
FilterDataModelInput,
} from '../../.mesh';
import { errorHandler } from '../utils/errorHandler';

/* The `DataModel` class is a TypeScript class that provides methods for creating and retrieving data
models. */
Expand All @@ -29,8 +30,7 @@ export class DataModel {
input: createModelInput,
});
} catch (error: any) {
console.log(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -45,8 +45,7 @@ export class DataModel {
try {
return await this.sdk.dataModel_query({ id: dataModelId });
} catch (error: any) {
console.log(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand Down Expand Up @@ -74,8 +73,7 @@ export class DataModel {
});
return data;
} catch (error: any) {
console.log(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand Down Expand Up @@ -107,7 +105,7 @@ export class DataModel {
filter: filterVariables,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -121,7 +119,7 @@ export class DataModel {
try {
return await this.sdk.dataModelsMetadata_query();
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -134,8 +132,7 @@ export class DataModel {
try {
return await this.sdk.issuersByDataModel_query({ id: id });
} catch (error: any) {
console.error(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -150,8 +147,7 @@ export class DataModel {
try {
return await this.sdk.issuersByDataModelCount_query({ id: dataModelId });
} catch (error: any) {
console.error(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -166,8 +162,7 @@ export class DataModel {
try {
return await this.sdk.getTotalofIssuersByDataModel_query({ dataModelId });
} catch (error: any) {
console.error(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}
}
19 changes: 10 additions & 9 deletions src/proof/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
sentProofsCount_queryQueryVariables,
sentProofs_queryQueryVariables,
} from '../../.mesh';
import { errorHandler } from '../utils/errorHandler';

export class Proof {
private sdk: Sdk;
Expand All @@ -27,7 +28,7 @@ export class Proof {
try {
return await this.sdk.proof_query({ id: id });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}
/**
Expand All @@ -46,7 +47,7 @@ export class Proof {
try {
return await this.sdk.createProof_mutation(inputVariables);
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -64,7 +65,7 @@ export class Proof {
requestId: requestId,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -89,7 +90,7 @@ export class Proof {
take,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -109,7 +110,7 @@ export class Proof {
try {
return await this.sdk.proofsByPDAIds_query({ pdaIds, skip, take });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -136,7 +137,7 @@ export class Proof {
take,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -153,7 +154,7 @@ export class Proof {
try {
return await this.sdk.receivedProofsCount_query({ organizationId });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}
/**
Expand All @@ -173,7 +174,7 @@ export class Proof {
try {
return await this.sdk.sentProofs_query({ order, skip, take });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -191,7 +192,7 @@ export class Proof {
try {
return await this.sdk.sentProofsCount_query(queryVariables);
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}
}
20 changes: 10 additions & 10 deletions src/request/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
requestsReceived_queryQueryVariables,
requestsSent_queryQueryVariables,
} from '../../.mesh';
import { errorHandler } from '../utils/errorHandler';

export class Request {
private sdk: Sdk;
Expand All @@ -27,7 +28,7 @@ export class Request {
try {
return this.sdk.createDataRequest_mutation({ input: inputSchema });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -44,7 +45,7 @@ export class Request {
try {
return await this.sdk.dataRequest_query({ requestId });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -60,7 +61,7 @@ export class Request {
try {
return await this.sdk.dataRequestCount_query({ filter: filterVariables });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -75,7 +76,7 @@ export class Request {
try {
return await this.sdk.dataRequestStatus_query({ requestId });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -92,8 +93,7 @@ export class Request {
try {
return await this.sdk.dataRequests_query({ filter: filterVariables });
} catch (error: any) {
console.log(error);
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -119,7 +119,7 @@ export class Request {
take,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -137,7 +137,7 @@ export class Request {
filter: filterVariables,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -159,7 +159,7 @@ export class Request {
try {
return await this.sdk.requestsSent_query({ filter, order, skip, take });
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}

Expand All @@ -177,7 +177,7 @@ export class Request {
filter: filterVariables,
});
} catch (error: any) {
throw new Error(error);
throw new Error(errorHandler(error));
}
}
}
9 changes: 4 additions & 5 deletions test/data-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe('data model function tests', () => {
}, 40000);

it('get the data model', async () => {
// first we create datamodel and then check with id
const { createDataModel } = await api.dataModel.createDataModel({
schema: {
type: 'object',
Expand All @@ -59,11 +58,11 @@ describe('data model function tests', () => {
expect(dataModel.id).toEqual(createDataModel.id);
});

// it('gets data moldel', async () => {
// const { dataModels } = await api.dataModel.getDataModels();
it('gets data moldel', async () => {
const { dataModels } = await api.dataModel.getDataModels();

// expect(dataModels.length).toBeGreaterThanOrEqual(0);
// }, 2200000);
expect(dataModels.length).toBeGreaterThanOrEqual(0);
}, 5000);

it('models count', async () => {
const { dataModelsCount } = await api.dataModel.getDataModelsCount();
Expand Down

0 comments on commit 055491b

Please sign in to comment.