nest-my-admin 0.9.0 → 0.10.3
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 +28 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -537,6 +537,13 @@ export class OrderAdmin extends AdminResourceBase<Order> {
|
|
|
537
537
|
- **Selections.** A bulk action runs on up to 100 records.
|
|
538
538
|
- By default each record gets its own transaction: the answer is `{ ok, failed: [{ id, code, message }], message? }`, and one failure does not stop the others. The list shows how many ran and why the others did not.
|
|
539
539
|
- `atomic: true` runs them all in one transaction: every record is checked first, and one failure is the answer, with nothing applied. It needs the admin's transactions (boot fails with `transactions: false`). The confirmation says "all or nothing".
|
|
540
|
+
- **A dropdown from live data.** `choices: { field: 'methodName' }` turns an input field into a dropdown whose options a method of the resource gives when the dialog opens: the branches of a repository, the services a provider offers today.
|
|
541
|
+
```ts
|
|
542
|
+
@AdminAction({ target: 'resource', input: DeployDto, choices: { backendRef: 'backendBranches' } })
|
|
543
|
+
async deploy(input: DeployDto) { … }
|
|
544
|
+
async backendBranches(ctx: AdminContext) { return this.github.branches('api'); } // strings, or { value, label }
|
|
545
|
+
```
|
|
546
|
+
The method runs for whoever may run the action (`GET …/actions/:action/choices/:field`), sync or async. A run reads the choices again and refuses a value that is not one of them (422 on the field). The field keeps its `default` while the list loads. Field names are checked against `input` by the types and at boot, and the method must exist.
|
|
540
547
|
- **Picking a record.** `@AdminField({ pickFrom: 'categoryId' })` on an input property shows the same picker as the resource's own relation field `categoryId`; the property receives the chosen id (validate it with `@IsInt()`, and check it exists in the method).
|
|
541
548
|
- **Refusing.** Throw from the method:
|
|
542
549
|
- an `HttpException` below 500 answers with its status and message (409 is `CONFLICT`, 400 is `BUSINESS_RULE`), and the UI shows the message;
|
|
@@ -761,7 +768,7 @@ AdminModule.forRoot({
|
|
|
761
768
|
- Five wrong passwords lock an account for 15 minutes. Sign-in attempts are limited to 20 per minute per IP, with 429 and `Retry-After`.
|
|
762
769
|
- Unknown users, wrong passwords and locked accounts get the same answer.
|
|
763
770
|
- The account page changes the password (which signs out every other session), lists signed-in devices, and signs out one or all others.
|
|
764
|
-
- **Two-factor sign-in** (TOTP, any authenticator app). A user turns it on from the account page by scanning a QR code and confirming a code, and gets 10 one-time recovery codes. After the password, sign-in answers 401 `TWO_FACTOR_REQUIRED` until the request also carries `otp` (a code or a recovery code). Each code works once, wrong codes count toward the lockout, and turning it on signs out every other session. Turning it off or issuing new recovery codes needs the password; an admin can reset a lost second factor from the Users page. Set `secretKey` (32 bytes, base64: `openssl rand -base64 32`) to encrypt the keys at rest with AES-256-GCM. `issuer` names the app in authenticators. Upgrading from 0.0.x adds four nullable columns to `nma_user` (`totpSecret`, `totpPending`, `totpLastStep`, `recoveryCodes`).
|
|
771
|
+
- **Two-factor sign-in** (TOTP, any authenticator app). A user turns it on from the account page by scanning a QR code and confirming a code, and gets 10 one-time recovery codes. After the password, sign-in answers 401 `TWO_FACTOR_REQUIRED` until the request also carries `otp` (a code or a recovery code). Each code works once, wrong codes count toward the lockout, and turning it on signs out every other session. Turning it off or issuing new recovery codes needs the password; an admin can reset a lost second factor from the Users page. Set `secretKey` (32 bytes, base64: `openssl rand -base64 32`) to encrypt the keys at rest with AES-256-GCM. `issuer` names the app in authenticators. `issuerImage` (an http(s) URL) adds `image=` to the QR code for the apps that read it; others, Ente Auth among them, show their own icons, matched on `issuer`. Upgrading from 0.0.x adds four nullable columns to `nma_user` (`totpSecret`, `totpPending`, `totpLastStep`, `recoveryCodes`).
|
|
765
772
|
- `bootstrapSuperuser` creates the first user when `nma_user` is empty (it runs in module init, so call `app.init()` before seeding other users). `createAdminUser(dataSource, { … })` adds more.
|
|
766
773
|
- **CSRF.** Every POST, PATCH and DELETE of a cookie session must send the session's token as `X-CSRF-Token` (the UI does). The API also accepts only `application/json` bodies.
|
|
767
774
|
- **Your own users:**
|
|
@@ -969,6 +976,26 @@ Things hosts tend to write by hand that the admin already does:
|
|
|
969
976
|
- **Inline children stay out of the sidebar** by default (`nav: false` unless they set `nav`): no extra group to hide them in.
|
|
970
977
|
- **Labels in one language** are plain strings; other languages can come from `translate` (see Languages, theme and branding).
|
|
971
978
|
|
|
979
|
+
## Upgrading to 0.10.3
|
|
980
|
+
|
|
981
|
+
Nothing to change. What you may notice:
|
|
982
|
+
|
|
983
|
+
- A save with inline rows now answers with every refused row at once: each row runs in a savepoint, and the save still fails as a whole. One refused row keeps its own status and message; several are one 422 with every row's `fields`.
|
|
984
|
+
- Filter chips are no longer dashed «+» buttons (they read as "add"): a funnel and an arrow, after a «Filter:» caption, and a title in the popover. A yes/no filter is a switch on the chip (one click on, one click off); «No» is behind its arrow. An editable yes/no list cell is a switch that saves on click.
|
|
985
|
+
- Money inputs group digits as they are typed, and a `money` widget also fits a string DTO property.
|
|
986
|
+
- Calendars are always six rows, the column menu scrolls inside the window, a field's `warnIf` no longer remounts its input (the input lost its focus after the first letter), and native controls follow the dark theme (`color-scheme`).
|
|
987
|
+
- In Persian, the server's own texts are translated by the UI, class-validator's default messages included («must not be greater than 5»), without the property's name. English shows them exactly as sent, and a host's own words are never touched. A field the form does not show gives its message without its name.
|
|
988
|
+
|
|
989
|
+
New: `@AdminResource({ creatable: false })` (no «New», a create is refused, records can still be edited), `{ inline, existingOnly: true }` (rows only on an existing parent), `form.afterCreate: 'edit'` (saving a new record opens it), and `afterInlines(record, dto, ctx)` on a resource (a rule about a record and its rows, after both are written, inside the transaction).
|
|
990
|
+
|
|
991
|
+
## Upgrading to 0.10.2
|
|
992
|
+
|
|
993
|
+
Nothing to change. New: `builtinAuth({ issuerImage })`, an http(s) URL of your logo, sent as `image=` in the two-factor QR code. Only some authenticator apps read it; others, Ente Auth among them, show their own icons, matched on `issuer`. A value that is not an absolute http(s) URL fails at boot.
|
|
994
|
+
|
|
995
|
+
## Upgrading to 0.9.1
|
|
996
|
+
|
|
997
|
+
Nothing to change. New: `@AdminAction({ choices })` (see Actions): an input field whose dropdown a resource method fills when the dialog opens, re-checked when the action runs. Every dropdown in the dashboard (forms, filters, sort, page size, inline cell edits, language, roles, audit, debugger, the editor's heading level) is now the dashboard's own list, styled like the rest and right to left in Persian, instead of the browser's native `<select>`. Tests that drove a native select (`selectOption`) click the field, then the option (`getByRole('option', { name })`).
|
|
998
|
+
|
|
972
999
|
## Upgrading to 0.9.0
|
|
973
1000
|
|
|
974
1001
|
The contracts between the admin and your code are now enforced: the decorators' types refuse a method or class of the wrong shape at compile time, and the admin refuses a wrong value at run time (a 500 with `nest-my-admin: …` in the log, or a boot error) instead of reading it as something else. Code that already followed the docs keeps working; code that compiled only through `any` or plain JavaScript may now fail. What to check:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nest-my-admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Django-admin-class admin panel for NestJS + TypeORM: @nest-my-admin/core, /auth and /testing under one name",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@nest-my-admin/auth": "0.
|
|
43
|
-
"@nest-my-admin/core": "0.
|
|
44
|
-
"@nest-my-admin/testing": "0.
|
|
42
|
+
"@nest-my-admin/auth": "0.10.3",
|
|
43
|
+
"@nest-my-admin/core": "0.10.3",
|
|
44
|
+
"@nest-my-admin/testing": "0.10.3"
|
|
45
45
|
}
|
|
46
46
|
}
|