@tstdl/base 0.92.129 → 0.92.130
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/document-management/api/document-management.api.d.ts +16 -18
- package/document-management/server/services/document.service.d.ts +3 -1
- package/document-management/server/services/document.service.js +15 -2
- package/document-management/service-models/document.service-model.d.ts +8 -9
- package/document-management/service-models/document.service-model.js +1 -1
- package/package.json +1 -1
|
@@ -89,15 +89,14 @@ export declare const documentManagementApiDefinition: {
|
|
|
89
89
|
resource: string;
|
|
90
90
|
method: "POST";
|
|
91
91
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
92
|
-
date
|
|
93
|
-
summary
|
|
94
|
-
title
|
|
95
|
-
typeId
|
|
96
|
-
subtitle
|
|
97
|
-
tags
|
|
98
|
-
comment
|
|
99
|
-
approval
|
|
100
|
-
createUserId: import("../../orm/schemas/uuid.js").Uuid | null;
|
|
92
|
+
date?: import("../../orm/types.js").NumericDate | null | undefined;
|
|
93
|
+
summary?: string | null | undefined;
|
|
94
|
+
title?: string | null | undefined;
|
|
95
|
+
typeId?: import("../../orm/types.js").Uuid | null | undefined;
|
|
96
|
+
subtitle?: string | null | undefined;
|
|
97
|
+
tags?: string[] | null | undefined;
|
|
98
|
+
comment?: string | null | undefined;
|
|
99
|
+
approval?: import("../models/document.model.js").DocumentApproval | undefined;
|
|
101
100
|
originalFileName: string | null;
|
|
102
101
|
assignment: {
|
|
103
102
|
collections: string | string[];
|
|
@@ -403,15 +402,14 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
|
|
|
403
402
|
resource: string;
|
|
404
403
|
method: "POST";
|
|
405
404
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
406
|
-
date
|
|
407
|
-
summary
|
|
408
|
-
title
|
|
409
|
-
typeId
|
|
410
|
-
subtitle
|
|
411
|
-
tags
|
|
412
|
-
comment
|
|
413
|
-
approval
|
|
414
|
-
createUserId: import("../../orm/schemas/uuid.js").Uuid | null;
|
|
405
|
+
date?: import("../../orm/types.js").NumericDate | null | undefined;
|
|
406
|
+
summary?: string | null | undefined;
|
|
407
|
+
title?: string | null | undefined;
|
|
408
|
+
typeId?: import("../../orm/types.js").Uuid | null | undefined;
|
|
409
|
+
subtitle?: string | null | undefined;
|
|
410
|
+
tags?: string[] | null | undefined;
|
|
411
|
+
comment?: string | null | undefined;
|
|
412
|
+
approval?: import("../models/document.model.js").DocumentApproval | undefined;
|
|
415
413
|
originalFileName: string | null;
|
|
416
414
|
assignment: {
|
|
417
415
|
collections: string | string[];
|
|
@@ -5,7 +5,9 @@ import { Document } from '../../models/index.js';
|
|
|
5
5
|
export declare class DocumentService extends Transactional {
|
|
6
6
|
#private;
|
|
7
7
|
readonly repository: import("../../../orm/server/repository.js").EntityRepository<Document>;
|
|
8
|
-
createDocument({ typeId, title, subtitle, date, summary, tags, approval, comment,
|
|
8
|
+
createDocument({ typeId, title, subtitle, date, summary, tags, approval, comment, originalFileName, assignment, properties, metadata }: CreateDocumentParameters, content: Uint8Array | ReadableStream<Uint8Array>, { createUserId }: {
|
|
9
|
+
createUserId?: string;
|
|
10
|
+
}): Promise<Document>;
|
|
9
11
|
updateDocument(id: string, update: Partial<Pick<Document, UpdatableDocumentProperties>> & {
|
|
10
12
|
properties?: SetDocumentPropertyParameters[];
|
|
11
13
|
}): Promise<void>;
|
|
@@ -27,11 +27,24 @@ export class DocumentService extends Transactional {
|
|
|
27
27
|
#documentAssignmentScopeRepository = injectRepository(DocumentAssignmentScope);
|
|
28
28
|
#logger = inject(Logger, _a.name);
|
|
29
29
|
repository = injectRepository(Document).withSession(this.session);
|
|
30
|
-
async createDocument({ typeId, title, subtitle, date, summary, tags, approval, comment,
|
|
30
|
+
async createDocument({ typeId, title, subtitle, date, summary, tags, approval, comment, originalFileName, assignment, properties, metadata }, content, { createUserId }) {
|
|
31
31
|
const document = await this.transaction(async (tx) => {
|
|
32
32
|
const documentFile = await this.#documentFileService.withTransaction(tx).create(content, originalFileName);
|
|
33
33
|
const pages = documentFile.mimeType.includes('pdf') ? await tryIgnoreLogAsync(this.#logger, async () => getPdfPageCount(content), null) : null;
|
|
34
|
-
const document = await this.repository.withTransaction(tx).insert({
|
|
34
|
+
const document = await this.repository.withTransaction(tx).insert({
|
|
35
|
+
fileId: documentFile.id,
|
|
36
|
+
typeId: typeId ?? null,
|
|
37
|
+
title: title ?? null,
|
|
38
|
+
subtitle: subtitle ?? null,
|
|
39
|
+
pages,
|
|
40
|
+
date: date ?? null,
|
|
41
|
+
summary: summary ?? null,
|
|
42
|
+
tags: tags ?? null,
|
|
43
|
+
approval: approval ?? DocumentApproval.Pending,
|
|
44
|
+
comment: comment ?? null,
|
|
45
|
+
createUserId: createUserId ?? null,
|
|
46
|
+
metadata,
|
|
47
|
+
});
|
|
35
48
|
if (isDefined(properties)) {
|
|
36
49
|
await this.#documentPropertyService.withTransaction(tx).setPropertyValues(document.id, properties);
|
|
37
50
|
}
|
|
@@ -15,15 +15,14 @@ export declare const setDocumentPropertyParametersSchema: import("../../schema/i
|
|
|
15
15
|
}> | undefined;
|
|
16
16
|
}>;
|
|
17
17
|
export declare const createDocumentParametersSchema: import("../../schema/index.js").ObjectSchema<{
|
|
18
|
-
date
|
|
19
|
-
summary
|
|
20
|
-
title
|
|
21
|
-
typeId
|
|
22
|
-
subtitle
|
|
23
|
-
tags
|
|
24
|
-
comment
|
|
25
|
-
approval
|
|
26
|
-
createUserId: import("../../orm/schemas/uuid.js").Uuid | null;
|
|
18
|
+
date?: import("../../orm/types.js").NumericDate | null | undefined;
|
|
19
|
+
summary?: string | null | undefined;
|
|
20
|
+
title?: string | null | undefined;
|
|
21
|
+
typeId?: import("../../orm/types.js").Uuid | null | undefined;
|
|
22
|
+
subtitle?: string | null | undefined;
|
|
23
|
+
tags?: string[] | null | undefined;
|
|
24
|
+
comment?: string | null | undefined;
|
|
25
|
+
approval?: import("../models/document.model.js").DocumentApproval | undefined;
|
|
27
26
|
originalFileName: string | null;
|
|
28
27
|
assignment: {
|
|
29
28
|
collections: string | string[];
|
|
@@ -4,7 +4,7 @@ import { Document, DocumentAssignmentTarget, DocumentCategory, DocumentCollectio
|
|
|
4
4
|
export const metadataParameterSchema = optional(partial(pick(EntityMetadata, 'attributes')));
|
|
5
5
|
export const metadataParameterObjectSchema = object({ metadata: metadataParameterSchema });
|
|
6
6
|
export const setDocumentPropertyParametersSchema = assign(pick(DocumentPropertyValue, ['propertyId']), object({ value: union(string(), number(), boolean(), nullable(never())) }), metadataParameterObjectSchema);
|
|
7
|
-
export const createDocumentParametersSchema = assign(pick(Document, ['typeId', 'title', 'subtitle', 'date', 'summary', 'tags', 'approval', 'comment'
|
|
7
|
+
export const createDocumentParametersSchema = assign(partial(pick(Document, ['typeId', 'title', 'subtitle', 'date', 'summary', 'tags', 'approval', 'comment'])), pick(DocumentFile, ['originalFileName']), object({
|
|
8
8
|
assignment: union(object({ collections: oneOrMany(string(), { minimum: 1 }) }), object({ request: string() }), object({
|
|
9
9
|
automatic: object({
|
|
10
10
|
/** collection ids to assign in */
|