@pasosdejesus/m 0.28.0 → 0.30.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/README.md +1 -1
- package/dist/CHANGELOG.md +69 -0
- package/dist/compose/data.d.ts +30 -0
- package/dist/compose/data.d.ts.map +1 -0
- package/dist/compose/data.js +46 -0
- package/dist/compose/data.js.map +1 -0
- package/dist/compose/derive.d.ts +18 -2
- package/dist/compose/derive.d.ts.map +1 -1
- package/dist/compose/derive.js +56 -5
- package/dist/compose/derive.js.map +1 -1
- package/dist/compose/git.d.ts +31 -0
- package/dist/compose/git.d.ts.map +1 -0
- package/dist/compose/git.js +71 -0
- package/dist/compose/git.js.map +1 -0
- package/dist/compose/index.d.ts +4 -2
- package/dist/compose/index.d.ts.map +1 -1
- package/dist/compose/index.js +3 -1
- package/dist/compose/index.js.map +1 -1
- package/dist/compose/manifest.d.ts +2 -1
- package/dist/compose/manifest.d.ts.map +1 -1
- package/dist/compose/vendor.d.ts +25 -2
- package/dist/compose/vendor.d.ts.map +1 -1
- package/dist/compose/vendor.js +28 -9
- package/dist/compose/vendor.js.map +1 -1
- package/dist/compose/verify.d.ts.map +1 -1
- package/dist/compose/verify.js +37 -2
- package/dist/compose/verify.js.map +1 -1
- package/dist/i18n/locales/cli.d.ts.map +1 -1
- package/dist/i18n/locales/cli.js +26 -22
- package/dist/i18n/locales/cli.js.map +1 -1
- package/dist/m.js +9 -7
- package/dist/m.js.map +1 -1
- package/dist/tasks/engine.d.ts.map +1 -1
- package/dist/tasks/engine.js +207 -11
- package/dist/tasks/engine.js.map +1 -1
- package/dist/tasks/wallet.js +38 -38
- package/dist/tasks/wallet.js.map +1 -1
- package/dist/templates/AGENTS.md.hbs +3 -3
- package/dist/templates/ARCHITECTURE.md.hbs +7 -7
- package/dist/templates/CONTRIBUTING.md.hbs +2 -2
- package/dist/templates/README.md.hbs +2 -2
- package/dist/templates/apps/.env.example.hbs +1 -1
- package/package.json +2 -2
- package/src/tasks/README.md +2 -2
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ credentials). The `usdt` payment engine lives in `@pasosdejesus/usdt`.
|
|
|
32
32
|
|------|----------|
|
|
33
33
|
| Scaffolding | `m:create`, `m:update` |
|
|
34
34
|
| Database (PostgreSQL + Kysely) | `db:create`, `db:migrate`, `db:rollback`, `db:dump`, `db:restore`, `db:structure:dump/load`, `db:console`, `db:test`, `db:seed` |
|
|
35
|
-
| Wallet (replaces `cast` on OpenBSD) | `
|
|
35
|
+
| Wallet (replaces `cast` on OpenBSD) | `eng:opwallet:generate`, `eng:opwallet:import`, `eng:opwallet:list`, `eng:opwallet:balance`, `eng:opwallet:send`, `eng:opwallet:approve`, `eng:opwallet:call`, `eng:opwallet:sign`, `eng:opwallet:broadcast`, `eng:opwallet:keccak`, `eng:opwallet:derive` — keys in `~/.m/wallets/` with `chmod 600` |
|
|
36
36
|
| Contracts | `contract:test` (EVM via `@pasosdejesus/edr`, no native binaries) |
|
|
37
37
|
| AI tooling | `ai:context`, `ai:readfile`, `ai:writefile`, `ai:edit`, `ai:grep`, `ai:glob` |
|
|
38
38
|
| Requirements | `req:list`, `req:show`, `req:cross`, `req:compare`, `req:sync-from-repo`, `req:sync-to-repo`, `req:list-repo`, `req:create`, `req:close` |
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,75 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pasosdejesus/m` are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.30.0] - 2026-10-13
|
|
6
|
+
|
|
7
|
+
### Changed (breaking) — [m/REQ/50](https://gitlab.com/pasosdeJesus/m/-/work_items/50) Fase 1
|
|
8
|
+
|
|
9
|
+
- **`wallet:*` → `eng:opwallet:*`:** los 11 comandos del **CLI de operador** (llaves del dispositivo en
|
|
10
|
+
`~/.m/wallets`, `chmod 600`: generate, import, list, balance, send, approve, call, sign, broadcast,
|
|
11
|
+
keccak, derive) pasan a la gramática `eng:*`, **sin alias**. La billetera **del usuario** no es esto:
|
|
12
|
+
se convertirá en el motor `wallet` (Fase 2). Actualiza scripts y docs
|
|
13
|
+
(`wallet:generate` → `eng:opwallet:generate`, …). Claves i18n `cmd.wallet_*` → `cmd.eng_opwallet_*`.
|
|
14
|
+
|
|
15
|
+
### Added — [m/REQ/50](https://gitlab.com/pasosdeJesus/m/-/work_items/50) Fase 2 (motor `wallet`) y selección por columna
|
|
16
|
+
|
|
17
|
+
- **Motor `wallet`** (`packages/wallet`, `@pasosdejesus/wallet`, `private`): modelo propio
|
|
18
|
+
`billetera_usuario`/`billetera_invitada` (migraciones + `db/structure.sql`), `provides: ["auth","wallet"]`,
|
|
19
|
+
y compone `msip` sólo por `usuario`. El enlace billetera↔usuario (`wallet-link.ts`) **sale de `msip`** y
|
|
20
|
+
pasa a este motor (corte coordinado con learn.tg `R-#265`).
|
|
21
|
+
- **`engines.<motor>.columns`** (selección por columna): `eng:verify` valida que cada columna declarada
|
|
22
|
+
exista en la tabla del motor (`UNKNOWN_COLUMN`).
|
|
23
|
+
- **Controllers del motor `wallet`** (faceta C, `src/controllers.ts`): `inspectWallet`, `signInWallet`,
|
|
24
|
+
`linkSecondWallet`, `unlinkAccountWallet`, `inviteWalletToAccount`, `acceptWalletInvitation`,
|
|
25
|
+
`cancelAccountInvitation`. Framework-agnósticos; exigen que el **consumidor** afirme la verificación
|
|
26
|
+
SIWE/verificación (`WalletNotVerifiedError`).
|
|
27
|
+
- **Vistas del motor `wallet`** (`@pasosdejesus/wallet/next`, faceta V):
|
|
28
|
+
- `WalletConnect` — punto de entrada con el **modal de elección** (un botón «Conectar» → *in-app* o *externa*).
|
|
29
|
+
- `WalletPanel` — **panel completo**: cuenta (N billeteras), **saldos**, **recibir** (QR), **enviar**
|
|
30
|
+
(nativo/ERC20) y **coleccionables** (NFT). Secciones **deshabilitables** (`features`); auth-only = no
|
|
31
|
+
usar el panel. Config inyectada (tokens, red/explorer, clientes viem, `fetchNfts`).
|
|
32
|
+
- Sobrecargables (`renderBody`/`renderWallet`, D10); textos inyectables. `eng:sync` deriva `views.components`.
|
|
33
|
+
- Helpers puros portados de learn.tg (`wallet-amounts.ts`: `formatTokenAmount`, `parseTokenAmount`, `validateSend`, explorer, `normalizeNftImage`).
|
|
34
|
+
- `@pasosdejesus/wallet/next` **re-exporta** los primitivos de `@pasosdejesus/m/wallet/next` (transición);
|
|
35
|
+
`m` no obliga a ningún motor de billetera (composición **web2** con cero motores verificada).
|
|
36
|
+
- **Correcciones de la 2ª auditoría de learn.tg:** saldo desconocido ≠ insuficiente (con reintento),
|
|
37
|
+
rama de **iniciar sesión** en `WalletConnect` cuando la in-app está desbloqueada sin sesión,
|
|
38
|
+
`InvalidWalletAddressError`, error de invitación normalizado, imágenes NFT con `referrerPolicy`
|
|
39
|
+
y `loading="lazy"`, dirección validada en la URL del explorer, y `Máximo` no aplica si el saldo ≤ reserva
|
|
40
|
+
de gas; +pruebas de las rutas de dinero (ERC20, sin gas, bloqueada, saldo desconocido).
|
|
41
|
+
|
|
42
|
+
### Changed (contrato) — modelo del motor `wallet` endurecido
|
|
43
|
+
|
|
44
|
+
- **`linkWallet`/`ensureWalletLink` rechazan** (`WalletOwnedByOtherError`) una billetera ya vinculada a
|
|
45
|
+
**otra** cuenta (antes devolvían el enlace ajeno); `acceptInvitation(db, dirección, usuarioId)` **rechaza**
|
|
46
|
+
si la dirección es de otra cuenta y **no** marca `used_at`.
|
|
47
|
+
- **Atomicidad:** `unlinkWallet` y `acceptInvitation` pasan a **una sentencia** (CTE en `acceptInvitation`);
|
|
48
|
+
`upsertUserByWallet` limpia el usuario huérfano en una carrera. Se valida la dirección (`0x` + 40 hex).
|
|
49
|
+
- **DDL según diseño:** `linked_at NOT NULL DEFAULT now()`, `linked_by varchar(60)`, `expires_at NOT NULL
|
|
50
|
+
DEFAULT now() + 30 días`; `listWallets` devuelve `linked_at`.
|
|
51
|
+
- Basado en la auditoría de learn.tg (`tmp/audita-wallet-desde-learn.tg.md`, 2026-10-13).
|
|
52
|
+
|
|
53
|
+
## [0.29.0] - 2026-10-13
|
|
54
|
+
|
|
55
|
+
### Added — [m/REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) (glue genérico, fuentes y drift)
|
|
56
|
+
|
|
57
|
+
- **`eng:setup [<motor>]` / `eng:seed [<motor>]` (D3):** glue genérico sobre **cualquier** motor.
|
|
58
|
+
`eng:setup` copia las migraciones del motor (`db/migrations`) de forma idempotente; `eng:seed` carga su
|
|
59
|
+
seed (`db/seed.sql.gz`). `eng:msip:setup` / `eng:msip:seed` quedan como **alias** para `msip`, que
|
|
60
|
+
conserva su seed idempotente.
|
|
61
|
+
- **`eng:sync <motor> --from-git <url>#<ref> [--path <subdir>]` (D4):** toma el motor de un **subárbol
|
|
62
|
+
git** (materializa el `ref` en caché) y anota en `PROVENANCE.json` `kind`/`origin`/`ref`/`version`/`sha256`.
|
|
63
|
+
- **Drift por versión (D5):** `eng:check` marca drift tanto por cambio de **esquema** (`sha256` de
|
|
64
|
+
`db/structure.sql`) como por cambio de **versión** del motor; además materializa el `ref` git anotado
|
|
65
|
+
para medir el drift contra él.
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- **`commands` de un motor:** se derivan de su **registro real** (`src/register.ts`), no de
|
|
70
|
+
`package.json:m.commands` (que duplicaba una lista que no reflejaba el registro).
|
|
71
|
+
- **Alcance de [m/REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40):** los motores `heb412_gen`/`mr519_gen` quedan **fuera** de este requerimiento
|
|
72
|
+
(se tratan con los consumidores que adoptan esos modelos).
|
|
73
|
+
|
|
5
74
|
## [0.28.0] - 2026-10-12
|
|
6
75
|
|
|
7
76
|
### Changed (breaking) — Fase 1 de `m/REQ/39`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Datos de un motor ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D3): sus migraciones y su seed,
|
|
3
|
+
* declarados por convención, para que `eng:setup`/`eng:seed` operen sobre
|
|
4
|
+
* **cualquier** motor y no sólo `msip`.
|
|
5
|
+
*
|
|
6
|
+
* - Migraciones: `<motor>/db/migrations/*.{ts,sql}`.
|
|
7
|
+
* - Seed: `<motor>/db/seed.sql.gz` (o `db/seed.sql`).
|
|
8
|
+
*
|
|
9
|
+
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
10
|
+
*/
|
|
11
|
+
/** Directorio de migraciones de un motor (`db/migrations`, por convención), o `null`. */
|
|
12
|
+
export declare function motorMigrationDir(dir: string): string | null;
|
|
13
|
+
/** Archivos de migración que el motor trae (`.ts`/`.sql`), ordenados. */
|
|
14
|
+
export declare function motorMigrationFiles(dir: string): string[];
|
|
15
|
+
export interface MigrationPlan {
|
|
16
|
+
/** Directorio de migraciones del motor, o `null` si no trae. */
|
|
17
|
+
sourceDir: string | null;
|
|
18
|
+
/** Migraciones que ya están en el consumidor. */
|
|
19
|
+
present: string[];
|
|
20
|
+
/** Migraciones que faltan en el consumidor. */
|
|
21
|
+
missing: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Qué migraciones de un motor faltan en el consumidor (idempotente): `eng:setup`
|
|
25
|
+
* sólo copia las que no están.
|
|
26
|
+
*/
|
|
27
|
+
export declare function planMigrationCopy(motorDir: string, outDir: string): MigrationPlan;
|
|
28
|
+
/** Archivo de seed que el motor trae (`db/seed.sql.gz` o `db/seed.sql`), o `null`. */
|
|
29
|
+
export declare function motorSeedFile(dir: string): string | null;
|
|
30
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/compose/data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,yFAAyF;AACzF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG5D;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAIzD;AAED,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iDAAiD;IACjD,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAQjF;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKxD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Datos de un motor ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D3): sus migraciones y su seed,
|
|
3
|
+
* declarados por convención, para que `eng:setup`/`eng:seed` operen sobre
|
|
4
|
+
* **cualquier** motor y no sólo `msip`.
|
|
5
|
+
*
|
|
6
|
+
* - Migraciones: `<motor>/db/migrations/*.{ts,sql}`.
|
|
7
|
+
* - Seed: `<motor>/db/seed.sql.gz` (o `db/seed.sql`).
|
|
8
|
+
*
|
|
9
|
+
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
/** Directorio de migraciones de un motor (`db/migrations`, por convención), o `null`. */
|
|
14
|
+
export function motorMigrationDir(dir) {
|
|
15
|
+
const candidate = join(dir, 'db', 'migrations');
|
|
16
|
+
return existsSync(candidate) ? candidate : null;
|
|
17
|
+
}
|
|
18
|
+
/** Archivos de migración que el motor trae (`.ts`/`.sql`), ordenados. */
|
|
19
|
+
export function motorMigrationFiles(dir) {
|
|
20
|
+
const migrationsDir = motorMigrationDir(dir);
|
|
21
|
+
if (!migrationsDir)
|
|
22
|
+
return [];
|
|
23
|
+
return readdirSync(migrationsDir).filter((file) => file.endsWith('.ts') || file.endsWith('.sql')).sort();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Qué migraciones de un motor faltan en el consumidor (idempotente): `eng:setup`
|
|
27
|
+
* sólo copia las que no están.
|
|
28
|
+
*/
|
|
29
|
+
export function planMigrationCopy(motorDir, outDir) {
|
|
30
|
+
const files = motorMigrationFiles(motorDir);
|
|
31
|
+
const existing = existsSync(outDir) ? readdirSync(outDir) : [];
|
|
32
|
+
return {
|
|
33
|
+
sourceDir: motorMigrationDir(motorDir),
|
|
34
|
+
present: files.filter((file) => existing.includes(file)),
|
|
35
|
+
missing: files.filter((file) => !existing.includes(file)),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Archivo de seed que el motor trae (`db/seed.sql.gz` o `db/seed.sql`), o `null`. */
|
|
39
|
+
export function motorSeedFile(dir) {
|
|
40
|
+
for (const candidate of ['db/seed.sql.gz', 'db/seed.sql']) {
|
|
41
|
+
if (existsSync(join(dir, candidate)))
|
|
42
|
+
return join(dir, candidate);
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/compose/data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,yFAAyF;AACzF,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;IAC/C,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC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AC,CAAA;IACnE,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/compose/derive.d.ts
CHANGED
|
@@ -27,20 +27,36 @@ export declare const GENERATED_RELATIVE = "src/m-engine.generated.ts";
|
|
|
27
27
|
* `m-engine.generated.ts` (el inventario completo de columnas/restricciones vive en el motor).
|
|
28
28
|
*/
|
|
29
29
|
export declare function structureTables(sql: string): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Columnas por tabla de una estructura de referencia (`pg_dump`): lee el cuerpo de
|
|
32
|
+
* cada `CREATE TABLE` y descarta las restricciones de tabla. Sirve para validar la
|
|
33
|
+
* **selección por columna** del consumidor (`engines.<motor>.columns`,
|
|
34
|
+
* [REQ/50](https://gitlab.com/pasosdeJesus/m/-/work_items/50) D9): declarar sólo las columnas que se usan (p. ej. `usuario` sin
|
|
35
|
+
* las de Devise).
|
|
36
|
+
*/
|
|
37
|
+
export declare function structureColumns(sql: string): Record<string, string[]>;
|
|
30
38
|
/**
|
|
31
39
|
* Tables of a motor's own model, derived from its **reference structure**
|
|
32
40
|
* (`db/structure.sql`), never from scanning all migrations (which have
|
|
33
41
|
* `DROP`/`RENAME`). A motor with no structure has no model tables (`[]`).
|
|
34
42
|
*/
|
|
35
43
|
export declare function deriveTables(dir: string): string[];
|
|
44
|
+
/** Columns per table of a motor's reference structure, or `{}` when it ships none. */
|
|
45
|
+
export declare function deriveColumns(dir: string): Record<string, string[]>;
|
|
36
46
|
/** Migrations directory, by convention `db/migrations` when it exists. */
|
|
37
47
|
export declare function deriveMigrations(dir: string): string | undefined;
|
|
38
48
|
/** Solidity contract names, from `contracts/contracts/*.sol` (skipping `_`-prefixed mocks). */
|
|
39
49
|
export declare function deriveContracts(dir: string): string[];
|
|
40
50
|
/** Views: React components under `src/components` and an `assets` directory. */
|
|
41
51
|
export declare function deriveViews(dir: string): Derived['views'];
|
|
42
|
-
/**
|
|
43
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Commands the motor registers (design §3.4: lo que el motor registra
|
|
54
|
+
* (`register.ts`/exports); nombres `eng:{motor}:*`). Se leen del módulo de registro
|
|
55
|
+
* del motor (`src/register.ts` o `register.ts`) extrayendo sus literales
|
|
56
|
+
* `eng:*`; ya **no** de `package.json:m.commands`, que duplicaba una lista que no
|
|
57
|
+
* reflejaba el registro real.
|
|
58
|
+
*/
|
|
59
|
+
export declare function deriveCommands(dir: string): string[];
|
|
44
60
|
/**
|
|
45
61
|
* Build the derived facts of a motor. Key order is fixed so the generated file
|
|
46
62
|
* is byte-identical across runs (idempotent, diffable).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/compose/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,+EAA0E,CAAA;AAEvG,kCAAkC;AAClC,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAA;AAK7D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAIrD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOlD;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE;AAED,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOrD;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYzD;AAED
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/compose/derive.ts"],"names":[],"mappings":"AAAA;;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ED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAWzD"}
|
package/dist/compose/derive.js
CHANGED
|
@@ -35,6 +35,32 @@ export function structureTables(sql) {
|
|
|
35
35
|
found.add(match[1]);
|
|
36
36
|
return [...found].sort();
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Columnas por tabla de una estructura de referencia (`pg_dump`): lee el cuerpo de
|
|
40
|
+
* cada `CREATE TABLE` y descarta las restricciones de tabla. Sirve para validar la
|
|
41
|
+
* **selección por columna** del consumidor (`engines.<motor>.columns`,
|
|
42
|
+
* [REQ/50](https://gitlab.com/pasosdeJesus/m/-/work_items/50) D9): declarar sólo las columnas que se usan (p. ej. `usuario` sin
|
|
43
|
+
* las de Devise).
|
|
44
|
+
*/
|
|
45
|
+
export function structureColumns(sql) {
|
|
46
|
+
const result = {};
|
|
47
|
+
const tableRe = /^CREATE TABLE (?:ONLY )?public\.(\w+) \(\r?\n([\s\S]*?)^\);/gm;
|
|
48
|
+
for (const match of sql.matchAll(tableRe)) {
|
|
49
|
+
const [, table, body] = match;
|
|
50
|
+
const columns = [];
|
|
51
|
+
for (const line of body.split('\n')) {
|
|
52
|
+
const trimmed = line.trim();
|
|
53
|
+
if (!trimmed)
|
|
54
|
+
continue;
|
|
55
|
+
const first = trimmed.split(/\s+/)[0];
|
|
56
|
+
if (/^(CONSTRAINT|PRIMARY|FOREIGN|UNIQUE|CHECK|EXCLUDE|LIKE)$/i.test(first))
|
|
57
|
+
continue;
|
|
58
|
+
columns.push(first.replace(/^"|"$/g, ''));
|
|
59
|
+
}
|
|
60
|
+
result[table] = columns;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
38
64
|
/**
|
|
39
65
|
* Tables of a motor's own model, derived from its **reference structure**
|
|
40
66
|
* (`db/structure.sql`), never from scanning all migrations (which have
|
|
@@ -49,6 +75,16 @@ export function deriveTables(dir) {
|
|
|
49
75
|
}
|
|
50
76
|
return [];
|
|
51
77
|
}
|
|
78
|
+
/** Columns per table of a motor's reference structure, or `{}` when it ships none. */
|
|
79
|
+
export function deriveColumns(dir) {
|
|
80
|
+
for (const candidate of STRUCTURE_CANDIDATES) {
|
|
81
|
+
const file = join(dir, candidate);
|
|
82
|
+
if (!existsSync(file))
|
|
83
|
+
continue;
|
|
84
|
+
return structureColumns(readFileSync(file, 'utf-8'));
|
|
85
|
+
}
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
52
88
|
/** Migrations directory, by convention `db/migrations` when it exists. */
|
|
53
89
|
export function deriveMigrations(dir) {
|
|
54
90
|
return existsSync(join(dir, 'db', 'migrations')) ? 'db/migrations' : undefined;
|
|
@@ -78,10 +114,25 @@ export function deriveViews(dir) {
|
|
|
78
114
|
return undefined;
|
|
79
115
|
return { components, ...(assets ? { assets } : {}) };
|
|
80
116
|
}
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Commands the motor registers (design §3.4: lo que el motor registra
|
|
119
|
+
* (`register.ts`/exports); nombres `eng:{motor}:*`). Se leen del módulo de registro
|
|
120
|
+
* del motor (`src/register.ts` o `register.ts`) extrayendo sus literales
|
|
121
|
+
* `eng:*`; ya **no** de `package.json:m.commands`, que duplicaba una lista que no
|
|
122
|
+
* reflejaba el registro real.
|
|
123
|
+
*/
|
|
124
|
+
export function deriveCommands(dir) {
|
|
125
|
+
const register = ['src/register.ts', 'register.ts']
|
|
126
|
+
.map((file) => join(dir, file))
|
|
127
|
+
.find((file) => existsSync(file));
|
|
128
|
+
if (!register)
|
|
129
|
+
return [];
|
|
130
|
+
const text = readFileSync(register, 'utf-8');
|
|
131
|
+
const found = new Set();
|
|
132
|
+
for (const match of text.matchAll(/['"`](eng:[a-zA-Z0-9_-]+(?::[a-zA-Z0-9_-]+)+)['"`]/g)) {
|
|
133
|
+
found.add(match[1]);
|
|
134
|
+
}
|
|
135
|
+
return [...found].sort();
|
|
85
136
|
}
|
|
86
137
|
/**
|
|
87
138
|
* Build the derived facts of a motor. Key order is fixed so the generated file
|
|
@@ -97,7 +148,7 @@ export function deriveFrom(dir, name, version, pkg) {
|
|
|
97
148
|
const contracts = deriveContracts(dir);
|
|
98
149
|
if (contracts.length > 0)
|
|
99
150
|
derived.contracts = contracts;
|
|
100
|
-
const commands = deriveCommands(
|
|
151
|
+
const commands = deriveCommands(dir);
|
|
101
152
|
if (commands.length > 0)
|
|
102
153
|
derived.commands = commands;
|
|
103
154
|
const views = deriveViews(dir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/compose/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAIhC,iEAAiE;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,uEAAuE,CAAA;AAEvG,kCAAkC;AAClC,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,EAAE,CAAA;AAE7D,0FAA0F;AAC1F,MAAM,oBAAoB,GAAG,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAElE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,QAAQ,CAAC,iDAAiD,CAAC;QAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACxG,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAA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KAAK,CAAA;IAChC,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,GAAG,gBAAgB,2BAA2B,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,cAAc,CAAA;AACrG,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;IAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAA;IACxE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAY,CAAA;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuentes git de un motor ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D4): `--from-git <url>#<ref>
|
|
3
|
+
* [--path <subdir>]`. Materializa (clona + checkout del ref) el repositorio en una
|
|
4
|
+
* caché por `url#ref` y devuelve la carpeta del motor, para poder vendorizarlo con
|
|
5
|
+
* procedencia trazable (`kind`, `origin`, `ref`, `version`, `sha256`).
|
|
6
|
+
*
|
|
7
|
+
* El registro de npm se evita a propósito: los motores viven en subárboles git (de
|
|
8
|
+
* pasosdejesus o de terceros) y `m` no declara dependencia de ninguno.
|
|
9
|
+
*
|
|
10
|
+
* "Porque ¿quién de vosotros, queriendo edificar una torre, no se sienta primero y calcula los gastos…?" (Lucas 14:28)
|
|
11
|
+
*/
|
|
12
|
+
import type { GitOrigin } from './vendor.js';
|
|
13
|
+
/** Directorio raíz de la caché de checkouts (`<tmp>/m-engines/<url#ref>`). */
|
|
14
|
+
export declare function gitCacheRoot(): string;
|
|
15
|
+
/** `true` cuando `git` está disponible para materializar una fuente git. */
|
|
16
|
+
export declare function gitAvailable(): boolean;
|
|
17
|
+
/** Parsea `<url>#<ref>`; el `ref` es obligatorio. */
|
|
18
|
+
export declare function parseFromGit(spec: string): {
|
|
19
|
+
url: string;
|
|
20
|
+
ref: string;
|
|
21
|
+
};
|
|
22
|
+
/** Carpeta de checkout (en caché) para un `url#ref`. */
|
|
23
|
+
export declare function gitCheckoutDir(origin: Pick<GitOrigin, 'url' | 'ref'>, cacheRoot?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Materializa (clona + `checkout <ref>`) el repositorio y devuelve la raíz del
|
|
26
|
+
* checkout. Es idempotente: un checkout ya presente se reutiliza.
|
|
27
|
+
*/
|
|
28
|
+
export declare function materializeGit(origin: Pick<GitOrigin, 'url' | 'ref'>, cacheRoot?: string): string;
|
|
29
|
+
/** Carpeta del motor dentro de un checkout (`<checkout>` o `<checkout>/<path>`). */
|
|
30
|
+
export declare function motorInCheckout(origin: Pick<GitOrigin, 'url' | 'ref' | 'path'>, cacheRoot?: string): string;
|
|
31
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/compose/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,8EAA8E;AAC9E,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAMvE;AAeD,wDAAwD;AACxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAGjH;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAQjH;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAG3H"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuentes git de un motor ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D4): `--from-git <url>#<ref>
|
|
3
|
+
* [--path <subdir>]`. Materializa (clona + checkout del ref) el repositorio en una
|
|
4
|
+
* caché por `url#ref` y devuelve la carpeta del motor, para poder vendorizarlo con
|
|
5
|
+
* procedencia trazable (`kind`, `origin`, `ref`, `version`, `sha256`).
|
|
6
|
+
*
|
|
7
|
+
* El registro de npm se evita a propósito: los motores viven en subárboles git (de
|
|
8
|
+
* pasosdejesus o de terceros) y `m` no declara dependencia de ninguno.
|
|
9
|
+
*
|
|
10
|
+
* "Porque ¿quién de vosotros, queriendo edificar una torre, no se sienta primero y calcula los gastos…?" (Lucas 14:28)
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
13
|
+
import { createHash } from 'node:crypto';
|
|
14
|
+
import { spawnSync } from 'node:child_process';
|
|
15
|
+
import { dirname, join } from 'node:path';
|
|
16
|
+
import { tmpdir } from 'node:os';
|
|
17
|
+
/** Directorio raíz de la caché de checkouts (`<tmp>/m-engines/<url#ref>`). */
|
|
18
|
+
export function gitCacheRoot() {
|
|
19
|
+
return join(tmpdir(), 'm-engines');
|
|
20
|
+
}
|
|
21
|
+
/** `true` cuando `git` está disponible para materializar una fuente git. */
|
|
22
|
+
export function gitAvailable() {
|
|
23
|
+
const probe = spawnSync('git', ['--version'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
|
|
24
|
+
return probe.status === 0;
|
|
25
|
+
}
|
|
26
|
+
/** Parsea `<url>#<ref>`; el `ref` es obligatorio. */
|
|
27
|
+
export function parseFromGit(spec) {
|
|
28
|
+
const hash = spec.lastIndexOf('#');
|
|
29
|
+
if (hash <= 0 || hash === spec.length - 1) {
|
|
30
|
+
throw new Error(`--from-git necesita <url>#<ref>: ${spec}`);
|
|
31
|
+
}
|
|
32
|
+
return { url: spec.slice(0, hash), ref: spec.slice(hash + 1) };
|
|
33
|
+
}
|
|
34
|
+
function runGit(args, cwd) {
|
|
35
|
+
const result = spawnSync('git', args, {
|
|
36
|
+
cwd,
|
|
37
|
+
encoding: 'utf-8',
|
|
38
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
39
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
40
|
+
});
|
|
41
|
+
if (result.status !== 0) {
|
|
42
|
+
throw new Error(`git ${args.join(' ')} falló: ${(result.stderr ?? '').toString().trim()}`);
|
|
43
|
+
}
|
|
44
|
+
return result.stdout ?? '';
|
|
45
|
+
}
|
|
46
|
+
/** Carpeta de checkout (en caché) para un `url#ref`. */
|
|
47
|
+
export function gitCheckoutDir(origin, cacheRoot = gitCacheRoot()) {
|
|
48
|
+
const key = createHash('sha256').update(`${origin.url}#${origin.ref}`).digest('hex').slice(0, 16);
|
|
49
|
+
return join(cacheRoot, key);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Materializa (clona + `checkout <ref>`) el repositorio y devuelve la raíz del
|
|
53
|
+
* checkout. Es idempotente: un checkout ya presente se reutiliza.
|
|
54
|
+
*/
|
|
55
|
+
export function materializeGit(origin, cacheRoot = gitCacheRoot()) {
|
|
56
|
+
if (!gitAvailable())
|
|
57
|
+
throw new Error('`git` no está disponible para --from-git');
|
|
58
|
+
const dir = gitCheckoutDir(origin, cacheRoot);
|
|
59
|
+
if (existsSync(join(dir, '.git')))
|
|
60
|
+
return dir;
|
|
61
|
+
mkdirSync(dirname(dir), { recursive: true });
|
|
62
|
+
runGit(['clone', '--quiet', origin.url, dir]);
|
|
63
|
+
runGit(['checkout', '--quiet', origin.ref], dir);
|
|
64
|
+
return dir;
|
|
65
|
+
}
|
|
66
|
+
/** Carpeta del motor dentro de un checkout (`<checkout>` o `<checkout>/<path>`). */
|
|
67
|
+
export function motorInCheckout(origin, cacheRoot = gitCacheRoot()) {
|
|
68
|
+
const root = materializeGit(origin, cacheRoot);
|
|
69
|
+
return origin.path ? join(root, origin.path) : root;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/compose/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIhC,8EAA8E;AAC9E,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,WAAW,CAAC,CAAA;AACpC,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC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,IAAI,CAAA;AACrD,CAAC"}
|
package/dist/compose/index.d.ts
CHANGED
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
9
9
|
*/
|
|
10
10
|
export type { Intention, Derived, DerivedModel, DerivedViews, EngineManifest, EngineMount, EngineRef, Finding, FindingCode, SyncResult, VerifyResult, } from './manifest.js';
|
|
11
|
-
export { deriveFrom, deriveTables, deriveMigrations, deriveContracts, deriveViews, deriveCommands, structureTables, renderGenerated, readGenerated, GENERATED_FILENAME, GENERATED_RELATIVE, GENERATED_HEADER, } from './derive.js';
|
|
11
|
+
export { deriveFrom, deriveTables, deriveColumns, deriveMigrations, deriveContracts, deriveViews, deriveCommands, structureTables, structureColumns, renderGenerated, readGenerated, GENERATED_FILENAME, GENERATED_RELATIVE, GENERATED_HEADER, } from './derive.js';
|
|
12
12
|
export { discoverEngines, readEngineManifest, readIntention, readPackageJson, engineClosure, } from './discover.js';
|
|
13
13
|
export { sync } from './sync.js';
|
|
14
14
|
export { verify } from './verify.js';
|
|
15
|
-
export { vendor, unvendor, drift, readProvenance, structureSha, type Provenance, type DriftFinding, type DriftCode, } from './vendor.js';
|
|
15
|
+
export { vendor, unvendor, drift, readProvenance, structureSha, type Provenance, type DriftFinding, type DriftCode, type DriftReason, type GitOrigin, } from './vendor.js';
|
|
16
|
+
export { parseFromGit, materializeGit, motorInCheckout, gitCheckoutDir, gitAvailable, gitCacheRoot, } from './git.js';
|
|
17
|
+
export { motorMigrationDir, motorMigrationFiles, planMigrationCopy, motorSeedFile, type MigrationPlan, } from './data.js';
|
|
16
18
|
export { tablesUsed, declaredUsage, usageReport, projectSources, type DeclaredUsage, type UsageReport, } from './usage.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compose/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,SAAS,EACT,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EACrD,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compose/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,SAAS,EACT,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EACrD,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,GACrF,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,GAC1F,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EACxE,KAAK,aAAa,GACnB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EACtD,KAAK,aAAa,EAAE,KAAK,WAAW,GACrC,MAAM,YAAY,CAAA"}
|
package/dist/compose/index.js
CHANGED
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
|
|
9
9
|
*/
|
|
10
|
-
export { deriveFrom, deriveTables, deriveMigrations, deriveContracts, deriveViews, deriveCommands, structureTables, renderGenerated, readGenerated, GENERATED_FILENAME, GENERATED_RELATIVE, GENERATED_HEADER, } from './derive.js';
|
|
10
|
+
export { deriveFrom, deriveTables, deriveColumns, deriveMigrations, deriveContracts, deriveViews, deriveCommands, structureTables, structureColumns, renderGenerated, readGenerated, GENERATED_FILENAME, GENERATED_RELATIVE, GENERATED_HEADER, } from './derive.js';
|
|
11
11
|
export { discoverEngines, readEngineManifest, readIntention, readPackageJson, engineClosure, } from './discover.js';
|
|
12
12
|
export { sync } from './sync.js';
|
|
13
13
|
export { verify } from './verify.js';
|
|
14
14
|
export { vendor, unvendor, drift, readProvenance, structureSha, } from './vendor.js';
|
|
15
|
+
export { parseFromGit, materializeGit, motorInCheckout, gitCheckoutDir, gitAvailable, gitCacheRoot, } from './git.js';
|
|
16
|
+
export { motorMigrationDir, motorMigrationFiles, planMigrationCopy, motorSeedFile, } from './data.js';
|
|
15
17
|
export { tablesUsed, declaredUsage, usageReport, projectSources, } from './usage.js';
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compose/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,GAEtD,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,GAEvD,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compose/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,GAEtD,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,GAC1F,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,GAEzE,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,GAEvD,MAAM,YAAY,CAAA"}
|
|
@@ -69,12 +69,13 @@ export interface EngineManifest extends Intention, Derived {
|
|
|
69
69
|
dir: string;
|
|
70
70
|
}
|
|
71
71
|
/** Grado de un hallazgo de verificación (análogo a los grados D6 de conformidad). */
|
|
72
|
-
export type FindingCode = 'GENERATED_MISSING' | 'GENERATED_STALE' | 'MISSING_ENGINE' | 'UNKNOWN_TABLE' | 'BROKEN_REFERENCE';
|
|
72
|
+
export type FindingCode = 'GENERATED_MISSING' | 'GENERATED_STALE' | 'MISSING_ENGINE' | 'UNKNOWN_TABLE' | 'UNKNOWN_COLUMN' | 'BROKEN_REFERENCE';
|
|
73
73
|
export interface Finding {
|
|
74
74
|
code: FindingCode;
|
|
75
75
|
message: string;
|
|
76
76
|
motor?: string;
|
|
77
77
|
table?: string;
|
|
78
|
+
column?: string;
|
|
78
79
|
}
|
|
79
80
|
/** Resultado de `eng:sync`. */
|
|
80
81
|
export interface SyncResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/compose/manifest.ts"],"names":[],"mappings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MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,YAAY,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED,2EAA2E;AAC3E,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,OAAO;IACxD,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,qFAAqF;AACrF,MAAM,MAAM,WAAW,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,kBAAkB,CAAA;AAEtB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB"}
|
package/dist/compose/vendor.d.ts
CHANGED
|
@@ -10,8 +10,23 @@ import { type PackageJson } from './discover.js';
|
|
|
10
10
|
export interface Provenance {
|
|
11
11
|
motor: string;
|
|
12
12
|
version: string;
|
|
13
|
+
/** Ruta local del motor (`kind: 'local'`), o `<url>#<ref>` cuando viene de git. */
|
|
13
14
|
source: string;
|
|
14
15
|
sha256: string;
|
|
16
|
+
/** De dónde se tomó el motor. Por defecto `local`. */
|
|
17
|
+
kind?: 'local' | 'git';
|
|
18
|
+
/** URL del repositorio cuando `kind: 'git'`. */
|
|
19
|
+
origin?: string;
|
|
20
|
+
/** Ref (rama, tag o commit) cuando `kind: 'git'`. */
|
|
21
|
+
ref?: string;
|
|
22
|
+
/** Subdirectorio del motor dentro del repositorio, cuando aplica. */
|
|
23
|
+
path?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Origen git de un motor, para dejar la procedencia trazable (`--from-git`). */
|
|
26
|
+
export interface GitOrigin {
|
|
27
|
+
url: string;
|
|
28
|
+
ref: string;
|
|
29
|
+
path?: string;
|
|
15
30
|
}
|
|
16
31
|
/** `sha256` del esquema de referencia del motor (`db/structure.sql`), o `null`. */
|
|
17
32
|
export declare function structureSha(dir: string): string | null;
|
|
@@ -30,16 +45,24 @@ export declare function vendoredPackageJson(motorDir: string, pkg: PackageJson |
|
|
|
30
45
|
*/
|
|
31
46
|
export declare function resolveOrigin(from: string | null, motorName: string, provenanceSource?: string): string | null;
|
|
32
47
|
/** Copia un motor a `outDir` con procedencia. Regenera: borra `outDir` primero. */
|
|
33
|
-
export declare function vendor(motorDir: string, outDir: string): Provenance;
|
|
48
|
+
export declare function vendor(motorDir: string, outDir: string, gitOrigin?: GitOrigin): Provenance;
|
|
34
49
|
/** Lee la procedencia de una copia vendorizada, o `null`. */
|
|
35
50
|
export declare function readProvenance(outDir: string): Provenance | null;
|
|
36
51
|
/** Quita una copia vendorizada. Devuelve `true` si existía. */
|
|
37
52
|
export declare function unvendor(outDir: string): boolean;
|
|
38
53
|
export type DriftCode = 'ok' | 'drift' | 'absent';
|
|
54
|
+
/** Qué cambió respecto de la procedencia: el esquema (`sha256`) o la versión del motor. */
|
|
55
|
+
export type DriftReason = 'schema' | 'version';
|
|
39
56
|
export interface DriftFinding {
|
|
40
57
|
code: DriftCode;
|
|
41
58
|
message: string;
|
|
59
|
+
reason?: DriftReason;
|
|
42
60
|
}
|
|
43
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Mide el drift de una copia vendorizada contra el motor original: primero el
|
|
63
|
+
* esquema (`sha256` de `db/structure.sql`) y después la **versión** del motor
|
|
64
|
+
* ([REQ/40](https://gitlab.com/pasosdeJesus/m/-/work_items/40) D5). Así un cambio de versión sin cambio de
|
|
65
|
+
* esquema también marca drift.
|
|
66
|
+
*/
|
|
44
67
|
export declare function drift(outDir: string, originalDir: string): DriftFinding;
|
|
45
68
|
//# sourceMappingURL=vendor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendor.d.ts","sourceRoot":"","sources":["../../src/compose/vendor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAKhF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"vendor.d.ts","sourceRoot":"","sources":["../../src/compose/vendor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAKhF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IACtB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM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