MessagesForMacintosh/JS/node_modules/apollo-boost/lib/bundle.umd.js.map

1 line
9.9 KiB
Plaintext

{"version":3,"sources":["../src/index.ts"],"names":["ApolloClient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAM,kBAAkB,GAAG,CACzB,SADyB,EAEzB,KAFyB,EAGzB,aAHyB,EAIzB,SAJyB,EAKzB,OALyB,EAMzB,cANyB,EAOzB,aAPyB,EAQzB,SARyB,EASzB,gBATyB,EAUzB,OAVyB,EAWzB,MAXyB,EAYzB,SAZyB,EAazB,WAbyB,EAczB,UAdyB,EAezB,iBAfyB,CAA3B;;AAkBA,MAAA,aAAA,GAAA,UAAA,MAAA,EAAA;AAAmDA,0BAAAA,aAAAA,EAAAA,MAAAA;;AACjD,aAAA,aAAA,CAAY,MAAZ,EAAqC;AAAzB,UAAA,MAAA,KAAA,KAAA,CAAA,EAAA;AAAA,QAAA,MAAA,GAAA,EAAA;AAAyB;;AAArC,UAAA,KAAA,GAAA,IAAA;;AACE,UAAI,MAAJ,EAAY;AACV,YAAM,IAAI,GAAG,MAAM,CAAC,IAAP,CAAY,MAAZ,EAAoB,MAApB,CACX,UAAA,GAAA,EAAG;AAAI,iBAAA,kBAAkB,CAAC,OAAnB,CAA2B,GAA3B,MAAoC,CAAC,CAArC;AAAsC,SADlC,CAAb;;AAIA,YAAI,IAAI,CAAC,MAAL,GAAc,CAAlB,EAAqB;AACnB,UAAA,OAAA,CAAA,GAAA,CAAA,QAAA,KAAA,YAAA,IAAA,uBAAA,IAAA,CAAA,4DAEI,KAAG,IAAI,CAAC,IAAL,CAAU,GAAV,CAFP,CAAA,CAAA;AAID;AACF;;AAGC,UAAA,OAAA,GAAA,MAAA,CAAA,OAAA;AAAA,UACA,GAAA,GAAA,MAAA,CAAA,GADA;AAAA,UAEA,WAAA,GAAA,MAAA,CAAA,WAFA;AAAA,UAGA,OAAA,GAAA,MAAA,CAAA,OAHA;AAAA,UAIA,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,EAAE,YAAY,IAAI,EAHF;AAI5B,QAAA,WAAW,EAAE,WAAW,IAAI,aAJA;AAK5B,QAAA,OAAO,EAAE,OAAO,IAAI;AALQ,OAAb,CAAjB;;AAQA,UAAM,IAAI,GAAG,uBAAW,IAAX,CAAgB,CAAC,SAAD,EAAY,cAAZ,EAA4B,QAA5B,EAAsC,MAAtC,CAC3B,UAAA,CAAA,EAAC;AAAI,eAAA,CAAC,CAAC,CAAF;AAAG,OADmB,CAAhB,CAAb;;AAIA,UAAI,eAAe,GAAG,SAAtB;AACA,UAAI,cAAc,GAAG,QAArB;AACA,UAAI,qBAAqB,GAAG,eAA5B;;AACA,UAAI,WAAJ,EAAiB;AACf,YAAI,WAAW,CAAC,QAAhB,EAA0B;AACxB,UAAA,KAAK,CAAC,SAAN,CAAgB;AACd,YAAA,IAAI,EAAE,WAAW,CAAC;AADJ,WAAhB;AAGD;;AACD,QAAA,eAAe,GAAG,WAAW,CAAC,SAA9B;AACA,QAAA,cAAc,GAAG,WAAW,CAAC,QAA7B;AACA,QAAA,qBAAqB,GAAG,WAAW,CAAC,eAApC;AACD;;AAGD,MAAA,KAAA,GAAA,MAAA,CAAA,IAAA,CAAA,IAAA,EAAM;AACJ,QAAA,KAAK,EAAA,KADD;AAEJ,QAAA,IAAI,EAAA,IAFA;AAGJ,QAAA,IAAI,EAAA,IAHA;AAIJ,QAAA,OAAO,EAAA,OAJH;AAKJ,QAAA,SAAS,EAAE,eALP;AAMJ,QAAA,QAAQ,EAAE,cANN;AAOJ,QAAA,eAAe,EAAE;AAPb,OAAN,KAQS,IART;;AASD;;AACH,WAAA,aAAA;AA9HA,GAAA,CAAmDA,qBAAnD,CAAA","sourcesContent":["/* necessary for backward compat */\nexport * from 'apollo-client';\nexport * from 'apollo-link';\nexport * from 'apollo-cache-inmemory';\n\nimport { Operation, ApolloLink, Observable } from 'apollo-link';\nimport { HttpLink, UriFunction } from 'apollo-link-http';\nimport { onError, ErrorLink } from 'apollo-link-error';\nimport { ApolloCache } from 'apollo-cache';\nimport { InMemoryCache, CacheResolverMap } from 'apollo-cache-inmemory';\nimport gql from 'graphql-tag';\nimport ApolloClient, {\n Resolvers,\n LocalStateFragmentMatcher,\n} from 'apollo-client';\nimport { DocumentNode } from 'graphql';\nimport { invariant } from 'ts-invariant';\n\nexport { gql, HttpLink };\n\ntype ClientStateConfig = {\n cache?: ApolloCache<any>;\n defaults?: Record<string, any>;\n resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n fragmentMatcher?: LocalStateFragmentMatcher;\n};\n\nexport interface PresetConfig {\n request?: (operation: Operation) => Promise<void> | void;\n uri?: string | UriFunction;\n credentials?: string;\n headers?: any;\n fetch?: WindowOrWorkerGlobalScope['fetch'];\n fetchOptions?: HttpLink.Options;\n clientState?: ClientStateConfig;\n onError?: ErrorLink.ErrorHandler;\n cacheRedirects?: CacheResolverMap;\n cache?: ApolloCache<any>;\n name?: string;\n version?: string;\n resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n fragmentMatcher?: LocalStateFragmentMatcher;\n assumeImmutableResults?: boolean;\n}\n\n// Yes, these are the exact same as the `PresetConfig` interface. We're\n// defining these again so they can be used to verify that valid config\n// options are being used in the `DefaultClient` constructor, for clients\n// that aren't using Typescript. This duplication is unfortunate, and at\n// some point can likely be adjusted so these items are inferred from\n// the `PresetConfig` interface using a Typescript transform at compilation\n// time. Unfortunately, TS transforms with rollup don't appear to be quite\n// working properly, so this will have to be re-visited at some point.\n// For now, when updating the properties of the `PresetConfig` interface,\n// please also update this constant.\nconst PRESET_CONFIG_KEYS = [\n 'request',\n 'uri',\n 'credentials',\n 'headers',\n 'fetch',\n 'fetchOptions',\n 'clientState',\n 'onError',\n 'cacheRedirects',\n 'cache',\n 'name',\n 'version',\n 'resolvers',\n 'typeDefs',\n 'fragmentMatcher',\n];\n\nexport default class DefaultClient<TCache> extends ApolloClient<TCache> {\n constructor(config: PresetConfig = {}) {\n if (config) {\n const diff = Object.keys(config).filter(\n key => PRESET_CONFIG_KEYS.indexOf(key) === -1,\n );\n\n if (diff.length > 0) {\n invariant.warn(\n 'ApolloBoost was initialized with unsupported options: ' +\n `${diff.join(' ')}`,\n );\n }\n }\n\n const {\n request,\n uri,\n credentials,\n headers,\n fetch,\n fetchOptions,\n clientState,\n cacheRedirects,\n onError: errorCallback,\n name,\n version,\n resolvers,\n typeDefs,\n fragmentMatcher,\n } = config;\n\n let { cache } = config;\n\n invariant(\n !cache || !cacheRedirects,\n 'Incompatible cache configuration. When not providing `cache`, ' +\n 'configure the provided instance with `cacheRedirects` instead.',\n );\n\n if (!cache) {\n cache = cacheRedirects\n ? new InMemoryCache({ cacheRedirects })\n : new InMemoryCache();\n }\n\n const errorLink = errorCallback\n ? onError(errorCallback)\n : onError(({ graphQLErrors, networkError }) => {\n if (graphQLErrors) {\n graphQLErrors.forEach(({ message, locations, path }) =>\n // tslint:disable-next-line\n invariant.warn(\n `[GraphQL error]: Message: ${message}, Location: ` +\n `${locations}, Path: ${path}`,\n ),\n );\n }\n if (networkError) {\n // tslint:disable-next-line\n invariant.warn(`[Network error]: ${networkError}`);\n }\n });\n\n const requestHandler = request\n ? new ApolloLink(\n (operation, forward) =>\n new Observable(observer => {\n let handle: any;\n Promise.resolve(operation)\n .then(oper => request(oper))\n .then(() => {\n handle = forward(operation).subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n })\n .catch(observer.error.bind(observer));\n\n return () => {\n if (handle) {\n handle.unsubscribe();\n }\n };\n }),\n )\n : false;\n\n const httpLink = new HttpLink({\n uri: uri || '/graphql',\n fetch,\n fetchOptions: fetchOptions || {},\n credentials: credentials || 'same-origin',\n headers: headers || {},\n });\n\n const link = ApolloLink.from([errorLink, requestHandler, httpLink].filter(\n x => !!x,\n ) as ApolloLink[]);\n\n let activeResolvers = resolvers;\n let activeTypeDefs = typeDefs;\n let activeFragmentMatcher = fragmentMatcher;\n if (clientState) {\n if (clientState.defaults) {\n cache.writeData({\n data: clientState.defaults,\n });\n }\n activeResolvers = clientState.resolvers;\n activeTypeDefs = clientState.typeDefs;\n activeFragmentMatcher = clientState.fragmentMatcher;\n }\n\n // super hacky, we will fix the types eventually\n super({\n cache,\n link,\n name,\n version,\n resolvers: activeResolvers,\n typeDefs: activeTypeDefs,\n fragmentMatcher: activeFragmentMatcher,\n } as any);\n }\n}\n"]}