Skip to content

Commit

Permalink
feat: replace generic tag with effect tag for lib-dynamodb services
Browse files Browse the repository at this point in the history
  • Loading branch information
floydspace committed Sep 28, 2024
1 parent dfddb5a commit 0404579
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
17 changes: 6 additions & 11 deletions packages/lib-dynamodb/src/DynamoDBDocumentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ const commands = {
UpdateCommand,
};

/**
* @since 1.0.0
* @category models
*/
export interface DynamoDBDocumentService {
interface DynamoDBDocumentService$ {
readonly _: unique symbol;

/**
Expand Down Expand Up @@ -322,12 +318,11 @@ export interface DynamoDBDocumentService {

/**
* @since 1.0.0
* @category tags
* @category models
*/
export const DynamoDBDocumentService =
Context.GenericTag<DynamoDBDocumentService>(
"@effect-aws/lib-dynamodb/DynamoDBDocumentService",
);
export class DynamoDBDocumentService extends Effect.Tag(
"@effect-aws/lib-dynamodb/DynamoDBDocumentService",
)<DynamoDBDocumentService, DynamoDBDocumentService$>() {}

/**
* @since 1.0.0
Expand Down Expand Up @@ -373,7 +368,7 @@ export const makeDynamoDBDocumentService = Effect.gen(function* (_) {
"",
);
return { ...acc, [methodName]: methodImpl };
}, {}) as DynamoDBDocumentService;
}, {}) as DynamoDBDocumentService$;
});

/**
Expand Down
11 changes: 5 additions & 6 deletions packages/lib-dynamodb/test/DynamoDBDocument.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
} from "../src";

const dynamodbMock = mockClient(DynamoDBDocumentClient);
const { put } = Effect.serviceFunctions(DynamoDBDocumentService);

describe("DynamoDBDocumentClientImpl", () => {
it("default", async () => {
Expand All @@ -35,7 +34,7 @@ describe("DynamoDBDocumentClientImpl", () => {
Item: { testAttr: "test" },
};

const program = put(args);
const program = DynamoDBDocumentService.put(args);

const result = await pipe(
program,
Expand All @@ -56,7 +55,7 @@ describe("DynamoDBDocumentClientImpl", () => {
Item: { testAttr: "test" },
};

const program = put(args);
const program = DynamoDBDocumentService.put(args);

const DynamoDBDocumentClientConfigLayer = Layer.succeed(
DynamoDBDocumentClientInstanceConfig,
Expand Down Expand Up @@ -86,7 +85,7 @@ describe("DynamoDBDocumentClientImpl", () => {
Item: { testAttr: "test" },
};

const program = put(args);
const program = DynamoDBDocumentService.put(args);

const DynamoDBDocumentClientInstanceLayer = Layer.succeed(
DynamoDBDocumentClientInstance,
Expand Down Expand Up @@ -119,7 +118,7 @@ describe("DynamoDBDocumentClientImpl", () => {
Item: { testAttr: "test" },
};

const program = put(args);
const program = DynamoDBDocumentService.put(args);

const DynamoDBDocumentClientInstanceLayer = Layer.effect(
DynamoDBDocumentClientInstance,
Expand Down Expand Up @@ -155,7 +154,7 @@ describe("DynamoDBDocumentClientImpl", () => {
Item: { testAttr: "test" },
};

const program = put(args, { requestTimeout: 1000 });
const program = DynamoDBDocumentService.put(args, { requestTimeout: 1000 });

const result = await pipe(
program,
Expand Down

0 comments on commit 0404579

Please sign in to comment.