fullnative 0.1.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/CHANGELOG.md +23 -0
- package/LICENSE +21 -0
- package/README.md +161 -0
- package/dist/core/env/env.d.ts +34 -0
- package/dist/core/env/env.d.ts.map +1 -0
- package/dist/core/env/env.js +134 -0
- package/dist/core/env/env.js.map +1 -0
- package/dist/core/env/index.d.ts +10 -0
- package/dist/core/env/index.d.ts.map +1 -0
- package/dist/core/env/index.js +10 -0
- package/dist/core/env/index.js.map +1 -0
- package/dist/core/file/File.d.ts +246 -0
- package/dist/core/file/File.d.ts.map +1 -0
- package/dist/core/file/File.js +397 -0
- package/dist/core/file/File.js.map +1 -0
- package/dist/core/file/Folder.d.ts +235 -0
- package/dist/core/file/Folder.d.ts.map +1 -0
- package/dist/core/file/Folder.js +427 -0
- package/dist/core/file/Folder.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/process/Command.d.ts +94 -0
- package/dist/core/process/Command.d.ts.map +1 -0
- package/dist/core/process/Command.js +143 -0
- package/dist/core/process/Command.js.map +1 -0
- package/dist/core/process/LiveProcess.d.ts +134 -0
- package/dist/core/process/LiveProcess.d.ts.map +1 -0
- package/dist/core/process/LiveProcess.js +214 -0
- package/dist/core/process/LiveProcess.js.map +1 -0
- package/dist/core/process/Process.d.ts +108 -0
- package/dist/core/process/Process.d.ts.map +1 -0
- package/dist/core/process/Process.js +138 -0
- package/dist/core/process/Process.js.map +1 -0
- package/dist/core/process/ProcessError.d.ts +50 -0
- package/dist/core/process/ProcessError.d.ts.map +1 -0
- package/dist/core/process/ProcessError.js +62 -0
- package/dist/core/process/ProcessError.js.map +1 -0
- package/dist/core/process/Result.d.ts +61 -0
- package/dist/core/process/Result.d.ts.map +1 -0
- package/dist/core/process/Result.js +89 -0
- package/dist/core/process/Result.js.map +1 -0
- package/dist/core/process/index.d.ts +7 -0
- package/dist/core/process/index.d.ts.map +1 -0
- package/dist/core/process/index.js +6 -0
- package/dist/core/process/index.js.map +1 -0
- package/dist/core/process/types.d.ts +17 -0
- package/dist/core/process/types.d.ts.map +1 -0
- package/dist/core/process/types.js +2 -0
- package/dist/core/process/types.js.map +1 -0
- package/dist/core/shell/Job.d.ts +149 -0
- package/dist/core/shell/Job.d.ts.map +1 -0
- package/dist/core/shell/Job.js +218 -0
- package/dist/core/shell/Job.js.map +1 -0
- package/dist/core/shell/Shell.d.ts +275 -0
- package/dist/core/shell/Shell.d.ts.map +1 -0
- package/dist/core/shell/Shell.js +461 -0
- package/dist/core/shell/Shell.js.map +1 -0
- package/dist/core/shell/index.d.ts +4 -0
- package/dist/core/shell/index.d.ts.map +1 -0
- package/dist/core/shell/index.js +3 -0
- package/dist/core/shell/index.js.map +1 -0
- package/dist/core/shell/types.d.ts +30 -0
- package/dist/core/shell/types.d.ts.map +1 -0
- package/dist/core/shell/types.js +2 -0
- package/dist/core/shell/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-08-14
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `File` class: read, write, JSON, hash, streams, copy, move, rename, replace, replaceMany, permissions, truncate, touch.
|
|
13
|
+
- `Folder` class: list, walk, walkIter, walkFilesIter, tree, find, matchFiles, watch, copy, move, rename, create, delete, clear.
|
|
14
|
+
- `Process` facade: run, output, shell, spawn, spawnWith, spawnScript, exists, which.
|
|
15
|
+
- `Command` builder: withArgs, in, withEnv, withTimeout, withInput, throwOnError, run, output, spawn.
|
|
16
|
+
- `LiveProcess` handle: stdin/stdout/stderr, kill, forceKill, wait, onOutput, onStdout, onStderr, onExit, elapsed, stopped.
|
|
17
|
+
- `Result` class: stdout, stderr, output, lines, json, ok, failed, exitCode, signal, throwIfFailed.
|
|
18
|
+
- `ProcessError` class: structured error with command, args, kind, exitCode, signal, stderr, cause.
|
|
19
|
+
- `Shell` session: run, $ tagged template, pipe, chain, ifOk, ifFail, bg, jobs registry, killAll, cd, set/unset, alias/unalias, history.
|
|
20
|
+
- `Job` class: name, autoRestart, restartCount, onRestart, kill, wait, result, full LiveProcess forwarding.
|
|
21
|
+
- `env` module: load (with `${VAR}` interpolation via `util.parseEnv`), get, require.
|
|
22
|
+
- 150 tests covering all modules.
|
|
23
|
+
- JSDoc in Spanish across all public APIs.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zeltri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# fullnative
|
|
2
|
+
|
|
3
|
+
TypeScript toolchain for Node.js scripting — files, folders, processes, and shell sessions with a clean, object-oriented API.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
Node's built-in modules are powerful but verbose. `fullnative` wraps them in simple objects that are pleasant to use in scripts, CLIs, and build tools — no callbacks, no boilerplate, just objects.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add fullnative
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { File, Folder, Process, Shell } from "fullnative";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### File
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const config = new File("./config.json");
|
|
25
|
+
|
|
26
|
+
await config.writeJson({ port: 3000 });
|
|
27
|
+
const { port } = await config.readJson<{ port: number }>();
|
|
28
|
+
|
|
29
|
+
await config.replace("v1.0.0", "v2.0.0");
|
|
30
|
+
const hash = await config.hash("sha256");
|
|
31
|
+
await config.copyTo("./backup/config.json");
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Folder
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const project = new Folder("./my-app");
|
|
38
|
+
await project.ensure();
|
|
39
|
+
|
|
40
|
+
const tsFiles = await project.listByExt("ts");
|
|
41
|
+
const entry = await project.find("index.ts");
|
|
42
|
+
const tree = await project.tree(); // ASCII tree visualization
|
|
43
|
+
await project.copyTo("./backup/my-app");
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Process
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
const proc = new Process();
|
|
50
|
+
|
|
51
|
+
const result = await proc.run("git", "log", "--oneline");
|
|
52
|
+
console.log(result.stdout);
|
|
53
|
+
console.log(result.ok); // true if exitCode === 0
|
|
54
|
+
console.log(result.lines); // stdout split into lines
|
|
55
|
+
|
|
56
|
+
// Builder API
|
|
57
|
+
const out = await proc
|
|
58
|
+
.cmd("git")
|
|
59
|
+
.withArgs("rev-parse", "--abbrev-ref", "HEAD")
|
|
60
|
+
.in("/my/repo")
|
|
61
|
+
.output();
|
|
62
|
+
|
|
63
|
+
// Interactive
|
|
64
|
+
const node = proc.spawn("node", "-i");
|
|
65
|
+
node.sendLine("1 + 1");
|
|
66
|
+
node.endInput();
|
|
67
|
+
const res = await node.wait();
|
|
68
|
+
|
|
69
|
+
// Check if a binary exists
|
|
70
|
+
if (await proc.exists("docker")) {
|
|
71
|
+
await proc.run("docker", "compose", "up", "-d");
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Shell
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
const sh = new Shell({ cwd: "/my/project" });
|
|
79
|
+
|
|
80
|
+
// Run shell scripts
|
|
81
|
+
await sh.run("npm install && npm run build");
|
|
82
|
+
|
|
83
|
+
// Tagged template with safe quoting
|
|
84
|
+
const branch = "main";
|
|
85
|
+
await sh.$`git push origin ${branch}`;
|
|
86
|
+
|
|
87
|
+
// Pipeline
|
|
88
|
+
const errors = await sh.pipe("cat log.txt", "grep ERROR", "wc -l");
|
|
89
|
+
|
|
90
|
+
// Chain (stop on error)
|
|
91
|
+
const results = await sh.chain("npm run lint", "npm run build", "npm test");
|
|
92
|
+
const allOk = results.every((r) => r.ok);
|
|
93
|
+
|
|
94
|
+
// Conditionals
|
|
95
|
+
await sh.ifOk("npm test", "npm run deploy");
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Background jobs
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const sh = new Shell();
|
|
102
|
+
|
|
103
|
+
const dev = sh.bg("npm run dev", { name: "dev" });
|
|
104
|
+
dev.onOutput((chunk) => process.stdout.write(chunk));
|
|
105
|
+
|
|
106
|
+
const server = sh.bg("npm run serve", {
|
|
107
|
+
name: "server",
|
|
108
|
+
autoRestart: true,
|
|
109
|
+
});
|
|
110
|
+
server.onRestart((job) => console.log(`Restarted (${job.restartCount})`));
|
|
111
|
+
|
|
112
|
+
// Introspect
|
|
113
|
+
console.log(sh.activeJobs.map((j) => j.name));
|
|
114
|
+
|
|
115
|
+
// Clean up everything
|
|
116
|
+
sh.killAll();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Error handling
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { ProcessError } from "fullnative";
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
await proc.run("npm", "run", "build").then((r) => r.throwIfFailed());
|
|
126
|
+
} catch (err) {
|
|
127
|
+
if (err instanceof ProcessError) {
|
|
128
|
+
console.log(err.command); // "npm"
|
|
129
|
+
console.log(err.kind); // "exit" | "spawn"
|
|
130
|
+
console.log(err.exitCode); // 1
|
|
131
|
+
console.log(err.stderr); // build error output
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## API
|
|
137
|
+
|
|
138
|
+
| Class | Description |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `File` | File operations: read, write, JSON, hash, streams, copy, move |
|
|
141
|
+
| `Folder` | Directory operations: list, walk, tree, find, matchFiles, watch, copy, move |
|
|
142
|
+
| `Process` | Execute native commands: run, spawn, shell, exists, which |
|
|
143
|
+
| `Command` | Immutable builder: withArgs, in, withEnv, withTimeout, withInput, throwOnError |
|
|
144
|
+
| `LiveProcess` | Running process: stdin/stdout/stderr, kill, wait, onOutput, elapsed, stopped |
|
|
145
|
+
| `Result` | Finished command: stdout, stderr, json, lines, ok, throwIfFailed |
|
|
146
|
+
| `Shell` | Shell session: run, $, pipe, chain, ifOk, ifFail, bg, jobs, killAll |
|
|
147
|
+
| `Job` | Background process: name, autoRestart, onRestart, kill, wait |
|
|
148
|
+
| `ProcessError` | Structured error: command, kind, exitCode, signal, stderr, cause |
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pnpm install
|
|
154
|
+
pnpm test # run tests
|
|
155
|
+
pnpm run typecheck # type check
|
|
156
|
+
pnpm run build # compile to dist/
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carga un archivo `.env`, interpola referencias `${VAR}` y las mergea a
|
|
3
|
+
* `process.env` **sin pisar** variables que ya estén seteadas en el entorno
|
|
4
|
+
* real. El entorno real siempre tiene prioridad sobre el archivo.
|
|
5
|
+
*
|
|
6
|
+
* El parseo se realiza con `util.parseEnv` de Node.js. Los valores `undefined`
|
|
7
|
+
* resultantes del parseo se descartan antes de interpolar.
|
|
8
|
+
*
|
|
9
|
+
* @param path Ruta al archivo `.env` (default `".env"`)
|
|
10
|
+
* @returns Nada; muta `process.env` como efecto secundario
|
|
11
|
+
* @throws {Error} Si el archivo no existe (ENOENT) u otro error de lectura
|
|
12
|
+
*/
|
|
13
|
+
export declare function load(envPath?: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Devuelve el valor de una env var, o `undefined` si no existe.
|
|
16
|
+
* @param key Nombre de la variable
|
|
17
|
+
* @returns El valor o `undefined`
|
|
18
|
+
*/
|
|
19
|
+
export declare function get(key: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Devuelve el valor de una env var, o `fallback` si no existe.
|
|
22
|
+
* @param key Nombre de la variable
|
|
23
|
+
* @param fallback Valor a retornar si la variable no existe
|
|
24
|
+
* @returns El valor o el fallback
|
|
25
|
+
*/
|
|
26
|
+
export declare function get(key: string, fallback: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Devuelve el valor de una env var, o lanza `Error` si no existe.
|
|
29
|
+
* @param key Nombre de la variable
|
|
30
|
+
* @returns El valor
|
|
31
|
+
* @throws {Error} Si la variable no existe, con un mensaje que incluye el nombre de la key
|
|
32
|
+
*/
|
|
33
|
+
export declare function require(key: string): string;
|
|
34
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/core/env/env.ts"],"names":[],"mappings":"AA4FA;;;;;;;;;;;GAWG;AACH,wBAAsB,IAAI,CAAC,OAAO,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAY1D;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;AAgB3D;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM3C"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { parseEnv } from "node:util";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
/**
|
|
4
|
+
* Expresión regular global que captura referencias de interpolación del tipo
|
|
5
|
+
* `${VAR}`. El identificador capturado debe comenzar con una letra o `_` y
|
|
6
|
+
* contener solo caracteres alfanuméricos o `_`.
|
|
7
|
+
*/
|
|
8
|
+
const REF = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
9
|
+
/**
|
|
10
|
+
* Resuelve referencias `${VAR}` dentro de los valores de un objeto de variables.
|
|
11
|
+
*
|
|
12
|
+
* - Busca el valor en el propio objeto primero, luego en `process.env`.
|
|
13
|
+
* - Si no se encuentra en ninguno, reemplaza por string vacío.
|
|
14
|
+
* - Repite pases hasta que no haya cambios entre un pase y el siguiente
|
|
15
|
+
* (soporta referencias encadenadas: A depende de B, B depende de C).
|
|
16
|
+
* - **Límite duro de `maxPasses` (default 5)**: corta referencias circulares
|
|
17
|
+
* (`A=${B}`, `B=${A}`) sin colgar el proceso. Al llegar al límite, devuelve
|
|
18
|
+
* el resultado tal como quedó — los `${...}` sin resolver sobreviven.
|
|
19
|
+
* Es una decisión de "mejor esfuerzo".
|
|
20
|
+
*
|
|
21
|
+
* La comparación entre pases se hace con `JSON.stringify` (no con regex
|
|
22
|
+
* stateful) para evitar falsos negativos por `lastIndex`.
|
|
23
|
+
*
|
|
24
|
+
* @param vars Objeto de variables a interpolar
|
|
25
|
+
* @param maxPasses Número máximo de pases de resolución (default 5)
|
|
26
|
+
* @returns Un nuevo objeto con las referencias `${VAR}` resueltas (de forma
|
|
27
|
+
* "mejor esfuerzo"; las no resolubles sobreviven literales)
|
|
28
|
+
*/
|
|
29
|
+
function interpolate(vars, maxPasses = 5) {
|
|
30
|
+
let current = vars;
|
|
31
|
+
/**
|
|
32
|
+
* Resuelve todas las referencias `${VAR}` de un valor individual.
|
|
33
|
+
*
|
|
34
|
+
* Para cada referencia, busca primero en el objeto `current` (resultado
|
|
35
|
+
* parcial del pase actual) y luego en `process.env`. Si no se encuentra en
|
|
36
|
+
* ninguno, reemplaza por string vacío.
|
|
37
|
+
*
|
|
38
|
+
* @param value Cadena que puede contener cero o más referencias `${VAR}`
|
|
39
|
+
* @returns El valor con todas las referencias resolubles reemplazadas
|
|
40
|
+
*/
|
|
41
|
+
const resolveValue = (value) => value.replace(REF, (_, name) => {
|
|
42
|
+
const found = current[name] ?? process.env[name] ?? "";
|
|
43
|
+
return found;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Ejecuta un único pase de resolución sobre todo el objeto de variables,
|
|
47
|
+
* aplicando `resolveValue` a cada clave.
|
|
48
|
+
*
|
|
49
|
+
* @param obj Objeto de variables a resolver en este pase
|
|
50
|
+
* @returns Un nuevo objeto con los valores tras aplicar `resolveValue`
|
|
51
|
+
*/
|
|
52
|
+
const resolvePass = (obj) => {
|
|
53
|
+
const next = {};
|
|
54
|
+
for (const key of Object.keys(obj)) {
|
|
55
|
+
next[key] = resolveValue(obj[key]);
|
|
56
|
+
}
|
|
57
|
+
return next;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Bucle recursivo que aplica `resolvePass` repetidamente hasta que no haya
|
|
61
|
+
* cambios entre pases (referencias encadenadas resueltas) o hasta alcanzar
|
|
62
|
+
* `maxPasses` (corta referencias circulares sin colgar el proceso).
|
|
63
|
+
*
|
|
64
|
+
* La comparación entre pases se hace con `JSON.stringify` (no con el estado
|
|
65
|
+
* interno de la regex) para evitar falsos negativos por `lastIndex`.
|
|
66
|
+
*
|
|
67
|
+
* @param acc Acumulador de variables resueltas hasta el pase actual
|
|
68
|
+
* @param pass Número de pase actual (comienza en 0)
|
|
69
|
+
* @returns El objeto de variables tras detenerse (por convergencia o límite)
|
|
70
|
+
*/
|
|
71
|
+
const loop = (acc, pass) => {
|
|
72
|
+
if (pass >= maxPasses)
|
|
73
|
+
return acc;
|
|
74
|
+
const next = resolvePass(acc);
|
|
75
|
+
if (JSON.stringify(next) === JSON.stringify(acc))
|
|
76
|
+
return next;
|
|
77
|
+
return loop(next, pass + 1);
|
|
78
|
+
};
|
|
79
|
+
return loop(current, 0);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Carga un archivo `.env`, interpola referencias `${VAR}` y las mergea a
|
|
83
|
+
* `process.env` **sin pisar** variables que ya estén seteadas en el entorno
|
|
84
|
+
* real. El entorno real siempre tiene prioridad sobre el archivo.
|
|
85
|
+
*
|
|
86
|
+
* El parseo se realiza con `util.parseEnv` de Node.js. Los valores `undefined`
|
|
87
|
+
* resultantes del parseo se descartan antes de interpolar.
|
|
88
|
+
*
|
|
89
|
+
* @param path Ruta al archivo `.env` (default `".env"`)
|
|
90
|
+
* @returns Nada; muta `process.env` como efecto secundario
|
|
91
|
+
* @throws {Error} Si el archivo no existe (ENOENT) u otro error de lectura
|
|
92
|
+
*/
|
|
93
|
+
export async function load(envPath = ".env") {
|
|
94
|
+
const raw = await readFile(envPath, "utf8");
|
|
95
|
+
const parsed = parseEnv(raw);
|
|
96
|
+
const clean = {};
|
|
97
|
+
for (const key of Object.keys(parsed)) {
|
|
98
|
+
const value = parsed[key];
|
|
99
|
+
if (value !== undefined)
|
|
100
|
+
clean[key] = value;
|
|
101
|
+
}
|
|
102
|
+
const resolved = interpolate(clean);
|
|
103
|
+
for (const key of Object.keys(resolved)) {
|
|
104
|
+
process.env[key] ??= resolved[key];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Implementación de `get`. Devuelve el valor de una env var, o `fallback`
|
|
109
|
+
* (que por defecto es `undefined`) si la variable no existe en `process.env`.
|
|
110
|
+
*
|
|
111
|
+
* @param key Nombre de la variable
|
|
112
|
+
* @param fallback Valor a retornar si la variable no existe (default `undefined`)
|
|
113
|
+
* @returns El valor de la variable, el fallback, o `undefined`
|
|
114
|
+
*/
|
|
115
|
+
export function get(key, fallback) {
|
|
116
|
+
const value = process.env[key];
|
|
117
|
+
if (value === undefined)
|
|
118
|
+
return fallback;
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Devuelve el valor de una env var, o lanza `Error` si no existe.
|
|
123
|
+
* @param key Nombre de la variable
|
|
124
|
+
* @returns El valor
|
|
125
|
+
* @throws {Error} Si la variable no existe, con un mensaje que incluye el nombre de la key
|
|
126
|
+
*/
|
|
127
|
+
export function require(key) {
|
|
128
|
+
const value = process.env[key];
|
|
129
|
+
if (value === undefined) {
|
|
130
|
+
throw new Error(`Missing required environment variable: ${key}`);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/core/env/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,GAAG,GAAG,iCAAiC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,WAAW,CAClB,IAA4B,EAC5B,SAAS,GAAG,CAAC;IAEb,IAAI,OAAO,GAAG,IAAI,CAAC;IAEnB;;;;;;;;;OASG;IACH,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE,CAC7C,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAY,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEL;;;;;;OAMG;IACH,MAAM,WAAW,GAAG,CAAC,GAA2B,EAA0B,EAAE;QAC1E,MAAM,IAAI,GAA2B,EAAE,CAAC;QACxC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF;;;;;;;;;;;OAWG;IACH,MAAM,IAAI,GAAG,CACX,GAA2B,EAC3B,IAAY,EACY,EAAE;QAC1B,IAAI,IAAI,IAAI,SAAS;YAAE,OAAO,GAAG,CAAC;Q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AAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,0CAA0C,GAAG,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Punto de entrada del módulo de variables de entorno.
|
|
3
|
+
*
|
|
4
|
+
* Reexporta la API pública para cargar, leer y exigir variables de entorno:
|
|
5
|
+
* - `load(path?)`: carga un archivo `.env` y lo mergea a `process.env`.
|
|
6
|
+
* - `get(key)` / `get(key, fallback)`: lee una variable con o sin valor por defecto.
|
|
7
|
+
* - `require(key)`: lee una variable o lanza si no existe.
|
|
8
|
+
*/
|
|
9
|
+
export { load, get, require } from "./env.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/env/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Punto de entrada del módulo de variables de entorno.
|
|
3
|
+
*
|
|
4
|
+
* Reexporta la API pública para cargar, leer y exigir variables de entorno:
|
|
5
|
+
* - `load(path?)`: carga un archivo `.env` y lo mergea a `process.env`.
|
|
6
|
+
* - `get(key)` / `get(key, fallback)`: lee una variable con o sin valor por defecto.
|
|
7
|
+
* - `require(key)`: lee una variable o lanza si no existe.
|
|
8
|
+
*/
|
|
9
|
+
export { load, get, require } from "./env.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/env/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { type Stats } from "node:fs";
|
|
2
|
+
import { Readable, Writable } from "node:stream";
|
|
3
|
+
/**
|
|
4
|
+
* Representa un archivo individual accesible mediante una API sencilla.
|
|
5
|
+
* Las operaciones son perezosas: leen/escriben en disco solo cuando se invocan.
|
|
6
|
+
*/
|
|
7
|
+
export declare class File {
|
|
8
|
+
path: string;
|
|
9
|
+
constructor(path: string);
|
|
10
|
+
/** Nombre del archivo incluyendo su extensión. */
|
|
11
|
+
get name(): string;
|
|
12
|
+
/** Nombre del archivo sin la extensión. */
|
|
13
|
+
get baseName(): string;
|
|
14
|
+
/** Extensión del archivo sin el punto inicial (ej. `txt`, `json`). */
|
|
15
|
+
get ext(): string;
|
|
16
|
+
/** Ruta absoluta del directorio que contiene al archivo. */
|
|
17
|
+
get dirname(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Tipo MIME inferido a partir de la extensión del archivo.
|
|
20
|
+
* Devuelve `application/octet-stream` para extensiones desconocidas.
|
|
21
|
+
*/
|
|
22
|
+
get mimeType(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Verifica si el archivo existe en disco.
|
|
25
|
+
* @returns `true` si el archivo existe, `false` en caso contrario.
|
|
26
|
+
*/
|
|
27
|
+
exists(): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Obtiene los metadatos (stat) del archivo en disco.
|
|
30
|
+
* @returns Una promesa con el objeto `Stats` de Node.js.
|
|
31
|
+
*/
|
|
32
|
+
stat(): Promise<Stats>;
|
|
33
|
+
/**
|
|
34
|
+
* Obtiene el tamaño del archivo en bytes.
|
|
35
|
+
* @returns Tamaño en bytes.
|
|
36
|
+
*/
|
|
37
|
+
size(): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Indica si el archivo está vacío (0 bytes).
|
|
40
|
+
* @returns `true` si el tamaño es 0, `false` en caso contrario.
|
|
41
|
+
*/
|
|
42
|
+
isEmpty(): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Obtiene la fecha de creación del archivo.
|
|
45
|
+
* @returns La fecha (`birthtime`) de creación.
|
|
46
|
+
*/
|
|
47
|
+
createdAt(): Promise<Date>;
|
|
48
|
+
/**
|
|
49
|
+
* Obtiene la fecha de última modificación del archivo.
|
|
50
|
+
* @returns La fecha (`mtime`) de última modificación.
|
|
51
|
+
*/
|
|
52
|
+
modifiedAt(): Promise<Date>;
|
|
53
|
+
/**
|
|
54
|
+
* Obtiene la fecha de último acceso al archivo.
|
|
55
|
+
* @returns La fecha (`atime`) de último acceso.
|
|
56
|
+
*/
|
|
57
|
+
accessedAt(): Promise<Date>;
|
|
58
|
+
/**
|
|
59
|
+
* Lee el contenido del archivo como texto.
|
|
60
|
+
* @param encoding Codificación a utilizar (por defecto `utf8`).
|
|
61
|
+
* @returns El contenido del archivo como cadena.
|
|
62
|
+
*/
|
|
63
|
+
read(encoding?: BufferEncoding): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Lee el contenido del archivo como `Buffer` binario.
|
|
66
|
+
* @returns Un `Buffer` con los bytes del archivo.
|
|
67
|
+
*/
|
|
68
|
+
readBuffer(): Promise<Buffer>;
|
|
69
|
+
/**
|
|
70
|
+
* Lee y parsea el contenido del archivo como JSON.
|
|
71
|
+
* @returns El valor parseado, tipado genéricamente como `T`.
|
|
72
|
+
*/
|
|
73
|
+
readJson<T = unknown>(): Promise<T>;
|
|
74
|
+
/**
|
|
75
|
+
* Lee el contenido del archivo y lo divide en líneas.
|
|
76
|
+
* @returns Un arreglo de cadenas, una por línea.
|
|
77
|
+
*/
|
|
78
|
+
readLines(): Promise<string[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Escribe datos en el archivo. Crea el directorio padre automáticamente
|
|
81
|
+
* si no existe (comportamiento intencional para que el caller no necesite
|
|
82
|
+
* un `mkdir -p` previo explícito). Sobrescribe el contenido existente.
|
|
83
|
+
* @param data Contenido a escribir (cadena, `Buffer` o `Uint8Array`).
|
|
84
|
+
* @returns Promesa que se resuelve cuando la escritura termina.
|
|
85
|
+
*/
|
|
86
|
+
write(data: string | Buffer | Uint8Array): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Serializa `data` a JSON y lo escribe en el archivo (creando el directorio padre).
|
|
89
|
+
* @param data Valor a serializar.
|
|
90
|
+
* @param pretty Si `true` (por defecto), indenta con 2 espacios; si `false`, compacto.
|
|
91
|
+
* @returns Promesa que se resuelve cuando la escritura termina.
|
|
92
|
+
*/
|
|
93
|
+
writeJson(data: unknown, pretty?: boolean): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Escribe un arreglo de líneas en el archivo, unidas por `\n`.
|
|
96
|
+
* Crea el directorio padre automáticamente.
|
|
97
|
+
* @param lines Líneas a escribir.
|
|
98
|
+
* @returns Promesa que se resuelve cuando la escritura termina.
|
|
99
|
+
*/
|
|
100
|
+
writeLines(lines: readonly string[]): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Añade datos al final del archivo. Crea el directorio padre automáticamente
|
|
103
|
+
* si no existe.
|
|
104
|
+
* @param data Contenido a añadir (cadena, `Buffer` o `Uint8Array`).
|
|
105
|
+
* @returns Promesa que se resuelve cuando la operación termina.
|
|
106
|
+
*/
|
|
107
|
+
append(data: string | Buffer | Uint8Array): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Añade una línea al final del archivo, seguida de un salto de línea.
|
|
110
|
+
* Crea el directorio padre automáticamente.
|
|
111
|
+
* @param line Texto de la línea a añadir.
|
|
112
|
+
* @returns Promesa que se resuelve cuando la operación termina.
|
|
113
|
+
*/
|
|
114
|
+
appendLine(line: string): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Prependa datos al inicio del archivo, leyendo el contenido existente y
|
|
117
|
+
* reescribiendo el archivo completo. Crea el directorio padre automáticamente.
|
|
118
|
+
* @param data Contenido a prepend (cadena, `Buffer` o `Uint8Array`).
|
|
119
|
+
* @returns Promesa que se resuelve cuando la operación termina.
|
|
120
|
+
*/
|
|
121
|
+
prepend(data: string | Buffer | Uint8Array): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Inserta una línea en una posición específica del archivo (por índice de línea).
|
|
124
|
+
* El índice se ajusta dentro de los límites válidos.
|
|
125
|
+
* @param lineIndex Índice (base 0) donde insertar la línea.
|
|
126
|
+
* @param content Texto de la línea a insertar.
|
|
127
|
+
* @returns Promesa que se resuelve cuando la escritura termina.
|
|
128
|
+
*/
|
|
129
|
+
insertAt(lineIndex: number, content: string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Reemplaza la primera ocurrencia de `search` por `replacement` en el contenido
|
|
132
|
+
* del archivo y lo reescribe.
|
|
133
|
+
* @param search Cadena o expresión regular a buscar.
|
|
134
|
+
* @param replacement Texto de reemplazo.
|
|
135
|
+
* @returns Promesa que se resuelve cuando la escritura termina.
|
|
136
|
+
*/
|
|
137
|
+
replace(search: string | RegExp, replacement: string): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Aplica múltiples reemplazos en secuencia sobre el contenido del archivo.
|
|
140
|
+
* Renombrado desde `replaceAll()` para evitar colisión con el método nativo
|
|
141
|
+
* de cadenas. Cada reemplazo se aplica al resultado del anterior, en orden.
|
|
142
|
+
* @param replacements Arreglo de pares `{ search, replacement }` aplicados en orden.
|
|
143
|
+
* @returns Promesa que se resuelve cuando la escritura termina.
|
|
144
|
+
*/
|
|
145
|
+
replaceMany(replacements: readonly {
|
|
146
|
+
search: string | RegExp;
|
|
147
|
+
replacement: string;
|
|
148
|
+
}[]): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Trunca el archivo al tamaño indicado.
|
|
151
|
+
* @param size Tamaño en bytes (por defecto 0, vacía el archivo).
|
|
152
|
+
* @returns Promesa que se resuelve al completar el truncado.
|
|
153
|
+
*/
|
|
154
|
+
truncate(size?: number): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Actualiza la fecha de acceso/modificación al momento actual, o crea el
|
|
157
|
+
* archivo vacío si no existe.
|
|
158
|
+
* @returns Promesa que se resuelve al completar la operación.
|
|
159
|
+
*/
|
|
160
|
+
touch(): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Cambia los permisos del archivo.
|
|
163
|
+
* @param mode Máscode de permisos numérico (ej. `0o644`).
|
|
164
|
+
* @returns Promesa que se resuelve al completar el cambio.
|
|
165
|
+
*/
|
|
166
|
+
chmod(mode: number): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Establece el archivo como solo lectura (modo `0o444`).
|
|
169
|
+
* @returns Promesa que se resuelve al completar el cambio.
|
|
170
|
+
*/
|
|
171
|
+
setReadOnly(): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Establece el archivo como lectura/escritura (modo `0o644`).
|
|
174
|
+
* @returns Promesa que se resuelve al completar el cambio.
|
|
175
|
+
*/
|
|
176
|
+
setReadWrite(): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Calcula el hash criptográfico del contenido del archivo.
|
|
179
|
+
* @param algo Algoritmo de hash (por defecto `sha256`).
|
|
180
|
+
* @returns El hash en formato hexadecimal.
|
|
181
|
+
*/
|
|
182
|
+
hash(algo?: string): Promise<string>;
|
|
183
|
+
/**
|
|
184
|
+
* Compara este archivo con otro por contenido (usando hash).
|
|
185
|
+
* @param other Otro `File` a comparar.
|
|
186
|
+
* @returns `true` si ambos existen y su hash coincide, `false` en caso contrario.
|
|
187
|
+
*/
|
|
188
|
+
equals(other: File): Promise<boolean>;
|
|
189
|
+
/**
|
|
190
|
+
* Compara el contenido del archivo con una cadena o `Buffer` dada.
|
|
191
|
+
* @param content Contenido a comparar.
|
|
192
|
+
* @returns `true` si el contenido coincide, `false` si no existe o difiere.
|
|
193
|
+
*/
|
|
194
|
+
contentEquals(content: string | Buffer): Promise<boolean>;
|
|
195
|
+
/**
|
|
196
|
+
* Crea un stream de lectura para el archivo.
|
|
197
|
+
* @returns Un `Readable` para consumir el contenido en streaming.
|
|
198
|
+
*/
|
|
199
|
+
readStream(): Readable;
|
|
200
|
+
/**
|
|
201
|
+
* Crea un stream de escritura hacia el archivo.
|
|
202
|
+
* @returns Un `Writable` para escribir contenido en streaming.
|
|
203
|
+
*/
|
|
204
|
+
writeStream(): Writable;
|
|
205
|
+
/**
|
|
206
|
+
* Elimina el archivo del disco.
|
|
207
|
+
* @returns `true` si el archivo existía y fue eliminado, `false` si no existía.
|
|
208
|
+
*/
|
|
209
|
+
delete(): Promise<boolean>;
|
|
210
|
+
/**
|
|
211
|
+
* Copia este archivo a una ruta destino. Crea el directorio padre del destino
|
|
212
|
+
* automáticamente si no existe.
|
|
213
|
+
* @param dest Ruta absoluta del archivo destino.
|
|
214
|
+
* @returns Una **nueva** instancia de `File` apuntando al destino.
|
|
215
|
+
*/
|
|
216
|
+
copyTo(dest: string): Promise<File>;
|
|
217
|
+
/**
|
|
218
|
+
* Copia este archivo dentro de un directorio, conservando su nombre.
|
|
219
|
+
* @param dir Ruta del directorio destino.
|
|
220
|
+
* @returns Una **nueva** instancia de `File` apuntando a `dir/name`.
|
|
221
|
+
*/
|
|
222
|
+
copyInto(dir: string): Promise<File>;
|
|
223
|
+
/**
|
|
224
|
+
* Mueve este archivo a una ruta destino. Crea el directorio padre del destino
|
|
225
|
+
* automáticamente si no existe. **Muta `this.path`** al nuevo destino y
|
|
226
|
+
* devuelve `this` para encadenamiento.
|
|
227
|
+
* @param dest Ruta absoluta del archivo destino.
|
|
228
|
+
* @returns La misma instancia (`this`) con `path` actualizado.
|
|
229
|
+
*/
|
|
230
|
+
moveTo(dest: string): Promise<this>;
|
|
231
|
+
/**
|
|
232
|
+
* Mueve este archivo dentro de un directorio, conservando su nombre.
|
|
233
|
+
* **Muta `this.path`** y devuelve `this`.
|
|
234
|
+
* @param dir Ruta del directorio destino.
|
|
235
|
+
* @returns La misma instancia (`this`) con `path` actualizado.
|
|
236
|
+
*/
|
|
237
|
+
moveInto(dir: string): Promise<this>;
|
|
238
|
+
/**
|
|
239
|
+
* Renombra este archivo dentro de su mismo directorio.
|
|
240
|
+
* **Muta `this.path`** y devuelve `this`.
|
|
241
|
+
* @param newName Nuevo nombre del archivo (sin ruta).
|
|
242
|
+
* @returns La misma instancia (`this`) con `path` actualizado.
|
|
243
|
+
*/
|
|
244
|
+
rename(newName: string): Promise<this>;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=File.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../src/core/file/File.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,KAAK,EAAuC,MAAM,SAAS,CAAC;AAG1F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD;;;GAGG;AACH,qBAAa,IAAI;IACR,IAAI,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,MAAM;IAIxB,kDAAkD;IAClD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,2CAA2C;IAC3C,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,sEAAsE;IACtE,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,4DAA4D;IAC5D,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,MAAM,CA8BrB;IAED;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAShC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC;IAI5B;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;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