@silkweave/nestjs 1.12.0 → 2.2.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 +108 -163
- package/build/index.d.mts +250 -267
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +736 -511
- package/build/index.mjs.map +1 -1
- package/package.json +22 -16
- package/.turbo/turbo-build.log +0 -16
- package/.turbo/turbo-check.log +0 -3
- package/.turbo/turbo-lint.log +0 -2
- package/.turbo/turbo-prepack.log +0 -18
- package/eslint.config.mjs +0 -93
- package/src/adapter/mcp.ts +0 -102
- package/src/adapter/rest.ts +0 -173
- package/src/adapter/trpc.ts +0 -58
- package/src/adapter/typegen.ts +0 -55
- package/src/decorator/action.ts +0 -38
- package/src/decorator/actions.ts +0 -25
- package/src/index.ts +0 -14
- package/src/lib/discovery.ts +0 -131
- package/src/lib/executionContext.ts +0 -76
- package/src/lib/filter.ts +0 -26
- package/src/lib/guards.ts +0 -70
- package/src/lib/metadata.ts +0 -58
- package/src/lib/openapi.ts +0 -116
- package/src/lib/silkweave.module.ts +0 -75
- package/src/lib/swagger.ts +0 -74
- package/src/lib/types.ts +0 -58
- package/tsconfig.json +0 -25
- package/tsconfig.tsbuildinfo +0 -1
- package/tsdown.config.ts +0 -7
package/src/lib/types.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { HttpAdapterHost } from '@nestjs/core'
|
|
2
|
-
import type { Action, SilkweaveContext, SilkweaveOptions } from '@silkweave/core'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Context passed to a Nest Silkweave adapter when `SilkweaveModule` wires it
|
|
6
|
-
* up. Adapters register their routes directly on `httpAdapter` (no
|
|
7
|
-
* placeholder middleware, no `silkweave()` builder), so they only fire
|
|
8
|
-
* `register()` once and own the rest of their lifecycle implicitly through
|
|
9
|
-
* Nest.
|
|
10
|
-
*/
|
|
11
|
-
export interface NestAdapterRegisterContext {
|
|
12
|
-
/** Nest's underlying HTTP adapter (Express or Fastify). */
|
|
13
|
-
httpAdapter: NonNullable<HttpAdapterHost['httpAdapter']>
|
|
14
|
-
/** Identity the adapter surfaces to clients (e.g. MCP server name). */
|
|
15
|
-
silkweaveOptions: SilkweaveOptions
|
|
16
|
-
/** Per-adapter context - already forked with `{ adapter: adapter.name, ...userContext }`. */
|
|
17
|
-
baseContext: SilkweaveContext
|
|
18
|
-
/** Actions filtered to those enabled on this adapter. */
|
|
19
|
-
actions: Action[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* A Silkweave Nest adapter. Each transport (REST, tRPC, MCP) implements this
|
|
24
|
-
* shape. `register()` is called from `SilkweaveModule.configure()` - which
|
|
25
|
-
* runs *before* Nest's controller routes are mapped - so adapter routes
|
|
26
|
-
* always sit ahead of any catch-all controllers in the framework's request
|
|
27
|
-
* pipeline.
|
|
28
|
-
*/
|
|
29
|
-
export interface NestSilkweaveAdapter {
|
|
30
|
-
/** Adapter discriminator - set on the silkweave context as `ctx.get('adapter')`. */
|
|
31
|
-
readonly name: 'rest' | 'trpc' | 'mcp' | 'typegen'
|
|
32
|
-
/**
|
|
33
|
-
* URL prefix the adapter mounts on (e.g. `'/api'`). Surfaced for introspection
|
|
34
|
-
* tooling such as `addSilkweaveActions()` (OpenAPI/Swagger), which reads it to
|
|
35
|
-
* keep generated docs aligned with the live routes.
|
|
36
|
-
*/
|
|
37
|
-
readonly basePath?: string
|
|
38
|
-
/**
|
|
39
|
-
* When `true`, the adapter receives every discovered action regardless of
|
|
40
|
-
* each action's `transports` allowlist / `isEnabled` gate. Used by
|
|
41
|
-
* non-runtime adapters like `typegen()` that emit types for the entire
|
|
42
|
-
* action surface.
|
|
43
|
-
*/
|
|
44
|
-
readonly allActions?: boolean
|
|
45
|
-
/** Register this adapter's routes on Nest's HTTP server. */
|
|
46
|
-
register(ctx: NestAdapterRegisterContext): void
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface SilkweaveModuleOptions {
|
|
50
|
-
/** Identity for the silkweave instance - surfaced to MCP clients, OpenAPI, etc. */
|
|
51
|
-
silkweave: SilkweaveOptions
|
|
52
|
-
/** Adapters to mount. Examples: `rest()`, `trpc()`, `mcp()`. */
|
|
53
|
-
adapters: NestSilkweaveAdapter[]
|
|
54
|
-
/** Initial context keys merged into every adapter's `baseContext`. */
|
|
55
|
-
context?: Record<string, unknown>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const SILKWEAVE_MODULE_OPTIONS = '__silkweave_module_options__'
|
package/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"lib": ["ES2022"],
|
|
7
|
-
"outDir": "build",
|
|
8
|
-
"rootDir": "src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"composite": true,
|
|
16
|
-
"declaration": true,
|
|
17
|
-
"declarationMap": true,
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"experimentalDecorators": true,
|
|
20
|
-
"emitDecoratorMetadata": true,
|
|
21
|
-
"useDefineForClassFields": false
|
|
22
|
-
},
|
|
23
|
-
"include": ["src"],
|
|
24
|
-
"exclude": ["node_modules", "build"]
|
|
25
|
-
}
|