@mdgf11/filesystem-lib 2.0.0 → 2.0.2
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/descritores.js +1 -4
- package/dist/filesystemDocumentMethods.d.ts +1 -1
- package/dist/filesystemDocumentMethods.js +33 -76
- package/dist/filesystemUpdateMethods.d.ts +1 -1
- package/dist/filesystemUpdateMethods.js +24 -33
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -19
- package/dist/types.js +13 -20
- package/package.json +2 -5
- package/src/descritores.ts +4246 -0
- package/src/filesystemDocumentMethods.ts +210 -0
- package/src/filesystemUpdateMethods.ts +81 -0
- package/src/index.ts +3 -0
- package/src/types.ts +62 -0
- package/tsconfig.json +112 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { calculateHASH, calculateUUID, JurisprudenciaDocument, PartialJurisprudenciaDocument } from "@stjiris/jurisprudencia-document";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import mammoth from "mammoth";
|
|
4
|
+
import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs';
|
|
5
|
+
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";
|
|
6
|
+
import { DescritorOficial } from "./descritores.js";
|
|
7
|
+
|
|
8
|
+
export function writeFilesystemDocument(filesystem_document: FilesystemDocument): void {
|
|
9
|
+
if (!filesystem_document.content)
|
|
10
|
+
return
|
|
11
|
+
|
|
12
|
+
const safe = {
|
|
13
|
+
...filesystem_document,
|
|
14
|
+
content: filesystem_document.content?.map(({ extension }) => ({ extension }))
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const content: ContentType[] = filesystem_document.content
|
|
18
|
+
|
|
19
|
+
if (filesystem_document.file_path) {
|
|
20
|
+
// make filesystem paths
|
|
21
|
+
const filesystem_dir_path = `${ROOT_PATH}${FILESYSTEM_PATH}${filesystem_document.file_path}`;
|
|
22
|
+
const filesystem_metadata_path = `${filesystem_dir_path}/${DETAILS_NAME}.json`;
|
|
23
|
+
fs.mkdirSync(filesystem_dir_path, { recursive: true });
|
|
24
|
+
fs.writeFileSync(filesystem_metadata_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
25
|
+
for (const content_i of content) {
|
|
26
|
+
const filesystem_original_path = `${filesystem_dir_path}/${ORIGINAL_NAME}.${content_i.extension}`;
|
|
27
|
+
fs.writeFileSync(filesystem_original_path, content_i.data, { encoding: "utf-8" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// make metadata copy on filesystem copy
|
|
31
|
+
if (filesystem_document.sharepoint_metadata) {
|
|
32
|
+
const filesystem_sharepoint_dir_path = `${ROOT_PATH}${SHAREPOINT_COPY_PATH}${filesystem_document.sharepoint_metadata.sharepoint_path_rel}`;
|
|
33
|
+
const filesystem_sharepoint_path = `${filesystem_sharepoint_dir_path}/${DETAILS_NAME}.json`;
|
|
34
|
+
fs.mkdirSync(filesystem_sharepoint_dir_path, { recursive: true });
|
|
35
|
+
fs.writeFileSync(filesystem_sharepoint_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
if (filesystem_document.sharepoint_metadata) {
|
|
39
|
+
const filesystem_sharepoint_dir_path = `${ROOT_PATH}${SHAREPOINT_COPY_PATH}${filesystem_document.sharepoint_metadata.sharepoint_path_rel}`;
|
|
40
|
+
const filesystem_sharepoint_path = `${filesystem_sharepoint_dir_path}/${DETAILS_NAME}.json`;
|
|
41
|
+
fs.mkdirSync(filesystem_sharepoint_dir_path, { recursive: true });
|
|
42
|
+
fs.writeFileSync(filesystem_sharepoint_path, JSON.stringify(safe, null, 2), { encoding: "utf-8" });
|
|
43
|
+
for (const content_i of content) {
|
|
44
|
+
const filesystem_original_path = `${filesystem_sharepoint_dir_path}/${ORIGINAL_NAME}.${content_i.extension}`;
|
|
45
|
+
fs.writeFileSync(filesystem_original_path, content_i.data, { encoding: "utf-8" });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function loadFilesystemDocument(jsonPath: string): FilesystemDocument {
|
|
52
|
+
const jsonString = fs.readFileSync(jsonPath, 'utf-8');
|
|
53
|
+
const parsed = JSON.parse(jsonString);
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
...parsed,
|
|
57
|
+
creation_date: new Date(parsed.creation_date),
|
|
58
|
+
last_update_date: new Date(parsed.last_update_date),
|
|
59
|
+
content: parsed.content?.map((item: any) => ({
|
|
60
|
+
extension: item.extension,
|
|
61
|
+
data: Buffer.from([])
|
|
62
|
+
}))
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function createJurisprudenciaDocument(retrievable_Metadata: Retrievable_Metadata, contents: ContentType[], date_area_section: Date_Area_Section, sharepoint_metadata?: Sharepoint_Metadata): Promise<PartialJurisprudenciaDocument> {
|
|
67
|
+
if (!retrievable_Metadata) {
|
|
68
|
+
throw new Error("Missing metadata.");
|
|
69
|
+
}
|
|
70
|
+
const content = await extractContent(contents);
|
|
71
|
+
const url = sharepoint_metadata ? sharepoint_metadata.sharepoint_url : "";
|
|
72
|
+
|
|
73
|
+
let Original: JurisprudenciaDocument["Original"] = {};
|
|
74
|
+
let CONTENT: JurisprudenciaDocument["CONTENT"] = content;
|
|
75
|
+
let numProc: JurisprudenciaDocument["Número de Processo"] = retrievable_Metadata.process_number;
|
|
76
|
+
let Data: JurisprudenciaDocument["Data"] = Intl.DateTimeFormat("pt-PT").format(date_area_section.file_date);
|
|
77
|
+
let origin: SupportedUpdateSources = "STJ (Sharepoint)";
|
|
78
|
+
|
|
79
|
+
Original["Decisão Texto Integral"] = content.map(line => `<p><font>${line}</font><br>`).join('');
|
|
80
|
+
Original["Data"] = Data;
|
|
81
|
+
Original["Número de Processo"] = numProc;
|
|
82
|
+
Original["Fonte"] = origin;
|
|
83
|
+
Original["URL"] = url;
|
|
84
|
+
Original["Jurisprudência"] = "Simples";
|
|
85
|
+
|
|
86
|
+
let obj: PartialJurisprudenciaDocument = {
|
|
87
|
+
"Original": Original,
|
|
88
|
+
"CONTENT": CONTENT,
|
|
89
|
+
"Data": Data,
|
|
90
|
+
"Número de Processo": numProc,
|
|
91
|
+
"Fonte": origin,
|
|
92
|
+
"URL": url,
|
|
93
|
+
"Jurisprudência": { Index: ["Simples"], Original: ["Simples"], Show: ["Simples"] },
|
|
94
|
+
"STATE": "importação",
|
|
95
|
+
}
|
|
96
|
+
obj.Sumário = "";
|
|
97
|
+
obj.Texto = content.map(line => `<p><font>${line}</font><br>`).join('');
|
|
98
|
+
if (retrievable_Metadata.descriptors && retrievable_Metadata.descriptors.length > 0) {
|
|
99
|
+
obj.Descritores = {
|
|
100
|
+
Index: retrievable_Metadata.descriptors.map(desc => DescritorOficial[desc]),
|
|
101
|
+
Original: retrievable_Metadata.descriptors,
|
|
102
|
+
Show: retrievable_Metadata.descriptors.map(desc => DescritorOficial[desc])
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (date_area_section.area && date_area_section.area.length > 0) {
|
|
106
|
+
obj.Área = { Index: [date_area_section.area], Original: [date_area_section.area], Show: [date_area_section.area] };
|
|
107
|
+
}
|
|
108
|
+
if (date_area_section.section && date_area_section.section.length > 0) {
|
|
109
|
+
obj.Secção = { Index: [date_area_section.section], Original: [date_area_section.section], Show: [date_area_section.section] };
|
|
110
|
+
}
|
|
111
|
+
if (retrievable_Metadata.judge && retrievable_Metadata.judge.length > 0) {
|
|
112
|
+
obj["Relator Nome Profissional"] = { Index: [retrievable_Metadata.judge], Original: [retrievable_Metadata.judge], Show: [retrievable_Metadata.judge] };
|
|
113
|
+
}
|
|
114
|
+
if (retrievable_Metadata.process_mean && retrievable_Metadata.process_mean.length > 0) {
|
|
115
|
+
obj["Meio Processual"] = { Index: [retrievable_Metadata.process_mean], Original: [retrievable_Metadata.process_mean], Show: [retrievable_Metadata.process_mean] };
|
|
116
|
+
}
|
|
117
|
+
if (retrievable_Metadata.decision && retrievable_Metadata.decision.length > 0) {
|
|
118
|
+
obj["Decisão"] = { Index: [retrievable_Metadata.decision], Original: [retrievable_Metadata.decision], Show: [retrievable_Metadata.decision] };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
obj["HASH"] = calculateHASH({
|
|
122
|
+
...obj,
|
|
123
|
+
Original: obj.Original,
|
|
124
|
+
"Número de Processo": obj["Número de Processo"] || "",
|
|
125
|
+
Sumário: obj.Sumário || "",
|
|
126
|
+
Texto: obj.Texto || "",
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
obj["UUID"] = calculateUUID(obj["HASH"]);
|
|
130
|
+
return obj;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export async function hasSelectableText(buffer: Buffer): Promise<boolean> {
|
|
134
|
+
try {
|
|
135
|
+
const uint8Array = new Uint8Array(buffer);
|
|
136
|
+
const loadingTask = pdfjsLib.getDocument({
|
|
137
|
+
data: uint8Array,
|
|
138
|
+
standardFontDataUrl: 'node_modules/pdfjs-dist/standard_fonts/',
|
|
139
|
+
});
|
|
140
|
+
const pdf = await loadingTask.promise;
|
|
141
|
+
|
|
142
|
+
const pagesToCheck = Math.min(3, pdf.numPages);
|
|
143
|
+
|
|
144
|
+
for (let i = 1; i <= pagesToCheck; i++) {
|
|
145
|
+
const page = await pdf.getPage(i);
|
|
146
|
+
const textContent = await page.getTextContent();
|
|
147
|
+
|
|
148
|
+
if (textContent.items.some((item: any) => item.str?.trim().length > 0)) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return false;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error('Error reading PDF:', error);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function generateFilePath(date_area_section: Date_Area_Section, retrievable_metadata: Retrievable_Metadata): string {
|
|
161
|
+
return `/${date_area_section.area}/${date_area_section.file_date.getFullYear()}/${date_area_section.file_date.getMonth() + 1}/${date_area_section.file_date.getDate()}/${retrievable_metadata.process_number.replace("/", "-")}`
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function extractContent(contents: ContentType[]): Promise<string[]> {
|
|
165
|
+
for (const content of contents) {
|
|
166
|
+
if (content.extension === "txt") {
|
|
167
|
+
return content.data.toString('utf-8').split(/\r?\n/).filter(line => line.trim().length > 0);
|
|
168
|
+
}
|
|
169
|
+
if (content.extension === "pdf") {
|
|
170
|
+
return await pdfToLines(content.data);
|
|
171
|
+
}
|
|
172
|
+
if (content.extension === "docx") {
|
|
173
|
+
return await docxToLines(content.data);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
throw new Error("Contents are not a supported format.");
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function pdfToLines(buffer: Buffer): Promise<string[]> {
|
|
180
|
+
const uint8Array = new Uint8Array(buffer);
|
|
181
|
+
const loadingTask = pdfjsLib.getDocument({ data: uint8Array, verbosity: 0 });
|
|
182
|
+
const pdf = await loadingTask.promise;
|
|
183
|
+
|
|
184
|
+
const allLines: string[] = [];
|
|
185
|
+
|
|
186
|
+
for (let i = 1; i <= pdf.numPages; i++) {
|
|
187
|
+
const page = await pdf.getPage(i);
|
|
188
|
+
const textContent = await page.getTextContent();
|
|
189
|
+
const pageText = textContent.items
|
|
190
|
+
.map((item: any) => item.str)
|
|
191
|
+
.join('\n');
|
|
192
|
+
|
|
193
|
+
const lines = pageText.split('\n').filter(line => line.trim().length > 0);
|
|
194
|
+
allLines.push(...lines);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return allLines;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async function docxToLines(buffer: Buffer): Promise<string[]> {
|
|
201
|
+
const result = await mammoth.extractRawText({ buffer });
|
|
202
|
+
const text = result.value || "";
|
|
203
|
+
|
|
204
|
+
const content = text
|
|
205
|
+
.split(/\r?\n/)
|
|
206
|
+
.map(line => line.trim())
|
|
207
|
+
.filter(Boolean);
|
|
208
|
+
|
|
209
|
+
return content;
|
|
210
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { FilesystemDocument, FilesystemUpdate, UPDATE_DIR } from "./types.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export function addFileToUpdate(update: FilesystemUpdate, filesystem_document: FilesystemDocument): void {
|
|
7
|
+
if (!filesystem_document.file_path) {
|
|
8
|
+
throw new Error("File to be added to update doesn't have a system path.");
|
|
9
|
+
}
|
|
10
|
+
if (!update.created) {
|
|
11
|
+
update.created = [];
|
|
12
|
+
}
|
|
13
|
+
if (!update.created_num) {
|
|
14
|
+
update.created_num = 0;
|
|
15
|
+
}
|
|
16
|
+
update.created_num += 1;
|
|
17
|
+
update.created.push(filesystem_document.file_path);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function writeFilesystemUpdate(update: FilesystemUpdate): void {
|
|
21
|
+
update.date_end = new Date();
|
|
22
|
+
|
|
23
|
+
fs.mkdirSync(UPDATE_DIR, { recursive: true });
|
|
24
|
+
const updates_file_path = `${UPDATE_DIR}/log_${formatUpdateDate(update.date_end)}.json`;
|
|
25
|
+
|
|
26
|
+
const drive_dir_path = `${UPDATE_DIR}/All`
|
|
27
|
+
fs.mkdirSync(drive_dir_path, { recursive: true });
|
|
28
|
+
const drive_file_path = `${drive_dir_path}/log_${formatUpdateDate(update.date_end)}.json`;
|
|
29
|
+
|
|
30
|
+
removeOldUpdate(UPDATE_DIR);
|
|
31
|
+
|
|
32
|
+
fs.writeFileSync(drive_file_path, JSON.stringify(update, null, 2), { encoding: "utf-8" });
|
|
33
|
+
fs.writeFileSync(updates_file_path, JSON.stringify(update, null, 2), { encoding: "utf-8" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function logDocumentProcessingError(update: FilesystemUpdate, err: string) {
|
|
37
|
+
update.file_errors.push(err);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function loadLastFilesystemUpdate(): FilesystemUpdate {
|
|
41
|
+
const empty_update: FilesystemUpdate = {
|
|
42
|
+
updateSource: "STJ (Sharepoint)",
|
|
43
|
+
file_errors: [],
|
|
44
|
+
date_start: new Date()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!fs.existsSync(UPDATE_DIR))
|
|
48
|
+
return empty_update;
|
|
49
|
+
|
|
50
|
+
const files = fs.readdirSync(UPDATE_DIR);
|
|
51
|
+
for (const file of files) {
|
|
52
|
+
const fullPath = path.join(UPDATE_DIR, file);
|
|
53
|
+
if (fs.statSync(fullPath).isFile() && file.toLowerCase().includes("log")) {
|
|
54
|
+
const jsonString = fs.readFileSync(fullPath, 'utf-8');
|
|
55
|
+
const parsed: FilesystemUpdate = JSON.parse(jsonString);
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return empty_update;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function formatUpdateDate(d: Date = new Date()): string {
|
|
64
|
+
const pad = (n: number) => n.toString().padStart(2, "0");
|
|
65
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}_${pad(d.getHours())}-${pad(d.getMinutes())}-${pad(d.getSeconds())}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function removeOldUpdate(folderPath: string) {
|
|
69
|
+
if (!fs.existsSync(folderPath))
|
|
70
|
+
return;
|
|
71
|
+
|
|
72
|
+
const files = fs.readdirSync(folderPath);
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
const fullPath = path.join(folderPath, file);
|
|
75
|
+
if (fs.statSync(fullPath).isFile() && file.toLowerCase().includes("log")) {
|
|
76
|
+
fs.unlinkSync(fullPath);
|
|
77
|
+
console.log(`Deleted: ${fullPath} `);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
export const UpdateSources = ["STJ (Sharepoint)", "Juris"] as const;
|
|
3
|
+
export type SupportedUpdateSources = typeof UpdateSources[number];
|
|
4
|
+
import { PartialJurisprudenciaDocument } from '@stjiris/jurisprudencia-document';
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
|
|
7
|
+
dotenv.config();
|
|
8
|
+
export const ROOT_PATH = process.env['LOCAL_ROOT'] || 'results';
|
|
9
|
+
export const FILESYSTEM_PATH = `/FileSystem`
|
|
10
|
+
export const SHAREPOINT_COPY_PATH = `/Sharepoint`
|
|
11
|
+
export const DETAILS_NAME = "Detalhes"
|
|
12
|
+
export const ORIGINAL_NAME = "Original"
|
|
13
|
+
export const LOGS_PATH = "/Updates"
|
|
14
|
+
export const UPDATE_DIR = `${ROOT_PATH}${LOGS_PATH}`;
|
|
15
|
+
|
|
16
|
+
export type FilesystemUpdate = {
|
|
17
|
+
updateSource: SupportedUpdateSources,
|
|
18
|
+
date_start: Date,
|
|
19
|
+
file_errors: string[],
|
|
20
|
+
date_end?: Date,
|
|
21
|
+
created_num?: number, created?: string[],
|
|
22
|
+
deleted_num?: number, deleted?: string[],
|
|
23
|
+
updated_num?: number, updated?: string[],
|
|
24
|
+
next_link?: string, delta_link?: string
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export type Sharepoint_Metadata = {
|
|
30
|
+
drive_name: string,
|
|
31
|
+
drive_id: string,
|
|
32
|
+
sharepoint_id: string,
|
|
33
|
+
parent_sharepoint_id: string,
|
|
34
|
+
sharepoint_path: string,
|
|
35
|
+
sharepoint_path_rel: string,
|
|
36
|
+
sharepoint_url: string,
|
|
37
|
+
extensions: Supported_Content_Extensions[],
|
|
38
|
+
xor_hash?: string,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type Retrievable_Metadata = { process_number: string, judge: string, process_mean: string, decision: string, descriptors?: string[] };
|
|
42
|
+
export type Date_Area_Section = { file_date: Date, area: string, section: string };
|
|
43
|
+
|
|
44
|
+
export const SUPPORTED_EXTENSIONS = ["txt", "pdf", "docx"] as const;
|
|
45
|
+
export type Supported_Content_Extensions = typeof SUPPORTED_EXTENSIONS[number];
|
|
46
|
+
|
|
47
|
+
export type ContentType = {
|
|
48
|
+
extension: Supported_Content_Extensions;
|
|
49
|
+
data: Buffer;
|
|
50
|
+
};
|
|
51
|
+
export type FilesystemDocument = {
|
|
52
|
+
creation_date: Date,
|
|
53
|
+
last_update_date: Date,
|
|
54
|
+
jurisprudencia_document: PartialJurisprudenciaDocument,
|
|
55
|
+
file_path: string,
|
|
56
|
+
sharepoint_metadata?: Sharepoint_Metadata
|
|
57
|
+
content?: ContentType[],
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function isSupportedExtension(ext: string): ext is Supported_Content_Extensions {
|
|
61
|
+
return (SUPPORTED_EXTENSIONS as readonly string[]).includes(ext);
|
|
62
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
"lib": ["ES2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "NodeNext", /* Specify what module code is generated. */
|
|
29
|
+
"rootDir": "src", /* Specify the root folder within your source files. */
|
|
30
|
+
"moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
+
|
|
46
|
+
/* JavaScript Support */
|
|
47
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
+
|
|
51
|
+
/* Emit */
|
|
52
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
+
"outDir": "dist/", /* Specify an output folder for all emitted files. */
|
|
59
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
63
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
64
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
65
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
67
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
68
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
69
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
70
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
71
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
72
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
73
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
74
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
75
|
+
|
|
76
|
+
/* Interop Constraints */
|
|
77
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
80
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
81
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
82
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
83
|
+
|
|
84
|
+
/* Type Checking */
|
|
85
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
86
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
87
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
88
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
89
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
90
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
91
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
92
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
93
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
94
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
95
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
96
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
97
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
98
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
99
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
100
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
101
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
102
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
103
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
104
|
+
|
|
105
|
+
/* Completeness */
|
|
106
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
+
},
|
|
109
|
+
"include": [
|
|
110
|
+
"src"
|
|
111
|
+
]
|
|
112
|
+
}
|