Skip to content

Commit

Permalink
fixing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
thetif committed Jan 8, 2025
1 parent 5222e57 commit 99ea3e8
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/lambda/sinkChangelog.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Handler } from "aws-lambda";
import { decodeBase64WithUtf8 } from "shared-utils";
import { KafkaEvent, KafkaRecord, opensearch } from "shared-types";
import { ErrorType, bulkUpdateDataWrapper, getTopic, logError } from "../libs/sink-lib";
import { ErrorType, bulkUpdateDataWrapper, getTopic, logError } from "libs/sink-lib";
import {
transformUpdateValuesSchema,
transformDeleteSchema,
transformedUpdateIdSchema,
} from "./update/adminChangeSchemas";
import { getPackageChangelog } from "lib/libs/api/package";
import { getPackageChangelog } from "libs/api/package";

// One notable difference between this handler and sinkMain's...
// The order in which records are processed for the changelog doesn't matter.
Expand Down
2 changes: 1 addition & 1 deletion lib/lambda/sinkMain.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect, vi, afterEach } from "vitest";
import { handler } from "./sinkMain";
import * as sinkMainProcessors from "./sinkMainProcessors";
import { KafkaEvent } from "lib/packages/shared-types";
import { KafkaEvent } from "shared-types";

const createKafkaEvent = (records: KafkaEvent["records"]) => ({
eventSource: "SelfManagedKafka",
Expand Down
2 changes: 1 addition & 1 deletion lib/lambda/sinkMainProcessors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import * as sinkLib from "libs";
import { Document, seatool } from "shared-types/opensearch/main";
import { offsetToUtc } from "shared-utils";
import { KafkaRecord } from "lib/packages/shared-types";
import { KafkaRecord } from "shared-types";

const convertObjToBase64 = (obj: object) => Buffer.from(JSON.stringify(obj)).toString("base64");

Expand Down
6 changes: 3 additions & 3 deletions lib/lambda/update/getPackageType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { response } from "lib/libs/handler-lib";
import { events } from "lib/packages/shared-types";
import { getPackageChangelog } from "lib/libs/api/package";
import { response } from "libs/handler-lib";
import { events } from "shared-types";
import { getPackageChangelog } from "libs/api/package";

export const getPackageType = async (packageId: string) => {
// use event of current package to determine how ID should be formatted
Expand Down
2 changes: 1 addition & 1 deletion lib/lambda/update/updatePackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getPackage } from "libs/api/package";
import { produceMessage } from "libs/api/kafka";
import { ItemResult } from "shared-types/opensearch/main";
import { getPackageType } from "./getPackageType";
import { events } from "lib/packages/shared-types";
import { events } from "shared-types";
import { z } from "zod";

const sendDeleteMessage = async (packageId: string) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/libs/api/package/getPackage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ItemResult } from "lib/packages/shared-types/opensearch/main";
import { ItemResult } from "shared-types/opensearch/main";
import * as os from "libs/opensearch-lib";
import { getDomainAndNamespace } from "../../utils";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommonEmailVariables, Events } from "lib/packages/shared-types";
import { CommonEmailVariables, Events } from "shared-types";
import { BasicFooter, Divider, PackageDetails } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommonEmailVariables, Events } from "lib/packages/shared-types";
import { CommonEmailVariables, Events } from "shared-types";
import { BasicFooter, FollowUpNotice, Divider, PackageDetails } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

Expand Down
9 changes: 6 additions & 3 deletions lib/libs/opensearch-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Client, Connection, errors as OpensearchErrors } from "@opensearch-proj
import * as aws4 from "aws4";
import { aws4Interceptor } from "aws4-axios";
import axios from "axios";
import { ItemResult, Document as OSDocument } from "lib/packages/shared-types/opensearch/main";
import { ItemResult, Document as OSDocument } from "shared-types/opensearch/main";
import { opensearch } from "shared-types";
import { getDomainAndNamespace } from "./sink-lib";

Expand Down Expand Up @@ -185,9 +185,12 @@ export async function getItem(
const response = await client.get({ id, index });
return decodeUtf8(response).body;
} catch (error) {
if (error instanceof OpensearchErrors.ResponseError && error.statusCode === 404 || error.meta?.statusCode === 404) {
if (
(error instanceof OpensearchErrors.ResponseError && error.statusCode === 404) ||
error.meta?.statusCode === 404
) {
console.log("Error (404) retrieving in OpenSearch:", error);
return undefined
return undefined;
}
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/libs/sink-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import pino from "pino";
const logger = pino();

import * as os from "./opensearch-lib";
import { BaseIndex } from "lib/packages/shared-types/opensearch";
import { BaseIndex } from "shared-types/opensearch";
import { getDomainAndNamespace } from "./utils";

export function getTopic(topicPartition: string) {
Expand Down

0 comments on commit 99ea3e8

Please sign in to comment.