@aventara/nest 0.1.0-pilot.4 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +150 -0
- package/README.md +2 -2
- package/dist/internal-failure.logger.d.ts +1 -1
- package/dist/internal-failure.logger.js +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @aventara/nest
|
|
2
|
+
|
|
3
|
+
## 1.0.0-rc.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- First release candidate of Aventara 1.0. The public API is now considered stable; changes before 1.0.0 are possible
|
|
8
|
+
based on feedback.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 24ffbab: Each package ships its `CHANGELOG.md`, so the release notes are in the installed package beside the README.
|
|
13
|
+
- 24ffbab: **Behaviour changes:** Pipelines and guards read where a request came from as `request.origin` (was `request.scope`).
|
|
14
|
+
The same property is renamed everywhere it means `"application"` or `"client"`: the pipeline context
|
|
15
|
+
(`context.origin`), the request objects `framework.execute` and `framework.executeTransaction` take
|
|
16
|
+
(`{ origin: "client", … }`), the context a computed field's behaviour receives, and every diagnostic the diagnostics
|
|
17
|
+
sink receives. There is no `scope` alias: replace `scope` with `origin` in those places. Nothing sent over HTTP
|
|
18
|
+
changes.
|
|
19
|
+
|
|
20
|
+
The Nest host's log line for an internal failure now reads `(client origin, request …)` instead of
|
|
21
|
+
`(client scope, request …)`.
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [24ffbab]
|
|
24
|
+
- Updated dependencies [24ffbab]
|
|
25
|
+
- Updated dependencies [24ffbab]
|
|
26
|
+
- Updated dependencies [24ffbab]
|
|
27
|
+
- Updated dependencies [24ffbab]
|
|
28
|
+
- Updated dependencies [24ffbab]
|
|
29
|
+
- Updated dependencies [24ffbab]
|
|
30
|
+
- Updated dependencies [24ffbab]
|
|
31
|
+
- Updated dependencies [24ffbab]
|
|
32
|
+
- Updated dependencies [24ffbab]
|
|
33
|
+
- Updated dependencies [24ffbab]
|
|
34
|
+
- Updated dependencies [24ffbab]
|
|
35
|
+
- Updated dependencies [a973e89]
|
|
36
|
+
- Updated dependencies [1e65e9a]
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
- Updated dependencies [a973e89]
|
|
39
|
+
- Updated dependencies [a973e89]
|
|
40
|
+
- Updated dependencies [1e65e9a]
|
|
41
|
+
- Updated dependencies [1e65e9a]
|
|
42
|
+
- Updated dependencies [24ffbab]
|
|
43
|
+
- Updated dependencies [2d00ad7]
|
|
44
|
+
- Updated dependencies [384a50c]
|
|
45
|
+
- Updated dependencies [d43d1cc]
|
|
46
|
+
- Updated dependencies [3f98749]
|
|
47
|
+
- Updated dependencies [032f792]
|
|
48
|
+
- Updated dependencies [dbe6961]
|
|
49
|
+
- @aventara/core@1.0.0-rc.0
|
|
50
|
+
|
|
51
|
+
## 0.1.0-pilot.4
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- f37dcd6: The documentation shipped with the package — the comments an editor shows on hover, and the README — now describes
|
|
56
|
+
what each export does, how to use it, what it returns and what it throws. Notes about how the package was built and
|
|
57
|
+
why are no longer part of what is published.
|
|
58
|
+
- Updated dependencies [f37dcd6]
|
|
59
|
+
- @aventara/core@0.1.0-pilot.4
|
|
60
|
+
|
|
61
|
+
## 0.1.0-pilot.3
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- @aventara/core@0.1.0-pilot.3
|
|
66
|
+
|
|
67
|
+
## 0.1.0-pilot.2
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- 5535994: Internal failures are visible in the host's log: when `AventaraModule` builds the framework from `config`, every
|
|
72
|
+
`A3000`–`A3003` writes one error line through Nest's `Logger` (context `Aventara`) with the code, the operation, the
|
|
73
|
+
scope, the request id and the thrown value's class name — never the error's message. A configured `diagnostics` sink
|
|
74
|
+
still receives the raw error.
|
|
75
|
+
- e69e88d: The published packages are written for the people who use them. The JavaScript ships without comments; the type
|
|
76
|
+
declarations keep their documentation, and it, the error messages, the protocol fixtures' labels and the comments in a
|
|
77
|
+
generated client no longer carry the project's internal development notes.
|
|
78
|
+
- ab58424: A pipe's output is checked against the server's own rules before it reaches the adapter. The request is validated
|
|
79
|
+
against the caller's Contract; after each pipe, the arguments are validated against the Core Contract (plus fields the
|
|
80
|
+
caller's scope adds), so a pipe may still write what the caller cannot — a field the client Contract hides, such as a
|
|
81
|
+
password hash — but not what the server cannot store. A refusal is the new internal code `A3004 PIPE_OUTPUT_INVALID` (HTTP
|
|
82
|
+
500). The caller receives only the generic `A server pipeline produced invalid arguments.`, like every internal
|
|
83
|
+
failure; the pipe (`pipes[i]` and its function name), the operation, the offending field and its V-code go to the
|
|
84
|
+
diagnostics sink as a `PipeOutputError`, and `@aventara/nest` writes them into its error log line. Nothing reaches the
|
|
85
|
+
adapter. This holds for operations and transaction steps alike (a plan answers with `cause.operation`). Generated
|
|
86
|
+
clients map `A3004` to `InternalError`; the protocol fixtures in `@aventara/testing` include an `A3004` row.
|
|
87
|
+
- Updated dependencies [c2a3b7c]
|
|
88
|
+
- Updated dependencies [e69e88d]
|
|
89
|
+
- Updated dependencies [ab58424]
|
|
90
|
+
- Updated dependencies [23937f8]
|
|
91
|
+
- @aventara/core@0.1.0-pilot.2
|
|
92
|
+
|
|
93
|
+
## 0.1.0-pilot.1
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- 1c45eb7: Startup says what Aventara mounted. Its routes are platform routes, which Nest's `RouterExplorer` never lists, so a
|
|
98
|
+
started server showed no sign of them. On mount, the module now logs one line through Nest's `Logger` (context
|
|
99
|
+
`AventaraModule`), read off `protocol.surface()`: `Aventara mounted 10 operations at /api (+ GET /api/_contract, POST
|
|
100
|
+
/api/_transactions)`. The application's logger settings govern it.
|
|
101
|
+
- 799346e: The package READMEs (each package's npm page) are rewritten for the people who use the packages. The Prisma 7
|
|
102
|
+
adapter's README now states the actual behaviour of a to-many relation or `$count` projected on
|
|
103
|
+
`update.many`/`create.many`: a validation refusal, `A2004` with `V1008`, before any statement runs (it said `A3001`).
|
|
104
|
+
Every install or run command names the `@pilot` dist-tag.
|
|
105
|
+
- e58aebf: The READMEs show how to call the API by hand: a copy-pasteable `curl` that fetches `/api/_contract` and sends a
|
|
106
|
+
`find.many` with both identity headers, and runs as printed against a scaffolded server. They also say that
|
|
107
|
+
Resource keys are the model names as written (`/_resources/User/…`, `avClient.User.find.many`), and that list results are
|
|
108
|
+
`readonly` arrays (`readonly User[]`).
|
|
109
|
+
- Updated dependencies [a45f8a8]
|
|
110
|
+
- Updated dependencies [799346e]
|
|
111
|
+
- @aventara/core@0.1.0-pilot.1
|
|
112
|
+
|
|
113
|
+
## 0.1.0-pilot.0
|
|
114
|
+
|
|
115
|
+
### Minor Changes
|
|
116
|
+
|
|
117
|
+
- First pilot release of `@aventara/nest`: it hosts an Aventara Framework in a NestJS 12 application (peers
|
|
118
|
+
`@nestjs/common` and `@nestjs/core` `^12.0.0`). It exports `AventaraModule`, `AVENTARA_FRAMEWORK`, `InjectFramework`
|
|
119
|
+
and the types `AventaraModuleOptions` / `AventaraModuleAsyncOptions`.
|
|
120
|
+
|
|
121
|
+
- **Mounting.** `AventaraModule.forRoot({ framework })` uses your own instance; `forRoot({ config })` calls
|
|
122
|
+
`createFramework(config)` itself; `forRootAsync({ imports, inject, useFactory })` resolves either. Both forms are
|
|
123
|
+
generic like `createFramework`, so a configuration is checked against its adapter's model. The module is global;
|
|
124
|
+
inject the Framework with `@InjectFramework()`. A configuration error rejects `NestFactory.create` before the
|
|
125
|
+
application listens, and passing both `framework` and `config`, neither, a value that is not a Framework, or
|
|
126
|
+
mounting the module twice is refused with a fixed message.
|
|
127
|
+
- **Routes.** One platform route per route the protocol advertises — every operation, `GET /_contract`, and
|
|
128
|
+
`POST /_transactions` when transactions are interactive — at its literal path under `FrameworkConfig.entrypoint`
|
|
129
|
+
(a Nest global prefix does not move it), on Express and on Fastify. Any other path under the entrypoint's `/_`
|
|
130
|
+
namespace gets the protocol's own answer; every other path goes on to Nest.
|
|
131
|
+
- **What runs on them.** Nest's guards, interceptors and pipes do not; `app.use` middleware and `enableCors()` do.
|
|
132
|
+
`MiddlewareConsumer` middleware does not run on them on Express, and does on Fastify — exclude `<entrypoint>/_*`
|
|
133
|
+
(for example `.exclude("api/_*path")`) to keep it off. A throw while translating a request reaches your exception
|
|
134
|
+
filter.
|
|
135
|
+
- **Request bodies.** Read raw and bounded by the contract's `limits.maxRequestBytes`; `gzip`, `deflate` and `br` are
|
|
136
|
+
decoded and the limit counts decoded bytes (`413 A2010`); any other coding answers `415 A2011`, and a body that does
|
|
137
|
+
not decode in the coding it names answers `400 A2000`. Nothing is executed in either case. Your own routes keep Nest's
|
|
138
|
+
parsed `req.body`.
|
|
139
|
+
- **Platform differences.** On Fastify, Resource keys or an entrypoint holding `*` or a reserved character
|
|
140
|
+
(`: + # $ & , / ; = ? @`) are refused at startup, naming them — rename them, or host on Express. Express answers a
|
|
141
|
+
non-canonical percent-encoding of a protocol route with `500 A3000`, and matches the entrypoint in any case by
|
|
142
|
+
default.
|
|
143
|
+
- Works under Nest's testing module (`Test.createTestingModule(…).compile()` then `createNestApplication()`), and every
|
|
144
|
+
export has a `default` condition, so a CommonJS NestJS project can `require()` it. The README covers the ways to
|
|
145
|
+
mount the module, typed injection, what fails before listen, and the platform differences.
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- Updated dependencies
|
|
150
|
+
- @aventara/core@0.1.0-pilot.0
|
package/README.md
CHANGED
|
@@ -127,12 +127,12 @@ own when it mounts them, through Nest's `Logger` (context `AventaraModule`; `log
|
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
An internal failure (`A3000`–`A3004`, answered as a 500) is logged as one error line through Nest's `Logger`
|
|
130
|
-
(context `Aventara`): the code, the operation, the
|
|
130
|
+
(context `Aventara`): the code, the operation, the origin and the request id, and the thrown value's class name — never
|
|
131
131
|
its message, which can hold SQL or a connection string. The raw error still goes to your `diagnostics` sink, when you
|
|
132
132
|
configure one:
|
|
133
133
|
|
|
134
134
|
```text
|
|
135
|
-
[Nest] ERROR [Aventara] A3001 on Post.create.one (client
|
|
135
|
+
[Nest] ERROR [Aventara] A3001 on Post.create.one (client origin, request 3f1c…): PrismaClientValidationError. The raw error goes to the framework's diagnostics sink.
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
For `A3004` — one of your pipes returned arguments the server contract refuses — the line also names the pipe, the
|
|
@@ -2,7 +2,7 @@ import type { FrameworkDiagnostic, FrameworkDiagnosticsSink } from "@aventara/co
|
|
|
2
2
|
/** Wraps the application's sink (if any): log an internal failure, then forward. */
|
|
3
3
|
export declare function withInternalFailureLog(sink: FrameworkDiagnosticsSink | undefined): FrameworkDiagnosticsSink;
|
|
4
4
|
/**
|
|
5
|
-
* e.g. `A3001 on Post.create.one (client
|
|
5
|
+
* e.g. `A3001 on Post.create.one (client origin, request 7f3c…): Error. The raw
|
|
6
6
|
* error goes to the framework's diagnostics sink.`
|
|
7
7
|
*/
|
|
8
8
|
export declare function internalFailureLine(diagnostic: FrameworkDiagnostic): string;
|
|
@@ -19,7 +19,7 @@ export function internalFailureLine(diagnostic) {
|
|
|
19
19
|
const step = diagnostic.operation === undefined
|
|
20
20
|
? ""
|
|
21
21
|
: `, plan operation ${diagnostic.operation}`;
|
|
22
|
-
return `${diagnostic.code} on ${subject} (${diagnostic.
|
|
22
|
+
return `${diagnostic.code} on ${subject} (${diagnostic.origin} origin, request ${diagnostic.requestId}${step}): ${thrownKind(diagnostic.error)}${frameworkDetail(diagnostic.error)}. The raw error goes to the framework's diagnostics sink.`;
|
|
23
23
|
}
|
|
24
24
|
function frameworkDetail(error) {
|
|
25
25
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aventara/nest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "NestJS host integration for Aventara.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
|
-
"LICENSE-ADDITIONAL-PERMISSION.md"
|
|
21
|
+
"LICENSE-ADDITIONAL-PERMISSION.md",
|
|
22
|
+
"CHANGELOG.md"
|
|
22
23
|
],
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@aventara/core": "
|
|
25
|
+
"@aventara/core": "1.0.0-rc.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"@nestjs/common": "^12.0.0",
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
"access": "public"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@aventara/prisma7-adapter": "
|
|
35
|
-
"@aventara/testing": "
|
|
35
|
+
"@aventara/prisma7-adapter": "1.0.0-rc.0",
|
|
36
|
+
"@aventara/testing": "1.0.0-rc.0",
|
|
36
37
|
"@nestjs/common": "^12.1.2",
|
|
37
38
|
"@nestjs/core": "^12.1.2",
|
|
38
39
|
"@nestjs/platform-express": "^12.1.2",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"rxjs": "^7.8.2"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
|
-
"build": "tsc -p tsconfig.json --removeComments --declaration false && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/build/declaration-comments.sanitizer.ts dist",
|
|
47
|
+
"build": "node ../../scripts/build/build-output.cleaner.ts dist && tsc -p tsconfig.json --removeComments --declaration false && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/build/declaration-comments.sanitizer.ts dist",
|
|
47
48
|
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
|
|
48
49
|
"test": "vitest run --typecheck --config ../../vitest.config.mts --root .",
|
|
49
50
|
"lint": "biome lint src"
|