@paroicms/server-database-media-storage 1.13.0 → 1.14.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/context.js +2 -5
- package/dist/context.js.map +1 -1
- package/dist/data-types.js +1 -2
- package/dist/db-init/db-init.js +14 -17
- package/dist/db-init/db-init.js.map +1 -1
- package/dist/db-init/ddl-migration.js +17 -21
- package/dist/db-init/ddl-migration.js.map +1 -1
- package/dist/entities/pa-image.model.js +8 -11
- package/dist/entities/pa-image.model.js.map +1 -1
- package/dist/entities/pa-media-handle.model.js +8 -11
- package/dist/entities/pa-media-handle.model.js.map +1 -1
- package/dist/entities/pa-media.model.js +12 -15
- package/dist/entities/pa-media.model.js.map +1 -1
- package/dist/helpers/data-formatters.helpers.d.ts +1 -1
- package/dist/helpers/data-formatters.helpers.js +16 -22
- package/dist/helpers/data-formatters.helpers.js.map +1 -1
- package/dist/helpers/sqlite-date-helper.js +1 -4
- package/dist/helpers/sqlite-date-helper.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -20
- package/dist/index.js.map +1 -1
- package/dist/media-storage-context.d.ts +1 -1
- package/dist/media-storage-context.js +5 -9
- package/dist/media-storage-context.js.map +1 -1
- package/dist/media-storage-types.js +1 -2
- package/dist/media-storage.d.ts +2 -2
- package/dist/media-storage.js +21 -26
- package/dist/media-storage.js.map +1 -1
- package/dist/media.queries.d.ts +3 -3
- package/dist/media.queries.js +31 -47
- package/dist/media.queries.js.map +1 -1
- package/package.json +6 -6
package/dist/context.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.packageDir = void 0;
|
|
4
|
-
const node_path_1 = require("node:path");
|
|
5
|
-
exports.packageDir = (0, node_path_1.dirname)(__dirname);
|
|
1
|
+
import { resolveModuleDirectory } from "@paroicms/public-server-lib";
|
|
2
|
+
export const packageDir = resolveModuleDirectory(import.meta.url, { parent: true });
|
|
6
3
|
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC"}
|
package/dist/data-types.js
CHANGED
package/dist/db-init/db-init.js
CHANGED
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
async function createOrOpenMediasConnection({ sqliteFile, canCreate, logger, }) {
|
|
9
|
-
const { logNextQuery, typeOrmLogger } = (0, internal_server_lib_1.createSqlLogger)({ logger, dbSchemaName: ddl_migration_1.dbSchemaName });
|
|
10
|
-
const { cn } = await (0, internal_server_lib_1.createOrOpenSqliteConnection)({
|
|
1
|
+
import { createOrOpenSqliteConnection, createSqlLogger, getMetadataDbSchemaVersion, } from "@paroicms/internal-server-lib";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { packageDir } from "../context.js";
|
|
4
|
+
import { currentDbSchemaVersion, dbSchemaName, migrateMediasDb } from "./ddl-migration.js";
|
|
5
|
+
export async function createOrOpenMediasConnection({ sqliteFile, canCreate, logger, }) {
|
|
6
|
+
const { logNextQuery, typeOrmLogger } = createSqlLogger({ logger, dbSchemaName });
|
|
7
|
+
const { cn } = await createOrOpenSqliteConnection({
|
|
11
8
|
canCreate,
|
|
12
|
-
dbSchemaName
|
|
9
|
+
dbSchemaName,
|
|
13
10
|
sqliteFile,
|
|
14
|
-
ddlFile:
|
|
11
|
+
ddlFile: join(packageDir, "ddl", "medias.ddl.sql"),
|
|
15
12
|
migrateDb,
|
|
16
|
-
entities: [`${
|
|
13
|
+
entities: [`${packageDir}/dist/**/*.model.js`],
|
|
17
14
|
typeOrmLogger,
|
|
18
15
|
logger,
|
|
19
16
|
});
|
|
20
17
|
async function migrateDb(cn) {
|
|
21
|
-
const dbVersion = await
|
|
22
|
-
if (dbVersion ===
|
|
18
|
+
const dbVersion = await getMetadataDbSchemaVersion(cn, { dbSchemaName });
|
|
19
|
+
if (dbVersion === currentDbSchemaVersion) {
|
|
23
20
|
return {
|
|
24
21
|
migrated: false,
|
|
25
22
|
schemaVersion: dbVersion,
|
|
26
23
|
};
|
|
27
24
|
}
|
|
28
|
-
await
|
|
25
|
+
await migrateMediasDb(cn, {
|
|
29
26
|
fromVersion: dbVersion,
|
|
30
27
|
logger,
|
|
31
28
|
});
|
|
32
29
|
return {
|
|
33
30
|
migrated: true,
|
|
34
31
|
fromVersion: dbVersion,
|
|
35
|
-
schemaVersion:
|
|
32
|
+
schemaVersion: currentDbSchemaVersion,
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
35
|
return { cn, logNextQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-init.js","sourceRoot":"","sources":["../../src/db-init/db-init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db-init.js","sourceRoot":"","sources":["../../src/db-init/db-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,4BAA4B,EAC5B,eAAe,EACf,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE3F,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,UAAU,EACV,SAAS,EACT,MAAM,GACwD;IAC9D,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IAElF,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,4BAA4B,CAAC;QAChD,SAAS;QACT,YAAY;QACZ,UAAU;QACV,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,CAAC;QAClD,SAAS;QACT,QAAQ,EAAE,CAAC,GAAG,UAAU,qBAAqB,CAAC;QAC9C,aAAa;QACb,MAAM;KACP,CAAC,CAAC;IAEH,KAAK,UAAU,SAAS,CAAC,EAAc;QACrC,MAAM,SAAS,GAAG,MAAM,0BAA0B,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;QACzE,IAAI,SAAS,KAAK,sBAAsB,EAAE,CAAC;YACzC,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,aAAa,EAAE,SAAS;aACzB,CAAC;QACJ,CAAC;QACD,MAAM,eAAe,CAAC,EAAE,EAAE;YACxB,WAAW,EAAE,SAAS;YACtB,MAAM;SACP,CAAC,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,sBAAsB;SACtC,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -1,58 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
exports.dbSchemaName = "medias";
|
|
8
|
-
exports.currentDbSchemaVersion = 7;
|
|
9
|
-
async function migrateMediasDb(cn, { fromVersion, logger }) {
|
|
10
|
-
const toVersion = exports.currentDbSchemaVersion;
|
|
1
|
+
import { dateVal, strVal, strValOrUndef } from "@paroi/data-formatters-lib";
|
|
2
|
+
import { generateResourceVersion, setMetadataDbSchemaVersion } from "@paroicms/internal-server-lib";
|
|
3
|
+
export const dbSchemaName = "medias";
|
|
4
|
+
export const currentDbSchemaVersion = 7;
|
|
5
|
+
export async function migrateMediasDb(cn, { fromVersion, logger }) {
|
|
6
|
+
const toVersion = currentDbSchemaVersion;
|
|
11
7
|
let currentVersion = fromVersion;
|
|
12
8
|
if (currentVersion === 3) {
|
|
13
9
|
// can't be not null because of the old data
|
|
14
10
|
await cn.query("alter table PaMedia add resourceVersion varchar(100)");
|
|
15
11
|
const rows = await cn.query("select uid, modifiedTs, originalName from PaMedia");
|
|
16
12
|
for (const row of rows) {
|
|
17
|
-
const uid =
|
|
18
|
-
const modifiedTs =
|
|
19
|
-
let originalName =
|
|
13
|
+
const uid = strVal(row.uid);
|
|
14
|
+
const modifiedTs = dateVal(row.modifiedTs);
|
|
15
|
+
let originalName = strValOrUndef(row.originalName);
|
|
20
16
|
if (originalName) {
|
|
21
17
|
if (modifiedTs.getTime() < new Date("2024-05-01").getTime()) {
|
|
22
18
|
originalName = Buffer.from(originalName, "latin1").toString("utf8");
|
|
23
19
|
}
|
|
24
20
|
originalName = removeExtensionFromFileName(originalName);
|
|
25
21
|
await cn.query(`update PaMedia set
|
|
26
|
-
resourceVersion = '${
|
|
22
|
+
resourceVersion = '${generateResourceVersion()}',
|
|
27
23
|
originalName = ?
|
|
28
24
|
where uid = '${uid}'`, [originalName]);
|
|
29
25
|
}
|
|
30
26
|
else {
|
|
31
|
-
await cn.query(`update PaMedia set resourceVersion = '${
|
|
27
|
+
await cn.query(`update PaMedia set resourceVersion = '${generateResourceVersion()}' where uid = '${uid}'`);
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
|
-
await
|
|
30
|
+
await setMetadataDbSchemaVersion(cn, { dbSchemaName, value: 4 });
|
|
35
31
|
currentVersion = 4;
|
|
36
32
|
}
|
|
37
33
|
if (currentVersion === 4) {
|
|
38
34
|
// Here, `PaDbSchemaVersion` table has been replaced by `PaMetadata`
|
|
39
|
-
await
|
|
35
|
+
await setMetadataDbSchemaVersion(cn, { dbSchemaName, value: 5 });
|
|
40
36
|
currentVersion = 5;
|
|
41
37
|
}
|
|
42
38
|
if (currentVersion === 5) {
|
|
43
39
|
await cn.query("alter table PaMediaHandle rename column leafId to nodeId");
|
|
44
|
-
await
|
|
40
|
+
await setMetadataDbSchemaVersion(cn, { dbSchemaName, value: 6 });
|
|
45
41
|
currentVersion = 6;
|
|
46
42
|
}
|
|
47
43
|
if (currentVersion === 6) {
|
|
48
44
|
await cn.query("update PaMediaHandle set handle = replace(handle, 'leaf', 'node') where handle like 'leaf:%'");
|
|
49
|
-
await
|
|
45
|
+
await setMetadataDbSchemaVersion(cn, { dbSchemaName, value: 7 });
|
|
50
46
|
currentVersion = 7;
|
|
51
47
|
}
|
|
52
48
|
if (currentVersion !== toVersion) {
|
|
53
|
-
throw new Error(`version of ${
|
|
49
|
+
throw new Error(`version of ${dbSchemaName} database should be '${toVersion}', but is '${currentVersion}'`);
|
|
54
50
|
}
|
|
55
|
-
logger.info(`${
|
|
51
|
+
logger.info(`${dbSchemaName} database was migrated from ${fromVersion} to ${currentVersion}`);
|
|
56
52
|
}
|
|
57
53
|
function removeExtensionFromFileName(fileName) {
|
|
58
54
|
const i = fileName.lastIndexOf(".");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddl-migration.js","sourceRoot":"","sources":["../../src/db-init/ddl-migration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ddl-migration.js","sourceRoot":"","sources":["../../src/db-init/ddl-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAIpG,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AACrC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,MAAM,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";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,33 +7,31 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.PaImageEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
10
|
+
import { Column, Entity } from "typeorm";
|
|
14
11
|
let PaImageEntity = class PaImageEntity {
|
|
15
12
|
uid;
|
|
16
13
|
width;
|
|
17
14
|
height;
|
|
18
15
|
lossless;
|
|
19
16
|
};
|
|
20
|
-
exports.PaImageEntity = PaImageEntity;
|
|
21
17
|
__decorate([
|
|
22
|
-
|
|
18
|
+
Column({ type: "varchar", length: 36, primary: true }),
|
|
23
19
|
__metadata("design:type", String)
|
|
24
20
|
], PaImageEntity.prototype, "uid", void 0);
|
|
25
21
|
__decorate([
|
|
26
|
-
|
|
22
|
+
Column({ type: "integer" }),
|
|
27
23
|
__metadata("design:type", Number)
|
|
28
24
|
], PaImageEntity.prototype, "width", void 0);
|
|
29
25
|
__decorate([
|
|
30
|
-
|
|
26
|
+
Column({ type: "integer" }),
|
|
31
27
|
__metadata("design:type", Number)
|
|
32
28
|
], PaImageEntity.prototype, "height", void 0);
|
|
33
29
|
__decorate([
|
|
34
|
-
|
|
30
|
+
Column({ type: "boolean", nullable: true }),
|
|
35
31
|
__metadata("design:type", Boolean)
|
|
36
32
|
], PaImageEntity.prototype, "lossless", void 0);
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
PaImageEntity = __decorate([
|
|
34
|
+
Entity("PaImage")
|
|
39
35
|
], PaImageEntity);
|
|
36
|
+
export { PaImageEntity };
|
|
40
37
|
//# sourceMappingURL=pa-image.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pa-image.model.js","sourceRoot":"","sources":["../../src/entities/pa-image.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pa-image.model.js","sourceRoot":"","sources":["../../src/entities/pa-image.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGlC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAExB,GAAG,CAAU;IAGb,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,QAAQ,CAAW;CACpB,CAAA;AAVC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CAC1C;AAGb;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;4CACb;AAGf;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;6CACZ;AAGhB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACzB;AAXR,aAAa;IADzB,MAAM,CAAC,SAAS,CAAC;GACL,aAAa,CAYzB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,33 +7,31 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.PaMediaHandleEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
10
|
+
import { Column, Entity } from "typeorm";
|
|
14
11
|
let PaMediaHandleEntity = class PaMediaHandleEntity {
|
|
15
12
|
mediaUid;
|
|
16
13
|
handle;
|
|
17
14
|
orderNum;
|
|
18
15
|
nodeId;
|
|
19
16
|
};
|
|
20
|
-
exports.PaMediaHandleEntity = PaMediaHandleEntity;
|
|
21
17
|
__decorate([
|
|
22
|
-
|
|
18
|
+
Column({ type: "varchar", length: 36, primary: true }),
|
|
23
19
|
__metadata("design:type", String)
|
|
24
20
|
], PaMediaHandleEntity.prototype, "mediaUid", void 0);
|
|
25
21
|
__decorate([
|
|
26
|
-
|
|
22
|
+
Column({ type: "varchar", primary: true }),
|
|
27
23
|
__metadata("design:type", String)
|
|
28
24
|
], PaMediaHandleEntity.prototype, "handle", void 0);
|
|
29
25
|
__decorate([
|
|
30
|
-
|
|
26
|
+
Column({ type: "integer", nullable: true }),
|
|
31
27
|
__metadata("design:type", Number)
|
|
32
28
|
], PaMediaHandleEntity.prototype, "orderNum", void 0);
|
|
33
29
|
__decorate([
|
|
34
|
-
|
|
30
|
+
Column({ type: "bigint", nullable: true }),
|
|
35
31
|
__metadata("design:type", String)
|
|
36
32
|
], PaMediaHandleEntity.prototype, "nodeId", void 0);
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
PaMediaHandleEntity = __decorate([
|
|
34
|
+
Entity("PaMediaHandle")
|
|
39
35
|
], PaMediaHandleEntity);
|
|
36
|
+
export { PaMediaHandleEntity };
|
|
40
37
|
//# sourceMappingURL=pa-media-handle.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pa-media-handle.model.js","sourceRoot":"","sources":["../../src/entities/pa-media-handle.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pa-media-handle.model.js","sourceRoot":"","sources":["../../src/entities/pa-media-handle.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGlC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAE9B,QAAQ,CAAU;IAGlB,MAAM,CAAU;IAGhB,QAAQ,CAAU;IAGlB,MAAM,CAAU;CACjB,CAAA;AAVC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;qDACrC;AAGlB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDAC3B;AAGhB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDAC1B;AAGlB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC3B;AAXL,mBAAmB;IAD/B,MAAM,CAAC,eAAe,CAAC;GACX,mBAAmB,CAY/B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,9 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.PaMediaEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
10
|
+
import { Column, Entity } from "typeorm";
|
|
14
11
|
let PaMediaEntity = class PaMediaEntity {
|
|
15
12
|
uid;
|
|
16
13
|
mediaType;
|
|
@@ -21,40 +18,40 @@ let PaMediaEntity = class PaMediaEntity {
|
|
|
21
18
|
attachedData;
|
|
22
19
|
originalName;
|
|
23
20
|
};
|
|
24
|
-
exports.PaMediaEntity = PaMediaEntity;
|
|
25
21
|
__decorate([
|
|
26
|
-
|
|
22
|
+
Column({ type: "varchar", length: 36, primary: true }),
|
|
27
23
|
__metadata("design:type", String)
|
|
28
24
|
], PaMediaEntity.prototype, "uid", void 0);
|
|
29
25
|
__decorate([
|
|
30
|
-
|
|
26
|
+
Column({ type: "varchar" }),
|
|
31
27
|
__metadata("design:type", String)
|
|
32
28
|
], PaMediaEntity.prototype, "mediaType", void 0);
|
|
33
29
|
__decorate([
|
|
34
|
-
|
|
30
|
+
Column({ type: "varchar" }),
|
|
35
31
|
__metadata("design:type", String)
|
|
36
32
|
], PaMediaEntity.prototype, "resourceVersion", void 0);
|
|
37
33
|
__decorate([
|
|
38
|
-
|
|
34
|
+
Column({ type: "integer" }),
|
|
39
35
|
__metadata("design:type", Number)
|
|
40
36
|
], PaMediaEntity.prototype, "weightB", void 0);
|
|
41
37
|
__decorate([
|
|
42
|
-
|
|
38
|
+
Column({ type: "datetime", default: () => "current_timestamp", onUpdate: "current_timestamp" }),
|
|
43
39
|
__metadata("design:type", Date)
|
|
44
40
|
], PaMediaEntity.prototype, "modifiedTs", void 0);
|
|
45
41
|
__decorate([
|
|
46
|
-
|
|
42
|
+
Column({ type: "blob" }),
|
|
47
43
|
__metadata("design:type", Buffer)
|
|
48
44
|
], PaMediaEntity.prototype, "binaryFile", void 0);
|
|
49
45
|
__decorate([
|
|
50
|
-
|
|
46
|
+
Column({ type: "text", nullable: true }),
|
|
51
47
|
__metadata("design:type", String)
|
|
52
48
|
], PaMediaEntity.prototype, "attachedData", void 0);
|
|
53
49
|
__decorate([
|
|
54
|
-
|
|
50
|
+
Column({ type: "varchar", nullable: true }),
|
|
55
51
|
__metadata("design:type", String)
|
|
56
52
|
], PaMediaEntity.prototype, "originalName", void 0);
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
PaMediaEntity = __decorate([
|
|
54
|
+
Entity("PaMedia")
|
|
59
55
|
], PaMediaEntity);
|
|
56
|
+
export { PaMediaEntity };
|
|
60
57
|
//# sourceMappingURL=pa-media.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pa-media.model.js","sourceRoot":"","sources":["../../src/entities/pa-media.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pa-media.model.js","sourceRoot":"","sources":["../../src/entities/pa-media.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGlC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAExB,GAAG,CAAU;IAGb,SAAS,CAAU;IAGnB,eAAe,CAAU;IAGzB,OAAO,CAAU;IAGjB,UAAU,CAAQ;IAGlB,UAAU,CAAU;IAGpB,YAAY,CAAU;IAGtB,YAAY,CAAU;CACvB,CAAA;AAtBC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CAC1C;AAGb;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;gDACT;AAGnB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;sDACH;AAGzB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;8CACX;AAGjB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;8BACnF,IAAI;iDAAC;AAGlB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8BACZ,MAAM;iDAAC;AAGpB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACnB;AAGtB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACtB;AAvBX,aAAa;IADzB,MAAM,CAAC,SAAS,CAAC;GACL,aAAa,CAwBzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Image, ImageWithBinary, Media, MediaWithBinary } from "../data-types";
|
|
1
|
+
import type { Image, ImageWithBinary, Media, MediaWithBinary } from "../data-types.js";
|
|
2
2
|
export declare function formatMedia(row: any): Media;
|
|
3
3
|
export declare function formatImage(row: any): Image;
|
|
4
4
|
export declare function formatMediaWithBinary(row: any): MediaWithBinary;
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.formatImage = formatImage;
|
|
5
|
-
exports.formatMediaWithBinary = formatMediaWithBinary;
|
|
6
|
-
exports.formatImageWithBinary = formatImageWithBinary;
|
|
7
|
-
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
8
|
-
const sqlite_date_helper_1 = require("./sqlite-date-helper");
|
|
9
|
-
function formatMedia(row) {
|
|
1
|
+
import { boolValOrUndef, nbVal, strVal, strValOrUndef } from "@paroi/data-formatters-lib";
|
|
2
|
+
import { parseSqliteDateTime } from "./sqlite-date-helper.js";
|
|
3
|
+
export function formatMedia(row) {
|
|
10
4
|
return {
|
|
11
5
|
kind: "media",
|
|
12
6
|
...formatMediaBase(row),
|
|
13
7
|
};
|
|
14
8
|
}
|
|
15
|
-
function formatImage(row) {
|
|
9
|
+
export function formatImage(row) {
|
|
16
10
|
return {
|
|
17
11
|
kind: "image",
|
|
18
12
|
...formatMediaBase(row),
|
|
19
|
-
height:
|
|
20
|
-
width:
|
|
21
|
-
lossless:
|
|
13
|
+
height: nbVal(row.height),
|
|
14
|
+
width: nbVal(row.width),
|
|
15
|
+
lossless: boolValOrUndef(row.lossless),
|
|
22
16
|
};
|
|
23
17
|
}
|
|
24
|
-
function formatMediaWithBinary(row) {
|
|
18
|
+
export function formatMediaWithBinary(row) {
|
|
25
19
|
return {
|
|
26
20
|
...formatMedia(row),
|
|
27
21
|
binaryFile: row.binaryFile,
|
|
28
22
|
};
|
|
29
23
|
}
|
|
30
|
-
function formatImageWithBinary(row) {
|
|
24
|
+
export function formatImageWithBinary(row) {
|
|
31
25
|
return {
|
|
32
26
|
...formatImage(row),
|
|
33
27
|
binaryFile: row.binaryFile,
|
|
@@ -35,13 +29,13 @@ function formatImageWithBinary(row) {
|
|
|
35
29
|
}
|
|
36
30
|
function formatMediaBase(row) {
|
|
37
31
|
return {
|
|
38
|
-
uid:
|
|
39
|
-
resourceVersion:
|
|
40
|
-
mediaType:
|
|
41
|
-
modifiedTs:
|
|
42
|
-
weightB:
|
|
43
|
-
attachedData:
|
|
44
|
-
originalName:
|
|
32
|
+
uid: strVal(row.uid),
|
|
33
|
+
resourceVersion: strVal(row.resourceVersion),
|
|
34
|
+
mediaType: strVal(row.mediaType),
|
|
35
|
+
modifiedTs: parseSqliteDateTime(row.modifiedTs),
|
|
36
|
+
weightB: nbVal(row.weightB),
|
|
37
|
+
attachedData: strValOrUndef(row.attachedData),
|
|
38
|
+
originalName: strValOrUndef(row.originalName),
|
|
45
39
|
};
|
|
46
40
|
}
|
|
47
41
|
//# sourceMappingURL=data-formatters.helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-formatters.helpers.js","sourceRoot":"","sources":["../../src/helpers/data-formatters.helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-formatters.helpers.js","sourceRoot":"","sources":["../../src/helpers/data-formatters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AAC,GAAG,CAAC,YAAY,CAAC;QAC7C,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSqliteDateTime = parseSqliteDateTime;
|
|
4
|
-
function parseSqliteDateTime(val) {
|
|
1
|
+
export function parseSqliteDateTime(val) {
|
|
5
2
|
const gmtDt = `${val.substring(0, 10)}T${val.substring(11, 19)}Z`;
|
|
6
3
|
return new Date(gmtDt);
|
|
7
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-date-helper.js","sourceRoot":"","sources":["../../src/helpers/sqlite-date-helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlite-date-helper.js","sourceRoot":"","sources":["../../src/helpers/sqlite-date-helper.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;IAClE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./data-types";
|
|
2
|
-
export * from "./db-init/db-init";
|
|
3
|
-
export * from "./media-storage";
|
|
4
|
-
export * from "./media-storage
|
|
1
|
+
export * from "./data-types.js";
|
|
2
|
+
export * from "./db-init/db-init.js";
|
|
3
|
+
export * from "./media-storage-types.js";
|
|
4
|
+
export * from "./media-storage.js";
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./data-types"), exports);
|
|
18
|
-
__exportStar(require("./db-init/db-init"), exports);
|
|
19
|
-
__exportStar(require("./media-storage"), exports);
|
|
20
|
-
__exportStar(require("./media-storage-types"), exports);
|
|
1
|
+
export * from "./data-types.js";
|
|
2
|
+
export * from "./db-init/db-init.js";
|
|
3
|
+
export * from "./media-storage-types.js";
|
|
4
|
+
export * from "./media-storage.js";
|
|
21
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppLogger } from "@paroicms/public-server-lib";
|
|
2
2
|
import type { DataSource } from "typeorm";
|
|
3
|
-
import type { MediaStorageOptions } from "./media-storage";
|
|
3
|
+
import type { MediaStorageOptions } from "./media-storage.js";
|
|
4
4
|
export declare class MediaStorageContext {
|
|
5
5
|
#private;
|
|
6
6
|
status: "ready" | "destroyed";
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const async_lib_1 = require("@paroi/async-lib");
|
|
5
|
-
const db_init_1 = require("./db-init/db-init");
|
|
6
|
-
class MediaStorageContext {
|
|
1
|
+
import { createAsyncQueue } from "@paroi/async-lib";
|
|
2
|
+
import { createOrOpenMediasConnection } from "./db-init/db-init.js";
|
|
3
|
+
export class MediaStorageContext {
|
|
7
4
|
status = "ready";
|
|
8
5
|
canCreate;
|
|
9
6
|
logger;
|
|
10
7
|
logNextQuery;
|
|
11
|
-
asyncQueue =
|
|
8
|
+
asyncQueue = createAsyncQueue();
|
|
12
9
|
#dbFileStorage;
|
|
13
10
|
#cn;
|
|
14
11
|
constructor(options) {
|
|
@@ -18,7 +15,7 @@ class MediaStorageContext {
|
|
|
18
15
|
this.logNextQuery = () => { };
|
|
19
16
|
}
|
|
20
17
|
async init() {
|
|
21
|
-
const { cn, logNextQuery } = await
|
|
18
|
+
const { cn, logNextQuery } = await createOrOpenMediasConnection({
|
|
22
19
|
sqliteFile: this.#dbFileStorage,
|
|
23
20
|
logger: this.logger,
|
|
24
21
|
canCreate: this.canCreate,
|
|
@@ -33,5 +30,4 @@ class MediaStorageContext {
|
|
|
33
30
|
return this.#cn;
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
exports.MediaStorageContext = MediaStorageContext;
|
|
37
33
|
//# sourceMappingURL=media-storage-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-storage-context.js","sourceRoot":"","sources":["../src/media-storage-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media-storage-context.js","sourceRoot":"","sources":["../src/media-storage-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,MAAM,OAAO,mBAAmB;IAC9B,MAAM,GAA0B,OAAO,CAAC;IACxC,SAAS,CAAU;IACnB,MAAM,CAAY;IAClB,YAAY,CAAuC;IACnD,UAAU,GAAG,gBAAgB,EAAE,CAAC;IAChC,cAAc,CAAS;IAEvB,GAAG,CAAc;IAEjB,YAAY,OAA4B;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,MAAM,4BAA4B,CAAC;YAC9D,UAAU,EAAE,IAAI,CAAC,cAAc;YAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAClD,CAAC;IAED,EAAE;QACA,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF"}
|
package/dist/media-storage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppLogger } from "@paroicms/public-server-lib";
|
|
2
|
-
import type { Image, ImageWithBinary, Media, MediaWithBinary } from "./data-types";
|
|
3
|
-
import type { NewMediaWithHandle, ReorderMediasInput } from "./media-storage-types";
|
|
2
|
+
import type { Image, ImageWithBinary, Media, MediaWithBinary } from "./data-types.js";
|
|
3
|
+
import type { NewMediaWithHandle, ReorderMediasInput } from "./media-storage-types.js";
|
|
4
4
|
export interface MediaStorageOptions {
|
|
5
5
|
canCreate: boolean;
|
|
6
6
|
storage: MediaStorageConf;
|
package/dist/media-storage.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.createMediaStorage = createMediaStorage;
|
|
5
|
-
const media_storage_context_1 = require("./media-storage-context");
|
|
6
|
-
const media_queries_1 = require("./media.queries");
|
|
7
|
-
async function createMediaStorage(options) {
|
|
1
|
+
import { MediaStorageContext } from "./media-storage-context.js";
|
|
2
|
+
import { countMediasByNodeId, createMedia, deleteHandle, deleteHandles, deleteMediaWithHandle, getAttachedDocumentsWeight, getFirstImageForHandle, getMedia, getMediaByHandle, getMediaWithBinary, getMediasByHandle, getMediasByHandles, reorderMedias, updateAttachedData, } from "./media.queries.js";
|
|
3
|
+
export async function createMediaStorage(options) {
|
|
8
4
|
const mediaStorage = new MediaStorage(options);
|
|
9
5
|
await mediaStorage.initialise();
|
|
10
6
|
return mediaStorage;
|
|
11
7
|
}
|
|
12
|
-
class MediaStorage {
|
|
8
|
+
export class MediaStorage {
|
|
13
9
|
#context;
|
|
14
10
|
constructor(options) {
|
|
15
|
-
this.#context = new
|
|
11
|
+
this.#context = new MediaStorageContext(options);
|
|
16
12
|
}
|
|
17
13
|
async initialise() {
|
|
18
14
|
this.#checkStatus();
|
|
@@ -20,65 +16,65 @@ class MediaStorage {
|
|
|
20
16
|
}
|
|
21
17
|
async addMedia(payload) {
|
|
22
18
|
this.#checkStatus();
|
|
23
|
-
const uid = await this.#context.asyncQueue(() =>
|
|
24
|
-
const media = await
|
|
19
|
+
const uid = await this.#context.asyncQueue(() => createMedia(this.#context, payload));
|
|
20
|
+
const media = await getMedia(this.#context.cn(), uid);
|
|
25
21
|
if (!media)
|
|
26
22
|
throw new Error(`should have a media '${uid}'`);
|
|
27
23
|
return media;
|
|
28
24
|
}
|
|
29
25
|
async getFirstImage(options) {
|
|
30
26
|
this.#checkStatus();
|
|
31
|
-
return await
|
|
27
|
+
return await getFirstImageForHandle(this.#context.cn(), options.handle);
|
|
32
28
|
}
|
|
33
29
|
async getMedias(options) {
|
|
34
30
|
this.#checkStatus();
|
|
35
31
|
if ("handle" in options) {
|
|
36
|
-
return await
|
|
32
|
+
return await getMediasByHandle(this.#context.cn(), options.handle);
|
|
37
33
|
}
|
|
38
|
-
return await
|
|
34
|
+
return await getMediasByHandles(this.#context.cn(), options.handles);
|
|
39
35
|
}
|
|
40
36
|
async getMedia(options) {
|
|
41
37
|
this.#checkStatus();
|
|
42
38
|
if ("handle" in options) {
|
|
43
|
-
return await
|
|
39
|
+
return await getMediaByHandle(this.#context.cn(), options.handle);
|
|
44
40
|
}
|
|
45
|
-
return await
|
|
41
|
+
return await getMedia(this.#context.cn(), options.uid);
|
|
46
42
|
}
|
|
47
43
|
async getMediaWithBinary(uid) {
|
|
48
44
|
this.#checkStatus();
|
|
49
|
-
return await
|
|
45
|
+
return await getMediaWithBinary(this.#context.cn(), uid);
|
|
50
46
|
}
|
|
51
47
|
async deleteMedia(options) {
|
|
52
48
|
this.#checkStatus();
|
|
53
49
|
if ("uid" in options) {
|
|
54
|
-
return await
|
|
50
|
+
return await deleteMediaWithHandle(this.#context.cn(), options);
|
|
55
51
|
}
|
|
56
|
-
return await
|
|
52
|
+
return await deleteHandle(this.#context.cn(), options.handle);
|
|
57
53
|
}
|
|
58
54
|
async deleteMedias(options) {
|
|
59
55
|
this.#checkStatus();
|
|
60
56
|
if ("handle" in options) {
|
|
61
|
-
return await
|
|
57
|
+
return await deleteHandle(this.#context.cn(), options.handle);
|
|
62
58
|
}
|
|
63
|
-
return await
|
|
59
|
+
return await deleteHandles(this.#context.cn(), options.handles);
|
|
64
60
|
}
|
|
65
61
|
async updateAttachedData(options) {
|
|
66
62
|
this.#checkStatus();
|
|
67
|
-
await
|
|
63
|
+
await updateAttachedData(this.#context.cn(), options);
|
|
68
64
|
return await this.getMedia({ uid: options.mediaUid });
|
|
69
65
|
}
|
|
70
66
|
async reorderMedias(options) {
|
|
71
67
|
this.#checkStatus();
|
|
72
|
-
await
|
|
68
|
+
await reorderMedias(this.#context, options);
|
|
73
69
|
return await this.getMedias({ handle: options.handle });
|
|
74
70
|
}
|
|
75
71
|
async countMedias({ nodeId, exceptHandle }) {
|
|
76
72
|
this.#checkStatus();
|
|
77
|
-
return await
|
|
73
|
+
return await countMediasByNodeId(this.#context.cn(), nodeId, { exceptHandle });
|
|
78
74
|
}
|
|
79
75
|
async getAttachedDocumentsWeight() {
|
|
80
76
|
this.#checkStatus();
|
|
81
|
-
return await
|
|
77
|
+
return await getAttachedDocumentsWeight(this.#context.cn());
|
|
82
78
|
}
|
|
83
79
|
async close() {
|
|
84
80
|
if (this.#context.status === "destroyed")
|
|
@@ -92,5 +88,4 @@ class MediaStorage {
|
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
|
-
exports.MediaStorage = MediaStorage;
|
|
96
91
|
//# sourceMappingURL=media-storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-storage.js","sourceRoot":"","sources":["../src/media-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media-storage.js","sourceRoot":"","sources":["../src/media-storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAa5B,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA4B;IACnE,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,OA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IACrC,CAAC;IAED,YAAY;QACV,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF"}
|
package/dist/media.queries.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type QueryBuilderConnection } from "@paroicms/internal-server-lib";
|
|
2
|
-
import type { Image, ImageWithBinary, Media, MediaWithBinary } from "./data-types";
|
|
3
|
-
import type { MediaStorageContext } from "./media-storage-context";
|
|
4
|
-
import type { NewMediaWithHandle, ReorderMediasInput } from "./media-storage-types";
|
|
2
|
+
import type { Image, ImageWithBinary, Media, MediaWithBinary } from "./data-types.js";
|
|
3
|
+
import type { MediaStorageContext } from "./media-storage-context.js";
|
|
4
|
+
import type { NewMediaWithHandle, ReorderMediasInput } from "./media-storage-types.js";
|
|
5
5
|
export declare function createMedia(ctx: MediaStorageContext, payload: NewMediaWithHandle): Promise<string>;
|
|
6
6
|
export declare function getFirstImageForHandle(cn: QueryBuilderConnection, handle: string): Promise<Image | undefined>;
|
|
7
7
|
export declare function getMediasByHandle(cn: QueryBuilderConnection, handle: string): Promise<(Image | Media)[]>;
|
package/dist/media.queries.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.countMediasByNodeId = countMediasByNodeId;
|
|
9
|
-
exports.getAttachedDocumentsWeight = getAttachedDocumentsWeight;
|
|
10
|
-
exports.getMediaByHandle = getMediaByHandle;
|
|
11
|
-
exports.getMediaWithBinary = getMediaWithBinary;
|
|
12
|
-
exports.deleteHandle = deleteHandle;
|
|
13
|
-
exports.deleteHandles = deleteHandles;
|
|
14
|
-
exports.deleteMediaWithHandle = deleteMediaWithHandle;
|
|
15
|
-
exports.updateAttachedData = updateAttachedData;
|
|
16
|
-
exports.reorderMedias = reorderMedias;
|
|
17
|
-
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
|
|
18
|
-
const internal_server_lib_1 = require("@paroicms/internal-server-lib");
|
|
19
|
-
const node_crypto_1 = require("node:crypto");
|
|
20
|
-
const data_formatters_helpers_1 = require("./helpers/data-formatters.helpers");
|
|
21
|
-
async function createMedia(ctx, payload) {
|
|
22
|
-
const uid = (0, node_crypto_1.randomUUID)();
|
|
23
|
-
const resourceVersion = (0, internal_server_lib_1.generateResourceVersion)();
|
|
1
|
+
import { isDef, nbVal, nbValOrUndef, strVal } from "@paroi/data-formatters-lib";
|
|
2
|
+
import { generateResourceVersion, } from "@paroicms/internal-server-lib";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { formatImage, formatImageWithBinary, formatMedia, formatMediaWithBinary, } from "./helpers/data-formatters.helpers.js";
|
|
5
|
+
export async function createMedia(ctx, payload) {
|
|
6
|
+
const uid = randomUUID();
|
|
7
|
+
const resourceVersion = generateResourceVersion();
|
|
24
8
|
await ctx.cn().transaction(async (tx) => {
|
|
25
9
|
if (payload.replace)
|
|
26
10
|
await deleteHandle(tx, payload.handle);
|
|
@@ -71,9 +55,9 @@ async function getMaxOrderNum(cn, handle) {
|
|
|
71
55
|
.from("PaMediaHandle", "h")
|
|
72
56
|
.andWhere("h.handle = :handle", { handle })
|
|
73
57
|
.getRawOne();
|
|
74
|
-
return
|
|
58
|
+
return nbValOrUndef(row?.maxNum);
|
|
75
59
|
}
|
|
76
|
-
async function getFirstImageForHandle(cn, handle) {
|
|
60
|
+
export async function getFirstImageForHandle(cn, handle) {
|
|
77
61
|
const row = await buildMediaQuery(cn, { onlyImage: true })
|
|
78
62
|
.innerJoin("PaMediaHandle", "h", "h.mediaUid = m.uid")
|
|
79
63
|
.andWhere("h.handle = :handle", { handle })
|
|
@@ -81,9 +65,9 @@ async function getFirstImageForHandle(cn, handle) {
|
|
|
81
65
|
.addOrderBy("m.modifiedTs", "ASC")
|
|
82
66
|
.limit(1)
|
|
83
67
|
.getRawOne();
|
|
84
|
-
return row ?
|
|
68
|
+
return row ? formatImage(row) : undefined;
|
|
85
69
|
}
|
|
86
|
-
async function getMediasByHandle(cn, handle) {
|
|
70
|
+
export async function getMediasByHandle(cn, handle) {
|
|
87
71
|
const rows = await buildMediaQuery(cn)
|
|
88
72
|
.addSelect("h.orderNum", "orderNum")
|
|
89
73
|
.innerJoin("PaMediaHandle", "h", "h.mediaUid = m.uid")
|
|
@@ -102,9 +86,9 @@ async function getMediasByHandle(cn, handle) {
|
|
|
102
86
|
}
|
|
103
87
|
});
|
|
104
88
|
const reordered = [...withOrderNum, ...withoutNotOrderNum];
|
|
105
|
-
return reordered.map((row) => (
|
|
89
|
+
return reordered.map((row) => (isDef(row.width) ? formatImage(row) : formatMedia(row)));
|
|
106
90
|
}
|
|
107
|
-
async function getMediasByHandles(cn, handles) {
|
|
91
|
+
export async function getMediasByHandles(cn, handles) {
|
|
108
92
|
const rows = await buildMediaQuery(cn)
|
|
109
93
|
.addSelect("h.handle", "handle")
|
|
110
94
|
.innerJoin("PaMediaHandle", "h", "h.mediaUid = m.uid")
|
|
@@ -112,18 +96,18 @@ async function getMediasByHandles(cn, handles) {
|
|
|
112
96
|
.getRawMany();
|
|
113
97
|
const map = new Map();
|
|
114
98
|
for (const row of rows) {
|
|
115
|
-
const handle =
|
|
116
|
-
map.set(handle,
|
|
99
|
+
const handle = strVal(row.handle);
|
|
100
|
+
map.set(handle, isDef(row.width) ? formatImage(row) : formatMedia(row));
|
|
117
101
|
}
|
|
118
102
|
return map;
|
|
119
103
|
}
|
|
120
|
-
async function getMedia(cn, uid) {
|
|
104
|
+
export async function getMedia(cn, uid) {
|
|
121
105
|
const row = await buildMediaQuery(cn).andWhere("m.uid = :uid", { uid }).getRawOne();
|
|
122
106
|
if (!row)
|
|
123
107
|
return;
|
|
124
|
-
return
|
|
108
|
+
return isDef(row.width) ? formatImage(row) : formatMedia(row);
|
|
125
109
|
}
|
|
126
|
-
async function countMediasByNodeId(cn, nodeId, options = {}) {
|
|
110
|
+
export async function countMediasByNodeId(cn, nodeId, options = {}) {
|
|
127
111
|
const query = cn
|
|
128
112
|
.createQueryBuilder()
|
|
129
113
|
.select("count(1)", "cnt")
|
|
@@ -133,39 +117,39 @@ async function countMediasByNodeId(cn, nodeId, options = {}) {
|
|
|
133
117
|
query.andWhere("h.handle <> :handle", { handle: options.exceptHandle });
|
|
134
118
|
}
|
|
135
119
|
const row = await query.getRawOne();
|
|
136
|
-
return
|
|
120
|
+
return nbVal(row?.cnt);
|
|
137
121
|
}
|
|
138
|
-
async function getAttachedDocumentsWeight(cn) {
|
|
122
|
+
export async function getAttachedDocumentsWeight(cn) {
|
|
139
123
|
const result = await cn
|
|
140
124
|
.createQueryBuilder()
|
|
141
125
|
.select("sum(m.weightB)", "weightB")
|
|
142
126
|
.from("PaMedia", "m")
|
|
143
127
|
.andWhere("m.mediaType = :mediaType", { mediaType: "application/pdf" })
|
|
144
128
|
.getRawOne();
|
|
145
|
-
return
|
|
129
|
+
return nbValOrUndef(result?.weightB) ?? 0;
|
|
146
130
|
}
|
|
147
|
-
async function getMediaByHandle(cn, handle) {
|
|
131
|
+
export async function getMediaByHandle(cn, handle) {
|
|
148
132
|
const row = await buildMediaQuery(cn)
|
|
149
133
|
.innerJoin("PaMediaHandle", "h", "h.mediaUid = m.uid")
|
|
150
134
|
.andWhere("h.handle = :handle", { handle })
|
|
151
135
|
.getRawOne();
|
|
152
136
|
if (!row)
|
|
153
137
|
return;
|
|
154
|
-
return
|
|
138
|
+
return isDef(row.width) ? formatImage(row) : formatMedia(row);
|
|
155
139
|
}
|
|
156
|
-
async function getMediaWithBinary(cn, uid) {
|
|
140
|
+
export async function getMediaWithBinary(cn, uid) {
|
|
157
141
|
const row = await buildMediaQuery(cn)
|
|
158
142
|
.addSelect("m.binaryFile", "binaryFile")
|
|
159
143
|
.andWhere("m.uid = :uid", { uid })
|
|
160
144
|
.getRawOne();
|
|
161
145
|
if (!row)
|
|
162
146
|
return;
|
|
163
|
-
return
|
|
147
|
+
return isDef(row.width) ? formatImageWithBinary(row) : formatMediaWithBinary(row);
|
|
164
148
|
}
|
|
165
149
|
/**
|
|
166
150
|
* @returns the deleted media uid
|
|
167
151
|
*/
|
|
168
|
-
async function deleteHandle(cn, handle) {
|
|
152
|
+
export async function deleteHandle(cn, handle) {
|
|
169
153
|
const res = await cn
|
|
170
154
|
.createQueryBuilder()
|
|
171
155
|
.delete()
|
|
@@ -179,7 +163,7 @@ async function deleteHandle(cn, handle) {
|
|
|
179
163
|
/**
|
|
180
164
|
* @returns the deleted media uids
|
|
181
165
|
*/
|
|
182
|
-
async function deleteHandles(cn, handles) {
|
|
166
|
+
export async function deleteHandles(cn, handles) {
|
|
183
167
|
const res = await cn
|
|
184
168
|
.createQueryBuilder()
|
|
185
169
|
.delete()
|
|
@@ -190,7 +174,7 @@ async function deleteHandles(cn, handles) {
|
|
|
190
174
|
return [];
|
|
191
175
|
return await deleteOrphanMedias(cn);
|
|
192
176
|
}
|
|
193
|
-
async function deleteMediaWithHandle(cn, { handle, uid }) {
|
|
177
|
+
export async function deleteMediaWithHandle(cn, { handle, uid }) {
|
|
194
178
|
await cn
|
|
195
179
|
.createQueryBuilder()
|
|
196
180
|
.delete()
|
|
@@ -211,7 +195,7 @@ async function deleteOrphanMedias(cn) {
|
|
|
211
195
|
where h.mediaUid = m.uid
|
|
212
196
|
)`)
|
|
213
197
|
.getRawMany();
|
|
214
|
-
const uids = rows.map((row) =>
|
|
198
|
+
const uids = rows.map((row) => strVal(row.uid));
|
|
215
199
|
await cn
|
|
216
200
|
.createQueryBuilder()
|
|
217
201
|
.delete()
|
|
@@ -220,7 +204,7 @@ async function deleteOrphanMedias(cn) {
|
|
|
220
204
|
.execute();
|
|
221
205
|
return uids;
|
|
222
206
|
}
|
|
223
|
-
async function updateAttachedData(cn, { mediaUid, values }) {
|
|
207
|
+
export async function updateAttachedData(cn, { mediaUid, values }) {
|
|
224
208
|
await cn
|
|
225
209
|
.createQueryBuilder()
|
|
226
210
|
.update("PaMedia")
|
|
@@ -228,7 +212,7 @@ async function updateAttachedData(cn, { mediaUid, values }) {
|
|
|
228
212
|
.andWhere({ uid: mediaUid })
|
|
229
213
|
.execute();
|
|
230
214
|
}
|
|
231
|
-
async function reorderMedias(ctx, { mediaUids: uids, handle }) {
|
|
215
|
+
export async function reorderMedias(ctx, { mediaUids: uids, handle }) {
|
|
232
216
|
const medias = await getMediasByHandle(ctx.cn(), handle);
|
|
233
217
|
const orderMedias = [];
|
|
234
218
|
let orderNum = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.queries.js","sourceRoot":"","sources":["../src/media.queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media.queries.js","sourceRoot":"","sources":["../src/media.queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAEL,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,WAAW,EACX,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAI9C,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAwB,EACxB,OAA2B;IAE3B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,eAAe,GAAG,uBAAuB,EAAE,CAAC;IAClD,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACtC,IAAI,OAAO,CAAC,OAAO;YAAE,MAAM,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAE5D,MAAM,EAAE;aACL,kBAAkB,E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,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/server-database-media-storage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "A library to make back-end for media galleries.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paroicms",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"author": "Paroi Team",
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"type": "
|
|
20
|
+
"type": "module",
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
23
|
"scripts": {
|
|
@@ -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.22.0",
|
|
37
|
+
"@paroicms/internal-server-lib": "1.11.0",
|
|
38
|
+
"@paroicms/public-server-lib": "0.23.0",
|
|
39
|
+
"@paroicms/public-anywhere-lib": "0.15.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"typeorm": "0.3"
|