@adminforth/storage-adapter-local 1.0.3 → 1.0.4

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.
Files changed (3) hide show
  1. package/dist/index.js +13 -2
  2. package/index.ts +11 -2
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -72,13 +72,24 @@ class AdminForthStorageAdapterLocalFilesystem {
72
72
  });
73
73
  }
74
74
  markKeyForDeletation(key) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ throw new Error("Method \"markKeyForDeletation\" is deprecated, use markKeyForDeletion instead");
77
+ });
78
+ }
79
+ markKeyForNotDeletation(key) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ throw new Error("Method \"markKeyForNotDeletation\" is deprecated, use markKeyForNotDeletion instead");
82
+ });
83
+ }
84
+ markKeyForDeletion(key) {
75
85
  return __awaiter(this, void 0, void 0, function* () {
76
86
  const metadata = yield this.metadataDb.get(key).catch((e) => {
77
87
  console.error(`Could not read metadata from db: ${e}`);
78
88
  throw new Error(`Could not read metadata from db: ${e}`);
79
89
  });
80
90
  if (!metadata) {
81
- throw new Error(`Metadata for key ${key} not found`);
91
+ console.error(`Metadata for key ${key} not found`);
92
+ return;
82
93
  }
83
94
  const metadataParsed = JSON.parse(metadata);
84
95
  try {
@@ -104,7 +115,7 @@ class AdminForthStorageAdapterLocalFilesystem {
104
115
  * This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
105
116
  * @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
106
117
  */
107
- markKeyForNotDeletation(key) {
118
+ markKeyForNotDeletion(key) {
108
119
  return __awaiter(this, void 0, void 0, function* () {
109
120
  try {
110
121
  // if key exists, delete it
package/index.ts CHANGED
@@ -99,12 +99,21 @@ export default class AdminForthStorageAdapterLocalFilesystem implements StorageA
99
99
  }
100
100
 
101
101
  async markKeyForDeletation(key: string): Promise<void> {
102
+ throw new Error("Method \"markKeyForDeletation\" is deprecated, use markKeyForDeletion instead");
103
+ }
104
+
105
+ async markKeyForNotDeletation(key: string): Promise<void> {
106
+ throw new Error("Method \"markKeyForNotDeletation\" is deprecated, use markKeyForNotDeletion instead");
107
+ }
108
+
109
+ async markKeyForDeletion(key: string): Promise<void> {
102
110
  const metadata = await this.metadataDb.get(key).catch((e) => {
103
111
  console.error(`Could not read metadata from db: ${e}`);
104
112
  throw new Error(`Could not read metadata from db: ${e}`);
105
113
  });
106
114
  if (!metadata) {
107
- throw new Error(`Metadata for key ${key} not found`);
115
+ console.error(`Metadata for key ${key} not found`);
116
+ return;
108
117
  }
109
118
  const metadataParsed = JSON.parse(metadata);
110
119
 
@@ -129,7 +138,7 @@ export default class AdminForthStorageAdapterLocalFilesystem implements StorageA
129
138
  * This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
130
139
  * @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
131
140
  */
132
- async markKeyForNotDeletation(key: string): Promise<void> {
141
+ async markKeyForNotDeletion(key: string): Promise<void> {
133
142
  try {
134
143
  // if key exists, delete it
135
144
  await this.candidatesForDeletionDb.del(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/storage-adapter-local",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",