@common-stack/client-core
Advanced tools
Comparing version 0.6.1-alpha.4 to 3.0.1-alpha.0
@@ -1,1 +0,1 @@ | ||
export {}; | ||
import 'jest'; |
@@ -1,2 +0,1 @@ | ||
export * from './apollo-client-feature'; | ||
export * from './base-client-feature'; | ||
export * from './abstract-connector'; |
import { ApolloClient } from '@apollo/client/core'; | ||
import { interfaces } from 'inversify'; | ||
import { ApolloClientFeature } from '../connector'; | ||
export declare const onAppCreate: (modules: ApolloClientFeature, entryModule: NodeModule) => Promise<void>; | ||
import { IFeature } from '../interfaces'; | ||
/** | ||
@@ -9,9 +8,7 @@ * Helper method to produce ApolloClient and Services from the feeded Feature Module. | ||
*/ | ||
export declare const apolloClientHelper: (modules: ApolloClientFeature) => { | ||
export declare const apolloClientHelper: (modules: IFeature) => { | ||
client: ApolloClient<any>; | ||
dataIdFromObject: (result: any) => any; | ||
services: { | ||
[key: string]: unknown; | ||
}; | ||
services: any; | ||
container: interfaces.Container; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import {ApolloClient}from'@apollo/client/core';import {InMemoryCache}from'@apollo/client/cache';import {ContainerModule}from'inversify';import {logger}from'@cdm-logger/client';import {ClientTypes}from'@common-stack/core';class UtilityClass { | ||
import {ApolloClient}from'@apollo/client/core';import {InMemoryCache}from'@apollo/client/cache';import {logger}from'@cdm-logger/client';import {ClientTypes}from'@common-stack/core';class UtilityClass { | ||
constructor(modules) { | ||
@@ -9,37 +9,2 @@ this.modules = modules; | ||
} | ||
const onAppCreate = async (modules, entryModule) => { | ||
const clientState = modules.getStateParams({ resolverContex: () => modules.createService({}, {}) }); | ||
const dataIdFromObject = (result) => modules.getDataIdFromObject(result); | ||
const cache = new InMemoryCache({ | ||
dataIdFromObject, | ||
possibleTypes: clientState.possibleTypes, | ||
}); | ||
const schema = ``; | ||
const params = { | ||
cache, | ||
queryDeduplication: true, | ||
typeDefs: schema.concat(clientState.typeDefs), | ||
resolvers: clientState.resolvers, | ||
}; | ||
const client = new ApolloClient(params); | ||
clientState.defaults.map((x) => { | ||
if (x.type === 'query') { | ||
cache.writeQuery(x); | ||
} | ||
else if (x.type === 'fragment') { | ||
cache.writeFragment(x); | ||
} | ||
}); | ||
const utility = new UtilityClass(modules); | ||
// additional bindings to container | ||
const additionalContainerFunc = () => new ContainerModule((bind) => { | ||
bind(ClientTypes.Logger).toConstantValue(logger); | ||
bind(ClientTypes.UtilityClass).toConstantValue(utility); | ||
bind(ClientTypes.ApolloClient).toConstantValue(client); | ||
bind(ClientTypes.InMemoryCache).toConstantValue(cache); | ||
}); | ||
modules.loadContainers({}, [additionalContainerFunc]); | ||
const services = modules.createService({}); | ||
client.container = services; | ||
}; | ||
/** | ||
@@ -54,3 +19,3 @@ * Helper method to produce ApolloClient and Services from the feeded Feature Module. | ||
dataIdFromObject, | ||
possibleTypes: clientState.possibleTypes, | ||
possibleTypes: clientState.possibleTypes | ||
}); | ||
@@ -65,3 +30,3 @@ const schema = ``; | ||
const client = new ApolloClient(params); | ||
clientState.defaults.map((x) => { | ||
clientState.defaults.map(x => { | ||
if (x.type === 'query') { | ||
@@ -76,3 +41,3 @@ cache.writeQuery(x); | ||
// additional bindings to container | ||
const container = modules.loadContainers({}); | ||
const container = modules.createContainers({}); | ||
container.bind(ClientTypes.Logger).toConstantValue(logger); | ||
@@ -90,2 +55,2 @@ container.bind(ClientTypes.UtilityClass).toConstantValue(utility); | ||
}; | ||
};export{apolloClientHelper,onAppCreate};//# sourceMappingURL=apollo-client-test-helper.js.map | ||
};export{apolloClientHelper};//# sourceMappingURL=apollo-client-test-helper.js.map |
@@ -1,1 +0,1 @@ | ||
export{logger}from'./logger/logger.js';export{ApolloClientFeature}from'./connector/apollo-client-feature.js';export{BaseClientFeature}from'./connector/base-client-feature.js';export{REDUX_PERSIST_KEY}from'./constants/constants.js';export{apolloClientHelper,onAppCreate}from'./helpers/apollo-client-test-helper.js';export{ClientTypes,ElectronTypes}from'@common-stack/core';//# sourceMappingURL=index.js.map | ||
export{logger}from'./logger/logger.js';export{AbstractFeature,featureCatalog}from'./connector/abstract-connector.js';export{REDUX_PERSIST_KEY}from'./constants/constants.js';export{apolloClientHelper}from'./helpers/apollo-client-test-helper.js';export{ClientTypes,ElectronTypes}from'@common-stack/core';//# sourceMappingURL=index.js.map |
@@ -1,3 +0,1 @@ | ||
export * from './apollo-client-feature'; | ||
export * from './base-client-feature'; | ||
export * from './client-feature'; | ||
export * from './connector'; |
{ | ||
"name": "@common-stack/client-core", | ||
"version": "0.6.1-alpha.4", | ||
"version": "3.0.1-alpha.0", | ||
"description": "common core for higher packages to depend on", | ||
@@ -22,3 +22,3 @@ "license": "ISC", | ||
"dependencies": { | ||
"@common-stack/core": "0.6.1-alpha.4" | ||
"@common-stack/core": "3.0.1-alpha.0" | ||
}, | ||
@@ -35,3 +35,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "8f1002595ef0da183fc26d37a4a185b9c94cfc76" | ||
"gitHead": "2c5be38e54fcffe218106da86a39bf5c253e504d" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43663
698
29
1
+ Added@common-stack/core@3.0.1-alpha.0(transitive)
- Removed@common-stack/core@0.6.1-alpha.4(transitive)
- Removedfractal-objects@0.10.4(transitive)