@paroicms/server-database-media-storage 1.10.1 → 1.12.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/ddl/medias.ddl.sql +1 -1
- package/dist/entities/pa-media-handle.model.d.ts +1 -1
- package/dist/entities/pa-media-handle.model.js +2 -2
- package/dist/media-storage-types.d.ts +1 -1
- package/dist/media-storage.d.ts +2 -2
- package/dist/media-storage.js +2 -2
- package/dist/media.queries.d.ts +1 -1
- package/dist/media.queries.js +4 -4
- package/package.json +5 -5
package/ddl/medias.ddl.sql
CHANGED
|
@@ -15,7 +15,7 @@ let PaMediaHandleEntity = class PaMediaHandleEntity {
|
|
|
15
15
|
mediaUid;
|
|
16
16
|
handle;
|
|
17
17
|
orderNum;
|
|
18
|
-
|
|
18
|
+
nodeId;
|
|
19
19
|
};
|
|
20
20
|
exports.PaMediaHandleEntity = PaMediaHandleEntity;
|
|
21
21
|
__decorate([
|
|
@@ -33,7 +33,7 @@ __decorate([
|
|
|
33
33
|
__decorate([
|
|
34
34
|
(0, typeorm_1.Column)({ type: "bigint", nullable: true }),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
|
-
], PaMediaHandleEntity.prototype, "
|
|
36
|
+
], PaMediaHandleEntity.prototype, "nodeId", void 0);
|
|
37
37
|
exports.PaMediaHandleEntity = PaMediaHandleEntity = __decorate([
|
|
38
38
|
(0, typeorm_1.Entity)("PaMediaHandle")
|
|
39
39
|
], PaMediaHandleEntity);
|
package/dist/media-storage.d.ts
CHANGED
|
@@ -57,8 +57,8 @@ export declare class MediaStorage {
|
|
|
57
57
|
values: string;
|
|
58
58
|
}): Promise<Media | Image | undefined>;
|
|
59
59
|
reorderMedias(options: ReorderMediasInput): Promise<(Media | Image)[]>;
|
|
60
|
-
countMedias({
|
|
61
|
-
|
|
60
|
+
countMedias({ nodeId, exceptHandle }: {
|
|
61
|
+
nodeId: string;
|
|
62
62
|
exceptHandle?: string;
|
|
63
63
|
}): Promise<number>;
|
|
64
64
|
getAttachedDocumentsWeight(): Promise<number>;
|
package/dist/media-storage.js
CHANGED
|
@@ -72,9 +72,9 @@ class MediaStorage {
|
|
|
72
72
|
await (0, media_queries_1.reorderMedias)(this.#context, options);
|
|
73
73
|
return await this.getMedias({ handle: options.handle });
|
|
74
74
|
}
|
|
75
|
-
async countMedias({
|
|
75
|
+
async countMedias({ nodeId, exceptHandle }) {
|
|
76
76
|
this.#checkStatus();
|
|
77
|
-
return await (0, media_queries_1.
|
|
77
|
+
return await (0, media_queries_1.countMediasByNodeId)(this.#context.cn(), nodeId, { exceptHandle });
|
|
78
78
|
}
|
|
79
79
|
async getAttachedDocumentsWeight() {
|
|
80
80
|
this.#checkStatus();
|
package/dist/media.queries.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function getFirstImageForHandle(cn: QueryBuilderConnection, handl
|
|
|
7
7
|
export declare function getMediasByHandle(cn: QueryBuilderConnection, handle: string): Promise<(Image | Media)[]>;
|
|
8
8
|
export declare function getMediasByHandles(cn: QueryBuilderConnection, handles: string[]): Promise<Map<string, Image | Media>>;
|
|
9
9
|
export declare function getMedia(cn: QueryBuilderConnection, uid: string): Promise<Media | Image | undefined>;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function countMediasByNodeId(cn: QueryBuilderConnection, nodeId: string, options?: {
|
|
11
11
|
exceptHandle?: string;
|
|
12
12
|
}): Promise<number>;
|
|
13
13
|
export declare function getAttachedDocumentsWeight(cn: QueryBuilderConnection): Promise<number>;
|
package/dist/media.queries.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.getFirstImageForHandle = getFirstImageForHandle;
|
|
|
5
5
|
exports.getMediasByHandle = getMediasByHandle;
|
|
6
6
|
exports.getMediasByHandles = getMediasByHandles;
|
|
7
7
|
exports.getMedia = getMedia;
|
|
8
|
-
exports.
|
|
8
|
+
exports.countMediasByNodeId = countMediasByNodeId;
|
|
9
9
|
exports.getAttachedDocumentsWeight = getAttachedDocumentsWeight;
|
|
10
10
|
exports.getMediaByHandle = getMediaByHandle;
|
|
11
11
|
exports.getMediaWithBinary = getMediaWithBinary;
|
|
@@ -58,7 +58,7 @@ async function createMedia(ctx, payload) {
|
|
|
58
58
|
mediaUid: uid,
|
|
59
59
|
handle: payload.handle,
|
|
60
60
|
orderNum: maxNum === undefined ? 1 : maxNum + 1,
|
|
61
|
-
|
|
61
|
+
nodeId: payload.nodeId,
|
|
62
62
|
})
|
|
63
63
|
.execute();
|
|
64
64
|
});
|
|
@@ -123,12 +123,12 @@ async function getMedia(cn, uid) {
|
|
|
123
123
|
return;
|
|
124
124
|
return (0, data_formatters_lib_1.isDef)(row.width) ? (0, data_formatters_helpers_1.formatImage)(row) : (0, data_formatters_helpers_1.formatMedia)(row);
|
|
125
125
|
}
|
|
126
|
-
async function
|
|
126
|
+
async function countMediasByNodeId(cn, nodeId, options = {}) {
|
|
127
127
|
const query = cn
|
|
128
128
|
.createQueryBuilder()
|
|
129
129
|
.select("count(1)", "cnt")
|
|
130
130
|
.from("PaMediaHandle", "h")
|
|
131
|
-
.andWhere("h.
|
|
131
|
+
.andWhere("h.nodeId = :nodeId", { nodeId });
|
|
132
132
|
if (options.exceptHandle) {
|
|
133
133
|
query.andWhere("h.handle <> :handle", { handle: options.exceptHandle });
|
|
134
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/server-database-media-storage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A library to make back-end for media galleries.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paroicms",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@paroi/async-lib": "~0.3.1",
|
|
35
35
|
"@paroi/data-formatters-lib": "~0.4.0",
|
|
36
|
-
"@paroicms/internal-anywhere-lib": "1.
|
|
37
|
-
"@paroicms/internal-server-lib": "1.
|
|
38
|
-
"@paroicms/public-server-lib": "0.
|
|
39
|
-
"@paroicms/public-anywhere-lib": "0.
|
|
36
|
+
"@paroicms/internal-anywhere-lib": "1.20.0",
|
|
37
|
+
"@paroicms/internal-server-lib": "1.9.1",
|
|
38
|
+
"@paroicms/public-server-lib": "0.20.0",
|
|
39
|
+
"@paroicms/public-anywhere-lib": "0.12.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"typeorm": "0.3"
|