Skip to content

Commit

Permalink
remove console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
psubram3 committed Nov 18, 2024
1 parent eb1ac18 commit 3fbecf9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/packages/external-event/external-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ async function uploadExternalEventType(req: Request, res: Response) {
const headers: HeadersInit = {
Authorization: authorizationHeader ?? '',
'Content-Type': 'application/json',
'x-hasura-admin-secret': 'aerie', // HACK, TODO: FIX
'x-hasura-role': roleHeader ? `${roleHeader}` : '',
'x-hasura-user-id': userHeader ? `${userHeader}` : '',
};

console.log("\n\n", JSON.stringify(attribute_schema), "\n\n")

// Validate schema is valid JSON Schema
try {
const schemaIsValid: boolean = ajv.validateSchema(attribute_schema);
Expand Down
14 changes: 0 additions & 14 deletions src/packages/external-source/external-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,10 @@ async function uploadExternalSource(req: Request, res: Response) {
const headers: HeadersInit = {
Authorization: authorizationHeader ?? '',
'Content-Type': 'application/json',
'x-hasura-admin-secret': 'aerie', // HACK, TODO: FIX
'x-hasura-role': roleHeader ? `${roleHeader}` : '',
'x-hasura-user-id': userHeader ? `${userHeader}` : '',
};


console.log("\n\n", body, "\n\n");

// Verify that this is a valid external source!
let sourceIsValid: boolean = false;
sourceIsValid = await compiledExternalSourceSchema(body);
Expand Down Expand Up @@ -154,7 +150,6 @@ async function uploadExternalSource(req: Request, res: Response) {
const sourceTypeResponseJSON = await sourceAttributeSchema.json();
const getExternalSourceTypeAttributeSchemaResponse = sourceTypeResponseJSON as GetExternalSourceTypeAttributeSchemaResponse | HasuraError;
if ((getExternalSourceTypeAttributeSchemaResponse as GetExternalSourceTypeAttributeSchemaResponse).data?.external_source_type_by_pk?.attribute_schema !== null) {
console.log(sourceTypeResponseJSON, source_type_name)
const { data: { external_source_type_by_pk: sourceAttributeSchema } } = getExternalSourceTypeAttributeSchemaResponse as GetExternalSourceTypeAttributeSchemaResponse;
if (sourceAttributeSchema !== undefined && sourceAttributeSchema !== null) {
sourceSchema = ajv.compile(sourceAttributeSchema.attribute_schema);
Expand Down Expand Up @@ -191,8 +186,6 @@ async function uploadExternalSource(req: Request, res: Response) {
};
return acc;
}, []);

console.log("usedExternalEventTypes", usedExternalEventTypes)

const usedExternalEventTypesAttributesSchemas: Record<string, Ajv.ValidateFunction> = {};
for (const eventType of usedExternalEventTypes) {
Expand All @@ -211,20 +204,16 @@ async function uploadExternalSource(req: Request, res: Response) {

if ((getExternalEventTypeAttributeSchemaResponse as GetExternalEventTypeAttributeSchemaResponse).data?.external_event_type_by_pk?.attribute_schema !== null) {
const { data: { external_event_type_by_pk: eventAttributeSchema } } = getExternalEventTypeAttributeSchemaResponse as GetExternalEventTypeAttributeSchemaResponse;
console.log("BINGO!", eventType, eventAttributeSchema)
if (eventAttributeSchema !== undefined && eventAttributeSchema !== null) {
usedExternalEventTypesAttributesSchemas[eventType] = ajv.compile(eventAttributeSchema.attribute_schema);
}
}
}

console.log("usedExternalEventTypesAttributesSchemas", usedExternalEventTypesAttributesSchemas)

for (const externalEvent of external_events) {
try {
const currentEventType = externalEvent.event_type_name;
const currentEventSchema: Ajv.ValidateFunction = usedExternalEventTypesAttributesSchemas[currentEventType];
console.log("CURRENT EVENT SCHEMA:", currentEventType, externalEvent.attributes, currentEventSchema)
const eventAttributesAreValid = await currentEventSchema(externalEvent.attributes);
if (!eventAttributesAreValid) {
throw new Error(`External Event '${externalEvent.key}' does not have a valid set of attributes, per it's type's schema:\n${JSON.stringify(currentEventSchema.errors)}`);
Expand All @@ -237,8 +226,6 @@ async function uploadExternalSource(req: Request, res: Response) {
}
}

console.log("VALID!");

// Run the Hasura migration for creating an external source
const derivationGroupInsert: DerivationGroupInsertInput = {
name: derivation_group_name,
Expand Down Expand Up @@ -271,7 +258,6 @@ async function uploadExternalSource(req: Request, res: Response) {
});

const jsonResponse = await response.json();
console.log(jsonResponse);
const createExternalSourceResponse = jsonResponse as CreateExternalSourceResponse | HasuraError;


Expand Down

0 comments on commit 3fbecf9

Please sign in to comment.