@stemy/backend 2.7.4 → 2.8.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/bundles/stemy-backend.umd.js +349 -198
- package/bundles/stemy-backend.umd.js.map +1 -1
- package/bundles/stemy-backend.umd.min.js +1 -1
- package/bundles/stemy-backend.umd.min.js.map +1 -1
- package/common-types.d.ts +17 -8
- package/esm2015/common-types.js +1 -1
- package/esm2015/services/assets.js +8 -4
- package/esm2015/services/entities/asset.js +16 -21
- package/esm2015/services/entities/base-entity.js +37 -0
- package/esm2015/services/entities/lazy-asset.js +42 -45
- package/esm2015/services/entities/progress.js +72 -54
- package/esm2015/services/lazy-assets.js +9 -5
- package/esm2015/services/progresses.js +10 -6
- package/esm2015/utilities/lazy-asset-generator.js +7 -2
- package/fesm2015/stemy-backend.js +202 -141
- package/fesm2015/stemy-backend.js.map +1 -1
- package/package.json +1 -1
- package/services/entities/asset.d.ts +6 -9
- package/services/entities/base-entity.d.ts +13 -0
- package/services/entities/lazy-asset.d.ts +6 -12
- package/services/entities/progress.d.ts +18 -20
package/package.json
CHANGED
|
@@ -4,22 +4,19 @@ import { Readable } from "stream";
|
|
|
4
4
|
import { Collection, GridFSBucket } from "mongodb";
|
|
5
5
|
import { ObjectId } from "bson";
|
|
6
6
|
import { IAsset, IAssetCropInfo, IAssetImageParams, IAssetMeta } from "../../common-types";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly filename: string;
|
|
10
|
-
readonly contentType: string;
|
|
11
|
-
readonly metadata: IAssetMeta;
|
|
7
|
+
import { BaseEntity } from "./base-entity";
|
|
8
|
+
export declare class Asset extends BaseEntity<IAsset> implements IAsset {
|
|
12
9
|
protected bucket: GridFSBucket;
|
|
13
|
-
protected collection: Collection;
|
|
14
10
|
protected static toCropRegion(cropInfo: string | IAssetCropInfo): Region;
|
|
15
11
|
protected static toImage(stream: Readable, meta?: IAssetMeta, params?: IAssetImageParams): Promise<Readable>;
|
|
16
|
-
get
|
|
12
|
+
get filename(): string;
|
|
13
|
+
get contentType(): string;
|
|
14
|
+
get metadata(): IAssetMeta;
|
|
17
15
|
get stream(): Readable;
|
|
18
|
-
constructor(
|
|
16
|
+
constructor(id: ObjectId, data: Partial<IAsset>, collection: Collection, bucket: GridFSBucket);
|
|
19
17
|
unlink(): Promise<string>;
|
|
20
18
|
getBuffer(): Promise<Buffer>;
|
|
21
19
|
download(metadata?: IAssetMeta): Promise<Readable>;
|
|
22
20
|
getImage(params?: IAssetImageParams): Promise<Readable>;
|
|
23
21
|
downloadImage(params?: IAssetImageParams, metadata?: IAssetMeta): Promise<Readable>;
|
|
24
|
-
toJSON(): any;
|
|
25
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Collection } from "mongodb";
|
|
2
|
+
import { ObjectId } from "bson";
|
|
3
|
+
export declare class BaseEntity<T> {
|
|
4
|
+
readonly mId: ObjectId;
|
|
5
|
+
protected data: Partial<T>;
|
|
6
|
+
protected collection: Collection;
|
|
7
|
+
get id(): string;
|
|
8
|
+
protected deleted: boolean;
|
|
9
|
+
constructor(mId: ObjectId, data: Partial<T>, collection: Collection);
|
|
10
|
+
save(): Promise<any>;
|
|
11
|
+
load(): Promise<this>;
|
|
12
|
+
toJSON(): any;
|
|
13
|
+
}
|
|
@@ -4,26 +4,20 @@ import { IAsset, ILazyAsset } from "../../common-types";
|
|
|
4
4
|
import { Assets } from "../assets";
|
|
5
5
|
import { JobManager } from "../job-manager";
|
|
6
6
|
import { Progresses } from "../progresses";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly jobName: string;
|
|
10
|
-
readonly jobParams: any;
|
|
11
|
-
readonly jobQue: string;
|
|
12
|
-
protected mProgressId: string;
|
|
13
|
-
protected mAssetId: string;
|
|
7
|
+
import { BaseEntity } from "./base-entity";
|
|
8
|
+
export declare class LazyAsset extends BaseEntity<ILazyAsset> implements ILazyAsset {
|
|
14
9
|
protected assets: Assets;
|
|
15
10
|
protected progresses: Progresses;
|
|
16
11
|
protected jobMan: JobManager;
|
|
17
|
-
|
|
18
|
-
get
|
|
12
|
+
get jobName(): string;
|
|
13
|
+
get jobParams(): any;
|
|
14
|
+
get jobQue(): string;
|
|
19
15
|
get progressId(): string;
|
|
20
16
|
get assetId(): string;
|
|
21
|
-
constructor(
|
|
17
|
+
constructor(id: ObjectId, data: Partial<ILazyAsset>, collection: Collection, assets: Assets, progresses: Progresses, jobMan: JobManager);
|
|
22
18
|
unlink(): Promise<string>;
|
|
23
19
|
startWorking(): void;
|
|
24
20
|
loadAsset(): Promise<IAsset>;
|
|
25
21
|
writeAsset(asset: IAsset): Promise<IAsset>;
|
|
26
|
-
save(): Promise<any>;
|
|
27
|
-
toJSON(): any;
|
|
28
22
|
protected startWorkingOnAsset(): Promise<any>;
|
|
29
23
|
}
|
|
@@ -2,48 +2,46 @@
|
|
|
2
2
|
import { ObjectId } from "bson";
|
|
3
3
|
import { Collection } from "mongodb";
|
|
4
4
|
import { IProgress } from "../../common-types";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
protected mCurrent: number;
|
|
8
|
-
protected mMax: number;
|
|
9
|
-
protected mMessage: string;
|
|
10
|
-
protected mError: string;
|
|
5
|
+
import { BaseEntity } from "./base-entity";
|
|
6
|
+
export declare class Progress extends BaseEntity<IProgress> implements IProgress {
|
|
11
7
|
protected client: SocketIOClient.Socket;
|
|
12
|
-
protected collection: Collection;
|
|
13
|
-
get id(): string;
|
|
14
8
|
get current(): number;
|
|
15
9
|
get max(): number;
|
|
16
10
|
get message(): string;
|
|
17
11
|
get error(): string;
|
|
12
|
+
get canceled(): boolean;
|
|
18
13
|
get percent(): number;
|
|
19
14
|
get remaining(): number;
|
|
20
|
-
constructor(
|
|
15
|
+
constructor(id: ObjectId, data: Partial<IProgress>, collection: Collection, client: SocketIOClient.Socket);
|
|
21
16
|
createSubProgress(progressValue: number, max?: number, message?: string): Promise<IProgress>;
|
|
22
17
|
setMax(max: number): Promise<any>;
|
|
18
|
+
setMessage(message: string): Promise<any>;
|
|
23
19
|
setError(error: string): Promise<any>;
|
|
24
20
|
advance(value?: number): Promise<any>;
|
|
25
|
-
|
|
26
|
-
save(): Promise<any>;
|
|
21
|
+
cancel(): Promise<any>;
|
|
27
22
|
}
|
|
28
23
|
export declare class SubProgress implements IProgress {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
protected parent: IProgress;
|
|
25
|
+
protected progressFrom: number;
|
|
26
|
+
protected progressValue: number;
|
|
27
|
+
protected mMax: number;
|
|
33
28
|
get id(): string;
|
|
29
|
+
get current(): number;
|
|
30
|
+
get max(): number;
|
|
34
31
|
get message(): string;
|
|
35
|
-
set message(value: string);
|
|
36
32
|
get error(): string;
|
|
37
|
-
set error(value: string);
|
|
38
33
|
get percent(): number;
|
|
39
|
-
get current(): number;
|
|
40
34
|
get remaining(): number;
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
get canceled(): boolean;
|
|
36
|
+
protected mCurrent: number;
|
|
37
|
+
constructor(parent: IProgress, progressFrom: number, progressValue: number, mMax?: number);
|
|
43
38
|
createSubProgress(progressValue: number, max?: number, message?: string): Promise<IProgress>;
|
|
44
39
|
setMax(max: number): Promise<any>;
|
|
40
|
+
setMessage(message: string): Promise<any>;
|
|
45
41
|
setError(error: string): Promise<any>;
|
|
46
42
|
advance(value?: number): Promise<any>;
|
|
43
|
+
cancel(): Promise<any>;
|
|
47
44
|
save(): Promise<any>;
|
|
45
|
+
load(): Promise<any>;
|
|
48
46
|
toJSON(): any;
|
|
49
47
|
}
|