emilsoftware-utilities 2.0.0-dev.71 → 2.0.0-dev.73
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 +43 -0
- package/dist/accessi/client/admin/index.d.ts +18 -0
- package/dist/accessi/client/admin/index.js +58 -0
- package/dist/accessi/client/admin/index.js.map +1 -0
- package/dist/accessi/client/createAccessiClient.d.ts +21 -0
- package/dist/accessi/client/createAccessiClient.js +31 -0
- package/dist/accessi/client/createAccessiClient.js.map +1 -0
- package/dist/accessi/client/generated/admin.d.ts +601 -0
- package/dist/accessi/client/generated/admin.js +557 -0
- package/dist/accessi/client/generated/admin.js.map +1 -0
- package/dist/accessi/client/generated/public.d.ts +121 -0
- package/dist/accessi/client/generated/public.js +119 -0
- package/dist/accessi/client/generated/public.js.map +1 -0
- package/dist/accessi/client/generated/service.d.ts +53 -0
- package/dist/accessi/client/generated/service.js +63 -0
- package/dist/accessi/client/generated/service.js.map +1 -0
- package/dist/accessi/client/index.d.ts +7 -13
- package/dist/accessi/client/index.js +16 -29
- package/dist/accessi/client/index.js.map +1 -1
- package/dist/accessi/client/public/index.d.ts +18 -0
- package/dist/accessi/client/public/index.js +58 -0
- package/dist/accessi/client/public/index.js.map +1 -0
- package/dist/accessi/client/service/index.d.ts +17 -0
- package/dist/accessi/client/service/index.js +57 -0
- package/dist/accessi/client/service/index.js.map +1 -0
- package/dist/accessi-module/Console/console.js +6 -0
- package/dist/accessi-module/Console/wiki.js +6 -0
- package/dist/accessi-module/Console/wiki.js.map +1 -1
- package/dist/accessi-module/Controllers/AccessiIntrospectionController.js +1 -1
- package/dist/accessi-module/Controllers/AccessiIntrospectionController.js.map +1 -1
- package/dist/emilsoftware-utilities-2.0.0-dev.73.tgz +0 -0
- package/docs/accessi-openapi-baseline.json +4500 -0
- package/docs/accessi-openapi-breaking-allowlist.json +1 -0
- package/docs/adr/0001-split-package.md +79 -0
- package/integration-prompt.md +6 -2
- package/package.json +37 -4
- package/dist/emilsoftware-utilities-2.0.0-dev.71.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# ADR 0001 — Split in pacchetti separati: contracts, client, resource-server, server
|
|
2
|
+
|
|
3
|
+
- **Stato:** accettato
|
|
4
|
+
- **Data:** 2026-10-30
|
|
5
|
+
- **Issue:** #9
|
|
6
|
+
- **Ambito:** packaging e rilascio di `emilsoftware-utilities`
|
|
7
|
+
|
|
8
|
+
## Contesto
|
|
9
|
+
|
|
10
|
+
Il package espone gia entry point separati (`accessi/server`, `accessi/resource-server`,
|
|
11
|
+
`accessi/client` con gli scope `public`/`admin`/`service`, `accessi/contracts`, `accessi/openapi`,
|
|
12
|
+
`accessi/console`, `accessi/ui`). Hanno però un unico `package.json`, un unico numero di versione e
|
|
13
|
+
un unico ciclo di rilascio, mentre i consumer reali hanno esigenze diverse:
|
|
14
|
+
|
|
15
|
+
- i frontend usano solo `contracts` e `client/public` e non devono scaricare Nest, Firebird o SMTP;
|
|
16
|
+
- i backend fratelli usano `resource-server` e `client/service`;
|
|
17
|
+
- solo il backend proprietario usa `server` (database, migrazioni, console).
|
|
18
|
+
|
|
19
|
+
Oggi il tarball contiene tutto (~950 KB) e una modifica server-side obbliga un bump che i frontend
|
|
20
|
+
devono comunque recepire. Lo split è però un cambio invasivo per i consumer e per la release.
|
|
21
|
+
|
|
22
|
+
## Opzioni valutate
|
|
23
|
+
|
|
24
|
+
| Opzione | Pro | Contro |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| **A. Pacchetto singolo con entry point per scope (attuale)** | Zero migrazioni; un solo `npm ci`; types condivisi per costruzione; release unica e semplice; il tree-shaking elimina il codice non importato | Il tarball contiene dipendenze server anche per i frontend; versione unica per domini diversi |
|
|
27
|
+
| **B. Monorepo npm workspaces con 4 pacchetti** | Versioning indipendente; dipendenze minime per pacchetto; build/publish selettivi | Richiede cambiare toolchain, CI e release; 4 tarball da pubblicare; gestione versioni incrociate (`contracts` → `client`); migrazione dei consumer |
|
|
28
|
+
| **C. Pacchetti in repository separati** | Massima indipendenza | Frammentazione, PR incrociate, release coordinate manualmente, overhead alto per un team piccolo |
|
|
29
|
+
|
|
30
|
+
## Decisione
|
|
31
|
+
|
|
32
|
+
Si adotta **l'opzione A** nel breve periodo, rafforzata dagli entry point per scope introdotti
|
|
33
|
+
nell'issue #7 e verificati dal test `npm run test:pack`.
|
|
34
|
+
|
|
35
|
+
Motivazioni:
|
|
36
|
+
|
|
37
|
+
1. **Nessuna regressione:** gli import esistenti (`emilsoftware-utilities`,
|
|
38
|
+
`.../accessi/client`, ...) restano identici; una migrazione forzata avrebbe costo alto e
|
|
39
|
+
beneficio non dimostrato.
|
|
40
|
+
2. **Tipi condivisi per costruzione:** un solo set di modelli generati da OpenAPI evita divergenze
|
|
41
|
+
tra client e contracts, che con pacchetti separati andrebbero versionati insieme.
|
|
42
|
+
3. **Bundle:** i consumer browser usano `accessi/client/public` e `accessi/contracts`; con
|
|
43
|
+
`sideEffects` limitato ai soli moduli con effetti, i bundler eliminano il resto.
|
|
44
|
+
4. **Release riproducibile:** `npm ci && npm run build && npm run test:pack` produce e verifica lo
|
|
45
|
+
stesso tarball; semantic-release pubblica un solo artefatto.
|
|
46
|
+
|
|
47
|
+
Lo split resta un'opzione futura, non un rifiuto: le soglie che lo giustificherebbero sono elencate
|
|
48
|
+
sotto.
|
|
49
|
+
|
|
50
|
+
## Quando rivalutare
|
|
51
|
+
|
|
52
|
+
Riaprire la decisione (ADR successivo) se si verifica almeno una di queste condizioni:
|
|
53
|
+
|
|
54
|
+
- i frontend richiedono un rilascio di `contracts`/`client` indipendente da `server`;
|
|
55
|
+
- il peso delle dipendenze server nel bundle browser diventa un problema non risolvibile con il
|
|
56
|
+
tree-shaking (es. consumer senza bundler);
|
|
57
|
+
- il team cresce al punto da avere cicli di rilascio separati per server e client;
|
|
58
|
+
- si rende necessario pubblicare su registry diversi o con licenze diverse.
|
|
59
|
+
|
|
60
|
+
## Piano di migrazione (se e quando)
|
|
61
|
+
|
|
62
|
+
1. Introdurre i workspace (`npm workspaces`) mantenendo i path pubblici attuali come facade.
|
|
63
|
+
2. Estrarre per primo `contracts` (zero dipendenze runtime), poi `client`, poi `resource-server`,
|
|
64
|
+
infine `server`.
|
|
65
|
+
3. Ogni pacchetto facade re-esporta dal nuovo package, così `accessi/client`, `accessi/contracts`,
|
|
66
|
+
ecc. continuano a funzionare senza modifiche ai consumer.
|
|
67
|
+
4. Aggiungere una test matrix che installa i tarball di tutti i pacchetti insieme e verifica i path
|
|
68
|
+
legacy.
|
|
69
|
+
5. Deprecare i facade solo in una major successiva, con guida di migrazione.
|
|
70
|
+
|
|
71
|
+
## Conseguenze
|
|
72
|
+
|
|
73
|
+
- **Versioning:** unico, gestito da semantic-release sul branch `dev` → `main`.
|
|
74
|
+
- **Compatibilita:** garantita dall'export map e dallo smoke test del tarball
|
|
75
|
+
(`scripts/pack-smoke-consumer.cjs`) che copre ogni subpath e gli scope client.
|
|
76
|
+
- **Build/publish riproducibili:** build dichiarativa (`npm run build`), configurazione npm
|
|
77
|
+
isolata nello smoke test, nessun passaggio manuale oltre al merge.
|
|
78
|
+
- **Debito accettato:** il tarball include dipendenze server anche per i consumer frontend; è un
|
|
79
|
+
costo noto e monitorato, non un bug.
|
package/integration-prompt.md
CHANGED
|
@@ -41,7 +41,10 @@ Se per ora Accessi e montato dentro Backend A, va bene: Backend A e il proprieta
|
|
|
41
41
|
|---|---|
|
|
42
42
|
| `emilsoftware-utilities/accessi/server` | Backend che ospita Accessi: `AccessiModule`, `initializeAccessiModule`, updater DB, migrazioni, console. |
|
|
43
43
|
| `emilsoftware-utilities/accessi/resource-server` | Backend fratello: middleware Express, guard Nest, verifica JWT e introspection. |
|
|
44
|
-
| `emilsoftware-utilities/accessi/client` | Client OpenAPI
|
|
44
|
+
| `emilsoftware-utilities/accessi/client` | Client OpenAPI completo, con configurazione globale o per istanza (`createAccessiClient`). |
|
|
45
|
+
| `emilsoftware-utilities/accessi/client/public` | Solo API pubbliche (login, refresh, 2FA, reset password, ticket console): da preferire nei frontend. |
|
|
46
|
+
| `emilsoftware-utilities/accessi/client/admin` | Solo API amministrative (utenti, ruoli, menu, filtri, provider federati, schema): console e tool admin. |
|
|
47
|
+
| `emilsoftware-utilities/accessi/client/service` | Solo API service-to-service (service token e introspezione): backend fratelli e job. |
|
|
45
48
|
| `emilsoftware-utilities/accessi/contracts` | Tipi, enum e helper puri browser-safe. |
|
|
46
49
|
| `emilsoftware-utilities/accessi/contracts/dtos` | DTO Nest con `class-validator` e decoratori OpenAPI. Solo backend. |
|
|
47
50
|
| `emilsoftware-utilities/accessi/openapi` | `setupOpenApi`, `mergeOpenApiDocuments`. |
|
|
@@ -628,6 +631,7 @@ I componenti sono frameworkless e ricevono i dati via proprieta; non fanno chiam
|
|
|
628
631
|
- `accessi/contracts`: tipi/enum/helper puri, adatti anche al browser.
|
|
629
632
|
- `accessi/contracts/dtos`: DTO Nest con decoratori; non usarli in bundle frontend leggeri.
|
|
630
633
|
- `accessi/client`: tipi generati dall'OpenAPI e funzioni HTTP; e la fonte consigliata per frontend e backend fratelli.
|
|
634
|
+
- `accessi/client/public` / `admin` / `service`: stessi tipi e funzioni, filtrati per scope. Il client pubblico non espone operazioni amministrative; usare `createAccessiPublicClient`, `createAccessiAdminClient` o `createAccessiServiceClient` per isolare base URL e token per istanza.
|
|
631
635
|
|
|
632
636
|
Non usare i DTO server come contratto pubblico se il frontend non ha `class-validator`, `class-transformer` e `reflect-metadata`.
|
|
633
637
|
|
|
@@ -755,7 +759,7 @@ Checklist:
|
|
|
755
759
|
|
|
756
760
|
### Per un frontend
|
|
757
761
|
|
|
758
|
-
> Usa `emilsoftware-utilities/accessi/client
|
|
762
|
+
> Usa `emilsoftware-utilities/accessi/client/public` nei frontend (mai il client admin) e `createAccessiClient`/`createAccessiPublicClient` se parli con piu Accessi Service o tenant: chiama `configureAccessiClient({ baseUrl, token })` dopo il login e `getToken` se il token cambia. Il login, il refresh, il 2FA e il reset password passano da Accessi Service. Verso i backend usa `Authorization: Bearer <access-token>`. Non incorporare il database o il server Accessi. Per la console usa `buildAccessiConsoleUrl` con il ticket monouso restituito da `POST /api/accessi/console/entry`; non mettere mai il JWT nell'URL. Per i componenti UI usa gli asset di `accessi/ui`. Gestisci gli errori 401 (`AUTH_TOKEN_INVALID`) portando l'utente al login e 403 (`AUTH_INSUFFICIENT_PERMISSIONS`) mostrando un messaggio di permessi insufficienti.
|
|
759
763
|
|
|
760
764
|
### Per un agente AI
|
|
761
765
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emilsoftware-utilities",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.73",
|
|
4
4
|
"description": "Utilities for EmilSoftware",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"accessi/*": [
|
|
11
|
+
"dist/accessi/*"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"./dist/index.js",
|
|
17
|
+
"./dist/firebird-compat.js",
|
|
18
|
+
"./dist/accessi-module/Console/console.js"
|
|
19
|
+
],
|
|
8
20
|
"exports": {
|
|
9
21
|
".": {
|
|
10
22
|
"types": "./dist/index.d.ts",
|
|
@@ -60,6 +72,24 @@
|
|
|
60
72
|
"import": "./dist/accessi/client/index.js",
|
|
61
73
|
"default": "./dist/accessi/client/index.js"
|
|
62
74
|
},
|
|
75
|
+
"./accessi/client/public": {
|
|
76
|
+
"types": "./dist/accessi/client/public/index.d.ts",
|
|
77
|
+
"require": "./dist/accessi/client/public/index.js",
|
|
78
|
+
"import": "./dist/accessi/client/public/index.js",
|
|
79
|
+
"default": "./dist/accessi/client/public/index.js"
|
|
80
|
+
},
|
|
81
|
+
"./accessi/client/admin": {
|
|
82
|
+
"types": "./dist/accessi/client/admin/index.d.ts",
|
|
83
|
+
"require": "./dist/accessi/client/admin/index.js",
|
|
84
|
+
"import": "./dist/accessi/client/admin/index.js",
|
|
85
|
+
"default": "./dist/accessi/client/admin/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./accessi/client/service": {
|
|
88
|
+
"types": "./dist/accessi/client/service/index.d.ts",
|
|
89
|
+
"require": "./dist/accessi/client/service/index.js",
|
|
90
|
+
"import": "./dist/accessi/client/service/index.js",
|
|
91
|
+
"default": "./dist/accessi/client/service/index.js"
|
|
92
|
+
},
|
|
63
93
|
"./accessi/openapi": {
|
|
64
94
|
"types": "./dist/accessi/openapi/index.d.ts",
|
|
65
95
|
"require": "./dist/accessi/openapi/index.js",
|
|
@@ -87,9 +117,11 @@
|
|
|
87
117
|
},
|
|
88
118
|
"scripts": {
|
|
89
119
|
"release": "semantic-release",
|
|
90
|
-
"build": "npm run generate:accessi-openapi && npm run check:accessi-openapi && npm run generate:accessi-client && npm run generate:accessi-wiki && tsc && tsc -p tsconfig.console.json --noEmit && npm run build:accessi-console && npm run copy-views",
|
|
120
|
+
"build": "npm run generate:accessi-openapi && npm run check:accessi-openapi && npm run check:accessi-openapi-diff && npm run generate:accessi-client && npm run generate:accessi-wiki && tsc && tsc -p tsconfig.console.json --noEmit && npm run build:accessi-console && npm run copy-views",
|
|
91
121
|
"check:accessi-openapi": "node scripts/check-accessi-openapi.cjs",
|
|
92
122
|
"accessi:update-openapi-fingerprint": "node scripts/check-accessi-openapi.cjs --update",
|
|
123
|
+
"check:accessi-openapi-diff": "node scripts/openapi-semantic-diff.cjs",
|
|
124
|
+
"accessi:update-openapi-baseline": "node scripts/openapi-semantic-diff.cjs --update",
|
|
93
125
|
"generate:accessi-openapi": "ts-node --transpile-only src/scripts/generateAccessiOpenApi.ts",
|
|
94
126
|
"generate:accessi-client": "orval --config orval.config.ts",
|
|
95
127
|
"generate:accessi-wiki": "ts-node --transpile-only src/scripts/generateAccessiWiki.ts",
|
|
@@ -106,8 +138,8 @@
|
|
|
106
138
|
"typecheck": "tsc --noEmit",
|
|
107
139
|
"lint": "node scripts/lint.cjs",
|
|
108
140
|
"test": "npm run typecheck && npm run lint && npm run test:unit",
|
|
109
|
-
"test:unit": "node --test test/angular-components.cjs test/menus-catalog.mjs test/menu-scopes.cjs test/accessi-regressions.cjs test/password-reset-regressions.cjs test/two-factor.cjs test/accessi-schema.cjs test/utilities-regressions.cjs test/service-token-regressions.cjs test/accessi-email-config.cjs test/accessi-catalog-scripts.cjs test/openapi-config.cjs test/resource-server.cjs test/accessi-security-standards.cjs test/accessi-service.cjs test/refresh-token.cjs test/token-revocation.cjs test/accessi-client.cjs",
|
|
110
|
-
"test:coverage": "node --experimental-test-coverage --test-coverage-lines=50 --test-coverage-functions=60 --test-coverage-branches=60 --test test/angular-components.cjs test/menus-catalog.mjs test/menu-scopes.cjs test/accessi-regressions.cjs test/password-reset-regressions.cjs test/two-factor.cjs test/accessi-schema.cjs test/utilities-regressions.cjs test/service-token-regressions.cjs test/accessi-email-config.cjs test/accessi-catalog-scripts.cjs test/openapi-config.cjs test/resource-server.cjs test/accessi-security-standards.cjs test/accessi-service.cjs test/refresh-token.cjs test/token-revocation.cjs test/accessi-client.cjs",
|
|
141
|
+
"test:unit": "node --test test/angular-components.cjs test/menus-catalog.mjs test/menu-scopes.cjs test/accessi-regressions.cjs test/password-reset-regressions.cjs test/two-factor.cjs test/accessi-schema.cjs test/utilities-regressions.cjs test/service-token-regressions.cjs test/accessi-email-config.cjs test/accessi-catalog-scripts.cjs test/openapi-config.cjs test/resource-server.cjs test/accessi-security-standards.cjs test/accessi-service.cjs test/refresh-token.cjs test/token-revocation.cjs test/accessi-client.cjs test/accessi-client-scopes.cjs test/openapi-semantic-diff.cjs",
|
|
142
|
+
"test:coverage": "node --experimental-test-coverage --test-coverage-lines=50 --test-coverage-functions=60 --test-coverage-branches=60 --test test/angular-components.cjs test/menus-catalog.mjs test/menu-scopes.cjs test/accessi-regressions.cjs test/password-reset-regressions.cjs test/two-factor.cjs test/accessi-schema.cjs test/utilities-regressions.cjs test/service-token-regressions.cjs test/accessi-email-config.cjs test/accessi-catalog-scripts.cjs test/openapi-config.cjs test/resource-server.cjs test/accessi-security-standards.cjs test/accessi-service.cjs test/refresh-token.cjs test/token-revocation.cjs test/accessi-client.cjs test/accessi-client-scopes.cjs test/openapi-semantic-diff.cjs",
|
|
111
143
|
"test:accessi": "npm run test:unit",
|
|
112
144
|
"test:all": "npm test && npm run test:integration && npm run test:integration:redis",
|
|
113
145
|
"test:integration": "node test/integration/run-firebird.cjs 5",
|
|
@@ -116,6 +148,7 @@
|
|
|
116
148
|
"test:integration:fb3": "node test/integration/run-firebird.cjs 3",
|
|
117
149
|
"test:integration:fb25": "node test/integration/run-firebird.cjs 2.5",
|
|
118
150
|
"test:accessi-console": "npm run build && node test/console-two-factor.cjs",
|
|
151
|
+
"test:pack": "node scripts/pack-smoke-test.cjs",
|
|
119
152
|
"accessi:seed-admin": "node scripts/seed-accessi-admin.cjs",
|
|
120
153
|
"accessi:console": "node scripts/run-accessi-console.cjs",
|
|
121
154
|
"test:accessi-schema": "node --test test/accessi-schema.cjs",
|
|
Binary file
|