object-graph.ts
1 import { AppStoreObjectGraph } from '@jet-app/app-store/foundation/runtime/app-store-object-graph'; 2 import { ObjectGraphType } from '@jet-app/app-store/gameservicesui/src/foundation/object-graph-types'; 3 4 import type { Dependencies } from './make-dependencies'; 5 import { WebFeatureFlags } from './feature-flags'; 6 import { WebMediaTokenService } from './media-token-service'; 7 8 export { ObjectGraphType }; 9 10 class AppStoreWebObjectGraph extends AppStoreObjectGraph { 11 /** 12 * Configures the ObjectGraph from our `Dependencies` definition 13 * 14 * @param dependencies 15 * @returns 16 */ 17 configureWithDependencies(dependencies: Dependencies) { 18 const { 19 bag, 20 client, 21 console, 22 host, 23 locale, 24 localization, 25 metricsIdentifiers, 26 net, 27 properties, 28 random, 29 seo, 30 storage, 31 user, 32 } = dependencies; 33 34 return this.addingClient(client) 35 .addingNetwork(net) 36 .addingHost(host) 37 .addingBag(bag) 38 .addingLoc(localization) 39 .addingMediaToken(new WebMediaTokenService()) 40 .addingConsole(console) 41 .addingAppleSilicon(undefined) 42 .addingProperties(properties) 43 .addingLocale(locale) 44 .addingUser(user) 45 .addingFeatureFlags(new WebFeatureFlags()) 46 .addingMetricsIdentifiers(metricsIdentifiers) 47 .addingSEO(seo) 48 .addingStorage(storage) 49 .addingRandom(random); 50 } 51 } 52 53 export function makeObjectGraph( 54 dependencies: Dependencies, 55 ): AppStoreObjectGraph { 56 const objectGraph = new AppStoreWebObjectGraph('app-store'); 57 58 return objectGraph.configureWithDependencies(dependencies); 59 }