@jantstack/adonis-authz 2.4.0-alpha.3 → 2.4.0-alpha.5
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 +92 -3
- package/build/commands/authz_reconcile.d.ts +5 -3
- package/build/commands/authz_reconcile.d.ts.map +1 -1
- package/build/commands/authz_reconcile.js +15 -3
- package/build/commands/authz_reconcile.js.map +1 -1
- package/build/commands/authz_scopes_relay.d.ts +18 -0
- package/build/commands/authz_scopes_relay.d.ts.map +1 -1
- package/build/commands/authz_scopes_relay.js +55 -7
- package/build/commands/authz_scopes_relay.js.map +1 -1
- package/build/commands/authz_scopes_requeue.d.ts +63 -0
- package/build/commands/authz_scopes_requeue.d.ts.map +1 -0
- package/build/commands/authz_scopes_requeue.js +154 -0
- package/build/commands/authz_scopes_requeue.js.map +1 -0
- package/build/commands/main.d.ts +16 -13
- package/build/commands/main.d.ts.map +1 -1
- package/build/commands/main.js +59 -11
- package/build/commands/main.js.map +1 -1
- package/build/commands/openfga_provision.d.ts +49 -3
- package/build/commands/openfga_provision.d.ts.map +1 -1
- package/build/commands/openfga_provision.js +72 -7
- package/build/commands/openfga_provision.js.map +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/src/define_config.d.ts +24 -0
- package/build/src/define_config.d.ts.map +1 -1
- package/build/src/define_config.js.map +1 -1
- package/build/src/drivers/openfga_driver.d.ts +4 -2
- package/build/src/drivers/openfga_driver.d.ts.map +1 -1
- package/build/src/drivers/openfga_driver.js +38 -5
- package/build/src/drivers/openfga_driver.js.map +1 -1
- package/build/src/errors.d.ts +30 -0
- package/build/src/errors.d.ts.map +1 -1
- package/build/src/errors.js +32 -0
- package/build/src/errors.js.map +1 -1
- package/build/src/manager.d.ts +106 -5
- package/build/src/manager.d.ts.map +1 -1
- package/build/src/manager.js +425 -26
- package/build/src/manager.js.map +1 -1
- package/build/src/relations/manager.d.ts +13 -1
- package/build/src/relations/manager.d.ts.map +1 -1
- package/build/src/relations/manager.js +15 -1
- package/build/src/relations/manager.js.map +1 -1
- package/build/src/scope_outbox.d.ts +21 -0
- package/build/src/scope_outbox.d.ts.map +1 -1
- package/build/src/scope_outbox.js +211 -24
- package/build/src/scope_outbox.js.map +1 -1
- package/build/src/sql_descendants.d.ts +8 -0
- package/build/src/sql_descendants.d.ts.map +1 -1
- package/build/src/sql_descendants.js.map +1 -1
- package/build/src/testing/contract.d.ts.map +1 -1
- package/build/src/testing/contract.js +4 -1
- package/build/src/testing/contract.js.map +1 -1
- package/build/src/testing/main.d.ts +2 -0
- package/build/src/testing/main.d.ts.map +1 -1
- package/build/src/testing/main.js +1 -0
- package/build/src/testing/main.js.map +1 -1
- package/build/src/testing/scope_outbox_contract.d.ts +88 -0
- package/build/src/testing/scope_outbox_contract.d.ts.map +1 -0
- package/build/src/testing/scope_outbox_contract.js +607 -0
- package/build/src/testing/scope_outbox_contract.js.map +1 -0
- package/build/src/types.d.ts +255 -18
- package/build/src/types.d.ts.map +1 -1
- package/build/src/types.js +51 -0
- package/build/src/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { BaseCommand, flags } from '@adonisjs/core/ace';
|
|
11
|
+
/** Una entrada de la cola, en una línea (misma forma que en `authz:scopes:relay`). */
|
|
12
|
+
function linea(item) {
|
|
13
|
+
const { change } = item;
|
|
14
|
+
const scope = (s) => `${s.type}:${s.uuid ?? ''}`;
|
|
15
|
+
const destino = change.op === 'detached' ? '' : ` → ${scope(change.parent)}`;
|
|
16
|
+
const intentos = item.attempts ? ` (intentos: ${item.attempts})` : '';
|
|
17
|
+
const causa = item.lastError ? ` — ${item.lastError}` : '';
|
|
18
|
+
return `#${item.id} ${change.op} ${scope(change.child)}${destino}${intentos}${causa}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Las líneas del comando y si la ejecución es «limpia», en una función PURA
|
|
22
|
+
* (mismo patrón que `reconcileLines`/`orphanLines`): es lo único del comando
|
|
23
|
+
* que decide algo, y así tiene su caso sin montar un ace.
|
|
24
|
+
*
|
|
25
|
+
* - `refused`: el manager se NEGÓ (500 `E_AUTHZ_REQUEUE_REFUSED`). Se imprime
|
|
26
|
+
* el DIFF entero —cada aparcada y cada entrada APLICADA posterior que
|
|
27
|
+
* reaplicarla revertiría— y se sale ≠ 0, con las dos salidas: `--force`
|
|
28
|
+
* (que entra igual, con este mismo diff delante) y `authz:reconcile`.
|
|
29
|
+
* - `report`: se reencoló. Con `forced` y `overrides`, el diff se imprime
|
|
30
|
+
* como AVISO: forzar no es un éxito mudo.
|
|
31
|
+
*/
|
|
32
|
+
export function requeueLines(input) {
|
|
33
|
+
const lines = [];
|
|
34
|
+
const diff = (level, conflict) => {
|
|
35
|
+
lines.push({
|
|
36
|
+
level,
|
|
37
|
+
message: `${level === 'error' ? 'NEGADO' : 'FORZADO'}: ${linea(conflict.parked)} está APARCADA y hay ` +
|
|
38
|
+
`${conflict.applied.length} entrada(s) APLICADA(s) después sobre la misma clave de scope. Reencolarla las REVERTIRÍA ` +
|
|
39
|
+
`(el store quedaría con un árbol que nunca existió, y con UN solo padre nada lo delata):`,
|
|
40
|
+
});
|
|
41
|
+
for (const applied of conflict.applied)
|
|
42
|
+
lines.push({ level, message: ` revertiría ${linea(applied)}` });
|
|
43
|
+
if (conflict.truncated) {
|
|
44
|
+
lines.push({
|
|
45
|
+
level,
|
|
46
|
+
message: ` … y más: solo se listan las primeras ${conflict.applied.length} aplicadas posteriores sobre esa clave; el diff está CORTADO.`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
if (input.refused !== undefined) {
|
|
51
|
+
for (const conflict of input.refused)
|
|
52
|
+
diff('error', conflict);
|
|
53
|
+
lines.push({
|
|
54
|
+
level: 'warning',
|
|
55
|
+
message: 'No se ha reencolado NADA (todo o nada). Para recalcular el store con el árbol de HOY: ' +
|
|
56
|
+
'node ace authz:reconcile --to=<driver>. Si de verdad quieres revertir esas entradas, repite con --force: ' +
|
|
57
|
+
'imprime este mismo diff y entra igual.',
|
|
58
|
+
});
|
|
59
|
+
return { lines, clean: false };
|
|
60
|
+
}
|
|
61
|
+
const report = input.report;
|
|
62
|
+
if (report.forced)
|
|
63
|
+
for (const conflict of report.overrides)
|
|
64
|
+
diff('warning', conflict);
|
|
65
|
+
for (const item of report.requeued)
|
|
66
|
+
lines.push({ level: 'log', message: `reencolada: ${linea(item)}` });
|
|
67
|
+
lines.push({
|
|
68
|
+
level: 'success',
|
|
69
|
+
message: `${report.requeued.length} entrada(s) devuelta(s) a la cola con attempts = maxAttempts − 1: si la causa sigue rota ` +
|
|
70
|
+
'vuelve(n) a aparcarse en UNA pasada; si la arreglaste, entra(n) a la primera. Corre node ace authz:scopes:relay.',
|
|
71
|
+
});
|
|
72
|
+
return { lines, clean: true };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* **Devuelve entradas APARCADAS de la outbox a la cola** (2.4.0-alpha.5 · R2b;
|
|
76
|
+
* panel relay, cuestión 2).
|
|
77
|
+
*
|
|
78
|
+
* node ace authz:scopes:requeue --id=12 # una
|
|
79
|
+
* node ace authz:scopes:requeue --id=12,13 # varias (o --id repetido)
|
|
80
|
+
* node ace authz:scopes:requeue --id=12 --force # aunque revierta lo aplicado después (diff impreso)
|
|
81
|
+
*
|
|
82
|
+
* Una entrada aparcada (`sqlScopeOutbox({ maxAttempts })`, 5 por defecto)
|
|
83
|
+
* no se reintenta sola: el relay la reporta en cada pasada y sale ≠ 0. Cuando
|
|
84
|
+
* el operador arregla la causa —el padre que faltaba vuelve, el store se
|
|
85
|
+
* reconcilia— este comando la devuelve a `pending()` con **`attempts =
|
|
86
|
+
* maxAttempts − 1`**: entra a la primera si está arreglada y vuelve a
|
|
87
|
+
* aparcarse en UNA sola pasada si no (así un requeue automatizado de lo
|
|
88
|
+
* irreparable no es un grifo de aplazamiento para el resto del scope).
|
|
89
|
+
*
|
|
90
|
+
* **La sonda anti-reversión es del manager y no tiene excepción**: si después
|
|
91
|
+
* de la aparcada se APLICÓ otra entrada sobre la misma clave de scope,
|
|
92
|
+
* reencolarla reaplicaría el cambio viejo por encima del nuevo —un `moved`
|
|
93
|
+
* viejo tras el nuevo deja el store con el padre VIEJO y un solo padre—. El
|
|
94
|
+
* comando imprime ese diff y sale ≠ 0. **`--force` existe SOLO aquí**
|
|
95
|
+
* (decisión del dueño del 2026-09-09 (2)): imprime el diff y entra igual. Nunca
|
|
96
|
+
* en una ruta alcanzable por HTTP.
|
|
97
|
+
*
|
|
98
|
+
* Es una operación de PLATAFORMA (como `authz:scopes:relay`): sin actor, sin
|
|
99
|
+
* `within`, y no se expone por HTTP.
|
|
100
|
+
*/
|
|
101
|
+
export default class AuthzScopesRequeue extends BaseCommand {
|
|
102
|
+
static commandName = 'authz:scopes:requeue';
|
|
103
|
+
static description = 'Return parked scope-tree outbox entries to the queue (refuses to revert later applied changes unless --force)';
|
|
104
|
+
static options = {
|
|
105
|
+
startApp: true,
|
|
106
|
+
};
|
|
107
|
+
/** `--id=12,13` o `--id=12 --id=13`: ids numéricos como número, el resto como cadena. */
|
|
108
|
+
static parseIds(values) {
|
|
109
|
+
if (values === undefined)
|
|
110
|
+
return undefined;
|
|
111
|
+
return values
|
|
112
|
+
.flatMap((value) => String(value).split(','))
|
|
113
|
+
.map((value) => value.trim())
|
|
114
|
+
.filter((value) => value.length > 0)
|
|
115
|
+
.map((value) => (/^\d+$/.test(value) ? Number(value) : value));
|
|
116
|
+
}
|
|
117
|
+
async run() {
|
|
118
|
+
const ids = AuthzScopesRequeue.parseIds(this.id);
|
|
119
|
+
if (ids === undefined || ids.length === 0) {
|
|
120
|
+
this.logger.error('Falta --id: di QUÉ entradas aparcadas reencolar (las que reporta authz:scopes:relay). Sin ids no se reencola nada.');
|
|
121
|
+
this.exitCode = 1;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const { default: authorization } = await import('../services/main.js');
|
|
125
|
+
let result;
|
|
126
|
+
try {
|
|
127
|
+
const report = await authorization.requeueScopeChanges(ids, { force: this.force === true });
|
|
128
|
+
result = requeueLines({ report });
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error?.code !== 'E_AUTHZ_REQUEUE_REFUSED')
|
|
132
|
+
throw error;
|
|
133
|
+
result = requeueLines({ refused: error.conflicts });
|
|
134
|
+
}
|
|
135
|
+
for (const line of result.lines)
|
|
136
|
+
this.logger[line.level](line.message);
|
|
137
|
+
if (!result.clean)
|
|
138
|
+
this.exitCode = 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
__decorate([
|
|
142
|
+
flags.array({
|
|
143
|
+
name: 'id',
|
|
144
|
+
description: 'Outbox ids to requeue (the parked entries the relay reports), comma-separated or repeated',
|
|
145
|
+
}),
|
|
146
|
+
__metadata("design:type", Object)
|
|
147
|
+
], AuthzScopesRequeue.prototype, "id", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
flags.boolean({
|
|
150
|
+
description: 'Requeue even if a later APPLIED entry shares a scope key (the diff is printed; the store WILL be reverted)',
|
|
151
|
+
}),
|
|
152
|
+
__metadata("design:type", Object)
|
|
153
|
+
], AuthzScopesRequeue.prototype, "force", void 0);
|
|
154
|
+
//# sourceMappingURL=authz_scopes_requeue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz_scopes_requeue.js","sourceRoot":"","sources":["../../commands/authz_scopes_requeue.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAIvD,sFAAsF;AACtF,SAAS,KAAK,CAAC,IAA4B;IACzC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACvB,MAAM,KAAK,GAAG,CAAC,CAAyC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,CAAA;IACxF,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;IAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACrE,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1D,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,EAAE,CAAA;AACvF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwE;IAInG,MAAM,KAAK,GAA+E,EAAE,CAAA;IAC5F,MAAM,IAAI,GAAG,CAAC,KAA0B,EAAE,QAA8B,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.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
1
|
+
import type { CommandMetaData } from '@adonisjs/core/types/ace';
|
|
2
|
+
import OpenFgaProvision from './openfga_provision.js';
|
|
3
|
+
import AuthzCatalogDiff from './authz_catalog_diff.js';
|
|
4
|
+
import AuthzCatalogSync from './authz_catalog_sync.js';
|
|
5
|
+
import AuthzCatalogPruneOrphans from './authz_catalog_prune_orphans.js';
|
|
6
|
+
import AuthzScopesRelay from './authz_scopes_relay.js';
|
|
7
|
+
import AuthzScopesRequeue from './authz_scopes_requeue.js';
|
|
8
|
+
import AuthzReconcile from './authz_reconcile.js';
|
|
9
|
+
import AuthzRelationsReconcile from './authz_relations_reconcile.js';
|
|
10
|
+
import AuthzFreeze from './authz_freeze.js';
|
|
11
|
+
import AuthzUnfreeze from './authz_unfreeze.js';
|
|
12
|
+
export { OpenFgaProvision, AuthzCatalogDiff, AuthzCatalogSync, AuthzCatalogPruneOrphans, AuthzScopesRelay, AuthzScopesRequeue, AuthzReconcile, AuthzRelationsReconcile, AuthzFreeze, AuthzUnfreeze, };
|
|
13
|
+
/** Contrato de loader de ace (`LoadersContract.getMetaData`). */
|
|
14
|
+
export declare function getMetaData(): Promise<CommandMetaData[]>;
|
|
15
|
+
/** Contrato de loader de ace (`LoadersContract.getCommand`): la clase, o `null` si el nombre no es nuestro. */
|
|
16
|
+
export declare function getCommand(metaData: CommandMetaData): Promise<any>;
|
|
14
17
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,gBAAgB,MAAM,yBAAyB,CAAA;AACtD,OAAO,gBAAgB,MAAM,yBAAyB,CAAA;AACtD,OAAO,wBAAwB,MAAM,kCAAkC,CAAA;AACvE,OAAO,gBAAgB,MAAM,yBAAyB,CAAA;AACtD,OAAO,kBAAkB,MAAM,2BAA2B,CAAA;AAC1D,OAAO,cAAc,MAAM,sBAAsB,CAAA;AACjD,OAAO,uBAAuB,MAAM,gCAAgC,CAAA;AACpE,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAC3C,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,aAAa,GACd,CAAA;AAgBD,iEAAiE;AACjE,wBAAgB,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAExD;AAED,+GAA+G;AAC/G,wBAAgB,UAAU,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAElE"}
|
package/build/commands/main.js
CHANGED
|
@@ -1,14 +1,62 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* **El loader de ace de los comandos del paquete** (2.4.0-alpha.4). Se
|
|
3
|
+
* registra con `node ace configure @jantstack/adonis-authz`, que escribe en el
|
|
4
|
+
* `adonisrc.ts` del consumidor:
|
|
5
|
+
*
|
|
6
|
+
* commands: [() => import('@jantstack/adonis-authz/commands')]
|
|
7
|
+
*
|
|
8
|
+
* y ace trata **el módulo importado como el loader**: `Kernel.boot()` llama
|
|
9
|
+
* `getMetaData()` y `getCommand(meta)` sobre el namespace del módulo, sin
|
|
10
|
+
* desenvolver `default` (mismo contrato que `@adonisjs/core/commands` y
|
|
11
|
+
* `@adonisjs/lucid/commands`, que leen un `commands.json` generado por el
|
|
12
|
+
* assembler; aquí no hay assembler, así que el loader es un `ListLoader`
|
|
13
|
+
* sobre las diez clases (nueve hasta alpha.4) y no hay índice que generar).
|
|
14
|
+
*
|
|
15
|
+
* Hasta alpha.3 este fichero re-exportaba las nueve clases y NADA más, de
|
|
16
|
+
* modo que en un consumidor configurado con `node ace configure` **`node ace`
|
|
17
|
+
* entero reventaba** al arrancar (`TypeError: loaderInstance.getMetaData is
|
|
18
|
+
* not a function`), no solo `openfga:provision`. Ningún caso lo vio porque
|
|
19
|
+
* ninguno registraba el barrel como lo registra `createAceKernel`
|
|
20
|
+
* (`tests/commands.spec.ts` · C-1 lo hace desde alpha.4).
|
|
21
|
+
*
|
|
22
|
+
* Las re-exportaciones con nombre se MANTIENEN (quien importe una clase
|
|
23
|
+
* suelta sigue funcionando). Lo que NO vale desde alpha.4 es envolver el
|
|
24
|
+
* módulo en un `ListLoader(Object.values(m))`: `Object.values` incluye ahora
|
|
25
|
+
* las dos funciones y `ListLoader.getMetaData()` llama `serialize()` sobre
|
|
26
|
+
* cada valor. Se registra el módulo directamente, como escribe `configure`.
|
|
27
|
+
* Y NO se exporta `default`: ace no lo cargaría.
|
|
4
28
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
29
|
+
import { ListLoader } from '@adonisjs/core/ace';
|
|
30
|
+
import OpenFgaProvision from './openfga_provision.js';
|
|
31
|
+
import AuthzCatalogDiff from './authz_catalog_diff.js';
|
|
32
|
+
import AuthzCatalogSync from './authz_catalog_sync.js';
|
|
33
|
+
import AuthzCatalogPruneOrphans from './authz_catalog_prune_orphans.js';
|
|
34
|
+
import AuthzScopesRelay from './authz_scopes_relay.js';
|
|
35
|
+
import AuthzScopesRequeue from './authz_scopes_requeue.js';
|
|
36
|
+
import AuthzReconcile from './authz_reconcile.js';
|
|
37
|
+
import AuthzRelationsReconcile from './authz_relations_reconcile.js';
|
|
38
|
+
import AuthzFreeze from './authz_freeze.js';
|
|
39
|
+
import AuthzUnfreeze from './authz_unfreeze.js';
|
|
40
|
+
export { OpenFgaProvision, AuthzCatalogDiff, AuthzCatalogSync, AuthzCatalogPruneOrphans, AuthzScopesRelay, AuthzScopesRequeue, AuthzReconcile, AuthzRelationsReconcile, AuthzFreeze, AuthzUnfreeze, };
|
|
41
|
+
/** Los diez (nueve hasta alpha.4; `authz:scopes:requeue` desde alpha.5), en el orden en que `node ace list` los enseña. */
|
|
42
|
+
const loader = new ListLoader([
|
|
43
|
+
OpenFgaProvision,
|
|
44
|
+
AuthzCatalogDiff,
|
|
45
|
+
AuthzCatalogSync,
|
|
46
|
+
AuthzCatalogPruneOrphans,
|
|
47
|
+
AuthzScopesRelay,
|
|
48
|
+
AuthzScopesRequeue,
|
|
49
|
+
AuthzReconcile,
|
|
50
|
+
AuthzRelationsReconcile,
|
|
51
|
+
AuthzFreeze,
|
|
52
|
+
AuthzUnfreeze,
|
|
53
|
+
]);
|
|
54
|
+
/** Contrato de loader de ace (`LoadersContract.getMetaData`). */
|
|
55
|
+
export function getMetaData() {
|
|
56
|
+
return loader.getMetaData();
|
|
57
|
+
}
|
|
58
|
+
/** Contrato de loader de ace (`LoadersContract.getCommand`): la clase, o `null` si el nombre no es nuestro. */
|
|
59
|
+
export function getCommand(metaData) {
|
|
60
|
+
return loader.getCommand(metaData);
|
|
61
|
+
}
|
|
14
62
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,gBAAgB,MAAM,yBAAyB,CAAA;AACtD,OAAO,gBAAgB,MAAM,yBAAyB,CAAA;AACtD,OAAO,wBAAwB,MAAM,kCAAkC,CAAA;AACvE,OAAO,gBAAgB,MAAM,yBAAyB,CAAA;AACtD,OAAO,kBAAkB,MAAM,2BAA2B,CAAA;AAC1D,OAAO,cAAc,MAAM,sBAAsB,CAAA;AACjD,OAAO,uBAAuB,MAAM,gCAAgC,CAAA;AACpE,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAC3C,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,aAAa,GACd,CAAA;AAED,2HAA2H;AAC3H,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC;IAC5B,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,wBAAwB;IACxB,gBAAgB;IAChB,kBAAkB;IAClB,cAAc;IACd,uBAAuB;IACvB,WAAW;IACX,aAAa;CACP,CAAC,CAAA;AAET,iEAAiE;AACjE,MAAM,UAAU,WAAW;IACzB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAA;AAC7B,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,UAAU,CAAC,QAAyB;IAClD,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -27,10 +27,54 @@ import { CommandOptions } from '@adonisjs/core/types/ace';
|
|
|
27
27
|
export default class OpenFgaProvision extends BaseCommand {
|
|
28
28
|
static commandName: string;
|
|
29
29
|
static description: string;
|
|
30
|
+
/**
|
|
31
|
+
* **Bootstrap sin base: `startApp: false`, y el comando BOOTEA la app por su
|
|
32
|
+
* cuenta hasta `boot()`** (2.4.0-alpha.4, opción B del panel; el único de
|
|
33
|
+
* los nueve con `startApp: false`, a propósito).
|
|
34
|
+
*
|
|
35
|
+
* `this.app.config` NO existe hasta `app.boot()`: `Application.init()` no
|
|
36
|
+
* llama a `ConfigManager.process()`, `boot()` sí (`@adonisjs/application`
|
|
37
|
+
* 9.0.1; el docblock de `get config()` dice «after init» y es falso). Y el
|
|
38
|
+
* ignitor de ace solo hace `boot()`+`start()` con `startApp: true`. Hasta
|
|
39
|
+
* alpha.3 esto leía `this.app.config.get(...)` sobre `undefined`:
|
|
40
|
+
* `TypeError` en la primera línea de `run()`, en cualquier consumidor.
|
|
41
|
+
*
|
|
42
|
+
* Por qué NO `startApp: true` (opción A, la que recomendaba COGNITIV):
|
|
43
|
+
* `start()` ejecuta el `start()`/`ready()` de TODOS los providers del
|
|
44
|
+
* consumidor y sus preloads (`start/routes.ts`, `start/kernel.ts`…) —
|
|
45
|
+
* medido: un `ready()` que consulta la base mata este comando antes de
|
|
46
|
+
* `run()` con la base ausente, que es exactamente el escenario en el que
|
|
47
|
+
* corre; un preload que importe `services/relations` construye el driver
|
|
48
|
+
* de relaciones, que pide el `OPENFGA_STORE_ID` que este comando existe
|
|
49
|
+
* para producir (circular); y `app_provider.ready()` exige
|
|
50
|
+
* `config/encryption.ts` válido. Lo que este comando necesita es SOLO el
|
|
51
|
+
* config, y eso lo da `boot()` (≈80 ms: `config/*` + `register()`/`boot()`
|
|
52
|
+
* de los providers). Ver `prepare()`.
|
|
53
|
+
*/
|
|
30
54
|
static options: CommandOptions;
|
|
31
55
|
url: string | undefined;
|
|
32
56
|
storeId: string | undefined;
|
|
33
57
|
name: string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Arranca la app hasta `boot()` — sin `start()` — para que `config/*`
|
|
60
|
+
* exista. Va en `prepare()` y no en `run()` porque `BaseCommand.exec()`
|
|
61
|
+
* encadena `prepare()` → `interact()` → `run()` dentro del mismo `try`:
|
|
62
|
+
* el fallo se reporta igual y `run()` queda limpio de ciclo de vida.
|
|
63
|
+
*
|
|
64
|
+
* Las guardas de estado NO son decorativas: `Application.boot()` es un
|
|
65
|
+
* no-op SILENCIOSO si el estado no es `initiated` (⚪ 9 del auditor), así
|
|
66
|
+
* que desde `created` primero `init()`; desde `booted`/`ready` (comando
|
|
67
|
+
* invocado dentro de una app ya arrancada) no se hace nada: idempotente.
|
|
68
|
+
* Y si tras eso `app.config` sigue sin existir, se dice y se sale con 1
|
|
69
|
+
* en vez de repetir el `TypeError` con otro disfraz.
|
|
70
|
+
*
|
|
71
|
+
* **Lo que sí exige, escrito**: «antes de que haya base» sigue siendo
|
|
72
|
+
* verdad (cero conexiones, cero consultas, ningún `start`/`ready`, ningún
|
|
73
|
+
* preload), pero todo `config/*` tiene que poder IMPORTARSE — un
|
|
74
|
+
* `config/database.ts` que lance por un `.env` incompleto rompe esto igual
|
|
75
|
+
* que a cualquier otro comando.
|
|
76
|
+
*/
|
|
77
|
+
prepare(): Promise<void>;
|
|
34
78
|
run(): Promise<void>;
|
|
35
79
|
/**
|
|
36
80
|
* Los permisos del modelo, o `null` (y exit 1) si no hay ninguno: un modelo
|
|
@@ -59,9 +103,11 @@ export declare function permissionsOfCatalogs(config: any): Promise<string[]>;
|
|
|
59
103
|
* pieza que decide si un store recién aprovisionado acepta tuplas de relación.
|
|
60
104
|
*
|
|
61
105
|
* La fuente es el config (`relations.config`), NO `authz_relations_config` de
|
|
62
|
-
* la base: `openfga:provision` es
|
|
63
|
-
*
|
|
64
|
-
* `
|
|
106
|
+
* la base: `openfga:provision` es bootstrap sin base (`startApp: false`;
|
|
107
|
+
* arranca hasta `boot()` para cargar `config/*`, que tiene que poder
|
|
108
|
+
* importarse; no ejecuta `start`/`ready` ni preloads) y el config es lo único
|
|
109
|
+
* que tiene cargado — igual que los permisos salen de `catalogs` y no de
|
|
110
|
+
* `authz_permissions`.
|
|
65
111
|
*/
|
|
66
112
|
export declare function relationsConfigOf(config: any): {
|
|
67
113
|
objectTypes: readonly any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openfga_provision.d.ts","sourceRoot":"","sources":["../../commands/openfga_provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,MAAM,CAAC,WAAW,SAAsB;IACxC,MAAM,CAAC,WAAW,SAAoE;IAEtF,MAAM,CAAC,OAAO,EAAE,cAAc,CAE7B;IAGO,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IAGvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAG3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"openfga_provision.d.ts","sourceRoot":"","sources":["../../commands/openfga_provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,MAAM,CAAC,WAAW,SAAsB;IACxC,MAAM,CAAC,WAAW,SAAoE;IAEtF;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,OAAO,EAAE,cAAc,CAE7B;IAGO,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IAGvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAG3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;IACG,OAAO;IAaP,GAAG;IAkET;;;;OAIG;YACW,kBAAkB;CAajC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,GAAG;IAAE,WAAW,EAAE,SAAS,GAAG,EAAE,CAAA;CAAE,GAAG,SAAS,CAI1F"}
|
|
@@ -35,10 +35,67 @@ import { BaseCommand, flags } from '@adonisjs/core/ace';
|
|
|
35
35
|
export default class OpenFgaProvision extends BaseCommand {
|
|
36
36
|
static commandName = 'openfga:provision';
|
|
37
37
|
static description = 'Create an OpenFGA store + write the chassis authorization model';
|
|
38
|
+
/**
|
|
39
|
+
* **Bootstrap sin base: `startApp: false`, y el comando BOOTEA la app por su
|
|
40
|
+
* cuenta hasta `boot()`** (2.4.0-alpha.4, opción B del panel; el único de
|
|
41
|
+
* los nueve con `startApp: false`, a propósito).
|
|
42
|
+
*
|
|
43
|
+
* `this.app.config` NO existe hasta `app.boot()`: `Application.init()` no
|
|
44
|
+
* llama a `ConfigManager.process()`, `boot()` sí (`@adonisjs/application`
|
|
45
|
+
* 9.0.1; el docblock de `get config()` dice «after init» y es falso). Y el
|
|
46
|
+
* ignitor de ace solo hace `boot()`+`start()` con `startApp: true`. Hasta
|
|
47
|
+
* alpha.3 esto leía `this.app.config.get(...)` sobre `undefined`:
|
|
48
|
+
* `TypeError` en la primera línea de `run()`, en cualquier consumidor.
|
|
49
|
+
*
|
|
50
|
+
* Por qué NO `startApp: true` (opción A, la que recomendaba COGNITIV):
|
|
51
|
+
* `start()` ejecuta el `start()`/`ready()` de TODOS los providers del
|
|
52
|
+
* consumidor y sus preloads (`start/routes.ts`, `start/kernel.ts`…) —
|
|
53
|
+
* medido: un `ready()` que consulta la base mata este comando antes de
|
|
54
|
+
* `run()` con la base ausente, que es exactamente el escenario en el que
|
|
55
|
+
* corre; un preload que importe `services/relations` construye el driver
|
|
56
|
+
* de relaciones, que pide el `OPENFGA_STORE_ID` que este comando existe
|
|
57
|
+
* para producir (circular); y `app_provider.ready()` exige
|
|
58
|
+
* `config/encryption.ts` válido. Lo que este comando necesita es SOLO el
|
|
59
|
+
* config, y eso lo da `boot()` (≈80 ms: `config/*` + `register()`/`boot()`
|
|
60
|
+
* de los providers). Ver `prepare()`.
|
|
61
|
+
*/
|
|
38
62
|
static options = {
|
|
39
63
|
startApp: false,
|
|
40
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Arranca la app hasta `boot()` — sin `start()` — para que `config/*`
|
|
67
|
+
* exista. Va en `prepare()` y no en `run()` porque `BaseCommand.exec()`
|
|
68
|
+
* encadena `prepare()` → `interact()` → `run()` dentro del mismo `try`:
|
|
69
|
+
* el fallo se reporta igual y `run()` queda limpio de ciclo de vida.
|
|
70
|
+
*
|
|
71
|
+
* Las guardas de estado NO son decorativas: `Application.boot()` es un
|
|
72
|
+
* no-op SILENCIOSO si el estado no es `initiated` (⚪ 9 del auditor), así
|
|
73
|
+
* que desde `created` primero `init()`; desde `booted`/`ready` (comando
|
|
74
|
+
* invocado dentro de una app ya arrancada) no se hace nada: idempotente.
|
|
75
|
+
* Y si tras eso `app.config` sigue sin existir, se dice y se sale con 1
|
|
76
|
+
* en vez de repetir el `TypeError` con otro disfraz.
|
|
77
|
+
*
|
|
78
|
+
* **Lo que sí exige, escrito**: «antes de que haya base» sigue siendo
|
|
79
|
+
* verdad (cero conexiones, cero consultas, ningún `start`/`ready`, ningún
|
|
80
|
+
* preload), pero todo `config/*` tiene que poder IMPORTARSE — un
|
|
81
|
+
* `config/database.ts` que lance por un `.env` incompleto rompe esto igual
|
|
82
|
+
* que a cualquier otro comando.
|
|
83
|
+
*/
|
|
84
|
+
async prepare() {
|
|
85
|
+
if (this.app.getState() === 'created')
|
|
86
|
+
await this.app.init();
|
|
87
|
+
if (this.app.getState() === 'initiated')
|
|
88
|
+
await this.app.boot();
|
|
89
|
+
if (!this.app.config) {
|
|
90
|
+
this.logger.error('config/* no está cargado: openfga:provision bootea la app hasta boot() para leer config/authorization.ts ' +
|
|
91
|
+
`y tras hacerlo app.config sigue sin existir (estado de la app: ${this.app.getState()}). ` +
|
|
92
|
+
'Comprueba que la app se puede inicializar y que todo config/* se puede importar.');
|
|
93
|
+
this.exitCode = 1;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
41
96
|
async run() {
|
|
97
|
+
if (this.exitCode === 1)
|
|
98
|
+
return;
|
|
42
99
|
const config = this.app.config.get('authorization');
|
|
43
100
|
const apiUrl = this.url ?? config?.openfga?.url;
|
|
44
101
|
if (!apiUrl) {
|
|
@@ -48,7 +105,7 @@ export default class OpenFgaProvision extends BaseCommand {
|
|
|
48
105
|
}
|
|
49
106
|
const { OpenFgaClient } = await import('@openfga/sdk');
|
|
50
107
|
// El subpath `/openfga` es la única puerta al SDK (D9).
|
|
51
|
-
const { openFgaFactsModel, provisionOpenFgaStore } = await import('../src/openfga.js');
|
|
108
|
+
const { openFgaFactsModel, provisionOpenFgaStore, assertFactsModelPublishable } = await import('../src/openfga.js');
|
|
52
109
|
// Los holders del consumidor viven en SU config, no en el paquete.
|
|
53
110
|
const holderTypes = config?.holderTypes ?? {};
|
|
54
111
|
// Los PERMISOS del modelo (c2r) salen de los catálogos del config. Se
|
|
@@ -60,13 +117,19 @@ export default class OpenFgaProvision extends BaseCommand {
|
|
|
60
117
|
return;
|
|
61
118
|
// Los tipos de RELACIÓN (ReBAC) que el modelo lleva FUSIONADOS (Fase 4-8):
|
|
62
119
|
// salen del CONFIG estático (`relations.config`), igual que los permisos
|
|
63
|
-
// salen de `catalogs`. El comando es
|
|
64
|
-
//
|
|
65
|
-
//
|
|
120
|
+
// salen de `catalogs`. El comando es bootstrap sin base —`startApp: false`,
|
|
121
|
+
// arranca hasta `boot()` para cargar `config/*`, que tiene que poder
|
|
122
|
+
// importarse; no ejecuta `start`/`ready` ni preloads— y no puede leer
|
|
123
|
+
// `authz_relations_config` de la BD; el config sí. Sin `relations.config` el modelo es
|
|
66
124
|
// facts-only, como hasta ahora. Con él, un store recién aprovisionado ya
|
|
67
125
|
// acepta tuplas de relación sin un `authz:catalog:sync` previo.
|
|
68
126
|
const relations = relationsConfigOf(config);
|
|
69
127
|
if (this.storeId) {
|
|
128
|
+
// El mismo gate que la rama que CREA el store (L-F): la rama que
|
|
129
|
+
// ACTUALIZA el modelo es justo donde se toca el techo de bytes, y sin
|
|
130
|
+
// esto salía como error crudo del SDK con una request ya hecha (⚪ N1
|
|
131
|
+
// del auditor de alpha.4). Cero requests si no es publicable.
|
|
132
|
+
assertFactsModelPublishable(holderTypes, permissions, undefined, relations);
|
|
70
133
|
const client = new OpenFgaClient({ apiUrl, storeId: this.storeId });
|
|
71
134
|
const model = await client.writeAuthorizationModel(openFgaFactsModel(holderTypes, permissions, relations));
|
|
72
135
|
this.logger.success('Nuevo authorization model escrito en el store existente.');
|
|
@@ -144,9 +207,11 @@ export async function permissionsOfCatalogs(config) {
|
|
|
144
207
|
* pieza que decide si un store recién aprovisionado acepta tuplas de relación.
|
|
145
208
|
*
|
|
146
209
|
* La fuente es el config (`relations.config`), NO `authz_relations_config` de
|
|
147
|
-
* la base: `openfga:provision` es
|
|
148
|
-
*
|
|
149
|
-
* `
|
|
210
|
+
* la base: `openfga:provision` es bootstrap sin base (`startApp: false`;
|
|
211
|
+
* arranca hasta `boot()` para cargar `config/*`, que tiene que poder
|
|
212
|
+
* importarse; no ejecuta `start`/`ready` ni preloads) y el config es lo único
|
|
213
|
+
* que tiene cargado — igual que los permisos salen de `catalogs` y no de
|
|
214
|
+
* `authz_permissions`.
|
|
150
215
|
*/
|
|
151
216
|
export function relationsConfigOf(config) {
|
|
152
217
|
const objectTypes = config?.relations?.config?.objectTypes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openfga_provision.js","sourceRoot":"","sources":["../../commands/openfga_provision.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAo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,2CAA2C,EAAE,CAAC;;6CAC5C;AAGvB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;;iDACnD;AAG3B;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8DAA8D,EAAE,CAAC;;8CAC9D;AAwHlC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAW;IACrD,MAAM,OAAO,GAAoC,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAA;IACvE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,MAAM,EAAE,CAAA;QAC9B,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE,WAAW,IAAI,EAAE;YAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAW;IAC3C,MAAM,WAAW,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAA;IAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAC7E,OAAO,EAAE,WAAW,EAAE,CAAA;AACxB,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Entrada pública del paquete.
|
|
3
3
|
* import { AuthorizationManager, APP_SCOPE } from '@jantstack/adonis-authz'
|
|
4
4
|
*/
|
|
5
|
-
export { AuthorizationManager, DEFAULT_MAX_SCOPES, DEFAULT_MAX_DESCENDANTS, MAX_SCOPE_BOUND, DEFAULT_VIEW_MAX_AGE_MS, expandExcludedSubtrees } from './src/manager.js';
|
|
5
|
+
export { AuthorizationManager, DEFAULT_MAX_SCOPES, DEFAULT_MAX_DESCENDANTS, MAX_SCOPE_BOUND, DEFAULT_VIEW_MAX_AGE_MS, PARKED_CENSUS_MAX, expandExcludedSubtrees } from './src/manager.js';
|
|
6
6
|
export type { AuthorizationView, ForRequestOptions } from './src/manager.js';
|
|
7
7
|
export { defineConfig } from './src/define_config.js';
|
|
8
8
|
export type { AuthorizationConfig } from './src/define_config.js';
|
|
@@ -50,7 +50,7 @@ export type { SqlScopeOutboxOptions } from './src/scope_outbox.js';
|
|
|
50
50
|
* obligaría a importar ese SDK — acoplando el call-site al backend que este
|
|
51
51
|
* paquete existe para abstraer.
|
|
52
52
|
*/
|
|
53
|
-
export { AuthorizationBackendError, AuthorizationBackendTimeoutError, ScopeResolverError, InvalidIdentityError, InvalidSlugError, AuthorizationConfigError, AuthorizationInternalError, UnknownScopeError, NoScopeResolverError, UnknownRoleError, UnknownPermissionError, CatalogConflictError, RoleIsNotAccessError, ScopeCycleError, PurgeIncompleteError, WriteConflictError, ActorRequiredError, NotWithinError, WithinRequiredError, WithinRootForbiddenError, TooManyScopesError, TooManyLocalRolesError, MassPurgeRefusedError, PruneInterruptedError, UnsupportedDialectError, ScopeTooDeepError, UnsupportedOperationError, NoDescendantsResolverError, ViewExpiredError, RoleNotVisibleError, AmbiguousRoleError, RoleImmutableError, RoleLevelAboveOwnerError, RoleNotAssignableAtError, PermissionNotDelegableError, RankExceededError, ModelTooLargeError, RelationConfigError, RelationTypeUnknownError, RelationUnknownError, ScopeTreeDriftError, ScopeDriftUnguardedError, AuthorizationFrozenError, FreezeHeldError, MassReconcileRefusedError, ReconcileTooLargeError, markPartialWrite, isPartialWrite, } from './src/errors.js';
|
|
53
|
+
export { AuthorizationBackendError, AuthorizationBackendTimeoutError, ScopeResolverError, InvalidIdentityError, InvalidSlugError, AuthorizationConfigError, AuthorizationInternalError, UnknownScopeError, NoScopeResolverError, UnknownRoleError, UnknownPermissionError, CatalogConflictError, RoleIsNotAccessError, ScopeCycleError, PurgeIncompleteError, WriteConflictError, ActorRequiredError, NotWithinError, WithinRequiredError, WithinRootForbiddenError, TooManyScopesError, TooManyLocalRolesError, MassPurgeRefusedError, PruneInterruptedError, UnsupportedDialectError, ScopeTooDeepError, ScopeDepthLimitError, ScopeRequeueRefusedError, UnsupportedOperationError, NoDescendantsResolverError, ViewExpiredError, RoleNotVisibleError, AmbiguousRoleError, RoleImmutableError, RoleLevelAboveOwnerError, RoleNotAssignableAtError, PermissionNotDelegableError, RankExceededError, ModelTooLargeError, RelationConfigError, RelationTypeUnknownError, RelationUnknownError, ScopeTreeDriftError, ScopeDriftUnguardedError, AuthorizationFrozenError, FreezeHeldError, MassReconcileRefusedError, ReconcileTooLargeError, markPartialWrite, isPartialWrite, } from './src/errors.js';
|
|
54
54
|
/**
|
|
55
55
|
* Validación de identidad y de slugs (422). La aplica el manager en cada
|
|
56
56
|
* llamada y los drivers por defensa en profundidad; se exporta para que un
|
|
@@ -84,7 +84,7 @@ export type { DatabaseDriverOptions } from './src/drivers/database_driver.js';
|
|
|
84
84
|
* opcional `@openfga/sdk`. Un consumidor solo-database arranca sin él (D9).
|
|
85
85
|
*/
|
|
86
86
|
export { APP_SCOPE, APP_SCOPE_TYPE, DEFAULT_RECONCILE_MAX_TUPLES } from './src/types.js';
|
|
87
|
-
export type { AuthorizationDriver, AuthorizationDriverFactory, AuthorizedScopes, AuthzWriteEvent, AuthzCatalogWriteEvent, CatalogPermissionSpec, CatalogRole, CatalogRoleSpec, CatalogSpec, ScopedRoleChanges, ScopedRoleSpec, DenyOptions, DenyRef, ExcludedSubtree, GrantOptions, GrantOutcome, HolderTypeMap, ReconcileCounts, ReconcileFact, ReconcileFactPage, ReconcileFactsEnumerator, ReconcileOptions, ReconcileReport, ReconcileSkip, ReconcileSource, RoleQuery, ScopeChainResolver, ScopeDescendantsResolver, ScopeEdge, ScopeEdgePage, ScopeEdgesEnumerator, ScopedWriteOptions, ScopeRef, ScopeType, SubjectRef, WriteOptions, RelationsDriver, RelationsDriverCapabilities, RelObject, RelSubject, RelUserset, RelationRef, RelationWriteEvent, RelationWriteOptions, RelationTransactionOptions, RelationPurgeOptions, RelationPage, RelationObjectsPage, RelationSubjectsPage, RelationTuple, RelationTuplePage, } from './src/types.js';
|
|
87
|
+
export type { AuthorizationDriver, AuthorizationDriverFactory, AuthorizedScopes, AuthzWriteEvent, AuthzCatalogWriteEvent, CatalogPermissionSpec, CatalogRole, CatalogRoleSpec, CatalogSpec, ScopedRoleChanges, ScopedRoleSpec, DenyOptions, DenyRef, ExcludedSubtree, GrantOptions, GrantOutcome, HolderTypeMap, ReconcileCounts, ReconcileFact, ReconcileFactPage, ReconcileFactsEnumerator, ReconcileOptions, ReconcileReport, ReconcileSkip, ReconcileSource, RoleQuery, ScopeChainResolver, ScopeDescendantsResolver, ScopeEdge, ScopeEdgePage, ScopeEdgesEnumerator, ScopedWriteOptions, ScopeRef, ScopeType, SubjectRef, WriteOptions, AuthorizationDriverCapabilities, RelationsDriver, RelationsDriverCapabilities, RelObject, RelSubject, RelUserset, RelationRef, RelationWriteEvent, RelationWriteOptions, RelationTransactionOptions, RelationPurgeOptions, RelationPage, RelationObjectsPage, RelationSubjectsPage, RelationTuple, RelationTuplePage, ScopeOutbox, ScopeOutboxContext, ScopeOutboxLease, ScopeOutboxPendingFilter, ScopeOutboxFailure, ScopeRequeueConflict, ScopeRequeueReport, ScopeTreeChange, PendingScopeTreeChange, RelayedScopeChange, ScopeRelayReport, ScopeRelayFailure, ScopeRelayEntry, ScopeRelayEntryStatus, ScopeEnqueueReceipt, } from './src/types.js';
|
|
88
88
|
export { isRelUserset } from './src/types.js';
|
|
89
89
|
/**
|
|
90
90
|
* **¿De quién es esta transacción?** (L-1 · 🟠 9, regla del puerto `{trx}`):
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,eAAe,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,eAAe,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzL,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE9G;;;;;;;GAOG;AACH,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAA;AAEvC;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D;;;;GAIG;AACH,OAAO,EAAE,y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CAAA;AAC7E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Entrada pública del paquete.
|
|
3
3
|
* import { AuthorizationManager, APP_SCOPE } from '@jantstack/adonis-authz'
|
|
4
4
|
*/
|
|
5
|
-
export { AuthorizationManager, DEFAULT_MAX_SCOPES, DEFAULT_MAX_DESCENDANTS, MAX_SCOPE_BOUND, DEFAULT_VIEW_MAX_AGE_MS, expandExcludedSubtrees } from './src/manager.js';
|
|
5
|
+
export { AuthorizationManager, DEFAULT_MAX_SCOPES, DEFAULT_MAX_DESCENDANTS, MAX_SCOPE_BOUND, DEFAULT_VIEW_MAX_AGE_MS, PARKED_CENSUS_MAX, expandExcludedSubtrees } from './src/manager.js';
|
|
6
6
|
export { defineConfig } from './src/define_config.js';
|
|
7
7
|
export { syncAuthzCatalog, diffAuthzCatalog, catalogInSync, formatCatalogDiff, formatScopedRoles, formatShadowedRoles, runCatalogDiff, syncCatalogs, } from './src/catalog/catalog.js';
|
|
8
8
|
/**
|
|
@@ -43,7 +43,7 @@ export { sqlScopeOutbox } from './src/scope_outbox.js';
|
|
|
43
43
|
* obligaría a importar ese SDK — acoplando el call-site al backend que este
|
|
44
44
|
* paquete existe para abstraer.
|
|
45
45
|
*/
|
|
46
|
-
export { AuthorizationBackendError, AuthorizationBackendTimeoutError, ScopeResolverError, InvalidIdentityError, InvalidSlugError, AuthorizationConfigError, AuthorizationInternalError, UnknownScopeError, NoScopeResolverError, UnknownRoleError, UnknownPermissionError, CatalogConflictError, RoleIsNotAccessError, ScopeCycleError, PurgeIncompleteError, WriteConflictError, ActorRequiredError, NotWithinError, WithinRequiredError, WithinRootForbiddenError, TooManyScopesError, TooManyLocalRolesError, MassPurgeRefusedError, PruneInterruptedError, UnsupportedDialectError, ScopeTooDeepError, UnsupportedOperationError, NoDescendantsResolverError, ViewExpiredError, RoleNotVisibleError, AmbiguousRoleError, RoleImmutableError, RoleLevelAboveOwnerError, RoleNotAssignableAtError, PermissionNotDelegableError, RankExceededError, ModelTooLargeError, RelationConfigError, RelationTypeUnknownError, RelationUnknownError, ScopeTreeDriftError, ScopeDriftUnguardedError, AuthorizationFrozenError, FreezeHeldError, MassReconcileRefusedError, ReconcileTooLargeError,
|
|
46
|
+
export { AuthorizationBackendError, AuthorizationBackendTimeoutError, ScopeResolverError, InvalidIdentityError, InvalidSlugError, AuthorizationConfigError, AuthorizationInternalError, UnknownScopeError, NoScopeResolverError, UnknownRoleError, UnknownPermissionError, CatalogConflictError, RoleIsNotAccessError, ScopeCycleError, PurgeIncompleteError, WriteConflictError, ActorRequiredError, NotWithinError, WithinRequiredError, WithinRootForbiddenError, TooManyScopesError, TooManyLocalRolesError, MassPurgeRefusedError, PruneInterruptedError, UnsupportedDialectError, ScopeTooDeepError, ScopeDepthLimitError, ScopeRequeueRefusedError, UnsupportedOperationError, NoDescendantsResolverError, ViewExpiredError, RoleNotVisibleError, AmbiguousRoleError, RoleImmutableError, RoleLevelAboveOwnerError, RoleNotAssignableAtError, PermissionNotDelegableError, RankExceededError, ModelTooLargeError, RelationConfigError, RelationTypeUnknownError, RelationUnknownError, ScopeTreeDriftError, ScopeDriftUnguardedError, AuthorizationFrozenError, FreezeHeldError, MassReconcileRefusedError, ReconcileTooLargeError,
|
|
47
47
|
// Cierre de alpha.3 (invariante 13 en purgas multi-request): un driver de
|
|
48
48
|
// relaciones de terceros marca con `markPartialWrite` el fallo que llega
|
|
49
49
|
// DESPUÉS de haber borrado parte; el manager notifica `indeterminate: true`.
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE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