@apollo/client-react-streaming
Advanced tools
Comparing version 0.0.0-commit-release.0.1716900818.5757a9c to 0.0.0-commit-release.0.1718009266.650f886
import * as _apollo_client_index_js from '@apollo/client/index.js'; | ||
import { WatchQueryOptions, QueryRef, ApolloClient as ApolloClient$1, OperationVariables, ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, Observable as Observable$1, ApolloClientOptions, DocumentNode } from '@apollo/client/index.js'; | ||
import { WatchQueryOptions, QueryRef, ApolloClient as ApolloClient$1, OperationVariables, ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, InMemoryCacheConfig, Observable as Observable$1, NormalizedCacheObject, DocumentNode, ApolloClientOptions } from '@apollo/client/index.js'; | ||
import React, { ReactNode } from 'react'; | ||
@@ -102,3 +102,3 @@ import { QueryOptions } from '@apollo/client'; | ||
interface PreloadQueryComponent { | ||
<TData, TVariables extends OperationVariables>(props: PreloadQueryProps<TData, TVariables>): React.ReactNode; | ||
<TData, TVariables extends OperationVariables>(props: PreloadQueryProps<TData, TVariables>): React.ReactElement; | ||
} | ||
@@ -254,2 +254,4 @@ | ||
declare const sourceSymbol: unique symbol; | ||
/** | ||
@@ -263,2 +265,12 @@ * A version of `InMemoryCache` to be used with streaming SSR. | ||
declare class InMemoryCache extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static readonly info: { | ||
pkg: string; | ||
}; | ||
[sourceSymbol]: string; | ||
constructor(config?: InMemoryCacheConfig | undefined); | ||
} | ||
@@ -351,3 +363,6 @@ | ||
}; | ||
declare class ApolloClientBase<TCacheShape> extends ApolloClient$1<TCacheShape> { | ||
interface WrappedApolloClientOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, "cache"> { | ||
cache: InMemoryCache; | ||
} | ||
declare class ApolloClientBase extends ApolloClient$1<NormalizedCacheObject> { | ||
/** | ||
@@ -360,9 +375,8 @@ * Information about the current package and it's export names, for use in error messages. | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
[sourceSymbol]: string; | ||
constructor(options: WrappedApolloClientOptions); | ||
} | ||
declare class ApolloClientClientBaseImpl<TCacheShape> extends ApolloClientBase<TCacheShape> { | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
declare class ApolloClientClientBaseImpl extends ApolloClientBase { | ||
constructor(options: WrappedApolloClientOptions); | ||
private simulatedStreamingQueries; | ||
@@ -389,3 +403,3 @@ private transportedQueryOptions; | ||
} | ||
declare class ApolloClientSSRImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientSSRImpl extends ApolloClientClientBaseImpl { | ||
private forwardedQueries; | ||
@@ -415,3 +429,3 @@ watchQueryQueue: { | ||
} | ||
declare class ApolloClientBrowserImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientBrowserImpl extends ApolloClientClientBaseImpl { | ||
} | ||
@@ -426,13 +440,13 @@ declare const ApolloClient_base: typeof ApolloClientBase; | ||
*/ | ||
declare class ApolloClient<TCacheShape> extends ApolloClient_base<TCacheShape> implements Partial<ApolloClientBrowserImpl<TCacheShape>>, Partial<ApolloClientSSRImpl<TCacheShape>> { | ||
declare class ApolloClient<Ignored = NormalizedCacheObject> extends ApolloClient_base implements Partial<ApolloClientBrowserImpl>, Partial<ApolloClientSSRImpl> { | ||
/** @internal */ | ||
onQueryStarted?: ApolloClientBrowserImpl<TCacheShape>["onQueryStarted"]; | ||
onQueryStarted?: ApolloClientBrowserImpl["onQueryStarted"]; | ||
/** @internal */ | ||
onQueryProgress?: ApolloClientBrowserImpl<TCacheShape>["onQueryProgress"]; | ||
onQueryProgress?: ApolloClientBrowserImpl["onQueryProgress"]; | ||
/** @internal */ | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQueries"]; | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl["rerunSimulatedQueries"]; | ||
/** @internal */ | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQuery"]; | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl["rerunSimulatedQuery"]; | ||
/** @internal */ | ||
watchQueryQueue?: ApolloClientSSRImpl<TCacheShape>["watchQueryQueue"]; | ||
watchQueryQueue?: ApolloClientSSRImpl["watchQueryQueue"]; | ||
} | ||
@@ -477,4 +491,2 @@ | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
@@ -481,0 +493,0 @@ } |
import * as _apollo_client_index_js from '@apollo/client/index.js'; | ||
import { ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, WatchQueryOptions, Observable as Observable$1, OperationVariables, ApolloClient as ApolloClient$1, ApolloClientOptions, DocumentNode, QueryRef } from '@apollo/client/index.js'; | ||
import { ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, InMemoryCacheConfig, WatchQueryOptions, Observable as Observable$1, NormalizedCacheObject, OperationVariables, ApolloClient as ApolloClient$1, DocumentNode, ApolloClientOptions, QueryRef } from '@apollo/client/index.js'; | ||
import { Observable } from '@apollo/client/utilities/index.js'; | ||
@@ -154,2 +154,4 @@ import React from 'react'; | ||
declare const sourceSymbol: unique symbol; | ||
/** | ||
@@ -163,2 +165,12 @@ * A version of `InMemoryCache` to be used with streaming SSR. | ||
declare class InMemoryCache extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static readonly info: { | ||
pkg: string; | ||
}; | ||
[sourceSymbol]: string; | ||
constructor(config?: InMemoryCacheConfig | undefined); | ||
} | ||
@@ -255,3 +267,6 @@ | ||
}; | ||
declare class ApolloClientBase<TCacheShape> extends ApolloClient$1<TCacheShape> { | ||
interface WrappedApolloClientOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, "cache"> { | ||
cache: InMemoryCache; | ||
} | ||
declare class ApolloClientBase extends ApolloClient$1<NormalizedCacheObject> { | ||
/** | ||
@@ -264,9 +279,8 @@ * Information about the current package and it's export names, for use in error messages. | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
[sourceSymbol]: string; | ||
constructor(options: WrappedApolloClientOptions); | ||
} | ||
declare class ApolloClientClientBaseImpl<TCacheShape> extends ApolloClientBase<TCacheShape> { | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
declare class ApolloClientClientBaseImpl extends ApolloClientBase { | ||
constructor(options: WrappedApolloClientOptions); | ||
private simulatedStreamingQueries; | ||
@@ -293,3 +307,3 @@ private transportedQueryOptions; | ||
} | ||
declare class ApolloClientSSRImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientSSRImpl extends ApolloClientClientBaseImpl { | ||
private forwardedQueries; | ||
@@ -319,3 +333,3 @@ watchQueryQueue: { | ||
} | ||
declare class ApolloClientBrowserImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientBrowserImpl extends ApolloClientClientBaseImpl { | ||
} | ||
@@ -330,13 +344,13 @@ declare const ApolloClient_base: typeof ApolloClientBase; | ||
*/ | ||
declare class ApolloClient<TCacheShape> extends ApolloClient_base<TCacheShape> implements Partial<ApolloClientBrowserImpl<TCacheShape>>, Partial<ApolloClientSSRImpl<TCacheShape>> { | ||
declare class ApolloClient<Ignored = NormalizedCacheObject> extends ApolloClient_base implements Partial<ApolloClientBrowserImpl>, Partial<ApolloClientSSRImpl> { | ||
/** @internal */ | ||
onQueryStarted?: ApolloClientBrowserImpl<TCacheShape>["onQueryStarted"]; | ||
onQueryStarted?: ApolloClientBrowserImpl["onQueryStarted"]; | ||
/** @internal */ | ||
onQueryProgress?: ApolloClientBrowserImpl<TCacheShape>["onQueryProgress"]; | ||
onQueryProgress?: ApolloClientBrowserImpl["onQueryProgress"]; | ||
/** @internal */ | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQueries"]; | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl["rerunSimulatedQueries"]; | ||
/** @internal */ | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQuery"]; | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl["rerunSimulatedQuery"]; | ||
/** @internal */ | ||
watchQueryQueue?: ApolloClientSSRImpl<TCacheShape>["watchQueryQueue"]; | ||
watchQueryQueue?: ApolloClientSSRImpl["watchQueryQueue"]; | ||
} | ||
@@ -381,4 +395,2 @@ | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
@@ -385,0 +397,0 @@ } |
@@ -143,3 +143,23 @@ import { ApolloLink, InMemoryCache as InMemoryCache$1, ApolloProvider, Observable as Observable$1, gql, ApolloClient as ApolloClient$1, useApolloClient } from '@apollo/client/index.js'; | ||
}; | ||
// src/bundleInfo.ts | ||
var bundle = { | ||
pkg: "@apollo/client-react-streaming" | ||
}; | ||
var sourceSymbol = Symbol.for("apollo.source_package"); | ||
// src/DataTransportAbstraction/WrappedInMemoryCache.tsx | ||
var InMemoryCache = class extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static info = bundle; | ||
[sourceSymbol]; | ||
constructor(config) { | ||
super(config); | ||
const info = this.constructor.info; | ||
this[sourceSymbol] = `${info.pkg}:InMemoryCache`; | ||
} | ||
}; | ||
@@ -265,8 +285,10 @@ var DataTransportContext = /* @__PURE__ */ createContext(null); | ||
// src/bundleInfo.ts | ||
var bundle = { | ||
pkg: "@apollo/client-react-streaming", | ||
client: "ApolloClient", | ||
cache: "InMemoryCache" | ||
}; | ||
// src/assertInstance.ts | ||
function assertInstance(value, info, name) { | ||
if (value[sourceSymbol] !== `${info.pkg}:${name}`) { | ||
throw new Error( | ||
`When using \`${name}\` in streaming SSR, you must use the \`${name}\` export provided by \`"${info.pkg}"\`.` | ||
); | ||
} | ||
} | ||
@@ -285,2 +307,3 @@ // src/DataTransportAbstraction/WrappedApolloClient.tsx | ||
static info = bundle; | ||
[sourceSymbol]; | ||
constructor(options) { | ||
@@ -290,7 +313,9 @@ super( | ||
); | ||
if (!(this.cache instanceof InMemoryCache)) { | ||
throw new Error( | ||
`When using \`InMemoryCache\` in streaming SSR, you must use the \`${this.constructor.info.cache}\` export provided by \`"${this.constructor.info.pkg}"\`.` | ||
); | ||
} | ||
const info = this.constructor.info; | ||
this[sourceSymbol] = `${info.pkg}:ApolloClient`; | ||
assertInstance( | ||
this.cache, | ||
info, | ||
"InMemoryCache" | ||
); | ||
} | ||
@@ -451,8 +476,10 @@ }; | ||
const clientRef = useRef(void 0); | ||
{ | ||
clientRef.current = window[ApolloClientSingleton] ??= makeClient(); | ||
} | ||
if (!(clientRef.current instanceof ApolloClient)) { | ||
throw new Error( | ||
`When using \`ApolloClient\` in streaming SSR, you must use the \`${WrappedApolloProvider3.info.client}\` export provided by \`"${WrappedApolloProvider3.info.pkg}"\`.` | ||
if (!clientRef.current) { | ||
{ | ||
clientRef.current = window[ApolloClientSingleton] ??= makeClient(); | ||
} | ||
assertInstance( | ||
clientRef.current, | ||
WrappedApolloProvider3.info, | ||
"ApolloClient" | ||
); | ||
@@ -459,0 +486,0 @@ } |
import * as _apollo_client_index_js from '@apollo/client/index.js'; | ||
import { WatchQueryOptions, QueryRef, ApolloClient as ApolloClient$1, OperationVariables, ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, Observable as Observable$1, ApolloClientOptions, DocumentNode } from '@apollo/client/index.js'; | ||
import { WatchQueryOptions, QueryRef, ApolloClient as ApolloClient$1, OperationVariables, ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, InMemoryCacheConfig, NormalizedCacheObject, Observable as Observable$1, DocumentNode, ApolloClientOptions } from '@apollo/client/index.js'; | ||
import React, { ReactNode } from 'react'; | ||
@@ -102,3 +102,3 @@ import { QueryOptions } from '@apollo/client'; | ||
interface PreloadQueryComponent { | ||
<TData, TVariables extends OperationVariables>(props: PreloadQueryProps<TData, TVariables>): React.ReactNode; | ||
<TData, TVariables extends OperationVariables>(props: PreloadQueryProps<TData, TVariables>): React.ReactElement; | ||
} | ||
@@ -254,2 +254,4 @@ | ||
declare const sourceSymbol: unique symbol; | ||
/** | ||
@@ -263,2 +265,12 @@ * A version of `InMemoryCache` to be used with streaming SSR. | ||
declare class InMemoryCache extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static readonly info: { | ||
pkg: string; | ||
}; | ||
[sourceSymbol]: string; | ||
constructor(config?: InMemoryCacheConfig | undefined); | ||
} | ||
@@ -301,3 +313,6 @@ | ||
}; | ||
declare class ApolloClientBase<TCacheShape> extends ApolloClient$1<TCacheShape> { | ||
interface WrappedApolloClientOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, "cache"> { | ||
cache: InMemoryCache; | ||
} | ||
declare class ApolloClientBase extends ApolloClient$1<NormalizedCacheObject> { | ||
/** | ||
@@ -310,9 +325,8 @@ * Information about the current package and it's export names, for use in error messages. | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
[sourceSymbol]: string; | ||
constructor(options: WrappedApolloClientOptions); | ||
} | ||
declare class ApolloClientClientBaseImpl<TCacheShape> extends ApolloClientBase<TCacheShape> { | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
declare class ApolloClientClientBaseImpl extends ApolloClientBase { | ||
constructor(options: WrappedApolloClientOptions); | ||
private simulatedStreamingQueries; | ||
@@ -339,3 +353,3 @@ private transportedQueryOptions; | ||
} | ||
declare class ApolloClientSSRImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientSSRImpl extends ApolloClientClientBaseImpl { | ||
private forwardedQueries; | ||
@@ -365,3 +379,3 @@ watchQueryQueue: { | ||
} | ||
declare class ApolloClientBrowserImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientBrowserImpl extends ApolloClientClientBaseImpl { | ||
} | ||
@@ -376,13 +390,13 @@ declare const ApolloClient_base: typeof ApolloClientBase; | ||
*/ | ||
declare class ApolloClient<TCacheShape> extends ApolloClient_base<TCacheShape> implements Partial<ApolloClientBrowserImpl<TCacheShape>>, Partial<ApolloClientSSRImpl<TCacheShape>> { | ||
declare class ApolloClient<Ignored = NormalizedCacheObject> extends ApolloClient_base implements Partial<ApolloClientBrowserImpl>, Partial<ApolloClientSSRImpl> { | ||
/** @internal */ | ||
onQueryStarted?: ApolloClientBrowserImpl<TCacheShape>["onQueryStarted"]; | ||
onQueryStarted?: ApolloClientBrowserImpl["onQueryStarted"]; | ||
/** @internal */ | ||
onQueryProgress?: ApolloClientBrowserImpl<TCacheShape>["onQueryProgress"]; | ||
onQueryProgress?: ApolloClientBrowserImpl["onQueryProgress"]; | ||
/** @internal */ | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQueries"]; | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl["rerunSimulatedQueries"]; | ||
/** @internal */ | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQuery"]; | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl["rerunSimulatedQuery"]; | ||
/** @internal */ | ||
watchQueryQueue?: ApolloClientSSRImpl<TCacheShape>["watchQueryQueue"]; | ||
watchQueryQueue?: ApolloClientSSRImpl["watchQueryQueue"]; | ||
} | ||
@@ -389,0 +403,0 @@ |
@@ -1421,11 +1421,33 @@ import React, { cache } from 'react'; | ||
}; | ||
var InMemoryCache = class extends InMemoryCache$1 { | ||
}; | ||
// src/bundleInfo.ts | ||
var bundle = { | ||
pkg: "@apollo/client-react-streaming", | ||
client: "ApolloClient", | ||
cache: "InMemoryCache" | ||
pkg: "@apollo/client-react-streaming" | ||
}; | ||
var sourceSymbol = Symbol.for("apollo.source_package"); | ||
// src/DataTransportAbstraction/WrappedInMemoryCache.tsx | ||
var InMemoryCache = class extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static info = bundle; | ||
[sourceSymbol]; | ||
constructor(config) { | ||
super(config); | ||
const info = this.constructor.info; | ||
this[sourceSymbol] = `${info.pkg}:InMemoryCache`; | ||
} | ||
}; | ||
// src/assertInstance.ts | ||
function assertInstance(value, info, name) { | ||
if (value[sourceSymbol] !== `${info.pkg}:${name}`) { | ||
throw new Error( | ||
`When using \`${name}\` in streaming SSR, you must use the \`${name}\` export provided by \`"${info.pkg}"\`.` | ||
); | ||
} | ||
} | ||
var ApolloClientBase = class extends ApolloClient$1 { | ||
@@ -1438,2 +1460,3 @@ /** | ||
static info = bundle; | ||
[sourceSymbol]; | ||
constructor(options) { | ||
@@ -1446,7 +1469,9 @@ super( | ||
); | ||
if (!(this.cache instanceof InMemoryCache)) { | ||
throw new Error( | ||
`When using \`InMemoryCache\` in streaming SSR, you must use the \`${this.constructor.info.cache}\` export provided by \`"${this.constructor.info.pkg}"\`.` | ||
); | ||
} | ||
const info = this.constructor.info; | ||
this[sourceSymbol] = `${info.pkg}:ApolloClient`; | ||
assertInstance( | ||
this.cache, | ||
info, | ||
"InMemoryCache" | ||
); | ||
} | ||
@@ -1453,0 +1478,0 @@ }; |
import * as _apollo_client_index_js from '@apollo/client/index.js'; | ||
import { ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, WatchQueryOptions, Observable as Observable$1, OperationVariables, ApolloClient as ApolloClient$1, ApolloClientOptions, DocumentNode, QueryRef } from '@apollo/client/index.js'; | ||
import { ApolloLink, Operation, NextLink, FetchResult, InMemoryCache as InMemoryCache$1, InMemoryCacheConfig, WatchQueryOptions, Observable as Observable$1, NormalizedCacheObject, OperationVariables, ApolloClient as ApolloClient$1, DocumentNode, ApolloClientOptions, QueryRef } from '@apollo/client/index.js'; | ||
import { Observable } from '@apollo/client/utilities/index.js'; | ||
@@ -154,2 +154,4 @@ import React from 'react'; | ||
declare const sourceSymbol: unique symbol; | ||
/** | ||
@@ -163,2 +165,12 @@ * A version of `InMemoryCache` to be used with streaming SSR. | ||
declare class InMemoryCache extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static readonly info: { | ||
pkg: string; | ||
}; | ||
[sourceSymbol]: string; | ||
constructor(config?: InMemoryCacheConfig | undefined); | ||
} | ||
@@ -255,3 +267,6 @@ | ||
}; | ||
declare class ApolloClientBase<TCacheShape> extends ApolloClient$1<TCacheShape> { | ||
interface WrappedApolloClientOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, "cache"> { | ||
cache: InMemoryCache; | ||
} | ||
declare class ApolloClientBase extends ApolloClient$1<NormalizedCacheObject> { | ||
/** | ||
@@ -264,9 +279,8 @@ * Information about the current package and it's export names, for use in error messages. | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
[sourceSymbol]: string; | ||
constructor(options: WrappedApolloClientOptions); | ||
} | ||
declare class ApolloClientClientBaseImpl<TCacheShape> extends ApolloClientBase<TCacheShape> { | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
declare class ApolloClientClientBaseImpl extends ApolloClientBase { | ||
constructor(options: WrappedApolloClientOptions); | ||
private simulatedStreamingQueries; | ||
@@ -293,3 +307,3 @@ private transportedQueryOptions; | ||
} | ||
declare class ApolloClientSSRImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientSSRImpl extends ApolloClientClientBaseImpl { | ||
private forwardedQueries; | ||
@@ -319,3 +333,3 @@ watchQueryQueue: { | ||
} | ||
declare class ApolloClientBrowserImpl<TCacheShape> extends ApolloClientClientBaseImpl<TCacheShape> { | ||
declare class ApolloClientBrowserImpl extends ApolloClientClientBaseImpl { | ||
} | ||
@@ -330,13 +344,13 @@ declare const ApolloClient_base: typeof ApolloClientBase; | ||
*/ | ||
declare class ApolloClient<TCacheShape> extends ApolloClient_base<TCacheShape> implements Partial<ApolloClientBrowserImpl<TCacheShape>>, Partial<ApolloClientSSRImpl<TCacheShape>> { | ||
declare class ApolloClient<Ignored = NormalizedCacheObject> extends ApolloClient_base implements Partial<ApolloClientBrowserImpl>, Partial<ApolloClientSSRImpl> { | ||
/** @internal */ | ||
onQueryStarted?: ApolloClientBrowserImpl<TCacheShape>["onQueryStarted"]; | ||
onQueryStarted?: ApolloClientBrowserImpl["onQueryStarted"]; | ||
/** @internal */ | ||
onQueryProgress?: ApolloClientBrowserImpl<TCacheShape>["onQueryProgress"]; | ||
onQueryProgress?: ApolloClientBrowserImpl["onQueryProgress"]; | ||
/** @internal */ | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQueries"]; | ||
rerunSimulatedQueries?: ApolloClientBrowserImpl["rerunSimulatedQueries"]; | ||
/** @internal */ | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl<TCacheShape>["rerunSimulatedQuery"]; | ||
rerunSimulatedQuery?: ApolloClientBrowserImpl["rerunSimulatedQuery"]; | ||
/** @internal */ | ||
watchQueryQueue?: ApolloClientSSRImpl<TCacheShape>["watchQueryQueue"]; | ||
watchQueryQueue?: ApolloClientSSRImpl["watchQueryQueue"]; | ||
} | ||
@@ -381,4 +395,2 @@ | ||
pkg: string; | ||
client: string; | ||
cache: string; | ||
}; | ||
@@ -385,0 +397,0 @@ } |
@@ -143,3 +143,23 @@ import { ApolloLink, InMemoryCache as InMemoryCache$1, ApolloProvider, Observable as Observable$1, gql, ApolloClient as ApolloClient$1, useApolloClient } from '@apollo/client/index.js'; | ||
}; | ||
// src/bundleInfo.ts | ||
var bundle = { | ||
pkg: "@apollo/client-react-streaming" | ||
}; | ||
var sourceSymbol = Symbol.for("apollo.source_package"); | ||
// src/DataTransportAbstraction/WrappedInMemoryCache.tsx | ||
var InMemoryCache = class extends InMemoryCache$1 { | ||
/** | ||
* Information about the current package and it's export names, for use in error messages. | ||
* | ||
* @internal | ||
*/ | ||
static info = bundle; | ||
[sourceSymbol]; | ||
constructor(config) { | ||
super(config); | ||
const info = this.constructor.info; | ||
this[sourceSymbol] = `${info.pkg}:InMemoryCache`; | ||
} | ||
}; | ||
@@ -1450,8 +1470,10 @@ | ||
// src/bundleInfo.ts | ||
var bundle = { | ||
pkg: "@apollo/client-react-streaming", | ||
client: "ApolloClient", | ||
cache: "InMemoryCache" | ||
}; | ||
// src/assertInstance.ts | ||
function assertInstance(value, info, name) { | ||
if (value[sourceSymbol] !== `${info.pkg}:${name}`) { | ||
throw new Error( | ||
`When using \`${name}\` in streaming SSR, you must use the \`${name}\` export provided by \`"${info.pkg}"\`.` | ||
); | ||
} | ||
} | ||
@@ -1473,2 +1495,3 @@ // src/DataTransportAbstraction/WrappedApolloClient.tsx | ||
static info = bundle; | ||
[sourceSymbol]; | ||
constructor(options) { | ||
@@ -1481,7 +1504,9 @@ super( | ||
); | ||
if (!(this.cache instanceof InMemoryCache)) { | ||
throw new Error( | ||
`When using \`InMemoryCache\` in streaming SSR, you must use the \`${this.constructor.info.cache}\` export provided by \`"${this.constructor.info.pkg}"\`.` | ||
); | ||
} | ||
const info = this.constructor.info; | ||
this[sourceSymbol] = `${info.pkg}:ApolloClient`; | ||
assertInstance( | ||
this.cache, | ||
info, | ||
"InMemoryCache" | ||
); | ||
} | ||
@@ -1696,10 +1721,10 @@ }; | ||
const clientRef = useRef(void 0); | ||
{ | ||
if (!clientRef.current) { | ||
if (!clientRef.current) { | ||
{ | ||
clientRef.current = makeClient(); | ||
} | ||
} | ||
if (!(clientRef.current instanceof ApolloClient)) { | ||
throw new Error( | ||
`When using \`ApolloClient\` in streaming SSR, you must use the \`${WrappedApolloProvider3.info.client}\` export provided by \`"${WrappedApolloProvider3.info.pkg}"\`.` | ||
assertInstance( | ||
clientRef.current, | ||
WrappedApolloProvider3.info, | ||
"ApolloClient" | ||
); | ||
@@ -1706,0 +1731,0 @@ } |
{ | ||
"name": "@apollo/client-react-streaming", | ||
"version": "0.0.0-commit-release.0.1716900818.5757a9c", | ||
"version": "0.0.0-commit-release.0.1718009266.650f886", | ||
"repository": { | ||
@@ -136,2 +136,3 @@ "url": "git+https://github.com/apollographql/apollo-client-nextjs" | ||
"@arethetypeswrong/cli": "0.15.3", | ||
"@internal/test-utils": "workspace:^", | ||
"@microsoft/api-extractor": "7.43.2", | ||
@@ -138,0 +139,0 @@ "@testing-library/react": "15.0.7", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1167375
10245
30