Skip to content

Commit

Permalink
fix: merge dev into next
Browse files Browse the repository at this point in the history
  • Loading branch information
brunozoric committed Jan 5, 2025
1 parent c443ecc commit de44705
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions packages/api-prerendering-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@webiny/handler-client": "0.0.0",
"@webiny/plugins": "0.0.0",
"@webiny/utils": "0.0.0",
"he": "^1.2.0",
"lodash": "^4.17.21",
"object-hash": "^3.0.0",
"pluralize": "^8.0.0",
Expand All @@ -35,7 +34,6 @@
"srcset": "^4.0.0"
},
"devDependencies": {
"@types/he": "^1.2.3",
"@types/object-hash": "^2.2.1",
"@types/puppeteer-core": "7.0.4",
"@webiny/cli": "0.0.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/db-dynamodb/src/utils/entity/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { createEntityReadBatch } from "./EntityReadBatch";
import { createEntityWriteBatch } from "./EntityWriteBatch";
import { createTableWriteBatch } from "~/utils/table/TableWriteBatch";
import { queryAllClean, queryOneClean } from "../query";
import { GenericRecord } from "@webiny/api/types";

export type EntityConstructor<
T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>
Expand Down Expand Up @@ -64,7 +65,9 @@ export class Entity implements IEntity {
});
}

public async put(item: IPutParamsItem): ReturnType<typeof put> {
public async put<T extends GenericRecord = GenericRecord>(
item: IPutParamsItem<T>
): ReturnType<typeof put> {
return put({
entity: this.entity,
item
Expand Down
2 changes: 1 addition & 1 deletion packages/db-dynamodb/src/utils/entity/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface IEntity {
createEntityReader(): IEntityReadBatch;
createEntityWriter(): IEntityWriteBatch;
createTableWriter(): ITableWriteBatch;
put(item: IPutParamsItem): ReturnType<typeof put>;
put<T extends GenericRecord = GenericRecord>(item: IPutParamsItem<T>): ReturnType<typeof put>;
get<T>(keys: GetRecordParamsKeys): ReturnType<typeof get<T>>;
getClean<T>(keys: GetRecordParamsKeys): ReturnType<typeof getClean<T>>;
delete(keys: IDeleteItemKeys): ReturnType<typeof deleteItem>;
Expand Down
9 changes: 4 additions & 5 deletions packages/db-dynamodb/src/utils/put.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { Entity } from "~/toolbox";
import { GenericRecord } from "@webiny/api/types";

export type IPutParamsItem<T extends Record<string, any>> = {
export type IPutParamsItem<T extends GenericRecord = GenericRecord> = {
PK: string;
SK: string;
[key: string]: any;
} & T;

export interface IPutParams<T extends Record<string, any> = Record<string, any>> {
export interface IPutParams<T extends GenericRecord = GenericRecord> {
entity: Entity;
item: IPutParamsItem<T>;
}

export const put = async <T extends Record<string, any> = Record<string, any>>(
params: IPutParams<T>
) => {
export const put = async <T extends GenericRecord = GenericRecord>(params: IPutParams<T>) => {
const { entity, item } = params;

return await entity.put(item, {
Expand Down

0 comments on commit de44705

Please sign in to comment.