adminforth 1.21.0-next.17 → 1.21.0-next.19

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.
@@ -139,13 +139,22 @@ export interface OAuth2Adapter {
139
139
  }
140
140
 
141
141
 
142
+ /**
143
+ * Each storage adapter should support two ways of storing files:
144
+ * - publically (public URL) - the file can be accessed by anyone by HTTP GET / HEAD request with plain URL
145
+ * - privately (presigned URL) - the file can be accessed by anyone by HTTP GET / HEAD request only with presigned URLs, limited by expiration time
146
+ *
147
+ */
142
148
  export interface StorageAdapter {
143
149
  /**
144
- * This method should return the presigned URL for the given key capable of upload (PUT multipart form data to it).
150
+ * This method should return the presigned URL for the given key capable of upload (adapter user will call PUT multipart form data to this URL within expiresIn seconds after link generation).
151
+ * By default file which will be uploaded on PUT should be marked for deletion. So if during 24h it is not marked for not deletion, it adapter should delete it forever.
145
152
  * The PUT method should fail if the file already exists.
153
+ *
154
+ * Adapter user will always pass next parameters to the method:
146
155
  * @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
147
156
  * @param expiresIn - The expiration time in seconds for the presigned URL
148
- * @param contentType - The content type of the file to be uploaded
157
+ * @param contentType - The content type of the file to be uploaded, e.g. "image/png"
149
158
  *
150
159
  * @returns A promise that resolves to an object containing the upload URL and any extra parameters which should be sent with PUT multipart form data
151
160
  */
@@ -155,9 +164,9 @@ export interface StorageAdapter {
155
164
  }>;
156
165
 
157
166
  /**
158
- * This method should return the URL for the given key capable of download (200 GET request with response or 200 HEAD request without response).
159
- * If adapter configured to use public storage, this method should return the public URL of the file.
160
- * If adapter configured to use private storage, this method should return the presigned URL for the file.
167
+ * This method should return the URL for the given key capable of download (200 GET request with response body or 200 HEAD request without response body).
168
+ * If adapter configured to store objects publically, this method should return the public URL of the file.
169
+ * If adapter configured to no allow public storing of images, this method should return the presigned URL for the file.
161
170
  *
162
171
  * @param key - The key of the file to be downloaded e.g. "uploads/file.txt"
163
172
  * @param expiresIn - The expiration time in seconds for the presigned URL
@@ -186,6 +195,10 @@ export interface StorageAdapter {
186
195
  */
187
196
  setupLifecycle(): Promise<void>;
188
197
 
198
+ /**
199
+ * If adapter is configured to publically, this method should return true.
200
+ */
201
+ objectCanBeAccesedPublicly(): Promise<boolean>;
189
202
  }
190
203
 
191
204
 
@@ -103,13 +103,22 @@ export interface OAuth2Adapter {
103
103
  */
104
104
  getName?(): string;
105
105
  }
106
+ /**
107
+ * Each storage adapter should support two ways of storing files:
108
+ * - publically (public URL) - the file can be accessed by anyone by HTTP GET / HEAD request with plain URL
109
+ * - privately (presigned URL) - the file can be accessed by anyone by HTTP GET / HEAD request only with presigned URLs, limited by expiration time
110
+ *
111
+ */
106
112
  export interface StorageAdapter {
107
113
  /**
108
- * This method should return the presigned URL for the given key capable of upload (PUT multipart form data to it).
114
+ * This method should return the presigned URL for the given key capable of upload (adapter user will call PUT multipart form data to this URL within expiresIn seconds after link generation).
115
+ * By default file which will be uploaded on PUT should be marked for deletion. So if during 24h it is not marked for not deletion, it adapter should delete it forever.
109
116
  * The PUT method should fail if the file already exists.
117
+ *
118
+ * Adapter user will always pass next parameters to the method:
110
119
  * @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
111
120
  * @param expiresIn - The expiration time in seconds for the presigned URL
112
- * @param contentType - The content type of the file to be uploaded
121
+ * @param contentType - The content type of the file to be uploaded, e.g. "image/png"
113
122
  *
114
123
  * @returns A promise that resolves to an object containing the upload URL and any extra parameters which should be sent with PUT multipart form data
115
124
  */
@@ -118,9 +127,9 @@ export interface StorageAdapter {
118
127
  uploadExtraParams?: Record<string, string>;
119
128
  }>;
120
129
  /**
121
- * This method should return the URL for the given key capable of download (200 GET request with response or 200 HEAD request without response).
122
- * If adapter configured to use public storage, this method should return the public URL of the file.
123
- * If adapter configured to use private storage, this method should return the presigned URL for the file.
130
+ * This method should return the URL for the given key capable of download (200 GET request with response body or 200 HEAD request without response body).
131
+ * If adapter configured to store objects publically, this method should return the public URL of the file.
132
+ * If adapter configured to no allow public storing of images, this method should return the presigned URL for the file.
124
133
  *
125
134
  * @param key - The key of the file to be downloaded e.g. "uploads/file.txt"
126
135
  * @param expiresIn - The expiration time in seconds for the presigned URL
@@ -143,5 +152,9 @@ export interface StorageAdapter {
143
152
  * This method can start needed schedullers, cron jobs, etc. to clean up the storage.
144
153
  */
145
154
  setupLifecycle(): Promise<void>;
155
+ /**
156
+ * If adapter is configured to publically, this method should return true.
157
+ */
158
+ objectCanBeAccesedPublicly(): Promise<boolean>;
146
159
  }
147
160
  //# sourceMappingURL=Adapters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Adapters.d.ts","sourceRoot":"","sources":["../../types/Adapters.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAE3B;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;;;;OAOG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,EAAE,CAAC,EAAE,OAAO,CAAC;KACd,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAEhC;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;;;;;OAMG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,sBAAsB;IAErC;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;OAEG;IACH,6BAA6B,IAAI,MAAM,CAAC;IA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C,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAGtD;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.21.0-next.17",
3
+ "version": "1.21.0-next.19",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -20,9 +20,7 @@
20
20
  "rollout-doc": "cd documentation && npm run build && npm run deploy",
21
21
  "docs": "typedoc",
22
22
  "--comment_postinstall": "postinstall executed after package installed in other project package and when we do npm ci in the package",
23
- "postinstall": "if test -d ./dist/spa/; then cd ./dist/spa/ && npm ci && echo 'installed spa dependencies'; fi",
24
- "install-plugins": "cd ../plugins && bash install-plugins.sh",
25
- "install-adapters": "cd ../adapters && bash install-adapters.sh"
23
+ "postinstall": "if test -d ./dist/spa/; then cd ./dist/spa/ && npm ci && echo 'installed spa dependencies'; fi"
26
24
  },
27
25
  "release": {
28
26
  "plugins": [