@mdgf11/filesystem-lib 2.2.12 → 2.2.14

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,6 +2,7 @@ import { PartialJurisprudenciaDocument } from "@stjiris/jurisprudencia-document"
2
2
  import { ContentType, FilesystemDocument } from "./types.js";
3
3
  export declare function writeFilesystemDocument(filesystem_document: FilesystemDocument): void;
4
4
  export declare function loadFilesystemDocument(jsonPath: string): FilesystemDocument;
5
+ export declare function loadNlpDocument(jsonPath: string): string;
5
6
  export declare function hasSelectableText(buffer: Buffer): Promise<boolean>;
6
7
  export declare function generateFilePath(jurisprudencia_document: PartialJurisprudenciaDocument): string;
7
8
  export declare function extractContent(contents: ContentType[]): Promise<string[]>;
@@ -54,6 +54,9 @@ export function loadFilesystemDocument(jsonPath) {
54
54
  }))
55
55
  };
56
56
  }
57
+ export function loadNlpDocument(jsonPath) {
58
+ return fs.readFileSync(jsonPath, 'utf-8');
59
+ }
57
60
  export async function hasSelectableText(buffer) {
58
61
  try {
59
62
  const uint8Array = new Uint8Array(buffer);
package/dist/types.d.ts CHANGED
@@ -48,7 +48,7 @@ export type Date_Area_Section = {
48
48
  area: string;
49
49
  section: string;
50
50
  };
51
- export declare const SUPPORTED_EXTENSIONS: readonly ["txt", "pdf", "docx", "html"];
51
+ export declare const SUPPORTED_EXTENSIONS: readonly ["txt", "pdf", "docx", "html", "json"];
52
52
  export type Supported_Content_Extensions = typeof SUPPORTED_EXTENSIONS[number];
53
53
  export type ContentType = {
54
54
  extension: Supported_Content_Extensions;
package/dist/types.js CHANGED
@@ -12,7 +12,7 @@ export const DGSI_LOGS_PATH = `${LOGS_PATH}/DGSI`;
12
12
  export const SHAREPOINT_UPDATE_DIR = `${ROOT_PATH}${SHAREPOINT_LOGS_PATH}`;
13
13
  export const DGSI_UPDATE_DIR = `${ROOT_PATH}${DGSI_LOGS_PATH}`;
14
14
  export const SOURCE_TO_PATH = { "STJ (Sharepoint)": SHAREPOINT_UPDATE_DIR, "DGSI": DGSI_UPDATE_DIR };
15
- export const SUPPORTED_EXTENSIONS = ["txt", "pdf", "docx", "html"];
15
+ export const SUPPORTED_EXTENSIONS = ["txt", "pdf", "docx", "html", "json"];
16
16
  export function isSupportedExtension(ext) {
17
17
  return SUPPORTED_EXTENSIONS.includes(ext);
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdgf11/filesystem-lib",
3
- "version": "2.2.12",
3
+ "version": "2.2.14",
4
4
  "description": "Library to extend usage of jurisprudencia-document",
5
5
  "license": "ISC",
6
6
  "author": "Miguel Fonseca",
@@ -1,4 +1,4 @@
1
- import { calculateHASH, calculateUUID, JurisprudenciaDocument, PartialJurisprudenciaDocument } from "@stjiris/jurisprudencia-document";
1
+ import { PartialJurisprudenciaDocument } from "@stjiris/jurisprudencia-document";
2
2
  import fs from "fs";
3
3
  import mammoth from "mammoth";
4
4
  import { ContentType, Date_Area_Section, DETAILS_NAME, FILESYSTEM_PATH, FilesystemDocument, ORIGINAL_NAME, Retrievable_Metadata, ROOT_PATH, SHAREPOINT_COPY_PATH, Sharepoint_Metadata, SupportedUpdateSources } from "./types.js";
@@ -63,6 +63,10 @@ export function loadFilesystemDocument(jsonPath: string): FilesystemDocument {
63
63
  };
64
64
  }
65
65
 
66
+ export function loadNlpDocument(jsonPath: string): string {
67
+ return fs.readFileSync(jsonPath, 'utf-8');
68
+ }
69
+
66
70
  export async function hasSelectableText(buffer: Buffer): Promise<boolean> {
67
71
  try {
68
72
  const uint8Array = new Uint8Array(buffer);
package/src/types.ts CHANGED
@@ -1,7 +1,6 @@
1
1
 
2
2
  export const UpdateSources = ["STJ (Sharepoint)", "DGSI"] as const;
3
3
  export type SupportedUpdateSources = typeof UpdateSources[number];
4
- import { PartialJurisprudenciaDocument } from '@stjiris/jurisprudencia-document';
5
4
  import dotenv from 'dotenv';
6
5
 
7
6
  dotenv.config();
@@ -46,7 +45,7 @@ export type Sharepoint_Metadata = {
46
45
  export type Retrievable_Metadata = { process_number: string, judge: string, process_mean: string[], decision: string, descriptors?: string[] };
47
46
  export type Date_Area_Section = { file_date: Date, area: string, section: string };
48
47
 
49
- export const SUPPORTED_EXTENSIONS = ["txt", "pdf", "docx", "html"] as const;
48
+ export const SUPPORTED_EXTENSIONS = ["txt", "pdf", "docx", "html", "json"] as const;
50
49
  export type Supported_Content_Extensions = typeof SUPPORTED_EXTENSIONS[number];
51
50
 
52
51
  export type ContentType = {