@paroicms/server-database-media-storage 1.11.0 → 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.
@@ -32,6 +32,6 @@ create table PaMediaHandle (
32
32
  mediaUid char(36) not null references PaMedia (uid) on delete cascade,
33
33
  handle varchar(200) not null,
34
34
  orderNum integer,
35
- leafId bigint,
35
+ nodeId bigint,
36
36
  primary key (mediaUid, handle)
37
37
  );
@@ -2,5 +2,5 @@ export declare class PaMediaHandleEntity {
2
2
  mediaUid: string;
3
3
  handle: string;
4
4
  orderNum?: number;
5
- leafId?: string;
5
+ nodeId?: string;
6
6
  }
@@ -15,7 +15,7 @@ let PaMediaHandleEntity = class PaMediaHandleEntity {
15
15
  mediaUid;
16
16
  handle;
17
17
  orderNum;
18
- leafId;
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, "leafId", void 0);
36
+ ], PaMediaHandleEntity.prototype, "nodeId", void 0);
37
37
  exports.PaMediaHandleEntity = PaMediaHandleEntity = __decorate([
38
38
  (0, typeorm_1.Entity)("PaMediaHandle")
39
39
  ], PaMediaHandleEntity);
@@ -18,5 +18,5 @@ export interface ImageProperties {
18
18
  export interface NewMediaWithHandle extends NewMediaPayload {
19
19
  handle: string;
20
20
  replace?: boolean;
21
- leafId: string;
21
+ nodeId: string;
22
22
  }
@@ -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({ leafId, exceptHandle }: {
61
- leafId: string;
60
+ countMedias({ nodeId, exceptHandle }: {
61
+ nodeId: string;
62
62
  exceptHandle?: string;
63
63
  }): Promise<number>;
64
64
  getAttachedDocumentsWeight(): Promise<number>;
@@ -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({ leafId, exceptHandle }) {
75
+ async countMedias({ nodeId, exceptHandle }) {
76
76
  this.#checkStatus();
77
- return await (0, media_queries_1.countMediasByLeafId)(this.#context.cn(), leafId, { exceptHandle });
77
+ return await (0, media_queries_1.countMediasByNodeId)(this.#context.cn(), nodeId, { exceptHandle });
78
78
  }
79
79
  async getAttachedDocumentsWeight() {
80
80
  this.#checkStatus();
@@ -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 countMediasByLeafId(cn: QueryBuilderConnection, leafId: string, options?: {
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>;
@@ -5,7 +5,7 @@ exports.getFirstImageForHandle = getFirstImageForHandle;
5
5
  exports.getMediasByHandle = getMediasByHandle;
6
6
  exports.getMediasByHandles = getMediasByHandles;
7
7
  exports.getMedia = getMedia;
8
- exports.countMediasByLeafId = countMediasByLeafId;
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
- leafId: payload.leafId,
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 countMediasByLeafId(cn, leafId, options = {}) {
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.leafId = :leafId", { leafId });
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.11.0",
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.19.0",
37
- "@paroicms/internal-server-lib": "1.9.0",
38
- "@paroicms/public-server-lib": "0.19.0",
39
- "@paroicms/public-anywhere-lib": "0.11.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"