@lssm/lib.graphql-federation 1.7.3 → 1.9.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 +40 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @lssm/lib.graphql-federation
|
|
2
|
+
|
|
3
|
+
GraphQL Federation utilities for Pothos.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
To enable Apollo Federation support for Pothos schemas. This package configures the `@pothos/plugin-federation` and provides helpers for defining entities and resolving references.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @lssm/lib.graphql-federation
|
|
13
|
+
# or
|
|
14
|
+
bun add @lssm/lib.graphql-federation
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Key Concepts
|
|
18
|
+
|
|
19
|
+
- **Federation**: Apollo Federation V2 support.
|
|
20
|
+
- **Entities**: defining `key` fields and `resolveReference` methods.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { builder } from '@lssm/lib.graphql-core';
|
|
26
|
+
import '@lssm/lib.graphql-federation'; // Side-effect import to register plugin if needed, or use factory
|
|
27
|
+
|
|
28
|
+
builder.asEntity(User, {
|
|
29
|
+
key: builder.selection<{ id: string }>('id'),
|
|
30
|
+
resolveReference: (ref) => getUser(ref.id),
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.graphql-federation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Pothos federation helpers and subgraph schema export utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"graphql": ">=16.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@lssm/tool.tsdown": "
|
|
28
|
-
"tsdown": "^0.
|
|
27
|
+
"@lssm/tool.tsdown": "workspace:*",
|
|
28
|
+
"tsdown": "^0.16.6",
|
|
29
29
|
"typescript": "^5.9.3"
|
|
30
30
|
},
|
|
31
31
|
"type": "module",
|
|
32
32
|
"module": "./dist/index.js",
|
|
33
33
|
"exports": {
|
|
34
|
-
".": "./
|
|
34
|
+
".": "./dist/index.js",
|
|
35
35
|
"./*": "./*"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|