Socket
Socket
Sign inDemoInstall

@apollo/client

Package Overview
Dependencies
Maintainers
4
Versions
575
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/client - npm Package Compare versions

Comparing version 0.0.0-pr-11670-20240314104411 to 0.0.0-pr-11706-20240319212651

dev/setErrorMessageHandler.d.ts

15

cache/inmemory/readFromStore.js

@@ -194,11 +194,8 @@ import { __assign } from "tslib";

else if (isArray(fieldValue)) {
fieldValue =
fieldValue.length === 0 ?
fieldValue
: handleMissing(_this.executeSubSelectedArray({
field: selection,
array: fieldValue,
enclosingRef: enclosingRef,
context: context,
}), resultName);
fieldValue = handleMissing(_this.executeSubSelectedArray({
field: selection,
array: fieldValue,
enclosingRef: enclosingRef,
context: context,
}), resultName);
}

@@ -205,0 +202,0 @@ else if (!selection.selectionSet) {

14

core/ApolloClient.d.ts

@@ -31,3 +31,3 @@ import type { ExecutionResult, DocumentNode } from "graphql";

/**
* You can provide an {@link ApolloLink} instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).
* You can provide an `ApolloLink` instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).
*

@@ -100,5 +100,5 @@ * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.

* This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
* and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,
* and mutations) to a GraphQL spec-compliant server over an `ApolloLink` instance,
* receive results from the server and cache the results in a store. It also delivers updates
* to GraphQL queries through {@link Observable} instances.
* to GraphQL queries through `Observable` instances.
*/

@@ -119,3 +119,3 @@ export declare class ApolloClient<TCacheShape> implements DataProxy {

/**
* Constructs an instance of {@link ApolloClient}.
* Constructs an instance of `ApolloClient`.
*

@@ -160,3 +160,3 @@ * @example

* This watches the cache store of the query according to the options specified and
* returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and
* returns an `ObservableQuery`. We can subscribe to this `ObservableQuery` and
* receive updated results through a GraphQL observer when the cache store changes.

@@ -184,3 +184,3 @@ *

*
* @param options - An object of type {@link QueryOptions} that allows us to
* @param options - An object of type `QueryOptions` that allows us to
* describe how this query should be treated e.g. whether it should hit the

@@ -201,3 +201,3 @@ * server at all or just resolve from the cache, etc.

* This subscribes to a graphql subscription according to the options specified and returns an
* {@link Observable} which either emits received data or an error.
* `Observable` which either emits received data or an error.
*/

@@ -204,0 +204,0 @@ subscribe<T = any, TVariables extends OperationVariables = OperationVariables>(options: SubscriptionOptions<TVariables, T>): Observable<FetchResult<T>>;

@@ -18,9 +18,9 @@ import { __assign } from "tslib";

* This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
* and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,
* and mutations) to a GraphQL spec-compliant server over an `ApolloLink` instance,
* receive results from the server and cache the results in a store. It also delivers updates
* to GraphQL queries through {@link Observable} instances.
* to GraphQL queries through `Observable` instances.
*/
var ApolloClient = /** @class */ (function () {
/**
* Constructs an instance of {@link ApolloClient}.
* Constructs an instance of `ApolloClient`.
*

@@ -187,3 +187,3 @@ * @example

* This watches the cache store of the query according to the options specified and
* returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and
* returns an `ObservableQuery`. We can subscribe to this `ObservableQuery` and
* receive updated results through a GraphQL observer when the cache store changes.

@@ -222,3 +222,3 @@ *

*
* @param options - An object of type {@link QueryOptions} that allows us to
* @param options - An object of type `QueryOptions` that allows us to
* describe how this query should be treated e.g. whether it should hit the

@@ -253,3 +253,3 @@ * server at all or just resolve from the cache, etc.

* This subscribes to a graphql subscription according to the options specified and returns an
* {@link Observable} which either emits received data or an error.
* `Observable` which either emits received data or an error.
*/

@@ -256,0 +256,0 @@ ApolloClient.prototype.subscribe = function (options) {

@@ -158,3 +158,3 @@ import type { DocumentNode } from "graphql";

/**
* Specifies the {@link FetchPolicy} to be used after this query has completed.
* Specifies the `FetchPolicy` to be used after this query has completed.
*

@@ -323,3 +323,3 @@ * @docGroup

/**
* Specifies the {@link ErrorPolicy} to be used for this operation
* Specifies the `ErrorPolicy` to be used for this operation
*/

@@ -346,3 +346,3 @@ errorPolicy?: ErrorPolicy;

/**
* A {@link MutationQueryReducersMap}, which is map from query names to mutation query reducers. Briefly, this map defines how to incorporate the results of the mutation into the results of queries that are currently being watched by your application.
* A `MutationQueryReducersMap`, which is map from query names to mutation query reducers. Briefly, this map defines how to incorporate the results of the mutation into the results of queries that are currently being watched by your application.
*/

@@ -349,0 +349,0 @@ updateQueries?: MutationQueryReducersMap<TData>;

@@ -431,3 +431,3 @@ 'use strict';

var version = "0.0.0-pr-11670-20240314104411";
var version = "0.0.0-pr-11706-20240319212651";

@@ -519,2 +519,6 @@ function maybe(thunk) {

function setErrorMessageHandler(handler) {
globals.global[ApolloErrorMessageHandler] = handler;
}
function loadErrorMessageHandler() {

@@ -525,20 +529,18 @@ var errorCodes = [];

}
if (!globals.global[ApolloErrorMessageHandler]) {
globals.global[ApolloErrorMessageHandler] = handler;
}
setErrorMessageHandler(handler);
for (var _a = 0, errorCodes_1 = errorCodes; _a < errorCodes_1.length; _a++) {
var codes = errorCodes_1[_a];
Object.assign(globals.global[ApolloErrorMessageHandler], codes);
Object.assign(handler, codes);
}
return globals.global[ApolloErrorMessageHandler];
function handler(message, args) {
if (typeof message === "number") {
var definition = globals.global[ApolloErrorMessageHandler][message];
if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message))
return;
message = definition.message;
}
return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message));
return handler;
}
var handler = (function (message, args) {
if (typeof message === "number") {
var definition = globals.global[ApolloErrorMessageHandler][message];
if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message))
return;
message = definition.message;
}
}
return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message));
});

@@ -556,2 +558,3 @@ function loadDevMessages() {

exports.loadErrorMessages = loadErrorMessages;
exports.setErrorMessageHandler = setErrorMessageHandler;
//# sourceMappingURL=dev.cjs.map
export { loadDevMessages } from "./loadDevMessages.js";
export { loadErrorMessageHandler } from "./loadErrorMessageHandler.js";
export { loadErrorMessages } from "./loadErrorMessages.js";
export { setErrorMessageHandler } from "./setErrorMessageHandler.js";
export type { ErrorMessageHandler } from "./setErrorMessageHandler.js";
//# sourceMappingURL=index.d.ts.map
export { loadDevMessages } from "./loadDevMessages.js";
export { loadErrorMessageHandler } from "./loadErrorMessageHandler.js";
export { loadErrorMessages } from "./loadErrorMessages.js";
export { setErrorMessageHandler } from "./setErrorMessageHandler.js";
//# sourceMappingURL=index.js.map
import type { ErrorCodes } from "../invariantErrorCodes.js";
export declare function loadErrorMessageHandler(...errorCodes: ErrorCodes[]): ((message: string | number, args: unknown[]) => string | undefined) & ErrorCodes;
import type { ErrorMessageHandler } from "./setErrorMessageHandler.js";
/**
* Injects Apollo Client's default error message handler into the application and
* also loads the error codes that are passed in as arguments.
*/
export declare function loadErrorMessageHandler(...errorCodes: ErrorCodes[]): ErrorMessageHandler & ErrorCodes;
//# sourceMappingURL=loadErrorMessageHandler.d.ts.map
import { global } from "../utilities/globals/index.js";
import { ApolloErrorMessageHandler } from "../utilities/globals/invariantWrappers.js";
import { setErrorMessageHandler } from "./setErrorMessageHandler.js";
/**
* Injects Apollo Client's default error message handler into the application and
* also loads the error codes that are passed in as arguments.
*/
export function loadErrorMessageHandler() {

@@ -8,20 +13,18 @@ var errorCodes = [];

}
if (!global[ApolloErrorMessageHandler]) {
global[ApolloErrorMessageHandler] = handler;
}
setErrorMessageHandler(handler);
for (var _a = 0, errorCodes_1 = errorCodes; _a < errorCodes_1.length; _a++) {
var codes = errorCodes_1[_a];
Object.assign(global[ApolloErrorMessageHandler], codes);
Object.assign(handler, codes);
}
return global[ApolloErrorMessageHandler];
function handler(message, args) {
if (typeof message === "number") {
var definition = global[ApolloErrorMessageHandler][message];
if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message))
return;
message = definition.message;
}
return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message));
return handler;
}
var handler = (function (message, args) {
if (typeof message === "number") {
var definition = global[ApolloErrorMessageHandler][message];
if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message))
return;
message = definition.message;
}
}
return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message));
});
//# sourceMappingURL=loadErrorMessageHandler.js.map
{
"name": "@apollo/client",
"version": "0.0.0-pr-11670-20240314104411",
"version": "0.0.0-pr-11706-20240319212651",
"description": "A fully-featured caching GraphQL client.",

@@ -70,3 +70,3 @@ "private": false,

"devDependencies": {
"@arethetypeswrong/cli": "0.15.1",
"@arethetypeswrong/cli": "0.15.2",
"@babel/parser": "7.24.0",

@@ -78,4 +78,4 @@ "@changesets/changelog-github": "0.5.0",

"@rollup/plugin-node-resolve": "11.2.1",
"@size-limit/esbuild-why": "11.0.2",
"@size-limit/preset-small-lib": "11.0.2",
"@size-limit/esbuild-why": "11.1.1",
"@size-limit/preset-small-lib": "11.1.1",
"@testing-library/jest-dom": "6.4.2",

@@ -91,14 +91,14 @@ "@testing-library/react": "14.2.1",

"@types/jest": "29.5.12",
"@types/lodash": "4.14.202",
"@types/node": "20.11.25",
"@types/lodash": "4.17.0",
"@types/node": "20.11.28",
"@types/node-fetch": "2.6.11",
"@types/react": "18.2.64",
"@types/react-dom": "18.2.21",
"@types/react": "18.2.67",
"@types/react-dom": "18.2.22",
"@types/relay-runtime": "14.1.23",
"@types/use-sync-external-store": "0.0.6",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"@typescript-eslint/rule-tester": "7.1.1",
"@typescript-eslint/types": "7.1.1",
"@typescript-eslint/utils": "7.1.1",
"@typescript-eslint/eslint-plugin": "7.3.0",
"@typescript-eslint/parser": "7.3.0",
"@typescript-eslint/rule-tester": "7.3.0",
"@typescript-eslint/types": "7.3.0",
"@typescript-eslint/utils": "7.3.0",
"acorn": "8.11.3",

@@ -136,9 +136,9 @@ "blob-polyfill": "7.0.20220408",

"rxjs": "7.8.1",
"size-limit": "11.0.2",
"size-limit": "11.1.1",
"subscriptions-transport-ws": "0.11.0",
"terser": "5.29.1",
"terser": "5.29.2",
"ts-api-utils": "1.3.0",
"ts-jest": "29.1.2",
"ts-jest-resolver": "2.0.1",
"ts-morph": "21.0.1",
"ts-morph": "22.0.0",
"ts-node": "10.9.2",

@@ -148,3 +148,3 @@ "typedoc": "0.25.0",

"wait-for-observables": "1.0.3",
"web-streams-polyfill": "3.3.3",
"web-streams-polyfill": "4.0.0",
"whatwg-fetch": "3.6.20"

@@ -151,0 +151,0 @@ },

@@ -761,2 +761,5 @@ 'use strict';

});
React__namespace.useMemo(function () {
resultRef.current = diffToResult(cache.diff(diffOptions));
}, [diffOptions, cache]);
var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []);

@@ -763,0 +766,0 @@ return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) {

@@ -9,3 +9,3 @@ import type { DeepPartial } from "../../utilities/index.js";

/**
* The instance of {@link ApolloClient} to use to look up the fragment.
* The instance of `ApolloClient` to use to look up the fragment.
*

@@ -12,0 +12,0 @@ * By default, the instance that's passed down via context is used, but you

@@ -20,2 +20,7 @@ import { __assign, __rest } from "tslib";

});
// Since .next is async, we need to make sure that we
// get the correct diff on the next render given new diffOptions
React.useMemo(function () {
resultRef.current = diffToResult(cache.diff(diffOptions));
}, [diffOptions, cache]);
// Used for both getSnapshot and getServerSnapshot

@@ -22,0 +27,0 @@ var getSnapshot = React.useCallback(function () { return resultRef.current; }, []);

@@ -10,4 +10,4 @@ import type { ApolloQueryResult, ObservableQuery, OperationVariables, WatchQueryOptions } from "../../../core/index.js";

/**
* A `QueryReference` is an opaque object returned by {@link useBackgroundQuery}.
* A child component reading the `QueryReference` via {@link useReadQuery} will
* A `QueryReference` is an opaque object returned by `useBackgroundQuery`.
* A child component reading the `QueryReference` via `useReadQuery` will
* suspend until the promise resolves.

@@ -14,0 +14,0 @@ */

@@ -239,3 +239,3 @@ import { __assign } from "tslib";

returnedPromise
.then(function (result) {
.then(function () {
// In the case of `fetchMore`, this promise is resolved before a cache

@@ -254,4 +254,12 @@ // result is emitted due to the fact that `fetchMore` sets a `no-cache`

if (_this.promise.status === "pending") {
_this.result = result;
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);
// Use the current result from the observable instead of the value
// resolved from the promise. This avoids issues in some cases where
// the raw resolved value should not be the emitted value, such as
// when a `fetchMore` call returns an empty array after it has
// reached the end of the list.
//
// See the following for more information:
// https://github.com/apollographql/apollo-client/issues/11642
_this.result = _this.observable.getCurrentResult();
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);
}

@@ -258,0 +266,0 @@ });

@@ -210,8 +210,8 @@ 'use strict';

returnedPromise
.then(function (result) {
.then(function () {
setTimeout(function () {
var _a;
if (_this.promise.status === "pending") {
_this.result = result;
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);
_this.result = _this.observable.getCurrentResult();
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);
}

@@ -218,0 +218,0 @@ });

@@ -111,3 +111,3 @@ import type { ApolloClient, DefaultContext, DocumentNode, ErrorPolicy, OperationVariables, RefetchWritePolicy, TypedDocumentNode, WatchQueryFetchPolicy } from "../../core/index.js";

* A function that will begin loading a query when called. It's result can be
* read by {@link useReadQuery} which will suspend until the query is loaded.
* read by `useReadQuery` which will suspend until the query is loaded.
* This is useful when you want to start loading a query as early as possible

@@ -138,3 +138,3 @@ * outside of a React component.

/**
* A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
* A function that will begin loading a query when called. It's result can be read by `useReadQuery` which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
*

@@ -163,3 +163,3 @@ * @example

/**
* A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
* A function that will begin loading a query when called. It's result can be read by `useReadQuery` which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
*

@@ -191,3 +191,3 @@ * @example

/**
* A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
* A function that will begin loading a query when called. It's result can be read by `useReadQuery` which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
*

@@ -218,3 +218,3 @@ * @example

/**
* A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
* A function that will begin loading a query when called. It's result can be read by `useReadQuery` which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
*

@@ -245,3 +245,3 @@ * @example

/**
* A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
* A function that will begin loading a query when called. It's result can be read by `useReadQuery` which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component.
*

@@ -248,0 +248,0 @@ * @example

@@ -24,3 +24,3 @@ import type * as ReactTypes from "react";

/**
* The instance of {@link ApolloClient} to use to execute the query.
* The instance of `ApolloClient` to use to execute the query.
*

@@ -270,3 +270,3 @@ * By default, the instance that's passed down via context is used, but you can provide a different instance here.

/**
* The instance of {@link ApolloClient} to use to execute the query.
* The instance of `ApolloClient` to use to execute the query.
*

@@ -421,3 +421,3 @@ * By default, the instance that's passed down via context is used, but you can provide a different instance here.

/**
* The instance of {@link ApolloClient} to use to execute the query.
* The instance of `ApolloClient` to use to execute the query.
*

@@ -424,0 +424,0 @@ * By default, the instance that's passed down via context is used, but you can provide a different instance here.

@@ -43,3 +43,3 @@ export interface QueryOptionsDocumentation {

/**
* Specifies the {@link FetchPolicy} to be used after this query has completed.
* Specifies the `FetchPolicy` to be used after this query has completed.
*

@@ -155,3 +155,3 @@ * @docGroup 3. Caching options

/**
* The instance of {@link ApolloClient} to use to execute the query.
* The instance of `ApolloClient` to use to execute the query.
*

@@ -345,3 +345,3 @@ * By default, the instance that's passed down via context is used, but you

/**
* A {@link MutationQueryReducersMap}, which is map from query names to
* A `MutationQueryReducersMap`, which is map from query names to
* mutation query reducers. Briefly, this map defines how to incorporate the

@@ -494,3 +494,3 @@ * results of the mutation into the results of queries that are currently

/**
* Specifies the {@link ErrorPolicy} to be used for this operation
* Specifies the `ErrorPolicy` to be used for this operation
*/

@@ -497,0 +497,0 @@ errorPolicy: unknown;

@@ -7,3 +7,3 @@ 'use strict';

var version = "0.0.0-pr-11670-20240314104411";
var version = "0.0.0-pr-11706-20240319212651";

@@ -10,0 +10,0 @@ function maybe(thunk) {

@@ -59,3 +59,3 @@ import { InvariantError } from "ts-invariant";

[ApolloErrorMessageHandler]?: {
(message: string | number, args: unknown[]): string | undefined;
(message: string | number, args: string[]): string | undefined;
} & ErrorCodes;

@@ -62,0 +62,0 @@ }

@@ -1,2 +0,2 @@

export var version = "0.0.0-pr-11670-20240314104411";
export var version = "0.0.0-pr-11706-20240319212651";
//# sourceMappingURL=version.js.map

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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 too big to display

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc