@things-factory/shell 7.0.0-alpha.9 → 7.0.1-alpha.1
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.
@@ -20,9 +20,6 @@ const defaultOptions = {
|
|
20
20
|
errorPolicy: 'all'
|
21
21
|
}
|
22
22
|
};
|
23
|
-
const cache = new client_1.InMemoryCache({
|
24
|
-
addTypename: false
|
25
|
-
});
|
26
23
|
/**
|
27
24
|
* GraphqlLocalClient is a utility class for initializing an Apollo Client for a local GraphQL schema.
|
28
25
|
* It provides a static `init` method for setting up the client with a schema and an app context.
|
@@ -35,6 +32,9 @@ class GraphqlLocalClient {
|
|
35
32
|
* @param {object} app - The application context to be passed in as part of the execution context.
|
36
33
|
*/
|
37
34
|
static init(schema, app) {
|
35
|
+
const cache = new client_1.InMemoryCache({
|
36
|
+
addTypename: false
|
37
|
+
});
|
38
38
|
GraphqlLocalClient.client = new client_1.ApolloClient({
|
39
39
|
defaultOptions,
|
40
40
|
cache,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"graphql-local-client.js","sourceRoot":"","sources":["../server/graphql-local-client.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2CAAmF;AACnF,uDAAuD;AAEvD,MAAM,cAAc,GAAQ;IAC1B,UAAU,EAAE;QACV,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,QAAQ;KACtB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,KAAK;KACnB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,KAAK;KACnB;CACF,CAAA;AAED
|
1
|
+
{"version":3,"file":"graphql-local-client.js","sourceRoot":"","sources":["../server/graphql-local-client.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2CAAmF;AACnF,uDAAuD;AAEvD,MAAM,cAAc,GAAQ;IAC1B,UAAU,EAAE;QACV,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,QAAQ;KACtB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,KAAK;KACnB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,KAAK;KACnB;CACF,CAAA;AAED;;;GAGG;AACH,MAAa,kBAAkB;IAQ7B;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG;QACrB,MAAM,KAAK,GAAG,IAAI,sBAAa,CAAC;YAC9B,WAAW,EAAE,KAAK;SACnB,CAAC,CAAA;QAEF,kBAAkB,CAAC,MAAM,GAAG,IAAI,qBAAY,CAAC;YAC3C,cAAc;YACd,KAAK;YACL,IAAI,EAAE,IAAI,mBAAU,CAAC;gBACnB,MAAM;gBACN,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;oBACpC,uCACK,GAAG,CAAC,UAAU,EAAE,KACnB,GAAG,IACJ;gBACH,CAAC;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF;AAjCD,gDAiCC","sourcesContent":["/**\n * Apollo Client configuration for a local GraphQL schema.\n * This class provides a static method `init` to initialize the client with a schema and an app context.\n */\nimport { ApolloClient, InMemoryCache, NormalizedCacheObject } from '@apollo/client'\nimport { SchemaLink } from '@apollo/client/link/schema'\n\nconst defaultOptions: any = {\n watchQuery: {\n fetchPolicy: 'no-cache',\n errorPolicy: 'ignore'\n },\n query: {\n fetchPolicy: 'no-cache',\n errorPolicy: 'all'\n },\n mutate: {\n errorPolicy: 'all'\n }\n}\n\n/**\n * GraphqlLocalClient is a utility class for initializing an Apollo Client for a local GraphQL schema.\n * It provides a static `init` method for setting up the client with a schema and an app context.\n */\nexport class GraphqlLocalClient {\n /**\n * Apollo Client instance for local GraphQL schema.\n * @static\n * @type {ApolloClient<NormalizedCacheObject>}\n */\n static client: ApolloClient<NormalizedCacheObject>\n\n /**\n * Initializes the Apollo Client for a local GraphQL schema.\n * @static\n * @param {object} schema - The GraphQL schema to use.\n * @param {object} app - The application context to be passed in as part of the execution context.\n */\n static init(schema, app) {\n const cache = new InMemoryCache({\n addTypename: false\n })\n\n GraphqlLocalClient.client = new ApolloClient({\n defaultOptions,\n cache,\n link: new SchemaLink({\n schema,\n context: (obj, args, context, info) => {\n return {\n ...obj.getContext(),\n app\n }\n }\n })\n })\n }\n}\n"]}
|