Skip to content

Commit

Permalink
refactor(aws-sdk): update aws packages (#4063)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunozoric authored Mar 28, 2024
1 parent 926a372 commit 565f09b
Show file tree
Hide file tree
Showing 50 changed files with 1,055 additions and 2,774 deletions.
4 changes: 2 additions & 2 deletions apps/api/graphql/src/security.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { createTenancyContext, createTenancyGraphQL } from "@webiny/api-tenancy";
import { createStorageOperations as tenancyStorageOperations } from "@webiny/api-tenancy-so-ddb";
import { createSecurityContext, createSecurityGraphQL } from "@webiny/api-security";
Expand All @@ -12,7 +12,7 @@ import tenantLinkAuthorization from "@webiny/api-security/plugins/tenantLinkAuth
import createAdminUsersApp from "@webiny/api-admin-users";
import { createStorageOperations as createAdminUsersStorageOperations } from "@webiny/api-admin-users-so-ddb";

export default ({ documentClient }: { documentClient: DynamoDBClient }) => [
export default ({ documentClient }: { documentClient: DynamoDBDocument }) => [
/**
* Create Tenancy app in the `context`.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/api-admin-settings/src/storage/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TableModifier } from "../types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table } from "@webiny/db-dynamodb/toolbox";
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";

interface Params {
table?: TableModifier;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}
export const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {
const tableConfig: TableConstructor<string, string, string> = {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-admin-settings/src/storage/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { AdminSettings, AdminSettingsVariant } from "~/types";

export interface TableModifier {
(table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;
}

export interface StorageOperationsFactoryParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
table?: TableModifier;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/api-admin-users-so-ddb/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table } from "@webiny/db-dynamodb/toolbox";

interface CreateTableParams {
table?: string;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const createTable = ({ table, documentClient }: CreateTableParams) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-admin-users-so-ddb/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { AdminUsersStorageOperations as BaseAdminUsersStorageOperations } from "@webiny/api-admin-users/types";
Expand All @@ -12,7 +12,7 @@ export enum ENTITIES {

export interface CreateAdminUsersStorageOperations {
(params: {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
table?: string;
attributes?: Record<ENTITIES, Attributes>;
}): AdminUsersStorageOperations;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-apw-scheduler-so-ddb/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Table } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";

export interface Params {
table?: string;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const createTable = ({ table, documentClient }: Params) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-apw-scheduler-so-ddb/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";

export type Attributes = Record<string, AttributeDefinition>;

Expand All @@ -10,7 +10,7 @@ export interface PartitionKeyOptions {
}

export interface CreateStorageOperationsParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
table?: string;
attributes?: Attributes;
}
4 changes: 2 additions & 2 deletions packages/api-elasticsearch-tasks/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table, TableConstructor } from "@webiny/db-dynamodb/toolbox";

interface Params {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const createTable = ({ documentClient }: Params): Table<string, string, string> => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-file-manager-ddb/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import ddbPlugins from "@webiny/db-dynamodb/plugins";
import { PluginsContainer } from "@webiny/plugins";
import { PluginCollection } from "@webiny/plugins/types";
Expand All @@ -10,7 +10,7 @@ import { SettingsAttributePlugin, SystemAttributePlugin } from "./plugins";
import { AliasesStorageOperations } from "~/operations/AliasesStorageOperations";

export interface StorageOperationsConfig {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
plugins?: PluginCollection;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
import {
FileManagerAliasesStorageOperations,
Expand All @@ -15,7 +15,7 @@ import {
} from "@webiny/db-dynamodb";

interface AliasesStorageOperationsConfig {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

interface CreatePartitionKeyParams {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Entity } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import {
FileManagerSettings,
FileManagerSettingsStorageOperations,
Expand All @@ -12,7 +12,7 @@ import WebinyError from "@webiny/error";
import { createStandardEntity, createTable, deleteItem, get, put } from "@webiny/db-dynamodb";

interface SettingsStorageOperationsConfig {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

const SORT_KEY = "A";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity } from "@webiny/db-dynamodb/toolbox";
import {
FileManagerSystem,
Expand All @@ -11,7 +11,7 @@ import WebinyError from "@webiny/error";
import { createLegacyEntity, createTable, get, put } from "@webiny/db-dynamodb";

interface SystemStorageOperationsConstructorParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

const SORT_KEY = "FM";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Request } from "@webiny/handler/types";
import { DynamoDBClient, QueryCommand, unmarshall } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument, QueryCommand, unmarshall } from "@webiny/aws-sdk/client-dynamodb";
import { AssetRequest, AssetRequestResolver } from "~/delivery";

export class AliasAssetRequestResolver implements AssetRequestResolver {
private documentClient: DynamoDBClient;
private documentClient: DynamoDBDocument;
private resolver: AssetRequestResolver;

constructor(documentClient: DynamoDBClient, resolver: AssetRequestResolver) {
constructor(documentClient: DynamoDBDocument, resolver: AssetRequestResolver) {
this.documentClient = documentClient;
this.resolver = resolver;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/api-file-manager/src/delivery/setupAssetDelivery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import {
createHandlerOnRequest,
createModifyFastifyPlugin,
Expand Down Expand Up @@ -38,7 +38,7 @@ function assertAssetWasResolved(asset: Asset | undefined): asserts asset is Asse
}

export interface AssetDeliveryParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const setupAssetDelivery = (params: AssetDeliveryParams) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-form-builder-so-ddb-es/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table } from "@webiny/db-dynamodb/toolbox";

interface Params {
tableName?: string;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const createTable = (params: Params): Table<string, string, string> => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Table } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";

interface Params {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
tableName?: string;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/api-form-builder-so-ddb-es/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
FormBuilderFormStorageOperations as BaseFormBuilderFormStorageOperations,
FormBuilderContext
} from "@webiny/api-form-builder/types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { Client } from "@elastic/elasticsearch";
Expand All @@ -26,7 +26,7 @@ export enum ENTITIES {
}

export interface FormBuilderStorageOperationsFactoryParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
elasticsearch: Client;
table?: string;
esTable?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-form-builder-so-ddb/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table } from "@webiny/db-dynamodb/toolbox";

interface Params {
tableName?: string;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const createTable = (params: Params): Table<string, string, string> => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-form-builder-so-ddb/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
FormBuilderSettingsStorageOperations as BaseFormBuilderSettingsStorageOperations,
FormBuilderFormStorageOperations as BaseFormBuilderFormStorageOperations
} from "@webiny/api-form-builder/types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { Plugin } from "@webiny/plugins";
Expand All @@ -20,7 +20,7 @@ export enum ENTITIES {
}

export interface FormBuilderStorageOperationsFactoryParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
table?: string;
attributes?: Record<ENTITIES, Attributes>;
plugins?: Plugin;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-headless-cms-ddb-es/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TableModifier } from "~/types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table, TableConstructor } from "@webiny/db-dynamodb/toolbox";

export interface CreateTableParams {
table?: TableModifier;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}
export const createTable = ({
table,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TableModifier } from "~/types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table } from "@webiny/db-dynamodb/toolbox";
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";

export interface CreateElasticsearchTableParams {
table?: TableModifier;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}
export const createElasticsearchTable = ({
table,
Expand Down
4 changes: 2 additions & 2 deletions packages/api-headless-cms-ddb-es/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations
} from "@webiny/api-headless-cms/types";
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { Client } from "@elastic/elasticsearch";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
Expand Down Expand Up @@ -159,7 +159,7 @@ export interface TableModifier {
}

export interface StorageOperationsFactoryParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
elasticsearch: Client;
table?: TableModifier;
esTable?: TableModifier;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-headless-cms-ddb/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TableModifier } from "~/types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Table } from "@webiny/db-dynamodb/toolbox";
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";

interface Params {
table?: TableModifier;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}
export const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {
const tableConfig: TableConstructor<string, string, string> = {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-headless-cms-ddb/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@webiny/api-headless-cms/types";
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";

interface CmsFieldFilterValueTransformParams {
Expand Down Expand Up @@ -48,7 +48,7 @@ export interface TableModifier {
}

export interface StorageOperationsFactoryParams {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
table?: TableModifier;
attributes?: Record<ENTITIES, Attributes>;
plugins?: Plugin[] | Plugin[][];
Expand Down
6 changes: 3 additions & 3 deletions packages/api-i18n-ddb/src/operations/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import WebinyError from "@webiny/error";
import { I18NContext } from "@webiny/api-i18n/types";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";

export const getDocumentClient = (context: I18NContext): DynamoDBClient => {
const driver = context.db?.driver as unknown as { documentClient?: DynamoDBClient };
export const getDocumentClient = (context: I18NContext): DynamoDBDocument => {
const driver = context.db?.driver as unknown as { documentClient?: DynamoDBDocument };
if (!driver?.documentClient) {
throw new WebinyError(
`Missing documentDriver on the context db.driver property.`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Table } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";

interface CreateTableParams {
table?: string;
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
}

export const createTable = ({ table, documentClient }: CreateTableParams) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-page-builder-import-export-so-ddb/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
import { ImportExportTaskStorageOperations } from "@webiny/api-page-builder-import-export/types";

export type Attributes = Record<string, AttributeDefinition>;

export interface CreateStorageOperations {
(params: {
documentClient: DynamoDBClient;
documentClient: DynamoDBDocument;
table?: string;
attributes?: Attributes;
}): ImportExportTaskStorageOperations;
Expand Down
Loading

0 comments on commit 565f09b

Please sign in to comment.