@webiny/api-file-manager-ddb 5.39.0-beta.0 → 5.39.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
+ import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { PluginCollection } from "@webiny/plugins/types";
3
3
  import { FileManagerStorageOperations } from "@webiny/api-file-manager/types";
4
4
  export interface StorageOperationsConfig {
5
- documentClient: DocumentClient;
5
+ documentClient: DynamoDBClient;
6
6
  plugins?: PluginCollection;
7
7
  }
8
8
  export * from "./plugins";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","_interopRequireDefault","require","_plugins2","_FilesStorageOperations","_SettingsStorageOperations","_SystemStorageOperations","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_AliasesStorageOperations","createFileManagerStorageOperations","documentClient","plugins","userPlugins","PluginsContainer","ddbPlugins","beforeInit","context","types","SettingsAttributePlugin","type","SystemAttributePlugin","mergeByType","files","FilesStorageOperations","aliases","AliasesStorageOperations","settings","SettingsStorageOperations","system","SystemStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport ddbPlugins from \"@webiny/db-dynamodb/plugins\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport { FileManagerStorageOperations } from \"@webiny/api-file-manager/types\";\nimport { FilesStorageOperations } from \"~/operations/FilesStorageOperations\";\nimport { SettingsStorageOperations } from \"~/operations/SettingsStorageOperations\";\nimport { SystemStorageOperations } from \"~/operations/SystemStorageOperations\";\nimport { SettingsAttributePlugin, SystemAttributePlugin } from \"./plugins\";\nimport { AliasesStorageOperations } from \"~/operations/AliasesStorageOperations\";\n\nexport interface StorageOperationsConfig {\n documentClient: DocumentClient;\n plugins?: PluginCollection;\n}\n\nexport * from \"./plugins\";\n\nexport const createFileManagerStorageOperations = ({\n documentClient,\n plugins: userPlugins\n}: StorageOperationsConfig): FileManagerStorageOperations => {\n const plugins = new PluginsContainer([\n ddbPlugins(),\n // User plugins\n ...(userPlugins || [])\n ]);\n\n return {\n beforeInit: async context => {\n const types: string[] = [SettingsAttributePlugin.type, SystemAttributePlugin.type];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n files: new FilesStorageOperations(),\n aliases: new AliasesStorageOperations({ documentClient }),\n settings: new SettingsStorageOperations({ documentClient }),\n system: new SystemStorageOperations({ documentClient })\n };\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAGA,IAAAE,uBAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAH,OAAA;AACA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAQAM,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAPA,IAAAS,yBAAA,GAAAlB,OAAA;AASO,MAAMmB,kCAAkC,GAAGA,CAAC;EAC/CC,cAAc;EACdC,OAAO,EAAEC;AACY,CAAC,KAAmC;EACzD,MAAMD,OAAO,GAAG,IAAIE,0BAAgB,CAAC,CACjC,IAAAC,gBAAU,EAAC,CAAC;EACZ;EACA,IAAIF,WAAW,IAAI,EAAE,CAAC,CACzB,CAAC;EAEF,OAAO;IACHG,UAAU,EAAE,MAAMC,OAAO,IAAI;MACzB,MAAMC,KAAe,GAAG,CAACC,iCAAuB,CAACC,IAAI,EAAEC,+BAAqB,CAACD,IAAI,CAAC;MAClF,KAAK,MAAMA,IAAI,IAAIF,KAAK,EAAE;QACtBN,OAAO,CAACU,WAAW,CAACL,OAAO,CAACL,OAAO,EAAEQ,IAAI,CAAC;MAC9C;IACJ,CAAC;IACDG,KAAK,EAAE,IAAIC,8CAAsB,CAAC,CAAC;IACnCC,OAAO,EAAE,IAAIC,kDAAwB,CAAC;MAAEf;IAAe,CAAC,CAAC;IACzDgB,QAAQ,EAAE,IAAIC,oDAAyB,CAAC;MAAEjB;IAAe,CAAC,CAAC;IAC3DkB,MAAM,EAAE,IAAIC,gDAAuB,CAAC;MAAEnB;IAAe,CAAC;EAC1D,CAAC;AACL,CAAC;AAACN,OAAA,CAAAK,kCAAA,GAAAA,kCAAA"}
1
+ {"version":3,"names":["_plugins","_interopRequireDefault","require","_plugins2","_FilesStorageOperations","_SettingsStorageOperations","_SystemStorageOperations","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_AliasesStorageOperations","createFileManagerStorageOperations","documentClient","plugins","userPlugins","PluginsContainer","ddbPlugins","beforeInit","context","types","SettingsAttributePlugin","type","SystemAttributePlugin","mergeByType","files","FilesStorageOperations","aliases","AliasesStorageOperations","settings","SettingsStorageOperations","system","SystemStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport ddbPlugins from \"@webiny/db-dynamodb/plugins\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport { FileManagerStorageOperations } from \"@webiny/api-file-manager/types\";\nimport { FilesStorageOperations } from \"~/operations/FilesStorageOperations\";\nimport { SettingsStorageOperations } from \"~/operations/SettingsStorageOperations\";\nimport { SystemStorageOperations } from \"~/operations/SystemStorageOperations\";\nimport { SettingsAttributePlugin, SystemAttributePlugin } from \"./plugins\";\nimport { AliasesStorageOperations } from \"~/operations/AliasesStorageOperations\";\n\nexport interface StorageOperationsConfig {\n documentClient: DynamoDBClient;\n plugins?: PluginCollection;\n}\n\nexport * from \"./plugins\";\n\nexport const createFileManagerStorageOperations = ({\n documentClient,\n plugins: userPlugins\n}: StorageOperationsConfig): FileManagerStorageOperations => {\n const plugins = new PluginsContainer([\n ddbPlugins(),\n // User plugins\n ...(userPlugins || [])\n ]);\n\n return {\n beforeInit: async context => {\n const types: string[] = [SettingsAttributePlugin.type, SystemAttributePlugin.type];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n files: new FilesStorageOperations(),\n aliases: new AliasesStorageOperations({ documentClient }),\n settings: new SettingsStorageOperations({ documentClient }),\n system: new SystemStorageOperations({ documentClient })\n };\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAGA,IAAAE,uBAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAH,OAAA;AACA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAQAM,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAPA,IAAAS,yBAAA,GAAAlB,OAAA;AASO,MAAMmB,kCAAkC,GAAGA,CAAC;EAC/CC,cAAc;EACdC,OAAO,EAAEC;AACY,CAAC,KAAmC;EACzD,MAAMD,OAAO,GAAG,IAAIE,0BAAgB,CAAC,CACjC,IAAAC,gBAAU,EAAC,CAAC;EACZ;EACA,IAAIF,WAAW,IAAI,EAAE,CAAC,CACzB,CAAC;EAEF,OAAO;IACHG,UAAU,EAAE,MAAMC,OAAO,IAAI;MACzB,MAAMC,KAAe,GAAG,CAACC,iCAAuB,CAACC,IAAI,EAAEC,+BAAqB,CAACD,IAAI,CAAC;MAClF,KAAK,MAAMA,IAAI,IAAIF,KAAK,EAAE;QACtBN,OAAO,CAACU,WAAW,CAACL,OAAO,CAACL,OAAO,EAAEQ,IAAI,CAAC;MAC9C;IACJ,CAAC;IACDG,KAAK,EAAE,IAAIC,8CAAsB,CAAC,CAAC;IACnCC,OAAO,EAAE,IAAIC,kDAAwB,CAAC;MAAEf;IAAe,CAAC,CAAC;IACzDgB,QAAQ,EAAE,IAAIC,oDAAyB,CAAC;MAAEjB;IAAe,CAAC,CAAC;IAC3DkB,MAAM,EAAE,IAAIC,gDAAuB,CAAC;MAAEnB;IAAe,CAAC;EAC1D,CAAC;AACL,CAAC;AAACN,OAAA,CAAAK,kCAAA,GAAAA,kCAAA"}
@@ -1,7 +1,7 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
+ import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { FileManagerAliasesStorageOperations, File } from "@webiny/api-file-manager/types";
3
3
  interface AliasesStorageOperationsConfig {
4
- documentClient: DocumentClient;
4
+ documentClient: DynamoDBClient;
5
5
  }
6
6
  export declare class AliasesStorageOperations implements FileManagerAliasesStorageOperations {
7
7
  private readonly aliasEntity;
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.AliasesStorageOperations = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _dbDynamodb = require("@webiny/db-dynamodb");
10
8
  class AliasesStorageOperations {
11
9
  constructor({
12
10
  documentClient
13
11
  }) {
14
- (0, _defineProperty2.default)(this, "aliasEntity", void 0);
15
- (0, _defineProperty2.default)(this, "table", void 0);
16
12
  this.table = (0, _dbDynamodb.createTable)({
17
13
  documentClient
18
14
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_dbDynamodb","require","AliasesStorageOperations","constructor","documentClient","_defineProperty2","default","table","createTable","aliasEntity","createStandardEntity","name","deleteAliases","file","aliasItems","getExistingAliases","items","forEach","item","push","deleteBatch","PK","createPartitionKey","id","fileId","tenant","locale","SK","alias","batchWriteAll","storeAliases","existingAliases","newAliases","createNewAliasesRecords","putBatch","data","aliases","some","queryAll","entity","partitionKey","options","beginsWith","map","params","find","GSI1_PK","GSI1_SK","TYPE","key","filter","Boolean","exports"],"sources":["AliasesStorageOperations.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport {\n FileManagerAliasesStorageOperations,\n File,\n FileAlias\n} from \"@webiny/api-file-manager/types\";\nimport {\n BatchWriteItem,\n batchWriteAll,\n createStandardEntity,\n createTable,\n DbItem,\n queryAll\n} from \"@webiny/db-dynamodb\";\n\ninterface AliasesStorageOperationsConfig {\n documentClient: DocumentClient;\n}\n\ninterface CreatePartitionKeyParams {\n locale: string;\n tenant: string;\n id: string;\n}\n\nexport class AliasesStorageOperations implements FileManagerAliasesStorageOperations {\n private readonly aliasEntity: Entity<any>;\n private readonly table: Table;\n\n constructor({ documentClient }: AliasesStorageOperationsConfig) {\n this.table = createTable({ documentClient });\n\n this.aliasEntity = createStandardEntity({\n table: this.table,\n name: \"FM.FileAlias\"\n });\n }\n\n async deleteAliases(file: File): Promise<void> {\n const aliasItems = await this.getExistingAliases(file);\n const items: BatchWriteItem[] = [];\n\n aliasItems.forEach(item => {\n items.push(\n this.aliasEntity.deleteBatch({\n PK: this.createPartitionKey({\n id: item.fileId,\n tenant: item.tenant,\n locale: item.locale\n }),\n SK: `ALIAS#${item.alias}`\n })\n );\n });\n\n await batchWriteAll({ table: this.table, items });\n }\n\n async storeAliases(file: File): Promise<void> {\n const items: BatchWriteItem[] = [];\n const existingAliases = await this.getExistingAliases(file);\n const newAliases = this.createNewAliasesRecords(file, existingAliases);\n\n newAliases.forEach(alias => {\n items.push(this.aliasEntity.putBatch(alias));\n });\n\n // Delete aliases that are in the DB but are NOT in the file.\n for (const data of existingAliases) {\n if (!file.aliases.some(alias => data.alias === alias)) {\n items.push(\n this.aliasEntity.deleteBatch({\n PK: this.createPartitionKey(file),\n SK: `ALIAS#${data.alias}`\n })\n );\n }\n }\n\n await batchWriteAll({\n table: this.table,\n items\n });\n }\n\n private async getExistingAliases(file: File) {\n const aliases = await queryAll<{ data: FileAlias }>({\n entity: this.aliasEntity,\n partitionKey: this.createPartitionKey(file),\n options: {\n beginsWith: \"ALIAS#\"\n }\n });\n\n return aliases.map(alias => alias.data);\n }\n\n private createPartitionKey(params: CreatePartitionKeyParams): string {\n const { tenant, locale, id } = params;\n return `T#${tenant}#L#${locale}#FM#F${id}`;\n }\n\n private createNewAliasesRecords(\n file: File,\n existingAliases: FileAlias[] = []\n ): DbItem<FileAlias>[] {\n return (file.aliases || [])\n .map(alias => {\n // If alias is already in the DB, skip it.\n if (existingAliases.find(item => item.alias === alias)) {\n return null;\n }\n\n // Add a new alias.\n return {\n PK: this.createPartitionKey(file),\n SK: `ALIAS#${alias}`,\n GSI1_PK: `T#${file.tenant}#FM#FILE_ALIASES`,\n GSI1_SK: alias,\n TYPE: \"fm.fileAlias\",\n data: {\n alias,\n tenant: file.tenant,\n locale: file.locale,\n fileId: file.id,\n key: file.key\n }\n };\n })\n .filter(Boolean) as DbItem<FileAlias>[];\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAAA,WAAA,GAAAC,OAAA;AAmBO,MAAMC,wBAAwB,CAAgD;EAIjFC,WAAWA,CAAC;IAAEC;EAA+C,CAAC,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAC5D,IAAI,CAACC,KAAK,GAAG,IAAAC,uBAAW,EAAC;MAAEJ;IAAe,CAAC,CAAC;IAE5C,IAAI,CAACK,WAAW,GAAG,IAAAC,gCAAoB,EAAC;MACpCH,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBI,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEA,MAAMC,aAAaA,CAACC,IAAU,EAAiB;IAC3C,MAAMC,UAAU,GAAG,MAAM,IAAI,CAACC,kBAAkB,CAACF,IAAI,CAAC;IACtD,MAAMG,KAAuB,GAAG,EAAE;IAElCF,UAAU,CAACG,OAAO,CAACC,IAAI,IAAI;MACvBF,KAAK,CAACG,IAAI,CACN,IAAI,CAACV,WAAW,CAACW,WAAW,CAAC;QACzBC,EAAE,EAAE,IAAI,CAACC,kBAAkB,CAAC;UACxBC,EAAE,EAAEL,IAAI,CAACM,MAAM;UACfC,MAAM,EAAEP,IAAI,CAACO,MAAM;UACnBC,MAAM,EAAER,IAAI,CAACQ;QACjB,CAAC,CAAC;QACFC,EAAE,EAAG,SAAQT,IAAI,CAACU,KAAM;MAC5B,CAAC,CACL,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,IAAAC,yBAAa,EAAC;MAAEtB,KAAK,EAAE,IAAI,CAACA,KAAK;MAAES;IAAM,CAAC,CAAC;EACrD;EAEA,MAAMc,YAAYA,CAACjB,IAAU,EAAiB;IAC1C,MAAMG,KAAuB,GAAG,EAAE;IAClC,MAAMe,eAAe,GAAG,MAAM,IAAI,CAAChB,kBA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EAAC;EAC9C;EAEQU,uBAAuBA,CAC3BpB,IAAU,EACVkB,eAA4B,GAAG,EAAE,EACd;IACnB,OAAO,CAAClB,IAAI,CAACuB,OAAO,IAAI,EAAE,EACrBO,GAAG,CAACf,KAAK,IAAI;MACV;MACA,IAAIG,eAAe,CAACc,IAAI,CAAC3B,IAAI,IAAIA,IAAI,CAACU,KAAK,KAAKA,KAAK,CAAC,EAAE;QACpD,OAAO,IAAI;MACf;;MAEA;MACA,OAAO;QACHP,EAAE,EAAE,IAAI,CAACC,kBAAkB,CAACT,IAAI,CAAC;QACjCc,EAAE,EAAG,SAAQC,KAAM,EAAC;QACpBkB,OAAO,EAAG,KAAIjC,IAAI,CAACY,MAAO,kBAAiB;QAC3CsB,OAAO,EAAEnB,KAAK;QACdoB,IAAI,EAAE,cAAc;QACpBb,IAAI,EAAE;UACFP,KAAK;UACLH,MAAM,EAAEZ,IAAI,CAACY,MAAM;UACnBC,MAAM,EAAEb,IAAI,CAACa,MAAM;UACnBF,MAAM,EAAEX,IAAI,CAACU,EAAE;UACf0B,GAAG,EAAEpC,IAAI,CAACoC;QACd;MACJ,CAAC;IACL,CAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CAAC;EACxB;AACJ;AAACC,OAAA,CAAAlD,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_dbDynamodb","require","AliasesStorageOperations","constructor","documentClient","table","createTable","aliasEntity","createStandardEntity","name","deleteAliases","file","aliasItems","getExistingAliases","items","forEach","item","push","deleteBatch","PK","createPartitionKey","id","fileId","tenant","locale","SK","alias","batchWriteAll","storeAliases","existingAliases","newAliases","createNewAliasesRecords","putBatch","data","aliases","some","queryAll","entity","partitionKey","options","beginsWith","map","params","find","GSI1_PK","GSI1_SK","TYPE","key","filter","Boolean","exports"],"sources":["AliasesStorageOperations.ts"],"sourcesContent":["import { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport {\n FileManagerAliasesStorageOperations,\n File,\n FileAlias\n} from \"@webiny/api-file-manager/types\";\nimport {\n BatchWriteItem,\n batchWriteAll,\n createStandardEntity,\n createTable,\n DbItem,\n queryAll\n} from \"@webiny/db-dynamodb\";\n\ninterface AliasesStorageOperationsConfig {\n documentClient: DynamoDBClient;\n}\n\ninterface CreatePartitionKeyParams {\n locale: string;\n tenant: string;\n id: string;\n}\n\nexport class AliasesStorageOperations implements FileManagerAliasesStorageOperations {\n private readonly aliasEntity: Entity<any>;\n private readonly table: Table<string, string, string>;\n\n constructor({ documentClient }: AliasesStorageOperationsConfig) {\n this.table = createTable({ documentClient });\n\n this.aliasEntity = createStandardEntity({\n table: this.table,\n name: \"FM.FileAlias\"\n });\n }\n\n async deleteAliases(file: File): Promise<void> {\n const aliasItems = await this.getExistingAliases(file);\n const items: BatchWriteItem[] = [];\n\n aliasItems.forEach(item => {\n items.push(\n this.aliasEntity.deleteBatch({\n PK: this.createPartitionKey({\n id: item.fileId,\n tenant: item.tenant,\n locale: item.locale\n }),\n SK: `ALIAS#${item.alias}`\n })\n );\n });\n\n await batchWriteAll({ table: this.table, items });\n }\n\n async storeAliases(file: File): Promise<void> {\n const items: BatchWriteItem[] = [];\n const existingAliases = await this.getExistingAliases(file);\n const newAliases = this.createNewAliasesRecords(file, existingAliases);\n\n newAliases.forEach(alias => {\n items.push(this.aliasEntity.putBatch(alias));\n });\n\n // Delete aliases that are in the DB but are NOT in the file.\n for (const data of existingAliases) {\n if (!file.aliases.some(alias => data.alias === alias)) {\n items.push(\n this.aliasEntity.deleteBatch({\n PK: this.createPartitionKey(file),\n SK: `ALIAS#${data.alias}`\n })\n );\n }\n }\n\n await batchWriteAll({\n table: this.table,\n items\n });\n }\n\n private async getExistingAliases(file: File) {\n const aliases = await queryAll<{ data: FileAlias }>({\n entity: this.aliasEntity,\n partitionKey: this.createPartitionKey(file),\n options: {\n beginsWith: \"ALIAS#\"\n }\n });\n\n return aliases.map(alias => alias.data);\n }\n\n private createPartitionKey(params: CreatePartitionKeyParams): string {\n const { tenant, locale, id } = params;\n return `T#${tenant}#L#${locale}#FM#F${id}`;\n }\n\n private createNewAliasesRecords(\n file: File,\n existingAliases: FileAlias[] = []\n ): DbItem<FileAlias>[] {\n return (file.aliases || [])\n .map(alias => {\n // If alias is already in the DB, skip it.\n if (existingAliases.find(item => item.alias === alias)) {\n return null;\n }\n\n // Add a new alias.\n return {\n PK: this.createPartitionKey(file),\n SK: `ALIAS#${alias}`,\n GSI1_PK: `T#${file.tenant}#FM#FILE_ALIASES`,\n GSI1_SK: alias,\n TYPE: \"fm.fileAlias\",\n data: {\n alias,\n tenant: file.tenant,\n locale: file.locale,\n fileId: file.id,\n key: file.key\n }\n };\n })\n .filter(Boolean) as DbItem<FileAlias>[];\n }\n}\n"],"mappings":";;;;;;AAOA,IAAAA,WAAA,GAAAC,OAAA;AAmBO,MAAMC,wBAAwB,CAAgD;EAIjFC,WAAWA,CAAC;IAAEC;EAA+C,CAAC,EAAE;IAC5D,IAAI,CAACC,KAAK,GAAG,IAAAC,uBAAW,EAAC;MAAEF;IAAe,CAAC,CAAC;IAE5C,IAAI,CAACG,WAAW,GAAG,IAAAC,gCAAoB,EAAC;MACpCH,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBI,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEA,MAAMC,aAAaA,CAACC,IAAU,EAAiB;IAC3C,MAAMC,UAAU,GAAG,MAAM,IAAI,CAACC,kBAAkB,CAACF,IAAI,CAAC;IACtD,MAAMG,KAAuB,GAAG,EAAE;IAElCF,UAAU,CAACG,OAAO,CAACC,IAAI,IAAI;MACvBF,KAAK,CAACG,IAAI,CACN,IAAI,CAACV,WAAW,CAACW,WAAW,CAAC;QACzBC,EAAE,EAAE,IAAI,CAACC,kBAAkB,CAAC;UACxBC,EAAE,EAAEL,IAAI,CAACM,MAAM;UACfC,MAAM,EAAEP,IAAI,CAACO,MAAM;UACnBC,MAAM,EAAER,IAAI,CAACQ;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CAACT,IAAI,CAAC;MAC3C4B,OAAO,EAAE;QACLC,UAAU,EAAE;MAChB;IACJ,CAAC,CAAC;IAEF,OAAON,OAAO,CAACO,GAAG,CAACf,KAAK,IAAIA,KAAK,CAACO,IAAI,CAAC;EAC3C;EAEQb,kBAAkBA,CAACsB,MAAgC,EAAU;IACjE,MAAM;MAAEnB,MAAM;MAAEC,MAAM;MAAEH;IAAG,CAAC,GAAGqB,MAAM;IACrC,OAAQ,KAAInB,MAAO,MAAKC,MAAO,QAAOH,EAAG,EAAC;EAC9C;EAEQU,uBAAuBA,CAC3BpB,IAAU,EACVkB,eAA4B,GAAG,EAAE,EACd;IACnB,OAAO,CAAClB,IAAI,CAACuB,OAAO,IAAI,EAAE,EACrBO,GAAG,CAACf,KAAK,IAAI;MACV;MACA,IAAIG,eAAe,CAACc,IAAI,CAAC3B,IAAI,IAAIA,IAAI,CAACU,KAAK,KAAKA,KAAK,CAAC,EAAE;QACpD,OAAO,IAAI;MACf;;MAEA;MACA,OAAO;QACHP,EAAE,EAAE,IAAI,CAACC,kBAAkB,CAACT,IAAI,CAAC;QACjCc,EAAE,EAAG,SAAQC,KAAM,EAAC;QACpBkB,OAAO,EAAG,KAAIjC,IAAI,CAACY,MAAO,kBAAiB;QAC3CsB,OAAO,EAAEnB,KAAK;QACdoB,IAAI,EAAE,cAAc;QACpBb,IAAI,EAAE;UACFP,KAAK;UACLH,MAAM,EAAEZ,IAAI,CAACY,MAAM;UACnBC,MAAM,EAAEb,IAAI,CAACa,MAAM;UACnBF,MAAM,EAAEX,IAAI,CAACU,EAAE;UACf0B,GAAG,EAAEpC,IAAI,CAACoC;QACd;MACJ,CAAC;IACL,CAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CAAC;EACxB;AACJ;AAACC,OAAA,CAAAhD,wBAAA,GAAAA,wBAAA"}
@@ -1,7 +1,7 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
+ import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { FileManagerSettings, FileManagerSettingsStorageOperations, FileManagerSettingsStorageOperationsCreateParams, FileManagerSettingsStorageOperationsUpdateParams, FileManagerStorageOperationsDeleteSettings, FileManagerStorageOperationsGetSettingsParams } from "@webiny/api-file-manager/types";
3
3
  interface SettingsStorageOperationsConfig {
4
- documentClient: DocumentClient;
4
+ documentClient: DynamoDBClient;
5
5
  }
6
6
  export declare class SettingsStorageOperations implements FileManagerSettingsStorageOperations {
7
7
  private readonly _entity;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.SettingsStorageOperations = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _error = _interopRequireDefault(require("@webiny/error"));
10
9
  var _dbDynamodb = require("@webiny/db-dynamodb");
11
10
  const SORT_KEY = "A";
@@ -13,7 +12,6 @@ class SettingsStorageOperations {
13
12
  constructor({
14
13
  documentClient
15
14
  }) {
16
- (0, _defineProperty2.default)(this, "_entity", void 0);
17
15
  this._entity = (0, _dbDynamodb.createStandardEntity)({
18
16
  table: (0, _dbDynamodb.createTable)({
19
17
  documentClient
@@ -32,7 +30,7 @@ class SettingsStorageOperations {
32
30
  SK: SORT_KEY
33
31
  }
34
32
  });
35
- return settings ? settings.data : null;
33
+ return settings?.data || null;
36
34
  } catch (ex) {
37
35
  throw new _error.default(ex.message || "Could not fetch the FileManager settings.", ex.code || "GET_SETTINGS_ERROR");
38
36
  }
@@ -50,11 +48,14 @@ class SettingsStorageOperations {
50
48
  });
51
49
  }
52
50
  try {
53
- await this._entity.put({
54
- PK: `T#${data.tenant}#FM#SETTINGS`,
55
- SK: SORT_KEY,
56
- TYPE: "fm.settings",
57
- data
51
+ await (0, _dbDynamodb.put)({
52
+ entity: this._entity,
53
+ item: {
54
+ PK: `T#${data.tenant}#FM#SETTINGS`,
55
+ SK: SORT_KEY,
56
+ TYPE: "fm.settings",
57
+ data
58
+ }
58
59
  });
59
60
  return data;
60
61
  } catch (ex) {
@@ -67,11 +68,14 @@ class SettingsStorageOperations {
67
68
  data
68
69
  }) {
69
70
  try {
70
- await this._entity.update({
71
- PK: `T#${data.tenant}#FM#SETTINGS`,
72
- SK: SORT_KEY,
73
- TYPE: "fm.settings",
74
- data
71
+ await (0, _dbDynamodb.put)({
72
+ entity: this._entity,
73
+ item: {
74
+ PK: `T#${data.tenant}#FM#SETTINGS`,
75
+ SK: SORT_KEY,
76
+ TYPE: "fm.settings",
77
+ data
78
+ }
75
79
  });
76
80
  return data;
77
81
  } catch (ex) {
@@ -83,9 +87,12 @@ class SettingsStorageOperations {
83
87
  async delete({
84
88
  tenant
85
89
  }) {
86
- return this._entity.delete({
87
- PK: `T#${tenant}#FM#SETTINGS`,
88
- SK: SORT_KEY
90
+ await (0, _dbDynamodb.deleteItem)({
91
+ entity: this._entity,
92
+ keys: {
93
+ PK: `T#${tenant}#FM#SETTINGS`,
94
+ SK: SORT_KEY
95
+ }
89
96
  });
90
97
  }
91
98
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_dbDynamodb","SORT_KEY","SettingsStorageOperations","constructor","documentClient","_defineProperty2","default","_entity","createStandardEntity","table","createTable","name","get","tenant","settings","entity","keys","PK","SK","data","ex","WebinyError","message","code","create","original","update","put","TYPE","delete","exports"],"sources":["SettingsStorageOperations.ts"],"sourcesContent":["import { Entity } from \"dynamodb-toolbox\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport {\n FileManagerSettings,\n FileManagerSettingsStorageOperations,\n FileManagerSettingsStorageOperationsCreateParams,\n FileManagerSettingsStorageOperationsUpdateParams,\n FileManagerStorageOperationsDeleteSettings,\n FileManagerStorageOperationsGetSettingsParams\n} from \"@webiny/api-file-manager/types\";\nimport WebinyError from \"@webiny/error\";\nimport { get, createStandardEntity, createTable } from \"@webiny/db-dynamodb\";\n\ninterface SettingsStorageOperationsConfig {\n documentClient: DocumentClient;\n}\n\nconst SORT_KEY = \"A\";\n\nexport class SettingsStorageOperations implements FileManagerSettingsStorageOperations {\n private readonly _entity: Entity<any>;\n\n public constructor({ documentClient }: SettingsStorageOperationsConfig) {\n this._entity = createStandardEntity({\n table: createTable({ documentClient }),\n name: \"FM.Settings\"\n });\n }\n\n public async get({\n tenant\n }: FileManagerStorageOperationsGetSettingsParams): Promise<FileManagerSettings | null> {\n try {\n const settings = await get<{ data: FileManagerSettings }>({\n entity: this._entity,\n keys: {\n PK: `T#${tenant}#FM#SETTINGS`,\n SK: SORT_KEY\n }\n });\n\n return settings ? settings.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager settings.\",\n ex.code || \"GET_SETTINGS_ERROR\"\n );\n }\n }\n\n public async create({\n data\n }: FileManagerSettingsStorageOperationsCreateParams): Promise<FileManagerSettings> {\n const original = await this.get({ tenant: data.tenant });\n\n if (original) {\n return await this.update({ original, data });\n }\n\n try {\n await this._entity.put({\n PK: `T#${data.tenant}#FM#SETTINGS`,\n SK: SORT_KEY,\n TYPE: \"fm.settings\",\n data\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot create FileManager settings.\",\n ex.code || \"CREATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async update({\n data\n }: FileManagerSettingsStorageOperationsUpdateParams): Promise<FileManagerSettings> {\n try {\n await this._entity.update({\n PK: `T#${data.tenant}#FM#SETTINGS`,\n SK: SORT_KEY,\n TYPE: \"fm.settings\",\n data\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot update FileManager settings.\",\n ex.code || \"UPDATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async delete({ tenant }: FileManagerStorageOperationsDeleteSettings): Promise<void> {\n return this._entity.delete({\n PK: `T#${tenant}#FM#SETTINGS`,\n SK: SORT_KEY\n });\n }\n}\n"],"mappings":";;;;;;;;AAUA,IAAAA,MAAA,GAAAC,sBA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Q;QACZ2B,IAAI,EAAE,aAAa;QACnBT;MACJ,CAAC,CAAC;MACF,OAAOA,IAAI;IACf,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,qCAAqC,EACnDF,EAAE,CAACG,IAAI,IAAI,0BAA0B,EACrC;QACIJ;MACJ,CACJ,CAAC;IACL;EACJ;EAEA,MAAaO,MAAMA,CAAC;IAChBP;EAC8C,CAAC,EAAgC;IAC/E,IAAI;MACA,MAAM,IAAI,CAACZ,OAAO,CAACmB,MAAM,CAAC;QACtBT,EAAE,EAAG,KAAIE,IAAI,CAACN,MAAO,cAAa;QAClCK,EAAE,EAAEjB,QAAQ;QACZ2B,IAAI,EAAE,aAAa;QACnBT;MACJ,CAAC,CAAC;MACF,OAAOA,IAAI;IACf,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,qCAAqC,EACnDF,EAAE,CAACG,IAAI,IAAI,0BAA0B,EACrC;QACIJ;MACJ,CACJ,CAAC;IACL;EACJ;EAEA,MAAaU,MAAMA,CAAC;IAAEhB;EAAmD,CAAC,EAAiB;IACvF,OAAO,IAAI,CAACN,OAAO,CAACsB,MAAM,CAAC;MACvBZ,EAAE,EAAG,KAAIJ,MAAO,cAAa;MAC7BK,EAAE,EAAEjB;IACR,CAAC,CAAC;EACN;AACJ;AAAC6B,OAAA,CAAA5B,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_dbDynamodb","SORT_KEY","SettingsStorageOperations","constructor","documentClient","_entity","createStandardEntity","table","createTable","name","get","tenant","settings","entity","keys","PK","SK","data","ex","WebinyError","message","code","create","original","update","put","item","TYPE","delete","deleteItem","exports"],"sources":["SettingsStorageOperations.ts"],"sourcesContent":["import { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport {\n FileManagerSettings,\n FileManagerSettingsStorageOperations,\n FileManagerSettingsStorageOperationsCreateParams,\n FileManagerSettingsStorageOperationsUpdateParams,\n FileManagerStorageOperationsDeleteSettings,\n FileManagerStorageOperationsGetSettingsParams\n} from \"@webiny/api-file-manager/types\";\nimport WebinyError from \"@webiny/error\";\nimport { createStandardEntity, createTable, deleteItem, get, put } from \"@webiny/db-dynamodb\";\n\ninterface SettingsStorageOperationsConfig {\n documentClient: DynamoDBClient;\n}\n\nconst SORT_KEY = \"A\";\n\nexport class SettingsStorageOperations implements FileManagerSettingsStorageOperations {\n private readonly _entity: Entity<any>;\n\n public constructor({ documentClient }: SettingsStorageOperationsConfig) {\n this._entity = createStandardEntity({\n table: createTable({ documentClient }),\n name: \"FM.Settings\"\n });\n }\n\n public async get({\n tenant\n }: FileManagerStorageOperationsGetSettingsParams): Promise<FileManagerSettings | null> {\n try {\n const settings = await get<{ data: FileManagerSettings }>({\n entity: this._entity,\n keys: {\n PK: `T#${tenant}#FM#SETTINGS`,\n SK: SORT_KEY\n }\n });\n\n return settings?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager settings.\",\n ex.code || \"GET_SETTINGS_ERROR\"\n );\n }\n }\n\n public async create({\n data\n }: FileManagerSettingsStorageOperationsCreateParams): Promise<FileManagerSettings> {\n const original = await this.get({ tenant: data.tenant });\n\n if (original) {\n return await this.update({ original, data });\n }\n\n try {\n await put({\n entity: this._entity,\n item: {\n PK: `T#${data.tenant}#FM#SETTINGS`,\n SK: SORT_KEY,\n TYPE: \"fm.settings\",\n data\n }\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot create FileManager settings.\",\n ex.code || \"CREATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async update({\n data\n }: FileManagerSettingsStorageOperationsUpdateParams): Promise<FileManagerSettings> {\n try {\n await put({\n entity: this._entity,\n item: {\n PK: `T#${data.tenant}#FM#SETTINGS`,\n SK: SORT_KEY,\n TYPE: \"fm.settings\",\n data\n }\n });\n return data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Cannot update FileManager settings.\",\n ex.code || \"UPDATE_FM_SETTINGS_ERROR\",\n {\n data\n }\n );\n }\n }\n\n public async delete({ tenant }: FileManagerStorageOperationsDeleteSettings): Promise<void> {\n await deleteItem({\n entity: this._entity,\n keys: {\n PK: `T#${tenant}#FM#SETTINGS`,\n SK: SORT_KEY\n }\n });\n }\n}\n"],"mappings":";;;;;;;AAUA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,MAAME,QAAQ,GAAG,GAAG;AAEb,MAAMC,yBAAyB,CAAiD;EAG5EC,WAAWA,CAAC;IAAEC;EAAgD,CAAC,EAAE;IACpE,IAAI,CAACC,OAAO,GAAG,IAAAC,gCAAoB,EAAC;MAChCC,KAAK,EAAE,IAAAC,uBAAW,EAAC;QAAEJ;MAAe,CAAC,CAAC;MACtCK,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEA,MAAaC,GAAGA,CAAC;IACbC;EAC2C,CAAC,EAAuC;IACnF,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAM,IAAAF,eAAG,EAAgC;QACtDG,MAAM,EAAE,IAAI,CAACR,OAAO;QACpBS,IAAI,EAAE;UACFC,EAAE,EAAG,KAAIJ,MAAO,cAAa;UAC7BK,EAAE,EAAEf;QACR;MACJ,CAAC,CAAC;MAEF,OAAOW,QAAQ,EAAEK,IAAI,IAAI,IAAI;IACjC,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,2CAA2C,EACzDF,EAAE,CAACG,IAAI,IAAI,oBACf,CAAC;IACL;EACJ;EAEA,MAAaC,MAAMA,CAAC;IAChBL;EAC8C,CAAC,EAAgC;IAC/E,MAAMM,QAAQ,GAAG,MAAM,IAAI,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;MACpBS,IAAI,EAAE;QACFC,EAAE,EAAG,KAAIJ,MAAO,cAAa;QAC7BK,EAAE,EAAEf;MACR;IACJ,CAAC,CAAC;EACN;AACJ;AAAC6B,OAAA,CAAA5B,yBAAA,GAAAA,yBAAA"}
@@ -1,7 +1,7 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
+ import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { FileManagerSystem, FileManagerSystemStorageOperations, FileManagerSystemStorageOperationsCreateParams, FileManagerSystemStorageOperationsGetParams, FileManagerSystemStorageOperationsUpdateParams } from "@webiny/api-file-manager/types";
3
3
  interface SystemStorageOperationsConstructorParams {
4
- documentClient: DocumentClient;
4
+ documentClient: DynamoDBClient;
5
5
  }
6
6
  export declare class SystemStorageOperations implements FileManagerSystemStorageOperations {
7
7
  private readonly _entity;
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.SystemStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
9
  var _dbDynamodb = require("@webiny/db-dynamodb");
12
10
  const SORT_KEY = "FM";
@@ -14,7 +12,6 @@ class SystemStorageOperations {
14
12
  constructor({
15
13
  documentClient
16
14
  }) {
17
- (0, _defineProperty2.default)(this, "_entity", void 0);
18
15
  this._entity = (0, _dbDynamodb.createLegacyEntity)({
19
16
  table: (0, _dbDynamodb.createTable)({
20
17
  documentClient
@@ -34,14 +31,14 @@ class SystemStorageOperations {
34
31
  tenant
35
32
  }) {
36
33
  try {
37
- const system = await this._entity.get({
38
- PK: `T#${tenant}#SYSTEM`,
39
- SK: SORT_KEY
34
+ const system = await (0, _dbDynamodb.get)({
35
+ entity: this._entity,
36
+ keys: {
37
+ PK: `T#${tenant}#SYSTEM`,
38
+ SK: SORT_KEY
39
+ }
40
40
  });
41
- if (!system || !system.Item) {
42
- return null;
43
- }
44
- return system.Item;
41
+ return system || null;
45
42
  } catch (ex) {
46
43
  throw new _error.default(ex.message || "Could not fetch the FileManager system.", ex.code || "GET_SYSTEM_ERROR");
47
44
  }
@@ -51,10 +48,14 @@ class SystemStorageOperations {
51
48
  data
52
49
  } = params;
53
50
  try {
54
- await this._entity.put((0, _objectSpread2.default)({
55
- PK: `T#${data.tenant}#SYSTEM`,
56
- SK: SORT_KEY
57
- }, data));
51
+ await (0, _dbDynamodb.put)({
52
+ entity: this._entity,
53
+ item: {
54
+ ...data,
55
+ PK: `T#${data.tenant}#SYSTEM`,
56
+ SK: SORT_KEY
57
+ }
58
+ });
58
59
  } catch (ex) {
59
60
  throw new _error.default("Could not insert new system data into DynamoDB", "CREATE_SYSTEM_ERROR", {
60
61
  data
@@ -68,16 +69,23 @@ class SystemStorageOperations {
68
69
  data
69
70
  } = params;
70
71
  try {
71
- await this._entity.update((0, _objectSpread2.default)({
72
- PK: `T#${data.tenant}#SYSTEM`,
73
- SK: SORT_KEY
74
- }, data));
72
+ await (0, _dbDynamodb.put)({
73
+ entity: this._entity,
74
+ item: {
75
+ ...data,
76
+ PK: `T#${data.tenant}#SYSTEM`,
77
+ SK: SORT_KEY
78
+ }
79
+ });
75
80
  } catch (ex) {
76
81
  throw new _error.default("Could not update system data in the DynamoDB.", "UPDATE_SYSTEM_ERROR", {
77
82
  data
78
83
  });
79
84
  }
80
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, original), data);
85
+ return {
86
+ ...original,
87
+ ...data
88
+ };
81
89
  }
82
90
  }
83
91
  exports.SystemStorageOperations = SystemStorageOperations;
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_dbDynamodb","SORT_KEY","SystemStorageOperations","constructor","documentClient","_defineProperty2","default","_entity","createLegacyEntity","table","createTable","name","attributes","version","type","tenant","get","system","PK","SK","Item","ex","WebinyError","message","code","create","params","data","put","_objectSpread2","update","original","exports"],"sources":["SystemStorageOperations.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport {\n FileManagerSystem,\n FileManagerSystemStorageOperations,\n FileManagerSystemStorageOperationsCreateParams,\n FileManagerSystemStorageOperationsGetParams,\n FileManagerSystemStorageOperationsUpdateParams\n} from \"@webiny/api-file-manager/types\";\nimport WebinyError from \"@webiny/error\";\nimport { createLegacyEntity, createTable } from \"@webiny/db-dynamodb\";\n\ninterface SystemStorageOperationsConstructorParams {\n documentClient: DocumentClient;\n}\n\nconst SORT_KEY = \"FM\";\n\nexport class SystemStorageOperations implements FileManagerSystemStorageOperations {\n private readonly _entity: Entity<any>;\n\n public constructor({ documentClient }: SystemStorageOperationsConstructorParams) {\n this._entity = createLegacyEntity({\n table: createTable({ documentClient }),\n name: \"System\",\n attributes: {\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n }\n }\n });\n }\n\n public async get({\n tenant\n }: FileManagerSystemStorageOperationsGetParams): Promise<FileManagerSystem | null> {\n try {\n const system = await this._entity.get({\n PK: `T#${tenant}#SYSTEM`,\n SK: SORT_KEY\n });\n if (!system || !system.Item) {\n return null;\n }\n return system.Item;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager system.\",\n ex.code || \"GET_SYSTEM_ERROR\"\n );\n }\n }\n\n public async create(\n params: FileManagerSystemStorageOperationsCreateParams\n ): Promise<FileManagerSystem> {\n const { data } = params;\n try {\n await this._entity.put({\n PK: `T#${data.tenant}#SYSTEM`,\n SK: SORT_KEY,\n ...data\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not insert new system data into DynamoDB\",\n \"CREATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return data;\n }\n\n public async update(\n params: FileManagerSystemStorageOperationsUpdateParams\n ): Promise<FileManagerSystem> {\n const { original, data } = params;\n\n try {\n await this._entity.update({\n PK: `T#${data.tenant}#SYSTEM`,\n SK: SORT_KEY,\n ...data\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not update system data in the DynamoDB.\",\n \"UPDATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return {\n ...original,\n ...data\n };\n }\n}\n"],"mappings":";;;;;;;;;AASA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,MAAME,QAAQ,GAAG,IAAI;AAEd,MAAMC,uBAAuB,CAA+C;EAGxEC,WAAWA,CAAC;IAAEC;EAAyD,CAAC,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAC7E,IAAI,CAACC,OAAO,GAAG,IAAAC,8BAAkB,EAAC;MAC9BC,KAAK,EAAE,IAAAC,uBAAW,EAAC;QAAEN;MAAe,CAAC,CAAC;MACtCO,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;QACRC,OAAO,EAAE;UACLC,IAAI,EAAE;QACV,CAAC;QACDC,MAAM,EAAE;UACJD,IAAI,EAAE;QACV;MACJ;IACJ,CAAC,CAAC;EACN;EAEA,MAAaE,GAAGA,CAAC;IACbD;EACyC,CAAC,EAAqC;IAC/E,IAAI;MACA,MAAME,MAAM,GAAG,MAAM,IAAI,CAACV,OAAO,CAACS,GAAG,CAAC;QAClCE,EAAE,EAAG,KAAIH,MAAO,SAAQ;QACxBI,EAAE,EAAElB;MACR,CAAC,CAAC;MACF,IAAI,CAACgB,MAAM,IAAI,CAACA,MAAM,CAACG,IAAI,EAAE;QACzB,OAAO,IAAI;MACf;MACA,OAAOH,MAAM,CAACG,IAAI;IACtB,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,yCAAyC,EACvDF,EAAE,CAACG,IAAI,IAAI,kBACf,CAAC;IACL;EACJ;EAEA,MAAaC,MAAMA,CACfC,MAAsD,EAC5B;IAC1B,MAAM;MAAEC;IAAK,CAAC,GAAGD,MAAM;IACvB,IAAI;MACA,MAAM,IAAI,CAACnB,OAAO,CAACqB,GAAG,KAAAC,cAAA,CAAAvB,OAAA;QAClBY,EAAE,EAAG,KAAIS,IAAI,CAACZ,MAAO,SAAQ;QAC7BI,EAAE,EAAElB;MAAQ,GACT0B,IAAI,CACV,CAAC;IACN,CAAC,CAAC,OAAON,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,gDAAgD,EAChD,qBAAqB,EACrB;QACIK;MACJ,CACJ,CAAC;IACL;IACA,OAAOA,IAAI;EACf;EAEA,MAAaG,MAAMA,CACfJ,MAAsD,EAC5B;IAC1B,MAAM;MAAEK,QAAQ;MAAEJ;IAAK,CAAC,GAAGD,MAAM;IAEjC,IAAI;MACA,MAAM,IAAI,CAACnB,OAAO,CAACuB,MAAM,KAAAD,cAAA,CAAAvB,OAAA;QACrBY,EAAE,EAAG,KAAIS,IAAI,CAACZ,MAAO,SAAQ;QAC7BI,EAAE,EAAElB;MAAQ,GACT0B,IAAI,CACV,CAAC;IACN,CAAC,CAAC,OAAON,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,+CAA+C,EAC/C,qBAAqB,EACrB;QACIK;MACJ,CACJ,CAAC;IACL;IACA,WAAAE,cAAA,CAAAvB,OAAA,MAAAuB,cAAA,CAAAvB,OAAA,MACOyB,QAAQ,GACRJ,IAAI;EAEf;AACJ;AAACK,OAAA,CAAA9B,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_dbDynamodb","SORT_KEY","SystemStorageOperations","constructor","documentClient","_entity","createLegacyEntity","table","createTable","name","attributes","version","type","tenant","get","system","entity","keys","PK","SK","ex","WebinyError","message","code","create","params","data","put","item","update","original","exports"],"sources":["SystemStorageOperations.ts"],"sourcesContent":["import { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport {\n FileManagerSystem,\n FileManagerSystemStorageOperations,\n FileManagerSystemStorageOperationsCreateParams,\n FileManagerSystemStorageOperationsGetParams,\n FileManagerSystemStorageOperationsUpdateParams\n} from \"@webiny/api-file-manager/types\";\nimport WebinyError from \"@webiny/error\";\nimport { createLegacyEntity, createTable, get, put } from \"@webiny/db-dynamodb\";\n\ninterface SystemStorageOperationsConstructorParams {\n documentClient: DynamoDBClient;\n}\n\nconst SORT_KEY = \"FM\";\n\nexport class SystemStorageOperations implements FileManagerSystemStorageOperations {\n private readonly _entity: Entity<any>;\n\n public constructor({ documentClient }: SystemStorageOperationsConstructorParams) {\n this._entity = createLegacyEntity({\n table: createTable({ documentClient }),\n name: \"System\",\n attributes: {\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n }\n }\n });\n }\n\n public async get({\n tenant\n }: FileManagerSystemStorageOperationsGetParams): Promise<FileManagerSystem | null> {\n try {\n const system = await get<FileManagerSystem>({\n entity: this._entity,\n keys: {\n PK: `T#${tenant}#SYSTEM`,\n SK: SORT_KEY\n }\n });\n return system || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not fetch the FileManager system.\",\n ex.code || \"GET_SYSTEM_ERROR\"\n );\n }\n }\n\n public async create(\n params: FileManagerSystemStorageOperationsCreateParams\n ): Promise<FileManagerSystem> {\n const { data } = params;\n try {\n await put({\n entity: this._entity,\n item: {\n ...data,\n PK: `T#${data.tenant}#SYSTEM`,\n SK: SORT_KEY\n }\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not insert new system data into DynamoDB\",\n \"CREATE_SYSTEM_ERROR\",\n {\n data\n }\n );\n }\n return data;\n }\n\n public async update(\n params: FileManagerSystemStorageOperationsUpdateParams\n ): Promise<FileManagerSystem> {\n const { original, data } = params;\n\n try {\n await put({\n entity: this._entity,\n item: {\n ...data,\n PK: `T#${data.tenant}#SYSTEM`,\n SK: SORT_KEY\n }\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not update system data in the DynamoDB.\",\n \"UPDATE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AO,SAAQ;UAC7BM,EAAE,EAAElB;QACR;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOmB,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,gDAAgD,EAChD,qBAAqB,EACrB;QACIK;MACJ,CACJ,CAAC;IACL;IACA,OAAOA,IAAI;EACf;EAEA,MAAaG,MAAMA,CACfJ,MAAsD,EAC5B;IAC1B,MAAM;MAAEK,QAAQ;MAAEJ;IAAK,CAAC,GAAGD,MAAM;IAEjC,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNX,MAAM,EAAE,IAAI,CAACX,OAAO;QACpBuB,IAAI,EAAE;UACF,GAAGF,IAAI;UACPR,EAAE,EAAG,KAAIQ,IAAI,CAACb,MAAO,SAAQ;UAC7BM,EAAE,EAAElB;QACR;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOmB,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,+CAA+C,EAC/C,qBAAqB,EACrB;QACIK;MACJ,CACJ,CAAC;IACL;IACA,OAAO;MACH,GAAGI,QAAQ;MACX,GAAGJ;IACP,CAAC;EACL;AACJ;AAACK,OAAA,CAAA7B,uBAAA,GAAAA,uBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-file-manager-ddb",
3
- "version": "5.39.0-beta.0",
3
+ "version": "5.39.0-beta.2",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-file-manager",
@@ -21,13 +21,12 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@babel/runtime": "7.22.6",
24
- "@webiny/api-file-manager": "5.39.0-beta.0",
25
- "@webiny/db-dynamodb": "5.39.0-beta.0",
26
- "@webiny/error": "5.39.0-beta.0",
27
- "@webiny/plugins": "5.39.0-beta.0",
28
- "@webiny/project-utils": "5.39.0-beta.0",
29
- "aws-sdk": "2.1310.0",
30
- "dynamodb-toolbox": "0.3.5"
24
+ "@webiny/api-file-manager": "5.39.0-beta.2",
25
+ "@webiny/aws-sdk": "5.39.0-beta.2",
26
+ "@webiny/db-dynamodb": "5.39.0-beta.2",
27
+ "@webiny/error": "5.39.0-beta.2",
28
+ "@webiny/plugins": "5.39.0-beta.2",
29
+ "@webiny/project-utils": "5.39.0-beta.2"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@babel/cli": "7.22.6",
@@ -36,7 +35,7 @@
36
35
  "@babel/plugin-transform-runtime": "7.22.7",
37
36
  "@babel/preset-env": "7.22.7",
38
37
  "@babel/preset-typescript": "7.22.5",
39
- "@webiny/cli": "5.39.0-beta.0",
38
+ "@webiny/cli": "5.39.0-beta.2",
40
39
  "jest": "29.5.0",
41
40
  "jest-dynalite": "3.6.1",
42
41
  "jsonpack": "1.1.5",
@@ -58,10 +57,9 @@
58
57
  ],
59
58
  "ignore": {
60
59
  "src": [
61
- "aws-sdk",
62
60
  "sharp"
63
61
  ]
64
62
  }
65
63
  },
66
- "gitHead": "df94742fba6658ed3507e1e17ab53dc77bb66330"
64
+ "gitHead": "193039382160557448f23f43685f29136f58f87a"
67
65
  }
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.SettingsAttributePlugin = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
7
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
10
8
  class SettingsAttributePlugin extends _AttributePlugin.AttributePlugin {
11
9
  constructor(params) {
12
- super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
10
+ super({
11
+ ...params,
13
12
  entity: "FM.Settings"
14
- }));
13
+ });
15
14
  }
16
15
  }
17
16
  exports.SettingsAttributePlugin = SettingsAttributePlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["_AttributePlugin","require","SettingsAttributePlugin","AttributePlugin","constructor","params","_objectSpread2","default","entity","exports"],"sources":["SettingsAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SettingsAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"FM.Settings\"\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAKO,MAAMC,uBAAuB,SAASC,gCAAe,CAAC;EAClDC,WAAWA,CAACC,MAA6C,EAAE;IAC9D,KAAK,KAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACEF,MAAM;MACTG,MAAM,EAAE;IAAa,EACxB,CAAC;EACN;AACJ;AAACC,OAAA,CAAAP,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_AttributePlugin","require","SettingsAttributePlugin","AttributePlugin","constructor","params","entity","exports"],"sources":["SettingsAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SettingsAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"FM.Settings\"\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAKO,MAAMC,uBAAuB,SAASC,gCAAe,CAAC;EAClDC,WAAWA,CAACC,MAA6C,EAAE;IAC9D,KAAK,CAAC;MACF,GAAGA,MAAM;MACTC,MAAM,EAAE;IACZ,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAL,uBAAA,GAAAA,uBAAA"}
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.SystemAttributePlugin = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
7
  var _AttributePlugin = require("@webiny/db-dynamodb/plugins/definitions/AttributePlugin");
10
8
  class SystemAttributePlugin extends _AttributePlugin.AttributePlugin {
11
9
  constructor(params) {
12
- super((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
10
+ super({
11
+ ...params,
13
12
  entity: "System"
14
- }));
13
+ });
15
14
  }
16
15
  }
17
16
  exports.SystemAttributePlugin = SystemAttributePlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["_AttributePlugin","require","SystemAttributePlugin","AttributePlugin","constructor","params","_objectSpread2","default","entity","exports"],"sources":["SystemAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SystemAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"System\"\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAKO,MAAMC,qBAAqB,SAASC,gCAAe,CAAC;EAChDC,WAAWA,CAACC,MAA6C,EAAE;IAC9D,KAAK,KAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACEF,MAAM;MACTG,MAAM,EAAE;IAAQ,EACnB,CAAC;EACN;AACJ;AAACC,OAAA,CAAAP,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_AttributePlugin","require","SystemAttributePlugin","AttributePlugin","constructor","params","entity","exports"],"sources":["SystemAttributePlugin.ts"],"sourcesContent":["import {\n AttributePlugin,\n AttributePluginParams\n} from \"@webiny/db-dynamodb/plugins/definitions/AttributePlugin\";\n\nexport class SystemAttributePlugin extends AttributePlugin {\n public constructor(params: Omit<AttributePluginParams, \"entity\">) {\n super({\n ...params,\n entity: \"System\"\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAKO,MAAMC,qBAAqB,SAASC,gCAAe,CAAC;EAChDC,WAAWA,CAACC,MAA6C,EAAE;IAC9D,KAAK,CAAC;MACF,GAAGA,MAAM;MACTC,MAAM,EAAE;IACZ,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAL,qBAAA,GAAAA,qBAAA"}