@adminforth/storage-adapter-local 1.0.10 → 1.0.11

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 +4 -33
  2. package/index.ts +4 -31
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -74,43 +74,14 @@ class AdminForthStorageAdapterLocalFilesystem {
74
74
  }
75
75
  markKeyForDeletation(key) {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
- afLogger.error("Method \"markKeyForDeletation\" is deprecated, use markKeyForDeletion instead");
78
- const metadata = yield this.metadataDb.get(key).catch((e) => {
79
- afLogger.error(`Could not read metadata from db: ${e}`);
80
- throw new Error(`Could not read metadata from db: ${e}`);
81
- });
82
- if (!metadata) {
83
- afLogger.error(`Metadata for key ${key} not found`);
84
- return;
85
- }
86
- const metadataParsed = JSON.parse(metadata);
87
- try {
88
- yield this.candidatesForDeletionDb.get(key);
89
- // if key already exists, do nothing
90
- return;
91
- }
92
- catch (e) {
93
- // if key does not exist, continue
94
- }
95
- try {
96
- yield this.candidatesForDeletionDb.put(key, metadataParsed.createdAt);
97
- }
98
- catch (e) {
99
- afLogger.error(`Could not write metadata to db: ${e}`);
100
- throw new Error(`Could not write metadata to db: ${e}`);
101
- }
77
+ afLogger.warn("Method \"markKeyForDeletation\" is deprecated. Please update upload plugin");
78
+ this.markKeyForDeletion(key);
102
79
  });
103
80
  }
104
81
  markKeyForNotDeletation(key) {
105
82
  return __awaiter(this, void 0, void 0, function* () {
106
- afLogger.error("Method \"markKeyForNotDeletation\" is deprecated, use markKeyForNotDeletion instead");
107
- try {
108
- // if key exists, delete it
109
- yield this.candidatesForDeletionDb.del(key);
110
- }
111
- catch (e) {
112
- // if key does not exist, do nothing
113
- }
83
+ afLogger.warn("Method \"markKeyForNotDeletation\" is deprecated. Please update upload plugin");
84
+ this.markKeyForNotDeletion(key);
114
85
  });
115
86
  }
116
87
  markKeyForDeletion(key) {
package/index.ts CHANGED
@@ -99,40 +99,13 @@ export default class AdminForthStorageAdapterLocalFilesystem implements StorageA
99
99
  }
100
100
 
101
101
  async markKeyForDeletation(key: string): Promise<void> {
102
- afLogger.error("Method \"markKeyForDeletation\" is deprecated, use markKeyForDeletion instead");
103
- const metadata = await this.metadataDb.get(key).catch((e) => {
104
- afLogger.error(`Could not read metadata from db: ${e}`);
105
- throw new Error(`Could not read metadata from db: ${e}`);
106
- });
107
- if (!metadata) {
108
- afLogger.error(`Metadata for key ${key} not found`);
109
- return;
110
- }
111
- const metadataParsed = JSON.parse(metadata);
112
-
113
- try {
114
- await this.candidatesForDeletionDb.get(key);
115
- // if key already exists, do nothing
116
- return;
117
- } catch (e) {
118
- // if key does not exist, continue
119
- }
120
- try {
121
- await this.candidatesForDeletionDb.put(key, metadataParsed.createdAt)
122
- } catch (e) {
123
- afLogger.error(`Could not write metadata to db: ${e}`);
124
- throw new Error(`Could not write metadata to db: ${e}`);
125
- }
102
+ afLogger.warn("Method \"markKeyForDeletation\" is deprecated. Please update upload plugin");
103
+ this.markKeyForDeletion(key);
126
104
  }
127
105
 
128
106
  async markKeyForNotDeletation(key: string): Promise<void> {
129
- afLogger.error("Method \"markKeyForNotDeletation\" is deprecated, use markKeyForNotDeletion instead");
130
- try {
131
- // if key exists, delete it
132
- await this.candidatesForDeletionDb.del(key);
133
- } catch (e) {
134
- // if key does not exist, do nothing
135
- }
107
+ afLogger.warn("Method \"markKeyForNotDeletation\" is deprecated. Please update upload plugin");
108
+ this.markKeyForNotDeletion(key);
136
109
  }
137
110
 
138
111
  async markKeyForDeletion(key: string): Promise<void> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/storage-adapter-local",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",