@mdgf11/filesystem-lib 2.2.20 → 2.2.21
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.
|
@@ -2,7 +2,7 @@ import { execFileSync } from "child_process";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import mammoth from "mammoth";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import { DETAILS_NAME, FILESYSTEM_PATH, ORIGINAL_NAME, ROOT_PATH, SHAREPOINT_COPY_PATH } from "./types.js";
|
|
5
|
+
import { DETAILS_NAME, ENTITIES_NAME, FILESYSTEM_PATH, ORIGINAL_NAME, ROOT_PATH, SHAREPOINT_COPY_PATH } from "./types.js";
|
|
6
6
|
import { writeDocumentEvent } from "./filesystemUpdateMethods.js";
|
|
7
7
|
import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
8
8
|
export function writeFilesystemDocument(filesystem_document) {
|
|
@@ -20,7 +20,8 @@ export function writeFilesystemDocument(filesystem_document) {
|
|
|
20
20
|
fs.mkdirSync(filesystem_dir_path, { recursive: true });
|
|
21
21
|
fs.writeFileSync(filesystem_metadata_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
22
22
|
for (const content_i of content) {
|
|
23
|
-
const
|
|
23
|
+
const name = content_i.extension === "json" ? ENTITIES_NAME : ORIGINAL_NAME;
|
|
24
|
+
const filesystem_original_path = `${filesystem_dir_path}/${name}.${content_i.extension}`;
|
|
24
25
|
fs.writeFileSync(filesystem_original_path, content_i.data, { encoding: "utf-8" });
|
|
25
26
|
}
|
|
26
27
|
// make metadata copy on filesystem copy
|
|
@@ -38,7 +39,8 @@ export function writeFilesystemDocument(filesystem_document) {
|
|
|
38
39
|
fs.mkdirSync(filesystem_sharepoint_dir_path, { recursive: true });
|
|
39
40
|
fs.writeFileSync(filesystem_sharepoint_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
40
41
|
for (const content_i of content) {
|
|
41
|
-
const
|
|
42
|
+
const name = content_i.extension === "json" ? ENTITIES_NAME : ORIGINAL_NAME;
|
|
43
|
+
const filesystem_original_path = `${filesystem_sharepoint_dir_path}/${name}.${content_i.extension}`;
|
|
42
44
|
fs.writeFileSync(filesystem_original_path, content_i.data, { encoding: "utf-8" });
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -60,7 +62,7 @@ export function loadFilesystemDocument(jsonPath) {
|
|
|
60
62
|
export function loadDocumentFile(doc, type) {
|
|
61
63
|
const dirPath = `${ROOT_PATH}${FILESYSTEM_PATH}${generateFilePath(doc)}`;
|
|
62
64
|
if (type === "nlp") {
|
|
63
|
-
return fs.readFileSync(`${dirPath}/${
|
|
65
|
+
return fs.readFileSync(`${dirPath}/${ENTITIES_NAME}.json`, "utf-8");
|
|
64
66
|
}
|
|
65
67
|
if (type === "details") {
|
|
66
68
|
return fs.readFileSync(`${dirPath}/${DETAILS_NAME}.json`, "utf-8");
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const FILESYSTEM_PATH = "/FileSystem";
|
|
|
5
5
|
export declare const SHAREPOINT_COPY_PATH = "/Sharepoint";
|
|
6
6
|
export declare const DETAILS_NAME = "Detalhes";
|
|
7
7
|
export declare const ORIGINAL_NAME = "Original";
|
|
8
|
+
export declare const ENTITIES_NAME = "Entities";
|
|
8
9
|
export declare const LOGS_PATH = "/Updates";
|
|
9
10
|
export declare const SHAREPOINT_LOGS_PATH = "/Updates/Sharepoint";
|
|
10
11
|
export declare const DGSI_LOGS_PATH = "/Updates/DGSI";
|
package/dist/types.js
CHANGED
|
@@ -6,6 +6,7 @@ export const FILESYSTEM_PATH = `/FileSystem`;
|
|
|
6
6
|
export const SHAREPOINT_COPY_PATH = `/Sharepoint`;
|
|
7
7
|
export const DETAILS_NAME = "Detalhes";
|
|
8
8
|
export const ORIGINAL_NAME = "Original";
|
|
9
|
+
export const ENTITIES_NAME = "Entities";
|
|
9
10
|
export const LOGS_PATH = "/Updates";
|
|
10
11
|
export const SHAREPOINT_LOGS_PATH = `${LOGS_PATH}/Sharepoint`;
|
|
11
12
|
export const DGSI_LOGS_PATH = `${LOGS_PATH}/DGSI`;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { execFileSync } from "child_process";
|
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import mammoth from "mammoth";
|
|
5
5
|
import path from "path";
|
|
6
|
-
import { ContentType, Date_Area_Section, DETAILS_NAME, DocumentUpdateEvent, FILESYSTEM_PATH, FilesystemDocument, ORIGINAL_NAME, Retrievable_Metadata, ROOT_PATH, SHAREPOINT_COPY_PATH, Sharepoint_Metadata, SupportedUpdateSources } from "./types.js";
|
|
6
|
+
import { ContentType, Date_Area_Section, DETAILS_NAME, DocumentUpdateEvent, ENTITIES_NAME, FILESYSTEM_PATH, FilesystemDocument, ORIGINAL_NAME, Retrievable_Metadata, ROOT_PATH, SHAREPOINT_COPY_PATH, Sharepoint_Metadata, SupportedUpdateSources } from "./types.js";
|
|
7
7
|
import { writeDocumentEvent } from "./filesystemUpdateMethods.js";
|
|
8
8
|
import { DescritorOficial } from "./descritores.js";
|
|
9
9
|
import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -26,7 +26,8 @@ export function writeFilesystemDocument(filesystem_document: FilesystemDocument)
|
|
|
26
26
|
fs.mkdirSync(filesystem_dir_path, { recursive: true });
|
|
27
27
|
fs.writeFileSync(filesystem_metadata_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
28
28
|
for (const content_i of content) {
|
|
29
|
-
const
|
|
29
|
+
const name = content_i.extension === "json" ? ENTITIES_NAME : ORIGINAL_NAME;
|
|
30
|
+
const filesystem_original_path = `${filesystem_dir_path}/${name}.${content_i.extension}`;
|
|
30
31
|
fs.writeFileSync(filesystem_original_path, content_i.data, { encoding: "utf-8" });
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -44,7 +45,8 @@ export function writeFilesystemDocument(filesystem_document: FilesystemDocument)
|
|
|
44
45
|
fs.mkdirSync(filesystem_sharepoint_dir_path, { recursive: true });
|
|
45
46
|
fs.writeFileSync(filesystem_sharepoint_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
46
47
|
for (const content_i of content) {
|
|
47
|
-
const
|
|
48
|
+
const name = content_i.extension === "json" ? ENTITIES_NAME : ORIGINAL_NAME;
|
|
49
|
+
const filesystem_original_path = `${filesystem_sharepoint_dir_path}/${name}.${content_i.extension}`;
|
|
48
50
|
fs.writeFileSync(filesystem_original_path, content_i.data, { encoding: "utf-8" });
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -73,7 +75,7 @@ export function loadDocumentFile(doc: PartialJurisprudenciaDocument, type: "pdf"
|
|
|
73
75
|
export function loadDocumentFile(doc: PartialJurisprudenciaDocument, type: DocumentFileType): string | Buffer {
|
|
74
76
|
const dirPath = `${ROOT_PATH}${FILESYSTEM_PATH}${generateFilePath(doc)}`;
|
|
75
77
|
if (type === "nlp") {
|
|
76
|
-
return fs.readFileSync(`${dirPath}/${
|
|
78
|
+
return fs.readFileSync(`${dirPath}/${ENTITIES_NAME}.json`, "utf-8");
|
|
77
79
|
}
|
|
78
80
|
if (type === "details") {
|
|
79
81
|
return fs.readFileSync(`${dirPath}/${DETAILS_NAME}.json`, "utf-8");
|
package/src/types.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const FILESYSTEM_PATH = `/FileSystem`;
|
|
|
9
9
|
export const SHAREPOINT_COPY_PATH = `/Sharepoint`;
|
|
10
10
|
export const DETAILS_NAME = "Detalhes";
|
|
11
11
|
export const ORIGINAL_NAME = "Original";
|
|
12
|
+
export const ENTITIES_NAME = "Entities";
|
|
12
13
|
export const LOGS_PATH = "/Updates";
|
|
13
14
|
|
|
14
15
|
export const SHAREPOINT_LOGS_PATH = `${LOGS_PATH}/Sharepoint`;
|