@oblax/filemanager 1.0.0 → 2.1.0
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/dist/filemanager-module.d.ts +30 -7
- package/dist/filemanager-module.d.ts.map +1 -1
- package/dist/filemanager-module.js +49 -9
- package/dist/filemanager-module.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +60 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { OblaxContext } from '@oblax/core';
|
|
2
|
-
import type { FileIdParams, FileLink, FileManagerConfig, FileManagerItem, UploadFileParams } from './types.js';
|
|
2
|
+
import type { FileIdParams, FileLink, FileManagerConfig, FileManagerItem, FileManagerList, ListFilesParams, UpdateFileInfoParams, UploadFileParams } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The FileManager module.
|
|
5
5
|
*
|
|
6
|
-
* Handles file uploads (multipart/form-data), listing,
|
|
7
|
-
* and deletion.
|
|
6
|
+
* Handles file uploads (multipart/form-data), listing, image info (alt text,
|
|
7
|
+
* caption, credit, focal point), signed-link generation and deletion.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
@@ -12,22 +12,45 @@ import type { FileIdParams, FileLink, FileManagerConfig, FileManagerItem, Upload
|
|
|
12
12
|
* const uploaded = await oblax.filemanager.upload({
|
|
13
13
|
* file,
|
|
14
14
|
* filename: 'hello.txt',
|
|
15
|
-
* contentType: 'text/plain',
|
|
16
15
|
* directory: 'documents',
|
|
17
16
|
* })
|
|
18
17
|
*
|
|
18
|
+
* // The caller's own PDFs, newest first
|
|
19
|
+
* const { data, count } = await oblax.filemanager.list({
|
|
20
|
+
* filters: [{ field: 'type', op: 'eq', value: 'application/pdf' }],
|
|
21
|
+
* limit: 20,
|
|
22
|
+
* })
|
|
23
|
+
*
|
|
19
24
|
* const link = await oblax.filemanager.getLink({ id: uploaded.id })
|
|
25
|
+
*
|
|
26
|
+
* await oblax.filemanager.updateInfo({
|
|
27
|
+
* id: uploaded.id,
|
|
28
|
+
* alt: { en: 'A cat on a sofa' },
|
|
29
|
+
* focalX: 0.5,
|
|
30
|
+
* focalY: 0.3,
|
|
31
|
+
* })
|
|
20
32
|
* ```
|
|
21
33
|
*/
|
|
22
34
|
export declare class FileManagerModule {
|
|
23
35
|
private readonly ctx;
|
|
24
36
|
constructor(ctx: OblaxContext, _config: FileManagerConfig);
|
|
25
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Uploads a file using multipart/form-data. It waits up to 5 minutes for the
|
|
39
|
+
* API by default (`timeout`), not the client's shorter `timeout`.
|
|
40
|
+
*/
|
|
26
41
|
upload(params: UploadFileParams): Promise<FileManagerItem>;
|
|
27
|
-
/**
|
|
28
|
-
|
|
42
|
+
/**
|
|
43
|
+
* A page of the files the caller may see: their own, or every file for an
|
|
44
|
+
* app admin. Filter and page on the server; see `ListFilesParams`.
|
|
45
|
+
*/
|
|
46
|
+
list(params?: ListFilesParams): Promise<FileManagerList>;
|
|
29
47
|
/** Generates a temporary signed URL for a file. */
|
|
30
48
|
getLink(params: FileIdParams): Promise<FileLink>;
|
|
49
|
+
/**
|
|
50
|
+
* Replaces a file's image info: alt text, caption, credit and focal point.
|
|
51
|
+
* Fields left out are cleared. Only the owner or an admin may change it.
|
|
52
|
+
*/
|
|
53
|
+
updateInfo(params: UpdateFileInfoParams): Promise<FileManagerItem>;
|
|
31
54
|
/** Deletes a file by ID. */
|
|
32
55
|
delete(params: FileIdParams): Promise<void>;
|
|
33
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filemanager-module.d.ts","sourceRoot":"","sources":["../src/filemanager-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filemanager-module.d.ts","sourceRoot":"","sources":["../src/filemanager-module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAEV,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAOnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,iBAAiB;IAE1E;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAehE;;;OAGG;IACG,IAAI,CAAC,MAAM,GAAE,eAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIlE,mDAAmD;IAC7C,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;IAItD;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IAUxE,4BAA4B;IACtB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlD"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { buildQuery, listPairs } from '@oblax/core';
|
|
1
2
|
const DEFAULT_DIRECTORY = 'documents';
|
|
3
|
+
/** How long an upload waits for the API by default: 5 minutes */
|
|
4
|
+
const UPLOAD_TIMEOUT = 5 * 60 * 1000;
|
|
2
5
|
/**
|
|
3
6
|
* The FileManager module.
|
|
4
7
|
*
|
|
5
|
-
* Handles file uploads (multipart/form-data), listing,
|
|
6
|
-
* and deletion.
|
|
8
|
+
* Handles file uploads (multipart/form-data), listing, image info (alt text,
|
|
9
|
+
* caption, credit, focal point), signed-link generation and deletion.
|
|
7
10
|
*
|
|
8
11
|
* @example
|
|
9
12
|
* ```typescript
|
|
@@ -11,33 +14,70 @@ const DEFAULT_DIRECTORY = 'documents';
|
|
|
11
14
|
* const uploaded = await oblax.filemanager.upload({
|
|
12
15
|
* file,
|
|
13
16
|
* filename: 'hello.txt',
|
|
14
|
-
* contentType: 'text/plain',
|
|
15
17
|
* directory: 'documents',
|
|
16
18
|
* })
|
|
17
19
|
*
|
|
20
|
+
* // The caller's own PDFs, newest first
|
|
21
|
+
* const { data, count } = await oblax.filemanager.list({
|
|
22
|
+
* filters: [{ field: 'type', op: 'eq', value: 'application/pdf' }],
|
|
23
|
+
* limit: 20,
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
18
26
|
* const link = await oblax.filemanager.getLink({ id: uploaded.id })
|
|
27
|
+
*
|
|
28
|
+
* await oblax.filemanager.updateInfo({
|
|
29
|
+
* id: uploaded.id,
|
|
30
|
+
* alt: { en: 'A cat on a sofa' },
|
|
31
|
+
* focalX: 0.5,
|
|
32
|
+
* focalY: 0.3,
|
|
33
|
+
* })
|
|
19
34
|
* ```
|
|
20
35
|
*/
|
|
21
36
|
export class FileManagerModule {
|
|
22
37
|
constructor(ctx, _config) {
|
|
23
38
|
this.ctx = ctx;
|
|
24
39
|
}
|
|
25
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Uploads a file using multipart/form-data. It waits up to 5 minutes for the
|
|
42
|
+
* API by default (`timeout`), not the client's shorter `timeout`.
|
|
43
|
+
*/
|
|
26
44
|
async upload(params) {
|
|
45
|
+
const file = params.contentType && params.contentType !== params.file.type
|
|
46
|
+
? new Blob([params.file], { type: params.contentType })
|
|
47
|
+
: params.file;
|
|
27
48
|
const formData = new FormData();
|
|
28
|
-
formData.append('file',
|
|
49
|
+
formData.append('file', file, params.filename);
|
|
29
50
|
formData.append('directory', params.directory ?? DEFAULT_DIRECTORY);
|
|
30
51
|
formData.append('public', params.public ? 'true' : 'false');
|
|
31
|
-
return this.ctx.http.post('/filemanager', formData
|
|
52
|
+
return this.ctx.http.post('/filemanager', formData, {
|
|
53
|
+
timeout: params.timeout ?? UPLOAD_TIMEOUT,
|
|
54
|
+
...(params.signal ? { signal: params.signal } : {}),
|
|
55
|
+
});
|
|
32
56
|
}
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
/**
|
|
58
|
+
* A page of the files the caller may see: their own, or every file for an
|
|
59
|
+
* app admin. Filter and page on the server; see `ListFilesParams`.
|
|
60
|
+
*/
|
|
61
|
+
async list(params = {}) {
|
|
62
|
+
return this.ctx.http.get(`/filemanager${buildQuery({}, listPairs(params))}`);
|
|
36
63
|
}
|
|
37
64
|
/** Generates a temporary signed URL for a file. */
|
|
38
65
|
async getLink(params) {
|
|
39
66
|
return this.ctx.http.get(`/filemanager/${params.id}/link`);
|
|
40
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Replaces a file's image info: alt text, caption, credit and focal point.
|
|
70
|
+
* Fields left out are cleared. Only the owner or an admin may change it.
|
|
71
|
+
*/
|
|
72
|
+
async updateInfo(params) {
|
|
73
|
+
return this.ctx.http.put(`/filemanager/${params.id}`, {
|
|
74
|
+
alt: params.alt,
|
|
75
|
+
caption: params.caption,
|
|
76
|
+
credit: params.credit,
|
|
77
|
+
focal_x: params.focalX,
|
|
78
|
+
focal_y: params.focalY,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
41
81
|
/** Deletes a file by ID. */
|
|
42
82
|
async delete(params) {
|
|
43
83
|
return this.ctx.http.delete(`/filemanager/${params.id}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filemanager-module.js","sourceRoot":"","sources":["../src/filemanager-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filemanager-module.js","sourceRoot":"","sources":["../src/filemanager-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAcnD,MAAM,iBAAiB,GAAkB,WAAW,CAAA;AAEpD,iEAAiE;AACjE,MAAM,cAAc,GAAG,CAA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AC,IAAI,CAAC,GAAG,CAAkB,eAAe,UAAU,CAAC,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAA;IAC/F,CAAC;IAED,mDAAmD;IACnD,KAAK,CAAC,OAAO,CAAC,MAAoB;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAW,gBAAgB,MAAM,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,MAA4B;QAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAkB,gBAAgB,MAAM,CAAC,EAAE,EAAE,EAAE;YACrE,GAAG,EAAM,MAAM,CAAC,GAAG;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAG,MAAM,CAAC,MAAM;YACtB,OAAO,EAAE,MAAM,CAAC,MAAM;YACtB,OAAO,EAAE,MAAM,CAAC,MAAM;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,4BAA4B;IAC5B,KAAK,CAAC,MAAM,CAAC,MAAoB;QAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAO,gBAAgB,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;IAChE,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { OblaxModulePlugin } from '@oblax/core';
|
|
|
2
2
|
import { FileManagerModule } from './filemanager-module.js';
|
|
3
3
|
import type { FileManagerConfig } from './types.js';
|
|
4
4
|
export { FileManagerModule } from './filemanager-module.js';
|
|
5
|
-
export type { FileManagerConfig, FileManagerItem, UploadFileParams, FileIdParams, FileLink, FileDirectory, } from './types.js';
|
|
5
|
+
export type { FileManagerConfig, FileManagerItem, FileManagerList, ListFilesParams, UploadFileParams, UpdateFileInfoParams, FileIdParams, FileLink, FileDirectory, } from './types.js';
|
|
6
6
|
/**
|
|
7
7
|
* FileManager module factory.
|
|
8
8
|
*
|
|
@@ -23,7 +23,6 @@ export type { FileManagerConfig, FileManagerItem, UploadFileParams, FileIdParams
|
|
|
23
23
|
* const uploaded = await oblax.filemanager.upload({
|
|
24
24
|
* file: new Blob(['hello'], { type: 'text/plain' }),
|
|
25
25
|
* filename: 'hello.txt',
|
|
26
|
-
* contentType: 'text/plain',
|
|
27
26
|
* })
|
|
28
27
|
* ```
|
|
29
28
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,aAAa,GACd,MAAM,YAAY,CAAA;AAEnB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3D,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EACR,aAAa,GACd,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CACzB,MAAM,GAAE,iBAAsB,GAC7B,iBAAiB,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAOrD"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAc3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,WAAW,CACzB,SAA4B,EAAE;IAE9B,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,MAAM,CAAC,GAAiB;YACtB,OAAO,IAAI,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QAC3C,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListQuery } from '@oblax/core';
|
|
1
2
|
export type FileDirectory = 'documents' | 'images' | 'videos' | 'avatars' | 'pdfs';
|
|
2
3
|
/**
|
|
3
4
|
* A file stored by the Oblax file manager.
|
|
@@ -13,6 +14,23 @@ export interface FileManagerItem {
|
|
|
13
14
|
type: string;
|
|
14
15
|
size: number;
|
|
15
16
|
owner_id: string;
|
|
17
|
+
/** `true` when any user may link the file, not only its owner and admins. */
|
|
18
|
+
public: boolean;
|
|
19
|
+
/** Image width in pixels, measured on upload (JPEG, PNG, GIF); `0` otherwise. */
|
|
20
|
+
width: number;
|
|
21
|
+
/** Image height in pixels, measured on upload (JPEG, PNG, GIF); `0` otherwise. */
|
|
22
|
+
height: number;
|
|
23
|
+
/** Alt text by locale (keys are the project's enabled locales). */
|
|
24
|
+
alt?: Record<string, string>;
|
|
25
|
+
/** Caption by locale (keys are the project's enabled locales). */
|
|
26
|
+
caption?: Record<string, string>;
|
|
27
|
+
credit?: string;
|
|
28
|
+
/** Horizontal focal point, `0` (left) to `1` (right). Set together with `focal_y`. */
|
|
29
|
+
focal_x?: number;
|
|
30
|
+
/** Vertical focal point, `0` (top) to `1` (bottom). Set together with `focal_x`. */
|
|
31
|
+
focal_y?: number;
|
|
32
|
+
_created?: string;
|
|
33
|
+
_modified?: string;
|
|
16
34
|
}
|
|
17
35
|
/**
|
|
18
36
|
* Signed/temporary URL response.
|
|
@@ -30,9 +48,50 @@ export interface FileLink {
|
|
|
30
48
|
export interface UploadFileParams {
|
|
31
49
|
file: Blob | File;
|
|
32
50
|
filename: string;
|
|
33
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The file's media type. Left out, the `Blob`'s or `File`'s own `type` is
|
|
53
|
+
* sent. The API keeps it for private files and detects it for public ones.
|
|
54
|
+
*/
|
|
55
|
+
contentType?: string;
|
|
34
56
|
directory?: FileDirectory;
|
|
35
57
|
public?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* How long to wait for the API, in milliseconds, once the upload is sent;
|
|
60
|
+
* `0` sets no limit. Defaults to 5 minutes rather than the client's
|
|
61
|
+
* `timeout`, so a large file isn't cut off.
|
|
62
|
+
*/
|
|
63
|
+
timeout?: number;
|
|
64
|
+
/** Cancels the upload. */
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `filemanager.list()`'s filters, order and page. Filters: `owner_id`, `type`,
|
|
69
|
+
* `public`, `dir_path`, `original_filename`. Order by `_created` (the default,
|
|
70
|
+
* newest first), `original_filename`, `size` or `type`. Pages of 100 (`limit`
|
|
71
|
+
* up to 500, `offset`).
|
|
72
|
+
*/
|
|
73
|
+
export type ListFilesParams = ListQuery;
|
|
74
|
+
/** A page of files and the number of files that match. */
|
|
75
|
+
export interface FileManagerList {
|
|
76
|
+
data: FileManagerItem[];
|
|
77
|
+
count: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Image info for `filemanager.updateInfo()`.
|
|
81
|
+
*
|
|
82
|
+
* This replaces the info as a whole: any field left out is cleared.
|
|
83
|
+
*/
|
|
84
|
+
export interface UpdateFileInfoParams {
|
|
85
|
+
id: string;
|
|
86
|
+
/** Alt text by locale; keys must be enabled project locales. */
|
|
87
|
+
alt?: Record<string, string>;
|
|
88
|
+
/** Caption by locale; keys must be enabled project locales. */
|
|
89
|
+
caption?: Record<string, string>;
|
|
90
|
+
credit?: string;
|
|
91
|
+
/** Horizontal focal point, `0`–`1` from the left. Give both or neither. */
|
|
92
|
+
focalX?: number;
|
|
93
|
+
/** Vertical focal point, `0`–`1` from the top. Give both or neither. */
|
|
94
|
+
focalY?: number;
|
|
36
95
|
}
|
|
37
96
|
export interface FileIdParams {
|
|
38
97
|
id: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AAElF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAA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C,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,CAAA;AAEvC,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,iBAAiB;CAEjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oblax/filemanager",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Oblax SDK — file manager module (upload, list, signed links, delete)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -37,15 +37,16 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@oblax/core": "1.0
|
|
40
|
+
"@oblax/core": "^2.1.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"typescript": "^5.5.0",
|
|
44
|
-
"@oblax/core": "1.0
|
|
44
|
+
"@oblax/core": "2.1.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsc --build tsconfig.json",
|
|
48
48
|
"typecheck": "tsc --build tsconfig.json --dry",
|
|
49
|
+
"test": "tsc --build tsconfig.json && node --test \"test/*.test.ts\"",
|
|
49
50
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
50
51
|
}
|
|
51
52
|
}
|