@common-stack/server-stack 7.0.4-alpha.9 → 7.1.1-alpha.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/lib/MainStackServer.cjs +6 -3
- package/lib/MainStackServer.cjs.map +1 -1
- package/lib/MainStackServer.d.ts +2 -1
- package/lib/MainStackServer.mjs +6 -3
- package/lib/MainStackServer.mjs.map +1 -1
- package/lib/api/root-schema.graphqls.cjs +1 -1
- package/lib/api/root-schema.graphqls.mjs +1 -1
- package/lib/api/sub-graph-schema-builder.cjs +149 -0
- package/lib/api/sub-graph-schema-builder.cjs.map +1 -0
- package/lib/api/sub-graph-schema-builder.d.ts +24 -0
- package/lib/api/sub-graph-schema-builder.mjs +149 -0
- package/lib/api/sub-graph-schema-builder.mjs.map +1 -0
- package/lib/interfaces/graphql-request-context.d.ts +1 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/invalidateCachePlugin.cjs +31 -18
- package/lib/plugins/invalidateCachePlugin.cjs.map +1 -1
- package/lib/plugins/invalidateCachePlugin.mjs +31 -18
- package/lib/plugins/invalidateCachePlugin.mjs.map +1 -1
- package/lib/plugins/invalidateCachePlugin.test.d.ts +1 -0
- package/lib/plugins/response-cache-plugin.test.d.ts +1 -0
- package/lib/plugins/responseCachePlugin.cjs +64 -0
- package/lib/plugins/responseCachePlugin.cjs.map +1 -0
- package/lib/plugins/responseCachePlugin.d.ts +12 -0
- package/lib/plugins/responseCachePlugin.mjs +64 -0
- package/lib/plugins/responseCachePlugin.mjs.map +1 -0
- package/lib/servers/GraphqlServer.cjs +2 -48
- package/lib/servers/GraphqlServer.cjs.map +1 -1
- package/lib/servers/GraphqlServer.mjs +2 -48
- package/lib/servers/GraphqlServer.mjs.map +1 -1
- package/lib/utils/add-shareable-directive-to-schema.cjs +44 -0
- package/lib/utils/add-shareable-directive-to-schema.cjs.map +1 -0
- package/lib/utils/add-shareable-directive-to-schema.d.ts +1 -0
- package/lib/utils/add-shareable-directive-to-schema.mjs +44 -0
- package/lib/utils/add-shareable-directive-to-schema.mjs.map +1 -0
- package/lib/utils/add-shareable-directive-to-schema.test.d.ts +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/package.json +8 -7
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {parse,visit,Kind,print}from'graphql';const addShareableDirectiveToSchema = (schemaString) => {
|
|
2
|
+
const ast = parse(schemaString);
|
|
3
|
+
const modifiedAst = visit(ast, {
|
|
4
|
+
ObjectTypeDefinition(node) {
|
|
5
|
+
// Add @shareable directive to each type
|
|
6
|
+
const shareableDirective = {
|
|
7
|
+
kind: Kind.DIRECTIVE,
|
|
8
|
+
name: { kind: Kind.NAME, value: 'shareable' },
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
...node,
|
|
12
|
+
directives: [...(node.directives || []), shareableDirective],
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
ObjectTypeExtension(node) {
|
|
16
|
+
// Add @shareable directive to each extended type
|
|
17
|
+
const shareableDirective = {
|
|
18
|
+
kind: Kind.DIRECTIVE,
|
|
19
|
+
name: { kind: Kind.NAME, value: 'shareable' },
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
...node,
|
|
23
|
+
directives: [...(node.directives || []), shareableDirective],
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
FieldDefinition(node, _key, _parent, _path, ancestors) {
|
|
27
|
+
// Get the parent type definition from ancestors
|
|
28
|
+
const parent = ancestors[2];
|
|
29
|
+
// @ts-expect-error - parent is an object, but we need to check if it has a kind property
|
|
30
|
+
if (parent?.kind === Kind.OBJECT_TYPE_DEFINITION && parent.name.value === 'Query') {
|
|
31
|
+
const shareableDirective = {
|
|
32
|
+
kind: Kind.DIRECTIVE,
|
|
33
|
+
name: { kind: Kind.NAME, value: 'shareable' },
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
...node,
|
|
37
|
+
directives: [...(node.directives || []), shareableDirective],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return node;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return print(modifiedAst);
|
|
44
|
+
};export{addShareableDirectiveToSchema};//# sourceMappingURL=add-shareable-directive-to-schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-shareable-directive-to-schema.mjs","sources":["../../src/utils/add-shareable-directive-to-schema.ts"],"sourcesContent":[null],"names":[],"mappings":"6CAEa,MAAA,6BAA6B,GAAG,CAAC,YAAoB,KAAI;AAClE,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAEhC,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,EAAE;AAC3B,QAAA,oBAAoB,CAAC,IAAI,EAAA;;AAErB,YAAA,MAAM,kBAAkB,GAAG;gBACvB,IAAI,EAAE,IAAI,CAAC,SAAS;gBACpB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE;aAChD,CAAC;YAEF,OAAO;AACH,gBAAA,GAAG,IAAI;AACP,gBAAA,UAAU,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,kBAAkB,CAAC;aAC/D,CAAC;SACL;AACD,QAAA,mBAAmB,CAAC,IAAI,EAAA;;AAEpB,YAAA,MAAM,kBAAkB,GAAG;gBACvB,IAAI,EAAE,IAAI,CAAC,SAAS;gBACpB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE;aAChD,CAAC;YAEF,OAAO;AACH,gBAAA,GAAG,IAAI;AACP,gBAAA,UAAU,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,kBAAkB,CAAC;aAC/D,CAAC;SACL;QACD,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAA;;AAEjD,YAAA,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;;AAE5B,YAAA,IAAI,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC,sBAAsB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE;AAC/E,gBAAA,MAAM,kBAAkB,GAAG;oBACvB,IAAI,EAAE,IAAI,CAAC,SAAS;oBACpB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE;iBAChD,CAAC;gBAEF,OAAO;AACH,oBAAA,GAAG,IAAI;AACP,oBAAA,UAAU,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,kBAAkB,CAAC;iBAC/D,CAAC;aACL;AACD,YAAA,OAAO,IAAI,CAAC;SACf;AACJ,KAAA,CAAC,CAAC;AAEH,IAAA,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/server-stack",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1-alpha.3",
|
|
4
4
|
"description": "common core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -26,16 +26,17 @@
|
|
|
26
26
|
"@apollo/datasource-rest": "^6.3.0",
|
|
27
27
|
"@apollo/server": "^4.10.4",
|
|
28
28
|
"@apollo/server-plugin-response-cache": "^4.1.3",
|
|
29
|
+
"@apollo/subgraph": "^2.7.1",
|
|
29
30
|
"@apollo/utils.keyvadapter": "^3.1.0",
|
|
30
31
|
"@casl/ability": "^4.1.5",
|
|
31
32
|
"@cdm-logger/client": "^9.0.3",
|
|
32
33
|
"@cdm-logger/server": "^9.0.3",
|
|
33
34
|
"@cdmbase/graphql-type-uri": "^4.0.0",
|
|
34
|
-
"@common-stack/cache-api-server": "7.0.4-alpha.
|
|
35
|
-
"@common-stack/client-core": "7.
|
|
36
|
-
"@common-stack/core": "7.0.4-alpha.
|
|
37
|
-
"@common-stack/server-core": "7.0.4-alpha.
|
|
38
|
-
"@common-stack/store-mongo": "7.0.4-alpha.
|
|
35
|
+
"@common-stack/cache-api-server": "7.0.4-alpha.17",
|
|
36
|
+
"@common-stack/client-core": "7.1.1-alpha.3",
|
|
37
|
+
"@common-stack/core": "7.0.4-alpha.17",
|
|
38
|
+
"@common-stack/server-core": "7.0.4-alpha.17",
|
|
39
|
+
"@common-stack/store-mongo": "7.0.4-alpha.17",
|
|
39
40
|
"@graphql-tools/links": "~9.0.1",
|
|
40
41
|
"@graphql-tools/schema": "~10.0.6",
|
|
41
42
|
"@graphql-tools/stitch": "~9.2.10",
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
"publishConfig": {
|
|
89
90
|
"access": "public"
|
|
90
91
|
},
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "957549af03185aa8c04c216f68db9ab6251f2d0d",
|
|
92
93
|
"typescript": {
|
|
93
94
|
"definition": "lib/index.d.ts"
|
|
94
95
|
}
|