@contractspec/lib.graphql-federation 1.57.0 → 1.58.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/dist/browser/index.js +21 -0
- package/dist/index.d.ts +5 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -16
- package/dist/node/index.js +21 -0
- package/package.json +19 -12
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import"@pothos/plugin-federation";
|
|
3
|
+
import { printSubgraphSchema } from "@apollo/subgraph";
|
|
4
|
+
function toSubgraphSDL(schema) {
|
|
5
|
+
return printSubgraphSchema(schema);
|
|
6
|
+
}
|
|
7
|
+
function withEntityObject(builder, name, keyFields, fields, resolveReference) {
|
|
8
|
+
const ref = builder.objectRef(name);
|
|
9
|
+
ref.implement({
|
|
10
|
+
fields
|
|
11
|
+
});
|
|
12
|
+
builder.entity(name, {
|
|
13
|
+
key: keyFields.join(" "),
|
|
14
|
+
resolveReference
|
|
15
|
+
});
|
|
16
|
+
return ref;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
withEntityObject,
|
|
20
|
+
toSubgraphSDL
|
|
21
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { SchemaTypes } from
|
|
2
|
-
import
|
|
3
|
-
import { GraphQLSchema } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare function toSubgraphSDL(schema: GraphQLSchema): string;
|
|
7
|
-
declare function withEntityObject<T extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<T>, name: string, keyFields: string[], fields: (t: any) => Record<string, any>, resolveReference: (ref: any, ctx: any) => Promise<any> | any): any;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { toSubgraphSDL, withEntityObject };
|
|
1
|
+
import { type SchemaTypes } from '@pothos/core';
|
|
2
|
+
import '@pothos/plugin-federation';
|
|
3
|
+
import type { GraphQLSchema } from 'graphql';
|
|
4
|
+
export declare function toSubgraphSDL(schema: GraphQLSchema): string;
|
|
5
|
+
export declare function withEntityObject<T extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<T>, name: string, keyFields: string[], fields: (t: any) => Record<string, any>, resolveReference: (ref: any, ctx: any) => Promise<any> | any): any;
|
|
10
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,UAElD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EACpD,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC,EAC3C,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EAAE,EACnB,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvC,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,OAW7D"}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/index.ts
|
|
3
|
+
import"@pothos/plugin-federation";
|
|
3
4
|
import { printSubgraphSchema } from "@apollo/subgraph";
|
|
4
|
-
|
|
5
|
-
//#region src/index.ts
|
|
6
5
|
function toSubgraphSDL(schema) {
|
|
7
|
-
|
|
6
|
+
return printSubgraphSchema(schema);
|
|
8
7
|
}
|
|
9
8
|
function withEntityObject(builder, name, keyFields, fields, resolveReference) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const ref = builder.objectRef(name);
|
|
10
|
+
ref.implement({
|
|
11
|
+
fields
|
|
12
|
+
});
|
|
13
|
+
builder.entity(name, {
|
|
14
|
+
key: keyFields.join(" "),
|
|
15
|
+
resolveReference
|
|
16
|
+
});
|
|
17
|
+
return ref;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export {
|
|
20
|
+
withEntityObject,
|
|
21
|
+
toSubgraphSDL
|
|
22
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import"@pothos/plugin-federation";
|
|
3
|
+
import { printSubgraphSchema } from "@apollo/subgraph";
|
|
4
|
+
function toSubgraphSDL(schema) {
|
|
5
|
+
return printSubgraphSchema(schema);
|
|
6
|
+
}
|
|
7
|
+
function withEntityObject(builder, name, keyFields, fields, resolveReference) {
|
|
8
|
+
const ref = builder.objectRef(name);
|
|
9
|
+
ref.implement({
|
|
10
|
+
fields
|
|
11
|
+
});
|
|
12
|
+
builder.entity(name, {
|
|
13
|
+
key: keyFields.join(" "),
|
|
14
|
+
resolveReference
|
|
15
|
+
});
|
|
16
|
+
return ref;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
withEntityObject,
|
|
20
|
+
toSubgraphSDL
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.graphql-federation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "Pothos federation helpers and subgraph schema export utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -18,9 +18,13 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
20
20
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
21
|
-
"build": "
|
|
22
|
-
"dev": "
|
|
23
|
-
"clean": "rm -rf dist"
|
|
21
|
+
"build": "bun run prebuild && bun run build:bundle && bun run build:types",
|
|
22
|
+
"dev": "contractspec-bun-build dev",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"prebuild": "contractspec-bun-build prebuild",
|
|
25
|
+
"build:bundle": "contractspec-bun-build transpile",
|
|
26
|
+
"build:types": "contractspec-bun-build types",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
24
28
|
},
|
|
25
29
|
"dependencies": {
|
|
26
30
|
"@pothos/core": "^4.9.1",
|
|
@@ -33,21 +37,24 @@
|
|
|
33
37
|
"graphql": ">=16.0.0"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
36
|
-
"@contractspec/tool.typescript": "1.
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"typescript": "^5.9.3"
|
|
40
|
+
"@contractspec/tool.typescript": "1.58.0",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
|
+
"@contractspec/tool.bun": "1.57.0"
|
|
40
43
|
},
|
|
41
44
|
"type": "module",
|
|
42
45
|
"exports": {
|
|
43
|
-
".": "./
|
|
44
|
-
"./*": "./*"
|
|
46
|
+
".": "./src/index.ts"
|
|
45
47
|
},
|
|
46
48
|
"publishConfig": {
|
|
47
49
|
"access": "public",
|
|
48
50
|
"exports": {
|
|
49
|
-
".":
|
|
50
|
-
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"bun": "./dist/index.js",
|
|
54
|
+
"node": "./dist/node/index.mjs",
|
|
55
|
+
"browser": "./dist/browser/index.js",
|
|
56
|
+
"default": "./dist/index.js"
|
|
57
|
+
}
|
|
51
58
|
},
|
|
52
59
|
"registry": "https://registry.npmjs.org/"
|
|
53
60
|
},
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { type SchemaTypes } from '@pothos/core';\nimport '@pothos/plugin-federation';\nimport { printSubgraphSchema } from '@apollo/subgraph';\nimport type { GraphQLSchema } from 'graphql';\n\nexport function toSubgraphSDL(schema: GraphQLSchema) {\n return printSubgraphSchema(schema);\n}\n\nexport function withEntityObject<T extends SchemaTypes>(\n builder: PothosSchemaTypes.SchemaBuilder<T>,\n name: string,\n keyFields: string[],\n fields: (t: any) => Record<string, any>,\n resolveReference: (ref: any, ctx: any) => Promise<any> | any\n) {\n const ref = (builder as any).objectRef(name);\n ref.implement({\n fields,\n });\n (builder as any).entity(name, {\n key: keyFields.join(' '),\n resolveReference,\n });\n return ref;\n}\n"],"mappings":";;;;;AAKA,SAAgB,cAAc,QAAuB;AACnD,QAAO,oBAAoB,OAAO;;AAGpC,SAAgB,iBACd,SACA,MACA,WACA,QACA,kBACA;CACA,MAAM,MAAO,QAAgB,UAAU,KAAK;AAC5C,KAAI,UAAU,EACZ,QACD,CAAC;AACF,CAAC,QAAgB,OAAO,MAAM;EAC5B,KAAK,UAAU,KAAK,IAAI;EACxB;EACD,CAAC;AACF,QAAO"}
|