initial update
This commit is contained in:
18
node_modules/@apollo/client/react/components/Mutation.d.ts
generated
vendored
Normal file
18
node_modules/@apollo/client/react/components/Mutation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as PropTypes from "prop-types";
|
||||
import type * as ReactTypes from "react";
|
||||
import type { OperationVariables } from "../../core/index.js";
|
||||
import type { MutationComponentOptions } from "./types.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo render prop components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package,
|
||||
* but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;
|
||||
export declare namespace Mutation {
|
||||
var propTypes: PropTypes.InferProps<MutationComponentOptions<any, any, import("../../core/types.js").DefaultContext, import("../../core/index.js").ApolloCache<any>>>;
|
||||
}
|
||||
export interface Mutation<TData, TVariables> {
|
||||
propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;
|
||||
}
|
||||
//# sourceMappingURL=Mutation.d.ts.map
|
||||
28
node_modules/@apollo/client/react/components/Mutation.js
generated
vendored
Normal file
28
node_modules/@apollo/client/react/components/Mutation.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as PropTypes from "prop-types";
|
||||
import { useMutation } from "../hooks/index.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo render prop components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package,
|
||||
* but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function Mutation(props) {
|
||||
var _a = useMutation(props.mutation, props), runMutation = _a[0], result = _a[1];
|
||||
return props.children ? props.children(runMutation, result) : null;
|
||||
}
|
||||
Mutation.propTypes = {
|
||||
mutation: PropTypes.object.isRequired,
|
||||
variables: PropTypes.object,
|
||||
optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
||||
refetchQueries: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
|
||||
PropTypes.func,
|
||||
]),
|
||||
awaitRefetchQueries: PropTypes.bool,
|
||||
update: PropTypes.func,
|
||||
children: PropTypes.func.isRequired,
|
||||
onCompleted: PropTypes.func,
|
||||
onError: PropTypes.func,
|
||||
fetchPolicy: PropTypes.string,
|
||||
};
|
||||
//# sourceMappingURL=Mutation.js.map
|
||||
1
node_modules/@apollo/client/react/components/Mutation.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/Mutation.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Mutation.js","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAkD;IAE5C,IAAA,KAAwB,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAzD,WAAW,QAAA,EAAE,MAAM,QAAsC,CAAC;IACjE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAMD,QAAQ,CAAC,SAAS,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACrC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,OAAO,CACf,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAC1D;QACD,SAAS,CAAC,IAAI;KACf,CAAC;IACF,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;CACK,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { MutationComponentOptions } from \"./types.js\";\nimport { useMutation } from \"../hooks/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Mutation<TData = any, TVariables = OperationVariables>(\n props: MutationComponentOptions<TData, TVariables>\n): ReactTypes.JSX.Element | null {\n const [runMutation, result] = useMutation(props.mutation, props);\n return props.children ? props.children(runMutation, result) : null;\n}\n\nexport interface Mutation<TData, TVariables> {\n propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;\n}\n\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.object])\n ),\n PropTypes.func,\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n} as Mutation<any, any>[\"propTypes\"];\n"]}
|
||||
18
node_modules/@apollo/client/react/components/Query.d.ts
generated
vendored
Normal file
18
node_modules/@apollo/client/react/components/Query.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as PropTypes from "prop-types";
|
||||
import type * as ReactTypes from "react";
|
||||
import type { OperationVariables } from "../../core/index.js";
|
||||
import type { QueryComponentOptions } from "./types.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo render prop components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package,
|
||||
* but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;
|
||||
export declare namespace Query {
|
||||
var propTypes: PropTypes.InferProps<QueryComponentOptions<any, any>>;
|
||||
}
|
||||
export interface Query<TData, TVariables extends OperationVariables> {
|
||||
propTypes: PropTypes.InferProps<QueryComponentOptions<TData, TVariables>>;
|
||||
}
|
||||
//# sourceMappingURL=Query.d.ts.map
|
||||
29
node_modules/@apollo/client/react/components/Query.js
generated
vendored
Normal file
29
node_modules/@apollo/client/react/components/Query.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { __rest } from "tslib";
|
||||
import * as PropTypes from "prop-types";
|
||||
import { useQuery } from "../hooks/index.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo render prop components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package,
|
||||
* but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function Query(props) {
|
||||
var children = props.children, query = props.query, options = __rest(props, ["children", "query"]);
|
||||
var result = useQuery(query, options);
|
||||
return result ? children(result) : null;
|
||||
}
|
||||
Query.propTypes = {
|
||||
client: PropTypes.object,
|
||||
children: PropTypes.func.isRequired,
|
||||
fetchPolicy: PropTypes.string,
|
||||
notifyOnNetworkStatusChange: PropTypes.bool,
|
||||
onCompleted: PropTypes.func,
|
||||
onError: PropTypes.func,
|
||||
pollInterval: PropTypes.number,
|
||||
query: PropTypes.object.isRequired,
|
||||
variables: PropTypes.object,
|
||||
ssr: PropTypes.bool,
|
||||
partialRefetch: PropTypes.bool,
|
||||
returnPartialData: PropTypes.bool,
|
||||
};
|
||||
//# sourceMappingURL=Query.js.map
|
||||
1
node_modules/@apollo/client/react/components/Query.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/Query.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAInB,KAA+C;IAEvC,IAAA,QAAQ,GAAwB,KAAK,SAA7B,EAAE,KAAK,GAAiB,KAAK,MAAtB,EAAK,OAAO,UAAK,KAAK,EAAvC,qBAA+B,CAAF,CAAW;IAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAMD,KAAK,CAAC,SAAS,GAAG;IAChB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,2BAA2B,EAAE,SAAS,CAAC,IAAI;IAC3C,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,GAAG,EAAE,SAAS,CAAC,IAAI;IACnB,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,iBAAiB,EAAE,SAAS,CAAC,IAAI;CACF,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { QueryComponentOptions } from \"./types.js\";\nimport { useQuery } from \"../hooks/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Query<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n props: QueryComponentOptions<TData, TVariables>\n): ReactTypes.JSX.Element | null {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result as any) : null;\n}\n\nexport interface Query<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<QueryComponentOptions<TData, TVariables>>;\n}\n\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool,\n} as Query<any, any>[\"propTypes\"];\n"]}
|
||||
18
node_modules/@apollo/client/react/components/Subscription.d.ts
generated
vendored
Normal file
18
node_modules/@apollo/client/react/components/Subscription.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as PropTypes from "prop-types";
|
||||
import type * as ReactTypes from "react";
|
||||
import type { OperationVariables } from "../../core/index.js";
|
||||
import type { SubscriptionComponentOptions } from "./types.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo render prop components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package,
|
||||
* but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;
|
||||
export declare namespace Subscription {
|
||||
var propTypes: PropTypes.InferProps<SubscriptionComponentOptions<any, any>>;
|
||||
}
|
||||
export interface Subscription<TData, TVariables extends OperationVariables> {
|
||||
propTypes: PropTypes.InferProps<SubscriptionComponentOptions<TData, TVariables>>;
|
||||
}
|
||||
//# sourceMappingURL=Subscription.d.ts.map
|
||||
23
node_modules/@apollo/client/react/components/Subscription.js
generated
vendored
Normal file
23
node_modules/@apollo/client/react/components/Subscription.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as PropTypes from "prop-types";
|
||||
import { useSubscription } from "../hooks/index.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo render prop components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package,
|
||||
* but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function Subscription(props) {
|
||||
var result = useSubscription(props.subscription, props);
|
||||
return props.children && result ? props.children(result) : null;
|
||||
}
|
||||
Subscription.propTypes = {
|
||||
subscription: PropTypes.object.isRequired,
|
||||
variables: PropTypes.object,
|
||||
children: PropTypes.func,
|
||||
onSubscriptionData: PropTypes.func,
|
||||
onData: PropTypes.func,
|
||||
onSubscriptionComplete: PropTypes.func,
|
||||
onComplete: PropTypes.func,
|
||||
shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
||||
};
|
||||
//# sourceMappingURL=Subscription.js.map
|
||||
1
node_modules/@apollo/client/react/components/Subscription.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/Subscription.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAI1B,KAAsD;IAEtD,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAQD,YAAY,CAAC,SAAS,GAAG;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,sBAAsB,EAAE,SAAS,CAAC,IAAI;IACtC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { SubscriptionComponentOptions } from \"./types.js\";\nimport { useSubscription } from \"../hooks/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Subscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n props: SubscriptionComponentOptions<TData, TVariables>\n): ReactTypes.JSX.Element | null {\n const result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\n\nexport interface Subscription<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<\n SubscriptionComponentOptions<TData, TVariables>\n >;\n}\n\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),\n} as Subscription<any, any>[\"propTypes\"];\n"]}
|
||||
81
node_modules/@apollo/client/react/components/components.cjs
generated
vendored
Normal file
81
node_modules/@apollo/client/react/components/components.cjs
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var tslib = require('tslib');
|
||||
var PropTypes = require('prop-types');
|
||||
var hooks = require('../hooks');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes);
|
||||
|
||||
function Query(props) {
|
||||
var children = props.children, query = props.query, options = tslib.__rest(props, ["children", "query"]);
|
||||
var result = hooks.useQuery(query, options);
|
||||
return result ? children(result) : null;
|
||||
}
|
||||
Query.propTypes = {
|
||||
client: PropTypes__namespace.object,
|
||||
children: PropTypes__namespace.func.isRequired,
|
||||
fetchPolicy: PropTypes__namespace.string,
|
||||
notifyOnNetworkStatusChange: PropTypes__namespace.bool,
|
||||
onCompleted: PropTypes__namespace.func,
|
||||
onError: PropTypes__namespace.func,
|
||||
pollInterval: PropTypes__namespace.number,
|
||||
query: PropTypes__namespace.object.isRequired,
|
||||
variables: PropTypes__namespace.object,
|
||||
ssr: PropTypes__namespace.bool,
|
||||
partialRefetch: PropTypes__namespace.bool,
|
||||
returnPartialData: PropTypes__namespace.bool,
|
||||
};
|
||||
|
||||
function Mutation(props) {
|
||||
var _a = hooks.useMutation(props.mutation, props), runMutation = _a[0], result = _a[1];
|
||||
return props.children ? props.children(runMutation, result) : null;
|
||||
}
|
||||
Mutation.propTypes = {
|
||||
mutation: PropTypes__namespace.object.isRequired,
|
||||
variables: PropTypes__namespace.object,
|
||||
optimisticResponse: PropTypes__namespace.oneOfType([PropTypes__namespace.object, PropTypes__namespace.func]),
|
||||
refetchQueries: PropTypes__namespace.oneOfType([
|
||||
PropTypes__namespace.arrayOf(PropTypes__namespace.oneOfType([PropTypes__namespace.string, PropTypes__namespace.object])),
|
||||
PropTypes__namespace.func,
|
||||
]),
|
||||
awaitRefetchQueries: PropTypes__namespace.bool,
|
||||
update: PropTypes__namespace.func,
|
||||
children: PropTypes__namespace.func.isRequired,
|
||||
onCompleted: PropTypes__namespace.func,
|
||||
onError: PropTypes__namespace.func,
|
||||
fetchPolicy: PropTypes__namespace.string,
|
||||
};
|
||||
|
||||
function Subscription(props) {
|
||||
var result = hooks.useSubscription(props.subscription, props);
|
||||
return props.children && result ? props.children(result) : null;
|
||||
}
|
||||
Subscription.propTypes = {
|
||||
subscription: PropTypes__namespace.object.isRequired,
|
||||
variables: PropTypes__namespace.object,
|
||||
children: PropTypes__namespace.func,
|
||||
onSubscriptionData: PropTypes__namespace.func,
|
||||
onData: PropTypes__namespace.func,
|
||||
onSubscriptionComplete: PropTypes__namespace.func,
|
||||
onComplete: PropTypes__namespace.func,
|
||||
shouldResubscribe: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.bool]),
|
||||
};
|
||||
|
||||
exports.Mutation = Mutation;
|
||||
exports.Query = Query;
|
||||
exports.Subscription = Subscription;
|
||||
//# sourceMappingURL=components.cjs.map
|
||||
1
node_modules/@apollo/client/react/components/components.cjs.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/components.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
81
node_modules/@apollo/client/react/components/components.cjs.native.js
generated
vendored
Normal file
81
node_modules/@apollo/client/react/components/components.cjs.native.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var tslib = require('tslib');
|
||||
var PropTypes = require('prop-types');
|
||||
var hooks = require('../hooks');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes);
|
||||
|
||||
function Query(props) {
|
||||
var children = props.children, query = props.query, options = tslib.__rest(props, ["children", "query"]);
|
||||
var result = hooks.useQuery(query, options);
|
||||
return result ? children(result) : null;
|
||||
}
|
||||
Query.propTypes = {
|
||||
client: PropTypes__namespace.object,
|
||||
children: PropTypes__namespace.func.isRequired,
|
||||
fetchPolicy: PropTypes__namespace.string,
|
||||
notifyOnNetworkStatusChange: PropTypes__namespace.bool,
|
||||
onCompleted: PropTypes__namespace.func,
|
||||
onError: PropTypes__namespace.func,
|
||||
pollInterval: PropTypes__namespace.number,
|
||||
query: PropTypes__namespace.object.isRequired,
|
||||
variables: PropTypes__namespace.object,
|
||||
ssr: PropTypes__namespace.bool,
|
||||
partialRefetch: PropTypes__namespace.bool,
|
||||
returnPartialData: PropTypes__namespace.bool,
|
||||
};
|
||||
|
||||
function Mutation(props) {
|
||||
var _a = hooks.useMutation(props.mutation, props), runMutation = _a[0], result = _a[1];
|
||||
return props.children ? props.children(runMutation, result) : null;
|
||||
}
|
||||
Mutation.propTypes = {
|
||||
mutation: PropTypes__namespace.object.isRequired,
|
||||
variables: PropTypes__namespace.object,
|
||||
optimisticResponse: PropTypes__namespace.oneOfType([PropTypes__namespace.object, PropTypes__namespace.func]),
|
||||
refetchQueries: PropTypes__namespace.oneOfType([
|
||||
PropTypes__namespace.arrayOf(PropTypes__namespace.oneOfType([PropTypes__namespace.string, PropTypes__namespace.object])),
|
||||
PropTypes__namespace.func,
|
||||
]),
|
||||
awaitRefetchQueries: PropTypes__namespace.bool,
|
||||
update: PropTypes__namespace.func,
|
||||
children: PropTypes__namespace.func.isRequired,
|
||||
onCompleted: PropTypes__namespace.func,
|
||||
onError: PropTypes__namespace.func,
|
||||
fetchPolicy: PropTypes__namespace.string,
|
||||
};
|
||||
|
||||
function Subscription(props) {
|
||||
var result = hooks.useSubscription(props.subscription, props);
|
||||
return props.children && result ? props.children(result) : null;
|
||||
}
|
||||
Subscription.propTypes = {
|
||||
subscription: PropTypes__namespace.object.isRequired,
|
||||
variables: PropTypes__namespace.object,
|
||||
children: PropTypes__namespace.func,
|
||||
onSubscriptionData: PropTypes__namespace.func,
|
||||
onData: PropTypes__namespace.func,
|
||||
onSubscriptionComplete: PropTypes__namespace.func,
|
||||
onComplete: PropTypes__namespace.func,
|
||||
shouldResubscribe: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.bool]),
|
||||
};
|
||||
|
||||
exports.Mutation = Mutation;
|
||||
exports.Query = Query;
|
||||
exports.Subscription = Subscription;
|
||||
//# sourceMappingURL=components.cjs.map
|
||||
1
node_modules/@apollo/client/react/components/components.d.cts
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/components.d.cts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./index.d.ts";
|
||||
5
node_modules/@apollo/client/react/components/index.d.ts
generated
vendored
Normal file
5
node_modules/@apollo/client/react/components/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { Query } from "./Query.js";
|
||||
export { Mutation } from "./Mutation.js";
|
||||
export { Subscription } from "./Subscription.js";
|
||||
export type * from "./types.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
4
node_modules/@apollo/client/react/components/index.js
generated
vendored
Normal file
4
node_modules/@apollo/client/react/components/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { Query } from "./Query.js";
|
||||
export { Mutation } from "./Mutation.js";
|
||||
export { Subscription } from "./Subscription.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@apollo/client/react/components/index.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { Query } from \"./Query.js\";\nexport { Mutation } from \"./Mutation.js\";\nexport { Subscription } from \"./Subscription.js\";\n\nexport type * from \"./types.js\";\n"]}
|
||||
8
node_modules/@apollo/client/react/components/package.json
generated
vendored
Normal file
8
node_modules/@apollo/client/react/components/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/react/components",
|
||||
"type": "module",
|
||||
"main": "components.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
21
node_modules/@apollo/client/react/components/types.d.ts
generated
vendored
Normal file
21
node_modules/@apollo/client/react/components/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { DocumentNode } from "graphql";
|
||||
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
||||
import type * as ReactTypes from "react";
|
||||
import type { OperationVariables, DefaultContext, ApolloCache } from "../../core/index.js";
|
||||
import type { QueryFunctionOptions, QueryResult, BaseMutationOptions, MutationFunction, MutationResult, BaseSubscriptionOptions, SubscriptionResult } from "../types/types.js";
|
||||
export interface QueryComponentOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
|
||||
children: (result: QueryResult<TData, TVariables>) => ReactTypes.JSX.Element | null;
|
||||
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
||||
}
|
||||
export interface MutationComponentOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
|
||||
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
||||
children: (mutateFunction: MutationFunction<TData, TVariables, TContext>, result: MutationResult<TData>) => ReactTypes.JSX.Element | null;
|
||||
}
|
||||
export interface SubscriptionComponentOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends BaseSubscriptionOptions<TData, TVariables> {
|
||||
/**
|
||||
* A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single subscription inside of it.
|
||||
*/
|
||||
subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
||||
children?: null | ((result: SubscriptionResult<TData>) => ReactTypes.JSX.Element | null);
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
2
node_modules/@apollo/client/react/components/types.js
generated
vendored
Normal file
2
node_modules/@apollo/client/react/components/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@apollo/client/react/components/types.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/components/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type * as ReactTypes from \"react\";\n\nimport type {\n OperationVariables,\n DefaultContext,\n ApolloCache,\n} from \"../../core/index.js\";\nimport type {\n QueryFunctionOptions,\n QueryResult,\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n BaseSubscriptionOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\n\nexport interface QueryComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {\n children: (\n result: QueryResult<TData, TVariables>\n ) => ReactTypes.JSX.Element | null;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationComponentOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children: (\n mutateFunction: MutationFunction<TData, TVariables, TContext>,\n result: MutationResult<TData>\n ) => ReactTypes.JSX.Element | null;\n}\n\nexport interface SubscriptionComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#query:member} */\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?:\n | null\n | ((result: SubscriptionResult<TData>) => ReactTypes.JSX.Element | null);\n}\n"]}
|
||||
7
node_modules/@apollo/client/react/context/ApolloConsumer.d.ts
generated
vendored
Normal file
7
node_modules/@apollo/client/react/context/ApolloConsumer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { ApolloClient } from "../../core/index.js";
|
||||
export interface ApolloConsumerProps {
|
||||
children: (client: ApolloClient<object>) => ReactTypes.ReactNode;
|
||||
}
|
||||
export declare const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps>;
|
||||
//# sourceMappingURL=ApolloConsumer.d.ts.map
|
||||
11
node_modules/@apollo/client/react/context/ApolloConsumer.js
generated
vendored
Normal file
11
node_modules/@apollo/client/react/context/ApolloConsumer.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import * as React from "rehackt";
|
||||
import { getApolloContext } from "./ApolloContext.js";
|
||||
export var ApolloConsumer = function (props) {
|
||||
var ApolloContext = getApolloContext();
|
||||
return (React.createElement(ApolloContext.Consumer, null, function (context) {
|
||||
invariant(context && context.client, 53);
|
||||
return props.children(context.client);
|
||||
}));
|
||||
};
|
||||
//# sourceMappingURL=ApolloConsumer.js.map
|
||||
1
node_modules/@apollo/client/react/context/ApolloConsumer.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/context/ApolloConsumer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,KAAK;IACtE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => ReactTypes.ReactNode;\n}\n\nexport const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps> = (props) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n \"Wrap the root component in an <ApolloProvider>.\"\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
|
||||
15
node_modules/@apollo/client/react/context/ApolloContext.d.ts
generated
vendored
Normal file
15
node_modules/@apollo/client/react/context/ApolloContext.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { ApolloClient } from "../../core/index.js";
|
||||
import type { RenderPromises } from "../ssr/index.js";
|
||||
export interface ApolloContextValue {
|
||||
client?: ApolloClient<object>;
|
||||
renderPromises?: RenderPromises;
|
||||
}
|
||||
export declare function getApolloContext(): ReactTypes.Context<ApolloContextValue>;
|
||||
/**
|
||||
* @deprecated This function has no "resetting" effect since Apollo Client 3.4.12,
|
||||
* and will be removed in the next major version of Apollo Client.
|
||||
* If you want to get the Apollo Context, use `getApolloContext` instead.
|
||||
*/
|
||||
export declare const resetApolloContext: typeof getApolloContext;
|
||||
//# sourceMappingURL=ApolloContext.d.ts.map
|
||||
29
node_modules/@apollo/client/react/context/ApolloContext.js
generated
vendored
Normal file
29
node_modules/@apollo/client/react/context/ApolloContext.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import * as React from "rehackt";
|
||||
import { canUseSymbol } from "../../utilities/index.js";
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
// To make sure Apollo Client doesn't create more than one React context
|
||||
// (which can lead to problems like having an Apollo Client instance added
|
||||
// in one context, then attempting to retrieve it from another different
|
||||
// context), a single Apollo context is created and tracked in global state.
|
||||
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
||||
export function getApolloContext() {
|
||||
invariant("createContext" in React, 54);
|
||||
var context = React.createContext[contextKey];
|
||||
if (!context) {
|
||||
Object.defineProperty(React.createContext, contextKey, {
|
||||
value: (context = React.createContext({})),
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
context.displayName = "ApolloContext";
|
||||
}
|
||||
return context;
|
||||
}
|
||||
/**
|
||||
* @deprecated This function has no "resetting" effect since Apollo Client 3.4.12,
|
||||
* and will be removed in the next major version of Apollo Client.
|
||||
* If you want to get the Apollo Context, use `getApolloContext` instead.
|
||||
*/
|
||||
export var resetApolloContext = getApolloContext;
|
||||
//# sourceMappingURL=ApolloContext.js.map
|
||||
1
node_modules/@apollo/client/react/context/ApolloContext.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/context/ApolloContext.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAO7D,wEAAwE;AACxE,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,IAAM,UAAU,GACd,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAEzE,MAAM,UAAU,gBAAgB;IAC9B,SAAS,CACP,eAAe,IAAI,KAAK,EACxB,+FAA+F;QAC7F,uGAAuG;QACvG,iEAAiE;QACjE,4GAA4G;QAC5G,sGAAsG,CACzG,CAAC;IAEF,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CACxC,UAAU,CAC0B,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,CAAC,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC;YAC9D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;IACxC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport type { RenderPromises } from \"../ssr/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey =\n canUseSymbol ? Symbol.for(\"__APOLLO_CONTEXT__\") : \"__APOLLO_CONTEXT__\";\n\nexport function getApolloContext(): ReactTypes.Context<ApolloContextValue> {\n invariant(\n \"createContext\" in React,\n \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n );\n\n let context = (React.createContext as any)[\n contextKey\n ] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext<ApolloContextValue>({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport const resetApolloContext = getApolloContext;\n"]}
|
||||
8
node_modules/@apollo/client/react/context/ApolloProvider.d.ts
generated
vendored
Normal file
8
node_modules/@apollo/client/react/context/ApolloProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { ApolloClient } from "../../core/index.js";
|
||||
export interface ApolloProviderProps<TCache> {
|
||||
client: ApolloClient<TCache>;
|
||||
children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;
|
||||
}
|
||||
export declare const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>>;
|
||||
//# sourceMappingURL=ApolloProvider.d.ts.map
|
||||
15
node_modules/@apollo/client/react/context/ApolloProvider.js
generated
vendored
Normal file
15
node_modules/@apollo/client/react/context/ApolloProvider.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { __assign } from "tslib";
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import * as React from "rehackt";
|
||||
import { getApolloContext } from "./ApolloContext.js";
|
||||
export var ApolloProvider = function (_a) {
|
||||
var client = _a.client, children = _a.children;
|
||||
var ApolloContext = getApolloContext();
|
||||
var parentContext = React.useContext(ApolloContext);
|
||||
var context = React.useMemo(function () {
|
||||
return __assign(__assign({}, parentContext), { client: client || parentContext.client });
|
||||
}, [parentContext, client]);
|
||||
invariant(context.client, 55);
|
||||
return (React.createElement(ApolloContext.Provider, { value: context }, children));
|
||||
};
|
||||
//# sourceMappingURL=ApolloProvider.js.map
|
||||
1
node_modules/@apollo/client/react/context/ApolloProvider.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/context/ApolloProvider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,MAAM,CAAC,IAAM,cAAc,GAA4C,UAAC,EAGvE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEtD,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,6BACK,aAAa,KAChB,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,IACtC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5B,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;QACtD,qDAAqD,CACxD,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAA0B,CAC5E,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;\n}\n\nexport const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>> = ({\n client,\n children,\n}) => {\n const ApolloContext = getApolloContext();\n const parentContext = React.useContext(ApolloContext);\n\n const context = React.useMemo(() => {\n return {\n ...parentContext,\n client: client || parentContext.client,\n };\n }, [parentContext, client]);\n\n invariant(\n context.client,\n \"ApolloProvider was not passed a client instance. Make \" +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>{children}</ApolloContext.Provider>\n );\n};\n"]}
|
||||
64
node_modules/@apollo/client/react/context/context.cjs
generated
vendored
Normal file
64
node_modules/@apollo/client/react/context/context.cjs
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var React = require('rehackt');
|
||||
var utilities = require('../../utilities');
|
||||
var tslib = require('tslib');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
|
||||
var contextKey = utilities.canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
||||
function getApolloContext() {
|
||||
globals.invariant("createContext" in React__namespace, 54);
|
||||
var context = React__namespace.createContext[contextKey];
|
||||
if (!context) {
|
||||
Object.defineProperty(React__namespace.createContext, contextKey, {
|
||||
value: (context = React__namespace.createContext({})),
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
context.displayName = "ApolloContext";
|
||||
}
|
||||
return context;
|
||||
}
|
||||
var resetApolloContext = getApolloContext;
|
||||
|
||||
var ApolloConsumer = function (props) {
|
||||
var ApolloContext = getApolloContext();
|
||||
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
||||
globals.invariant(context && context.client, 53);
|
||||
return props.children(context.client);
|
||||
}));
|
||||
};
|
||||
|
||||
var ApolloProvider = function (_a) {
|
||||
var client = _a.client, children = _a.children;
|
||||
var ApolloContext = getApolloContext();
|
||||
var parentContext = React__namespace.useContext(ApolloContext);
|
||||
var context = React__namespace.useMemo(function () {
|
||||
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
||||
}, [parentContext, client]);
|
||||
globals.invariant(context.client, 55);
|
||||
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
||||
};
|
||||
|
||||
exports.ApolloConsumer = ApolloConsumer;
|
||||
exports.ApolloProvider = ApolloProvider;
|
||||
exports.getApolloContext = getApolloContext;
|
||||
exports.resetApolloContext = resetApolloContext;
|
||||
//# sourceMappingURL=context.cjs.map
|
||||
1
node_modules/@apollo/client/react/context/context.cjs.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/context/context.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from \"rehackt\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nvar contextKey = canUseSymbol ? Symbol.for(\"__APOLLO_CONTEXT__\") : \"__APOLLO_CONTEXT__\";\nexport function getApolloContext() {\n invariant(\"createContext\" in React, 54);\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport var resetApolloContext = getApolloContext;\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n invariant(context && context.client, 53);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client });\n }, [parentContext, client]);\n invariant(context.client, 55);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","invariant","React","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAI,UAAU,GAAGA,sBAAY,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AACjF,SAAS,gBAAgB,GAAG;AACnC,IAAIC,iBAAS,CAAC,eAAe,IAAIC,gBAAK,EAAE,EAAE,CAAC,CAAC;AAC5C,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,KAAK,GAAG,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AACtD,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY,EAAE,IAAI;AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AAMS,IAAC,kBAAkB,GAAG;;ACxBtB,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,QAAQA,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AACjF,QAAQD,iBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjD,QAAQ,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9C,KAAK,CAAC,EAAE;AACR;;ACLU,IAAC,cAAc,GAAG,UAAU,EAAE,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACnD,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,IAAI,aAAa,GAAGC,gBAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACxD,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,OAAO,CAAC,YAAY;AAC5C,QAAQ,OAAOC,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;AACjG,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAChC,IAAIF,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAClC,IAAI,QAAQC,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AACvF;;;;;;;"}
|
||||
64
node_modules/@apollo/client/react/context/context.cjs.native.js
generated
vendored
Normal file
64
node_modules/@apollo/client/react/context/context.cjs.native.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var React = require('rehackt');
|
||||
var utilities = require('../../utilities');
|
||||
var tslib = require('tslib');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
|
||||
var contextKey = utilities.canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
||||
function getApolloContext() {
|
||||
globals.invariant("createContext" in React__namespace, 54);
|
||||
var context = React__namespace.createContext[contextKey];
|
||||
if (!context) {
|
||||
Object.defineProperty(React__namespace.createContext, contextKey, {
|
||||
value: (context = React__namespace.createContext({})),
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
context.displayName = "ApolloContext";
|
||||
}
|
||||
return context;
|
||||
}
|
||||
var resetApolloContext = getApolloContext;
|
||||
|
||||
var ApolloConsumer = function (props) {
|
||||
var ApolloContext = getApolloContext();
|
||||
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
||||
globals.invariant(context && context.client, 53);
|
||||
return props.children(context.client);
|
||||
}));
|
||||
};
|
||||
|
||||
var ApolloProvider = function (_a) {
|
||||
var client = _a.client, children = _a.children;
|
||||
var ApolloContext = getApolloContext();
|
||||
var parentContext = React__namespace.useContext(ApolloContext);
|
||||
var context = React__namespace.useMemo(function () {
|
||||
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
||||
}, [parentContext, client]);
|
||||
globals.invariant(context.client, 55);
|
||||
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
||||
};
|
||||
|
||||
exports.ApolloConsumer = ApolloConsumer;
|
||||
exports.ApolloProvider = ApolloProvider;
|
||||
exports.getApolloContext = getApolloContext;
|
||||
exports.resetApolloContext = resetApolloContext;
|
||||
//# sourceMappingURL=context.cjs.map
|
||||
1
node_modules/@apollo/client/react/context/context.d.cts
generated
vendored
Normal file
1
node_modules/@apollo/client/react/context/context.d.cts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./index.d.ts";
|
||||
8
node_modules/@apollo/client/react/context/index.d.ts
generated
vendored
Normal file
8
node_modules/@apollo/client/react/context/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export type { ApolloConsumerProps } from "./ApolloConsumer.js";
|
||||
export { ApolloConsumer } from "./ApolloConsumer.js";
|
||||
export type { ApolloContextValue } from "./ApolloContext.js";
|
||||
export { getApolloContext, resetApolloContext } from "./ApolloContext.js";
|
||||
export type { ApolloProviderProps } from "./ApolloProvider.js";
|
||||
export { ApolloProvider } from "./ApolloProvider.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
5
node_modules/@apollo/client/react/context/index.js
generated
vendored
Normal file
5
node_modules/@apollo/client/react/context/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export { ApolloConsumer } from "./ApolloConsumer.js";
|
||||
export { getApolloContext, resetApolloContext } from "./ApolloContext.js";
|
||||
export { ApolloProvider } from "./ApolloProvider.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@apollo/client/react/context/index.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/context/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport type { ApolloConsumerProps } from \"./ApolloConsumer.js\";\nexport { ApolloConsumer } from \"./ApolloConsumer.js\";\nexport type { ApolloContextValue } from \"./ApolloContext.js\";\nexport { getApolloContext, resetApolloContext } from \"./ApolloContext.js\";\nexport type { ApolloProviderProps } from \"./ApolloProvider.js\";\nexport { ApolloProvider } from \"./ApolloProvider.js\";\n"]}
|
||||
8
node_modules/@apollo/client/react/context/package.json
generated
vendored
Normal file
8
node_modules/@apollo/client/react/context/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/react/context",
|
||||
"type": "module",
|
||||
"main": "context.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
11
node_modules/@apollo/client/react/hoc/graphql.d.ts
generated
vendored
Normal file
11
node_modules/@apollo/client/react/hoc/graphql.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { DocumentNode } from "graphql";
|
||||
import type * as ReactTypes from "react";
|
||||
import type { OperationOption, DataProps, MutateProps } from "./types.js";
|
||||
import type { OperationVariables } from "../../core/index.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function graphql<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps extends object = Partial<DataProps<TData, TGraphQLVariables>> & Partial<MutateProps<TData, TGraphQLVariables>>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;
|
||||
//# sourceMappingURL=graphql.d.ts.map
|
||||
22
node_modules/@apollo/client/react/hoc/graphql.js
generated
vendored
Normal file
22
node_modules/@apollo/client/react/hoc/graphql.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { parser, DocumentType } from "../parser/index.js";
|
||||
import { withQuery } from "./query-hoc.js";
|
||||
import { withMutation } from "./mutation-hoc.js";
|
||||
import { withSubscription } from "./subscription-hoc.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function graphql(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
switch (parser(document).type) {
|
||||
case DocumentType.Mutation:
|
||||
return withMutation(document, operationOptions);
|
||||
case DocumentType.Subscription:
|
||||
return withSubscription(document, operationOptions);
|
||||
case DocumentType.Query:
|
||||
default:
|
||||
return withQuery(document, operationOptions);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=graphql.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/graphql.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/graphql.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/react/hoc/graphql.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAOrB,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAIN,QAAQ,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9B,KAAK,YAAY,CAAC,QAAQ;YACxB,OAAO,YAAY,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAClD,KAAK,YAAY,CAAC,YAAY;YAC5B,OAAO,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACtD,KAAK,YAAY,CAAC,KAAK,CAAC;QACxB;YACE,OAAO,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IACjD,CAAC;AACH,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type * as ReactTypes from \"react\";\n\nimport { parser, DocumentType } from \"../parser/index.js\";\nimport { withQuery } from \"./query-hoc.js\";\nimport { withMutation } from \"./mutation-hoc.js\";\nimport { withSubscription } from \"./subscription-hoc.js\";\nimport type { OperationOption, DataProps, MutateProps } from \"./types.js\";\nimport type { OperationVariables } from \"../../core/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function graphql<\n TProps extends TGraphQLVariables | {} = {},\n TData extends object = {},\n TGraphQLVariables extends OperationVariables = {},\n TChildProps extends object = Partial<DataProps<TData, TGraphQLVariables>> &\n Partial<MutateProps<TData, TGraphQLVariables>>,\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n): (\n WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>\n) => ReactTypes.ComponentClass<TProps> {\n switch (parser(document).type) {\n case DocumentType.Mutation:\n return withMutation(document, operationOptions);\n case DocumentType.Subscription:\n return withSubscription(document, operationOptions);\n case DocumentType.Query:\n default:\n return withQuery(document, operationOptions);\n }\n}\n"]}
|
||||
17
node_modules/@apollo/client/react/hoc/hoc-utils.d.ts
generated
vendored
Normal file
17
node_modules/@apollo/client/react/hoc/hoc-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as React from "rehackt";
|
||||
import type { OperationVariables } from "../../core/index.js";
|
||||
import type { IDocumentDefinition } from "../parser/index.js";
|
||||
export declare const defaultMapPropsToOptions: () => {};
|
||||
export declare const defaultMapResultToProps: <P>(props: P) => P;
|
||||
export declare const defaultMapPropsToSkip: () => boolean;
|
||||
export declare function getDisplayName<P>(WrappedComponent: React.ComponentType<P>): string;
|
||||
export declare function calculateVariablesFromProps<TProps>(operation: IDocumentDefinition, props: TProps): OperationVariables;
|
||||
export type RefSetter<TChildProps> = (ref: React.ComponentClass<TChildProps>) => void | void;
|
||||
export declare class GraphQLBase<TProps, TChildProps, TState = any> extends React.Component<TProps, TState> {
|
||||
withRef: boolean;
|
||||
private wrappedInstance?;
|
||||
constructor(props: TProps);
|
||||
getWrappedInstance(): React.ComponentClass<TChildProps, any> | undefined;
|
||||
setWrappedInstance(ref: React.ComponentClass<TChildProps>): void;
|
||||
}
|
||||
//# sourceMappingURL=hoc-utils.d.ts.map
|
||||
48
node_modules/@apollo/client/react/hoc/hoc-utils.js
generated
vendored
Normal file
48
node_modules/@apollo/client/react/hoc/hoc-utils.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { __extends } from "tslib";
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import * as React from "rehackt";
|
||||
export var defaultMapPropsToOptions = function () { return ({}); };
|
||||
export var defaultMapResultToProps = function (props) { return props; };
|
||||
export var defaultMapPropsToSkip = function () { return false; };
|
||||
export function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
||||
}
|
||||
export function calculateVariablesFromProps(operation, props) {
|
||||
var variables = {};
|
||||
for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], variable = _b.variable, type = _b.type;
|
||||
if (!variable.name || !variable.name.value)
|
||||
continue;
|
||||
var variableName = variable.name.value;
|
||||
var variableProp = props[variableName];
|
||||
if (typeof variableProp !== "undefined") {
|
||||
variables[variableName] = variableProp;
|
||||
continue;
|
||||
}
|
||||
// Allow optional props
|
||||
if (type.kind !== "NonNullType") {
|
||||
variables[variableName] = undefined;
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
// base class for hocs to easily manage refs
|
||||
var GraphQLBase = /** @class */ (function (_super) {
|
||||
__extends(GraphQLBase, _super);
|
||||
function GraphQLBase(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.withRef = false;
|
||||
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
GraphQLBase.prototype.getWrappedInstance = function () {
|
||||
invariant(this.withRef, 56);
|
||||
return this.wrappedInstance;
|
||||
};
|
||||
GraphQLBase.prototype.setWrappedInstance = function (ref) {
|
||||
this.wrappedInstance = ref;
|
||||
};
|
||||
return GraphQLBase;
|
||||
}(React.Component));
|
||||
export { GraphQLBase };
|
||||
//# sourceMappingURL=hoc-utils.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/hoc-utils.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/hoc-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hoc-utils.js","sourceRoot":"","sources":["../../../src/react/hoc/hoc-utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,MAAM,CAAC,IAAM,wBAAwB,GAAG,cAAM,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,CAAC;AACnD,MAAM,CAAC,IAAM,uBAAuB,GAAuB,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK,CAAC;AAC5E,MAAM,CAAC,IAAM,qBAAqB,GAAG,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC;AAEjD,MAAM,UAAU,cAAc,CAAI,gBAAwC;IACxE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,SAA8B,EAC9B,KAAa;IAEb,IAAI,SAAS,GAAuB,EAAE,CAAC;IACvC,KAA+B,UAAmB,EAAnB,KAAA,SAAS,CAAC,SAAS,EAAnB,cAAmB,EAAnB,IAAmB,EAAE,CAAC;QAA5C,IAAA,WAAkB,EAAhB,QAAQ,cAAA,EAAE,IAAI,UAAA;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;YAAE,SAAS;QAErD,IAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QACzC,IAAM,YAAY,GAAI,KAAa,CAAC,YAAY,CAAC,CAAC;QAElD,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;YACxC,SAAS,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;YACvC,SAAS;QACX,CAAC;QAED,uBAAuB;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YAChC,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD,4CAA4C;AAC5C;IAIU,+BAA+B;IAKvC,qBAAY,KAAa;QACvB,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QALR,aAAO,GAAY,KAAK,CAAC;QAM9B,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;IAC/D,CAAC;IAED,wCAAkB,GAAlB;QACE,SAAS,CACP,IAAI,CAAC,OAAO,EACZ,sDAAsD;YACpD,kCAAkC,CACrC,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,wCAAkB,GAAlB,UAAmB,GAAsC;QACvD,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;IAC7B,CAAC;IACH,kBAAC;AAAD,CAAC,AA3BD,CAIU,KAAK,CAAC,SAAS,GAuBxB","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { IDocumentDefinition } from \"../parser/index.js\";\n\nexport const defaultMapPropsToOptions = () => ({});\nexport const defaultMapResultToProps: <P>(props: P) => P = (props) => props;\nexport const defaultMapPropsToSkip = () => false;\n\nexport function getDisplayName<P>(WrappedComponent: React.ComponentType<P>) {\n return WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n}\n\nexport function calculateVariablesFromProps<TProps>(\n operation: IDocumentDefinition,\n props: TProps\n) {\n let variables: OperationVariables = {};\n for (let { variable, type } of operation.variables) {\n if (!variable.name || !variable.name.value) continue;\n\n const variableName = variable.name.value;\n const variableProp = (props as any)[variableName];\n\n if (typeof variableProp !== \"undefined\") {\n variables[variableName] = variableProp;\n continue;\n }\n\n // Allow optional props\n if (type.kind !== \"NonNullType\") {\n variables[variableName] = undefined;\n }\n }\n return variables;\n}\n\nexport type RefSetter<TChildProps> = (\n ref: React.ComponentClass<TChildProps>\n) => void | void;\n\n// base class for hocs to easily manage refs\nexport class GraphQLBase<\n TProps,\n TChildProps,\n TState = any,\n> extends React.Component<TProps, TState> {\n public withRef: boolean = false;\n // wrapped instance\n private wrappedInstance?: React.ComponentClass<TChildProps>;\n\n constructor(props: TProps) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n this.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(ref: React.ComponentClass<TChildProps>) {\n this.wrappedInstance = ref;\n }\n}\n"]}
|
||||
322
node_modules/@apollo/client/react/hoc/hoc.cjs
generated
vendored
Normal file
322
node_modules/@apollo/client/react/hoc/hoc.cjs
generated
vendored
Normal file
@@ -0,0 +1,322 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var parser = require('../parser');
|
||||
var tslib = require('tslib');
|
||||
var React = require('rehackt');
|
||||
var hoistNonReactStatics = require('hoist-non-react-statics');
|
||||
var components = require('../components');
|
||||
var context = require('../context');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
var hoistNonReactStatics__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatics);
|
||||
|
||||
var defaultMapPropsToOptions = function () { return ({}); };
|
||||
var defaultMapPropsToSkip = function () { return false; };
|
||||
function getDisplayName$1(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
||||
}
|
||||
function calculateVariablesFromProps(operation, props) {
|
||||
var variables = {};
|
||||
for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], variable = _b.variable, type = _b.type;
|
||||
if (!variable.name || !variable.name.value)
|
||||
continue;
|
||||
var variableName = variable.name.value;
|
||||
var variableProp = props[variableName];
|
||||
if (typeof variableProp !== "undefined") {
|
||||
variables[variableName] = variableProp;
|
||||
continue;
|
||||
}
|
||||
if (type.kind !== "NonNullType") {
|
||||
variables[variableName] = undefined;
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
var GraphQLBase = (function (_super) {
|
||||
tslib.__extends(GraphQLBase, _super);
|
||||
function GraphQLBase(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.withRef = false;
|
||||
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
GraphQLBase.prototype.getWrappedInstance = function () {
|
||||
globals.invariant(this.withRef, 56);
|
||||
return this.wrappedInstance;
|
||||
};
|
||||
GraphQLBase.prototype.setWrappedInstance = function (ref) {
|
||||
this.wrappedInstance = ref;
|
||||
};
|
||||
return GraphQLBase;
|
||||
}(React__namespace.Component));
|
||||
|
||||
function withQuery(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var operation = parser.parser(document);
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function") {
|
||||
mapPropsToOptions = function () { return options; };
|
||||
}
|
||||
var mapPropsToSkip = skip;
|
||||
if (typeof mapPropsToSkip !== "function") {
|
||||
mapPropsToSkip = function () { return skip; };
|
||||
}
|
||||
var lastResultProps;
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
|
||||
var GraphQL = (function (_super) {
|
||||
tslib.__extends(GraphQL, _super);
|
||||
function GraphQL() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
GraphQL.prototype.render = function () {
|
||||
var _this = this;
|
||||
var props = this.props;
|
||||
var shouldSkip = mapPropsToSkip(props);
|
||||
var opts = shouldSkip ? Object.create(null) : tslib.__assign({}, mapPropsToOptions(props));
|
||||
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (React__namespace.createElement(components.Query, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
|
||||
var _b, _c;
|
||||
_a.client; var data = _a.data, r = tslib.__rest(_a, ["client", "data"]);
|
||||
if (operationOptions.withRef) {
|
||||
_this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: _this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (shouldSkip) {
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {})));
|
||||
}
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "data";
|
||||
var childProps = (_b = {}, _b[name] = result, _b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
lastResultProps = operationOptions.props(newResult, lastResultProps);
|
||||
childProps = lastResultProps;
|
||||
}
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)));
|
||||
}));
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
|
||||
function withMutation(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var operation = parser.parser(document);
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? "Apollo" : _b;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function")
|
||||
mapPropsToOptions = function () {
|
||||
return options;
|
||||
};
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
|
||||
var GraphQL = (function (_super) {
|
||||
tslib.__extends(GraphQL, _super);
|
||||
function GraphQL() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
GraphQL.prototype.render = function () {
|
||||
var props = this.props;
|
||||
var opts = mapPropsToOptions(props);
|
||||
if (operationOptions.withRef) {
|
||||
this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (!opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (
|
||||
(React__namespace.createElement(
|
||||
components.Mutation,
|
||||
tslib.__assign({ ignoreResults: true }, opts, { mutation: document }),
|
||||
function (mutate, _a) {
|
||||
var _b, _c;
|
||||
var data = _a.data, r = tslib.__rest(_a, ["data"]);
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "mutate";
|
||||
var resultName = operationOptions.name ? "".concat(name, "Result") : "result";
|
||||
var childProps = (_b = {},
|
||||
_b[name] = mutate,
|
||||
_b[resultName] = result,
|
||||
_b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = mutate,
|
||||
_c[resultName] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
childProps = operationOptions.props(newResult);
|
||||
}
|
||||
return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps));
|
||||
}
|
||||
))
|
||||
);
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
|
||||
function withSubscription(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var operation = parser.parser(document);
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c, shouldResubscribe = operationOptions.shouldResubscribe;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function")
|
||||
mapPropsToOptions = function () { return options; };
|
||||
var mapPropsToSkip = skip;
|
||||
if (typeof mapPropsToSkip !== "function")
|
||||
mapPropsToSkip = function () { return skip; };
|
||||
var lastResultProps;
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
|
||||
var GraphQL = (function (_super) {
|
||||
tslib.__extends(GraphQL, _super);
|
||||
function GraphQL(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.state = { resubscribe: false };
|
||||
return _this;
|
||||
}
|
||||
GraphQL.prototype.updateResubscribe = function (resubscribe) {
|
||||
this.setState({ resubscribe: resubscribe });
|
||||
};
|
||||
GraphQL.prototype.componentDidUpdate = function (prevProps) {
|
||||
var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props));
|
||||
if (this.state.resubscribe !== resubscribe) {
|
||||
this.updateResubscribe(resubscribe);
|
||||
}
|
||||
};
|
||||
GraphQL.prototype.render = function () {
|
||||
var _this = this;
|
||||
var props = this.props;
|
||||
var shouldSkip = mapPropsToSkip(props);
|
||||
var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props);
|
||||
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (React__namespace.createElement(components.Subscription, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
|
||||
var _b, _c;
|
||||
var data = _a.data, r = tslib.__rest(_a, ["data"]);
|
||||
if (operationOptions.withRef) {
|
||||
_this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: _this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (shouldSkip) {
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {})));
|
||||
}
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "data";
|
||||
var childProps = (_b = {}, _b[name] = result, _b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
lastResultProps = operationOptions.props(newResult, lastResultProps);
|
||||
childProps = lastResultProps;
|
||||
}
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)));
|
||||
}));
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
|
||||
function graphql(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
switch (parser.parser(document).type) {
|
||||
case parser.DocumentType.Mutation:
|
||||
return withMutation(document, operationOptions);
|
||||
case parser.DocumentType.Subscription:
|
||||
return withSubscription(document, operationOptions);
|
||||
case parser.DocumentType.Query:
|
||||
default:
|
||||
return withQuery(document, operationOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
||||
}
|
||||
function withApollo(WrappedComponent, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")");
|
||||
var WithApollo = (function (_super) {
|
||||
tslib.__extends(WithApollo, _super);
|
||||
function WithApollo(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
WithApollo.prototype.getWrappedInstance = function () {
|
||||
globals.invariant(operationOptions.withRef, 57);
|
||||
return this.wrappedInstance;
|
||||
};
|
||||
WithApollo.prototype.setWrappedInstance = function (ref) {
|
||||
this.wrappedInstance = ref;
|
||||
};
|
||||
WithApollo.prototype.render = function () {
|
||||
var _this = this;
|
||||
return (React__namespace.createElement(context.ApolloConsumer, null, function (client) {
|
||||
var props = Object.assign({}, _this.props, {
|
||||
client: client,
|
||||
ref: operationOptions.withRef ? _this.setWrappedInstance : undefined,
|
||||
});
|
||||
return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props));
|
||||
}));
|
||||
};
|
||||
WithApollo.displayName = withDisplayName;
|
||||
WithApollo.WrappedComponent = WrappedComponent;
|
||||
return WithApollo;
|
||||
}(React__namespace.Component));
|
||||
return hoistNonReactStatics__default(WithApollo, WrappedComponent, {});
|
||||
}
|
||||
|
||||
exports.graphql = graphql;
|
||||
exports.withApollo = withApollo;
|
||||
exports.withMutation = withMutation;
|
||||
exports.withQuery = withQuery;
|
||||
exports.withSubscription = withSubscription;
|
||||
//# sourceMappingURL=hoc.cjs.map
|
||||
1
node_modules/@apollo/client/react/hoc/hoc.cjs.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/hoc.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
322
node_modules/@apollo/client/react/hoc/hoc.cjs.native.js
generated
vendored
Normal file
322
node_modules/@apollo/client/react/hoc/hoc.cjs.native.js
generated
vendored
Normal file
@@ -0,0 +1,322 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var parser = require('../parser');
|
||||
var tslib = require('tslib');
|
||||
var React = require('rehackt');
|
||||
var hoistNonReactStatics = require('hoist-non-react-statics');
|
||||
var components = require('../components');
|
||||
var context = require('../context');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
var hoistNonReactStatics__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatics);
|
||||
|
||||
var defaultMapPropsToOptions = function () { return ({}); };
|
||||
var defaultMapPropsToSkip = function () { return false; };
|
||||
function getDisplayName$1(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
||||
}
|
||||
function calculateVariablesFromProps(operation, props) {
|
||||
var variables = {};
|
||||
for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], variable = _b.variable, type = _b.type;
|
||||
if (!variable.name || !variable.name.value)
|
||||
continue;
|
||||
var variableName = variable.name.value;
|
||||
var variableProp = props[variableName];
|
||||
if (typeof variableProp !== "undefined") {
|
||||
variables[variableName] = variableProp;
|
||||
continue;
|
||||
}
|
||||
if (type.kind !== "NonNullType") {
|
||||
variables[variableName] = undefined;
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
var GraphQLBase = (function (_super) {
|
||||
tslib.__extends(GraphQLBase, _super);
|
||||
function GraphQLBase(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.withRef = false;
|
||||
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
GraphQLBase.prototype.getWrappedInstance = function () {
|
||||
globals.invariant(this.withRef, 56);
|
||||
return this.wrappedInstance;
|
||||
};
|
||||
GraphQLBase.prototype.setWrappedInstance = function (ref) {
|
||||
this.wrappedInstance = ref;
|
||||
};
|
||||
return GraphQLBase;
|
||||
}(React__namespace.Component));
|
||||
|
||||
function withQuery(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var operation = parser.parser(document);
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function") {
|
||||
mapPropsToOptions = function () { return options; };
|
||||
}
|
||||
var mapPropsToSkip = skip;
|
||||
if (typeof mapPropsToSkip !== "function") {
|
||||
mapPropsToSkip = function () { return skip; };
|
||||
}
|
||||
var lastResultProps;
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
|
||||
var GraphQL = (function (_super) {
|
||||
tslib.__extends(GraphQL, _super);
|
||||
function GraphQL() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
GraphQL.prototype.render = function () {
|
||||
var _this = this;
|
||||
var props = this.props;
|
||||
var shouldSkip = mapPropsToSkip(props);
|
||||
var opts = shouldSkip ? Object.create(null) : tslib.__assign({}, mapPropsToOptions(props));
|
||||
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (React__namespace.createElement(components.Query, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
|
||||
var _b, _c;
|
||||
_a.client; var data = _a.data, r = tslib.__rest(_a, ["client", "data"]);
|
||||
if (operationOptions.withRef) {
|
||||
_this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: _this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (shouldSkip) {
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {})));
|
||||
}
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "data";
|
||||
var childProps = (_b = {}, _b[name] = result, _b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
lastResultProps = operationOptions.props(newResult, lastResultProps);
|
||||
childProps = lastResultProps;
|
||||
}
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)));
|
||||
}));
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
|
||||
function withMutation(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var operation = parser.parser(document);
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? "Apollo" : _b;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function")
|
||||
mapPropsToOptions = function () {
|
||||
return options;
|
||||
};
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
|
||||
var GraphQL = (function (_super) {
|
||||
tslib.__extends(GraphQL, _super);
|
||||
function GraphQL() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
GraphQL.prototype.render = function () {
|
||||
var props = this.props;
|
||||
var opts = mapPropsToOptions(props);
|
||||
if (operationOptions.withRef) {
|
||||
this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (!opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (
|
||||
(React__namespace.createElement(
|
||||
components.Mutation,
|
||||
tslib.__assign({ ignoreResults: true }, opts, { mutation: document }),
|
||||
function (mutate, _a) {
|
||||
var _b, _c;
|
||||
var data = _a.data, r = tslib.__rest(_a, ["data"]);
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "mutate";
|
||||
var resultName = operationOptions.name ? "".concat(name, "Result") : "result";
|
||||
var childProps = (_b = {},
|
||||
_b[name] = mutate,
|
||||
_b[resultName] = result,
|
||||
_b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = mutate,
|
||||
_c[resultName] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
childProps = operationOptions.props(newResult);
|
||||
}
|
||||
return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps));
|
||||
}
|
||||
))
|
||||
);
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
|
||||
function withSubscription(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var operation = parser.parser(document);
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c, shouldResubscribe = operationOptions.shouldResubscribe;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function")
|
||||
mapPropsToOptions = function () { return options; };
|
||||
var mapPropsToSkip = skip;
|
||||
if (typeof mapPropsToSkip !== "function")
|
||||
mapPropsToSkip = function () { return skip; };
|
||||
var lastResultProps;
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")");
|
||||
var GraphQL = (function (_super) {
|
||||
tslib.__extends(GraphQL, _super);
|
||||
function GraphQL(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.state = { resubscribe: false };
|
||||
return _this;
|
||||
}
|
||||
GraphQL.prototype.updateResubscribe = function (resubscribe) {
|
||||
this.setState({ resubscribe: resubscribe });
|
||||
};
|
||||
GraphQL.prototype.componentDidUpdate = function (prevProps) {
|
||||
var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props));
|
||||
if (this.state.resubscribe !== resubscribe) {
|
||||
this.updateResubscribe(resubscribe);
|
||||
}
|
||||
};
|
||||
GraphQL.prototype.render = function () {
|
||||
var _this = this;
|
||||
var props = this.props;
|
||||
var shouldSkip = mapPropsToSkip(props);
|
||||
var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props);
|
||||
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (React__namespace.createElement(components.Subscription, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
|
||||
var _b, _c;
|
||||
var data = _a.data, r = tslib.__rest(_a, ["data"]);
|
||||
if (operationOptions.withRef) {
|
||||
_this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: _this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (shouldSkip) {
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {})));
|
||||
}
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "data";
|
||||
var childProps = (_b = {}, _b[name] = result, _b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
lastResultProps = operationOptions.props(newResult, lastResultProps);
|
||||
childProps = lastResultProps;
|
||||
}
|
||||
return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)));
|
||||
}));
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
return hoistNonReactStatics__default(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
|
||||
function graphql(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
switch (parser.parser(document).type) {
|
||||
case parser.DocumentType.Mutation:
|
||||
return withMutation(document, operationOptions);
|
||||
case parser.DocumentType.Subscription:
|
||||
return withSubscription(document, operationOptions);
|
||||
case parser.DocumentType.Query:
|
||||
default:
|
||||
return withQuery(document, operationOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
||||
}
|
||||
function withApollo(WrappedComponent, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")");
|
||||
var WithApollo = (function (_super) {
|
||||
tslib.__extends(WithApollo, _super);
|
||||
function WithApollo(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
WithApollo.prototype.getWrappedInstance = function () {
|
||||
globals.invariant(operationOptions.withRef, 57);
|
||||
return this.wrappedInstance;
|
||||
};
|
||||
WithApollo.prototype.setWrappedInstance = function (ref) {
|
||||
this.wrappedInstance = ref;
|
||||
};
|
||||
WithApollo.prototype.render = function () {
|
||||
var _this = this;
|
||||
return (React__namespace.createElement(context.ApolloConsumer, null, function (client) {
|
||||
var props = Object.assign({}, _this.props, {
|
||||
client: client,
|
||||
ref: operationOptions.withRef ? _this.setWrappedInstance : undefined,
|
||||
});
|
||||
return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props));
|
||||
}));
|
||||
};
|
||||
WithApollo.displayName = withDisplayName;
|
||||
WithApollo.WrappedComponent = WrappedComponent;
|
||||
return WithApollo;
|
||||
}(React__namespace.Component));
|
||||
return hoistNonReactStatics__default(WithApollo, WrappedComponent, {});
|
||||
}
|
||||
|
||||
exports.graphql = graphql;
|
||||
exports.withApollo = withApollo;
|
||||
exports.withMutation = withMutation;
|
||||
exports.withQuery = withQuery;
|
||||
exports.withSubscription = withSubscription;
|
||||
//# sourceMappingURL=hoc.cjs.map
|
||||
1
node_modules/@apollo/client/react/hoc/hoc.d.cts
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/hoc.d.cts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./index.d.ts";
|
||||
8
node_modules/@apollo/client/react/hoc/index.d.ts
generated
vendored
Normal file
8
node_modules/@apollo/client/react/hoc/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export { graphql } from "./graphql.js";
|
||||
export { withQuery } from "./query-hoc.js";
|
||||
export { withMutation } from "./mutation-hoc.js";
|
||||
export { withSubscription } from "./subscription-hoc.js";
|
||||
export { withApollo } from "./withApollo.js";
|
||||
export type * from "./types.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
7
node_modules/@apollo/client/react/hoc/index.js
generated
vendored
Normal file
7
node_modules/@apollo/client/react/hoc/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export { graphql } from "./graphql.js";
|
||||
export { withQuery } from "./query-hoc.js";
|
||||
export { withMutation } from "./mutation-hoc.js";
|
||||
export { withSubscription } from "./subscription-hoc.js";
|
||||
export { withApollo } from "./withApollo.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/index.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport { graphql } from \"./graphql.js\";\n\nexport { withQuery } from \"./query-hoc.js\";\nexport { withMutation } from \"./mutation-hoc.js\";\nexport { withSubscription } from \"./subscription-hoc.js\";\nexport { withApollo } from \"./withApollo.js\";\n\nexport type * from \"./types.js\";\n"]}
|
||||
12
node_modules/@apollo/client/react/hoc/mutation-hoc.d.ts
generated
vendored
Normal file
12
node_modules/@apollo/client/react/hoc/mutation-hoc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { DocumentNode } from "graphql";
|
||||
import type { DefaultContext, OperationVariables } from "../../core/types.js";
|
||||
import type { OperationOption, MutateProps } from "./types.js";
|
||||
import type { ApolloCache } from "../../core/index.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function withMutation<TProps extends TGraphQLVariables | {} = {}, TData extends Record<string, any> = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps = MutateProps<TData, TGraphQLVariables>, TContext extends Record<string, any> = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;
|
||||
//# sourceMappingURL=mutation-hoc.d.ts.map
|
||||
83
node_modules/@apollo/client/react/hoc/mutation-hoc.js
generated
vendored
Normal file
83
node_modules/@apollo/client/react/hoc/mutation-hoc.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
import { __assign, __extends, __rest } from "tslib";
|
||||
import * as React from "rehackt";
|
||||
import hoistNonReactStatics from "hoist-non-react-statics";
|
||||
import { parser } from "../parser/index.js";
|
||||
import { Mutation } from "../components/index.js";
|
||||
import { defaultMapPropsToOptions, getDisplayName, calculateVariablesFromProps, GraphQLBase, } from "./hoc-utils.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function withMutation(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
// this is memoized so if coming from `graphql` there is nearly no extra cost
|
||||
var operation = parser(document);
|
||||
// extract options
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? "Apollo" : _b;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function")
|
||||
mapPropsToOptions = function () {
|
||||
return options;
|
||||
};
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")");
|
||||
var GraphQL = /** @class */ (function (_super) {
|
||||
__extends(GraphQL, _super);
|
||||
function GraphQL() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
GraphQL.prototype.render = function () {
|
||||
var props = this.props;
|
||||
var opts = mapPropsToOptions(props);
|
||||
if (operationOptions.withRef) {
|
||||
this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
if (!opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (
|
||||
// @ts-expect-error
|
||||
(React.createElement(
|
||||
Mutation,
|
||||
__assign({ ignoreResults: true }, opts, { mutation: document }),
|
||||
function (mutate, _a) {
|
||||
// the HOC's historically hoisted the data from the execution result
|
||||
// up onto the result since it was passed as a nested prop
|
||||
// we massage the Mutation component's shape here to replicate that
|
||||
// this matches the query HoC
|
||||
var _b, _c;
|
||||
var data = _a.data, r = __rest(_a, ["data"]);
|
||||
// @ts-ignore Type instantiation is excessively deep and possibly infinite.
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "mutate";
|
||||
var resultName = operationOptions.name ? "".concat(name, "Result") : "result";
|
||||
var childProps = (_b = {},
|
||||
_b[name] = mutate,
|
||||
_b[resultName] = result,
|
||||
_b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = mutate,
|
||||
_c[resultName] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
childProps = operationOptions.props(newResult);
|
||||
}
|
||||
return React.createElement(WrappedComponent, __assign({}, props, childProps));
|
||||
}
|
||||
))
|
||||
);
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
// Make sure we preserve any custom statics on the original component.
|
||||
return hoistNonReactStatics(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=mutation-hoc.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/mutation-hoc.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/mutation-hoc.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@apollo/client/react/hoc/package.json
generated
vendored
Normal file
8
node_modules/@apollo/client/react/hoc/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/react/hoc",
|
||||
"type": "module",
|
||||
"main": "hoc.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
10
node_modules/@apollo/client/react/hoc/query-hoc.d.ts
generated
vendored
Normal file
10
node_modules/@apollo/client/react/hoc/query-hoc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { DocumentNode } from "graphql";
|
||||
import type { OperationOption, DataProps } from "./types.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function withQuery<TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;
|
||||
//# sourceMappingURL=query-hoc.d.ts.map
|
||||
81
node_modules/@apollo/client/react/hoc/query-hoc.js
generated
vendored
Normal file
81
node_modules/@apollo/client/react/hoc/query-hoc.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import { __assign, __extends, __rest } from "tslib";
|
||||
import * as React from "rehackt";
|
||||
import hoistNonReactStatics from "hoist-non-react-statics";
|
||||
import { parser } from "../parser/index.js";
|
||||
import { Query } from "../components/index.js";
|
||||
import { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip, } from "./hoc-utils.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function withQuery(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
// this is memoized so if coming from `graphql` there is nearly no extra cost
|
||||
var operation = parser(document);
|
||||
// extract options
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function") {
|
||||
mapPropsToOptions = function () { return options; };
|
||||
}
|
||||
var mapPropsToSkip = skip;
|
||||
if (typeof mapPropsToSkip !== "function") {
|
||||
mapPropsToSkip = function () { return skip; };
|
||||
}
|
||||
// allow for advanced referential equality checks
|
||||
var lastResultProps;
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")");
|
||||
var GraphQL = /** @class */ (function (_super) {
|
||||
__extends(GraphQL, _super);
|
||||
function GraphQL() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
GraphQL.prototype.render = function () {
|
||||
var _this = this;
|
||||
var props = this.props;
|
||||
var shouldSkip = mapPropsToSkip(props);
|
||||
var opts = shouldSkip ? Object.create(null) : __assign({}, mapPropsToOptions(props));
|
||||
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (React.createElement(Query, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
|
||||
var _b, _c;
|
||||
var _ = _a.client, data = _a.data, r = __rest(_a, ["client", "data"]);
|
||||
if (operationOptions.withRef) {
|
||||
_this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: _this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
// if we have skipped, no reason to manage any reshaping
|
||||
if (shouldSkip) {
|
||||
return (React.createElement(WrappedComponent, __assign({}, props, {})));
|
||||
}
|
||||
// the HOC's historically hoisted the data from the execution result
|
||||
// up onto the result since it was passed as a nested prop
|
||||
// we massage the Query components shape here to replicate that
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "data";
|
||||
var childProps = (_b = {}, _b[name] = result, _b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
lastResultProps = operationOptions.props(newResult, lastResultProps);
|
||||
childProps = lastResultProps;
|
||||
}
|
||||
return (React.createElement(WrappedComponent, __assign({}, props, childProps)));
|
||||
}));
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
// Make sure we preserve any custom statics on the original component.
|
||||
return hoistNonReactStatics(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=query-hoc.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/query-hoc.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/query-hoc.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
node_modules/@apollo/client/react/hoc/subscription-hoc.d.ts
generated
vendored
Normal file
10
node_modules/@apollo/client/react/hoc/subscription-hoc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { DocumentNode } from "graphql";
|
||||
import type { OperationOption, DataProps } from "./types.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function withSubscription<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;
|
||||
//# sourceMappingURL=subscription-hoc.d.ts.map
|
||||
90
node_modules/@apollo/client/react/hoc/subscription-hoc.js
generated
vendored
Normal file
90
node_modules/@apollo/client/react/hoc/subscription-hoc.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
import { __assign, __extends, __rest } from "tslib";
|
||||
import * as React from "rehackt";
|
||||
import hoistNonReactStatics from "hoist-non-react-statics";
|
||||
import { parser } from "../parser/index.js";
|
||||
import { Subscription } from "../components/index.js";
|
||||
import { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip, } from "./hoc-utils.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function withSubscription(document, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
// this is memoized so if coming from `graphql` there is nearly no extra cost
|
||||
var operation = parser(document);
|
||||
// extract options
|
||||
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c, shouldResubscribe = operationOptions.shouldResubscribe;
|
||||
var mapPropsToOptions = options;
|
||||
if (typeof mapPropsToOptions !== "function")
|
||||
mapPropsToOptions = function () { return options; };
|
||||
var mapPropsToSkip = skip;
|
||||
if (typeof mapPropsToSkip !== "function")
|
||||
mapPropsToSkip = function () { return skip; };
|
||||
// allow for advanced referential equality checks
|
||||
var lastResultProps;
|
||||
return function (WrappedComponent) {
|
||||
var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")");
|
||||
var GraphQL = /** @class */ (function (_super) {
|
||||
__extends(GraphQL, _super);
|
||||
function GraphQL(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.state = { resubscribe: false };
|
||||
return _this;
|
||||
}
|
||||
GraphQL.prototype.updateResubscribe = function (resubscribe) {
|
||||
this.setState({ resubscribe: resubscribe });
|
||||
};
|
||||
GraphQL.prototype.componentDidUpdate = function (prevProps) {
|
||||
var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props));
|
||||
if (this.state.resubscribe !== resubscribe) {
|
||||
this.updateResubscribe(resubscribe);
|
||||
}
|
||||
};
|
||||
GraphQL.prototype.render = function () {
|
||||
var _this = this;
|
||||
var props = this.props;
|
||||
var shouldSkip = mapPropsToSkip(props);
|
||||
var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props);
|
||||
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
|
||||
opts.variables = calculateVariablesFromProps(operation, props);
|
||||
}
|
||||
return (React.createElement(Subscription, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
|
||||
var _b, _c;
|
||||
var data = _a.data, r = __rest(_a, ["data"]);
|
||||
if (operationOptions.withRef) {
|
||||
_this.withRef = true;
|
||||
props = Object.assign({}, props, {
|
||||
ref: _this.setWrappedInstance,
|
||||
});
|
||||
}
|
||||
// if we have skipped, no reason to manage any reshaping
|
||||
if (shouldSkip) {
|
||||
return (React.createElement(WrappedComponent, __assign({}, props, {})));
|
||||
}
|
||||
// the HOC's historically hoisted the data from the execution result
|
||||
// up onto the result since it was passed as a nested prop
|
||||
// we massage the Query components shape here to replicate that
|
||||
var result = Object.assign(r, data || {});
|
||||
var name = operationOptions.name || "data";
|
||||
var childProps = (_b = {}, _b[name] = result, _b);
|
||||
if (operationOptions.props) {
|
||||
var newResult = (_c = {},
|
||||
_c[name] = result,
|
||||
_c.ownProps = props,
|
||||
_c);
|
||||
lastResultProps = operationOptions.props(newResult, lastResultProps);
|
||||
childProps = lastResultProps;
|
||||
}
|
||||
return (React.createElement(WrappedComponent, __assign({}, props, childProps)));
|
||||
}));
|
||||
};
|
||||
GraphQL.displayName = graphQLDisplayName;
|
||||
GraphQL.WrappedComponent = WrappedComponent;
|
||||
return GraphQL;
|
||||
}(GraphQLBase));
|
||||
// Make sure we preserve any custom statics on the original component.
|
||||
return hoistNonReactStatics(GraphQL, WrappedComponent, {});
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=subscription-hoc.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/subscription-hoc.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/subscription-hoc.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
42
node_modules/@apollo/client/react/hoc/types.d.ts
generated
vendored
Normal file
42
node_modules/@apollo/client/react/hoc/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { ApolloError } from "../../errors/index.js";
|
||||
import type { ApolloCache, ApolloClient, ApolloQueryResult, DefaultContext, FetchMoreOptions, FetchMoreQueryOptions, OperationVariables, SubscribeToMoreOptions, UpdateQueryMapFn } from "../../core/index.js";
|
||||
import type { MutationFunction, BaseQueryOptions, BaseMutationOptions, MutationResult } from "../types/types.js";
|
||||
export interface QueryControls<TData = any, TGraphQLVariables = OperationVariables> {
|
||||
error?: ApolloError;
|
||||
networkStatus: number;
|
||||
loading: boolean;
|
||||
variables: TGraphQLVariables;
|
||||
fetchMore: (fetchMoreOptions: FetchMoreQueryOptions<TGraphQLVariables, TData> & FetchMoreOptions<TData, TGraphQLVariables>) => Promise<ApolloQueryResult<TData>>;
|
||||
refetch: (variables?: TGraphQLVariables) => Promise<ApolloQueryResult<TData>>;
|
||||
startPolling: (pollInterval: number) => void;
|
||||
stopPolling: () => void;
|
||||
subscribeToMore: (options: SubscribeToMoreOptions) => () => void;
|
||||
updateQuery: (mapFn: UpdateQueryMapFn<TData, TGraphQLVariables>) => void;
|
||||
}
|
||||
export type DataValue<TData, TGraphQLVariables = OperationVariables> = QueryControls<TData, TGraphQLVariables> & Partial<TData>;
|
||||
export interface DataProps<TData, TGraphQLVariables = OperationVariables> {
|
||||
data: DataValue<TData, TGraphQLVariables>;
|
||||
}
|
||||
export interface MutateProps<TData = any, TGraphQLVariables = OperationVariables> {
|
||||
mutate: MutationFunction<TData, TGraphQLVariables>;
|
||||
result: MutationResult<TData>;
|
||||
}
|
||||
export type ChildProps<TProps = {}, TData = {}, TGraphQLVariables = OperationVariables> = TProps & Partial<DataProps<TData, TGraphQLVariables>> & Partial<MutateProps<TData, TGraphQLVariables>>;
|
||||
export type ChildDataProps<TProps = {}, TData = {}, TGraphQLVariables = OperationVariables> = TProps & DataProps<TData, TGraphQLVariables>;
|
||||
export type ChildMutateProps<TProps = {}, TData = {}, TGraphQLVariables = OperationVariables> = TProps & MutateProps<TData, TGraphQLVariables>;
|
||||
export interface OptionProps<TProps = any, TData = any, TGraphQLVariables = OperationVariables> extends Partial<DataProps<TData, TGraphQLVariables>>, Partial<MutateProps<TData, TGraphQLVariables>> {
|
||||
ownProps: TProps;
|
||||
}
|
||||
export interface OperationOption<TProps, TData, TGraphQLVariables extends OperationVariables = OperationVariables, TChildProps = ChildProps<TProps, TData, TGraphQLVariables>, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> {
|
||||
options?: BaseQueryOptions<TGraphQLVariables> | BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache> | ((props: TProps) => BaseQueryOptions<TGraphQLVariables> | BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache>);
|
||||
props?: (props: OptionProps<TProps, TData, TGraphQLVariables>, lastProps?: TChildProps | void) => TChildProps;
|
||||
skip?: boolean | ((props: TProps) => boolean);
|
||||
name?: string;
|
||||
withRef?: boolean;
|
||||
shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean;
|
||||
alias?: string;
|
||||
}
|
||||
export type WithApolloClient<P> = P & {
|
||||
client?: ApolloClient<any>;
|
||||
};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
2
node_modules/@apollo/client/react/hoc/types.js
generated
vendored
Normal file
2
node_modules/@apollo/client/react/hoc/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/types.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/hoc/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloCache,\n ApolloClient,\n ApolloQueryResult,\n DefaultContext,\n FetchMoreOptions,\n FetchMoreQueryOptions,\n OperationVariables,\n SubscribeToMoreOptions,\n UpdateQueryMapFn,\n} from \"../../core/index.js\";\nimport type {\n MutationFunction,\n BaseQueryOptions,\n BaseMutationOptions,\n MutationResult,\n} from \"../types/types.js\";\n\nexport interface QueryControls<\n TData = any,\n TGraphQLVariables = OperationVariables,\n> {\n error?: ApolloError;\n networkStatus: number;\n loading: boolean;\n variables: TGraphQLVariables;\n fetchMore: (\n fetchMoreOptions: FetchMoreQueryOptions<TGraphQLVariables, TData> &\n FetchMoreOptions<TData, TGraphQLVariables>\n ) => Promise<ApolloQueryResult<TData>>;\n refetch: (variables?: TGraphQLVariables) => Promise<ApolloQueryResult<TData>>;\n startPolling: (pollInterval: number) => void;\n stopPolling: () => void;\n subscribeToMore: (options: SubscribeToMoreOptions) => () => void;\n updateQuery: (mapFn: UpdateQueryMapFn<TData, TGraphQLVariables>) => void;\n}\n\nexport type DataValue<\n TData,\n TGraphQLVariables = OperationVariables,\n> = QueryControls<TData, TGraphQLVariables> &\n // data may not yet be loaded\n Partial<TData>;\n\nexport interface DataProps<TData, TGraphQLVariables = OperationVariables> {\n data: DataValue<TData, TGraphQLVariables>;\n}\n\nexport interface MutateProps<\n TData = any,\n TGraphQLVariables = OperationVariables,\n> {\n mutate: MutationFunction<TData, TGraphQLVariables>;\n result: MutationResult<TData>;\n}\n\nexport type ChildProps<\n TProps = {},\n TData = {},\n TGraphQLVariables = OperationVariables,\n> = TProps &\n Partial<DataProps<TData, TGraphQLVariables>> &\n Partial<MutateProps<TData, TGraphQLVariables>>;\n\nexport type ChildDataProps<\n TProps = {},\n TData = {},\n TGraphQLVariables = OperationVariables,\n> = TProps & DataProps<TData, TGraphQLVariables>;\n\nexport type ChildMutateProps<\n TProps = {},\n TData = {},\n TGraphQLVariables = OperationVariables,\n> = TProps & MutateProps<TData, TGraphQLVariables>;\n\nexport interface OptionProps<\n TProps = any,\n TData = any,\n TGraphQLVariables = OperationVariables,\n> extends Partial<DataProps<TData, TGraphQLVariables>>,\n Partial<MutateProps<TData, TGraphQLVariables>> {\n ownProps: TProps;\n}\n\nexport interface OperationOption<\n TProps,\n TData,\n TGraphQLVariables extends OperationVariables = OperationVariables,\n TChildProps = ChildProps<TProps, TData, TGraphQLVariables>,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n options?:\n | BaseQueryOptions<TGraphQLVariables>\n | BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache>\n | ((\n props: TProps\n ) =>\n | BaseQueryOptions<TGraphQLVariables>\n | BaseMutationOptions<TData, TGraphQLVariables, TContext, TCache>);\n props?: (\n props: OptionProps<TProps, TData, TGraphQLVariables>,\n lastProps?: TChildProps | void\n ) => TChildProps;\n skip?: boolean | ((props: TProps) => boolean);\n name?: string;\n withRef?: boolean;\n shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean;\n alias?: string;\n}\n\nexport type WithApolloClient<P> = P & { client?: ApolloClient<any> };\n"]}
|
||||
9
node_modules/@apollo/client/react/hoc/withApollo.d.ts
generated
vendored
Normal file
9
node_modules/@apollo/client/react/hoc/withApollo.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type * as ReactTypes from "react";
|
||||
import type { OperationOption, WithApolloClient } from "./types.js";
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export declare function withApollo<TProps, TResult = any>(WrappedComponent: ReactTypes.ComponentType<WithApolloClient<Omit<TProps, "client">>>, operationOptions?: OperationOption<TProps, TResult>): ReactTypes.ComponentClass<Omit<TProps, "client">>;
|
||||
//# sourceMappingURL=withApollo.d.ts.map
|
||||
48
node_modules/@apollo/client/react/hoc/withApollo.js
generated
vendored
Normal file
48
node_modules/@apollo/client/react/hoc/withApollo.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { __assign, __extends } from "tslib";
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import * as React from "rehackt";
|
||||
import hoistNonReactStatics from "hoist-non-react-statics";
|
||||
import { ApolloConsumer } from "../context/index.js";
|
||||
function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* Official support for React Apollo higher order components ended in March 2020.
|
||||
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
|
||||
*/
|
||||
export function withApollo(WrappedComponent, operationOptions) {
|
||||
if (operationOptions === void 0) { operationOptions = {}; }
|
||||
var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")");
|
||||
var WithApollo = /** @class */ (function (_super) {
|
||||
__extends(WithApollo, _super);
|
||||
function WithApollo(props) {
|
||||
var _this = _super.call(this, props) || this;
|
||||
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
WithApollo.prototype.getWrappedInstance = function () {
|
||||
invariant(operationOptions.withRef, 57);
|
||||
return this.wrappedInstance;
|
||||
};
|
||||
WithApollo.prototype.setWrappedInstance = function (ref) {
|
||||
this.wrappedInstance = ref;
|
||||
};
|
||||
WithApollo.prototype.render = function () {
|
||||
var _this = this;
|
||||
return (React.createElement(ApolloConsumer, null, function (client) {
|
||||
var props = Object.assign({}, _this.props, {
|
||||
client: client,
|
||||
ref: operationOptions.withRef ? _this.setWrappedInstance : undefined,
|
||||
});
|
||||
return React.createElement(WrappedComponent, __assign({}, props));
|
||||
}));
|
||||
};
|
||||
WithApollo.displayName = withDisplayName;
|
||||
WithApollo.WrappedComponent = WrappedComponent;
|
||||
return WithApollo;
|
||||
}(React.Component));
|
||||
// Make sure we preserve any custom statics on the original component.
|
||||
return hoistNonReactStatics(WithApollo, WrappedComponent, {});
|
||||
}
|
||||
//# sourceMappingURL=withApollo.js.map
|
||||
1
node_modules/@apollo/client/react/hoc/withApollo.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hoc/withApollo.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"withApollo.js","sourceRoot":"","sources":["../../../src/react/hoc/withApollo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,SAAS,cAAc,CAAI,gBAA6C;IACtE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,gBAEC,EACD,gBAAuD;IAAvD,iCAAA,EAAA,qBAAuD;IAEvD,IAAM,eAAe,GAAG,qBAAc,cAAc,CAAC,gBAAgB,CAAC,MAAG,CAAC;IAE1E;QAAyB,8BAAuC;QAO9D,oBAAY,KAA6B;YACvC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YACb,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;QAC/D,CAAC;QAED,uCAAkB,GAAlB;YACE,SAAS,CACP,gBAAgB,CAAC,OAAO,EACxB,sDAAsD;gBACpD,kCAAkC,CACrC,CAAC;YAEF,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAED,uCAAkB,GAAlB,UACE,GAAuD;YAEvD,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC7B,CAAC;QAED,2BAAM,GAAN;YAAA,iBAaC;YAZC,OAAO,CACL,oBAAC,cAAc,QACZ,UAAC,MAAM;gBACN,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAI,CAAC,KAAK,EAAE;oBAC1C,MAAM,QAAA;oBACN,GAAG,EACD,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;iBACjE,CAAC,CAAC;gBACH,OAAO,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CAAC;YACzC,CAAC,CACc,CAClB,CAAC;QACJ,CAAC;QAxCM,sBAAW,GAAG,eAAe,CAAC;QAC9B,2BAAgB,GAAG,gBAAgB,CAAC;QAwC7C,iBAAC;KAAA,AA1CD,CAAyB,KAAK,CAAC,SAAS,GA0CvC;IAED,sEAAsE;IACtE,OAAO,oBAAoB,CAAC,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\n\nimport { ApolloConsumer } from \"../context/index.js\";\nimport type { OperationOption, WithApolloClient } from \"./types.js\";\n\nfunction getDisplayName<P>(WrappedComponent: ReactTypes.ComponentType<P>) {\n return WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n}\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withApollo<TProps, TResult = any>(\n WrappedComponent: ReactTypes.ComponentType<\n WithApolloClient<Omit<TProps, \"client\">>\n >,\n operationOptions: OperationOption<TProps, TResult> = {}\n): ReactTypes.ComponentClass<Omit<TProps, \"client\">> {\n const withDisplayName = `withApollo(${getDisplayName(WrappedComponent)})`;\n\n class WithApollo extends React.Component<Omit<TProps, \"client\">> {\n static displayName = withDisplayName;\n static WrappedComponent = WrappedComponent;\n\n // wrapped instance\n private wrappedInstance: any;\n\n constructor(props: Omit<TProps, \"client\">) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n operationOptions.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(\n ref: ReactTypes.ComponentType<WithApolloClient<TProps>>\n ) {\n this.wrappedInstance = ref;\n }\n\n render() {\n return (\n <ApolloConsumer>\n {(client) => {\n const props = Object.assign({}, this.props, {\n client,\n ref:\n operationOptions.withRef ? this.setWrappedInstance : undefined,\n });\n return <WrappedComponent {...props} />;\n }}\n </ApolloConsumer>\n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(WithApollo, WrappedComponent, {});\n}\n"]}
|
||||
3
node_modules/@apollo/client/react/hooks/constants.d.ts
generated
vendored
Normal file
3
node_modules/@apollo/client/react/hooks/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare const skipToken: unique symbol;
|
||||
export type SkipToken = typeof skipToken;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
2
node_modules/@apollo/client/react/hooks/constants.js
generated
vendored
Normal file
2
node_modules/@apollo/client/react/hooks/constants.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export var skipToken = Symbol.for("apollo.skipToken");
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/constants.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/constants.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/react/hooks/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["export const skipToken = Symbol.for(\"apollo.skipToken\");\nexport type SkipToken = typeof skipToken;\n"]}
|
||||
1262
node_modules/@apollo/client/react/hooks/hooks.cjs
generated
vendored
Normal file
1262
node_modules/@apollo/client/react/hooks/hooks.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@apollo/client/react/hooks/hooks.cjs.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/hooks.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1262
node_modules/@apollo/client/react/hooks/hooks.cjs.native.js
generated
vendored
Normal file
1262
node_modules/@apollo/client/react/hooks/hooks.cjs.native.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@apollo/client/react/hooks/hooks.d.cts
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/hooks.d.cts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./index.d.ts";
|
||||
23
node_modules/@apollo/client/react/hooks/index.d.ts
generated
vendored
Normal file
23
node_modules/@apollo/client/react/hooks/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export * from "./useApolloClient.js";
|
||||
export * from "./useLazyQuery.js";
|
||||
export * from "./useMutation.js";
|
||||
export { useQuery } from "./useQuery.js";
|
||||
export * from "./useSubscription.js";
|
||||
export * from "./useReactiveVar.js";
|
||||
export * from "./useFragment.js";
|
||||
export type { UseSuspenseQueryResult } from "./useSuspenseQuery.js";
|
||||
export { useSuspenseQuery } from "./useSuspenseQuery.js";
|
||||
export type { UseBackgroundQueryResult } from "./useBackgroundQuery.js";
|
||||
export { useBackgroundQuery } from "./useBackgroundQuery.js";
|
||||
export type { UseSuspenseFragmentResult, UseSuspenseFragmentOptions, } from "./useSuspenseFragment.js";
|
||||
export { useSuspenseFragment } from "./useSuspenseFragment.js";
|
||||
export type { LoadQueryFunction, UseLoadableQueryResult, } from "./useLoadableQuery.js";
|
||||
export { useLoadableQuery } from "./useLoadableQuery.js";
|
||||
export type { UseQueryRefHandlersResult } from "./useQueryRefHandlers.js";
|
||||
export { useQueryRefHandlers } from "./useQueryRefHandlers.js";
|
||||
export type { UseReadQueryResult } from "./useReadQuery.js";
|
||||
export { useReadQuery } from "./useReadQuery.js";
|
||||
export { skipToken } from "./constants.js";
|
||||
export type { SkipToken } from "./constants.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
16
node_modules/@apollo/client/react/hooks/index.js
generated
vendored
Normal file
16
node_modules/@apollo/client/react/hooks/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export * from "./useApolloClient.js";
|
||||
export * from "./useLazyQuery.js";
|
||||
export * from "./useMutation.js";
|
||||
export { useQuery } from "./useQuery.js";
|
||||
export * from "./useSubscription.js";
|
||||
export * from "./useReactiveVar.js";
|
||||
export * from "./useFragment.js";
|
||||
export { useSuspenseQuery } from "./useSuspenseQuery.js";
|
||||
export { useBackgroundQuery } from "./useBackgroundQuery.js";
|
||||
export { useSuspenseFragment } from "./useSuspenseFragment.js";
|
||||
export { useLoadableQuery } from "./useLoadableQuery.js";
|
||||
export { useQueryRefHandlers } from "./useQueryRefHandlers.js";
|
||||
export { useReadQuery } from "./useReadQuery.js";
|
||||
export { skipToken } from "./constants.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/index.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAK7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAK/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport * from \"./useApolloClient.js\";\nexport * from \"./useLazyQuery.js\";\nexport * from \"./useMutation.js\";\nexport { useQuery } from \"./useQuery.js\";\nexport * from \"./useSubscription.js\";\nexport * from \"./useReactiveVar.js\";\nexport * from \"./useFragment.js\";\nexport type { UseSuspenseQueryResult } from \"./useSuspenseQuery.js\";\nexport { useSuspenseQuery } from \"./useSuspenseQuery.js\";\nexport type { UseBackgroundQueryResult } from \"./useBackgroundQuery.js\";\nexport { useBackgroundQuery } from \"./useBackgroundQuery.js\";\nexport type {\n UseSuspenseFragmentResult,\n UseSuspenseFragmentOptions,\n} from \"./useSuspenseFragment.js\";\nexport { useSuspenseFragment } from \"./useSuspenseFragment.js\";\nexport type {\n LoadQueryFunction,\n UseLoadableQueryResult,\n} from \"./useLoadableQuery.js\";\nexport { useLoadableQuery } from \"./useLoadableQuery.js\";\nexport type { UseQueryRefHandlersResult } from \"./useQueryRefHandlers.js\";\nexport { useQueryRefHandlers } from \"./useQueryRefHandlers.js\";\nexport type { UseReadQueryResult } from \"./useReadQuery.js\";\nexport { useReadQuery } from \"./useReadQuery.js\";\nexport { skipToken } from \"./constants.js\";\nexport type { SkipToken } from \"./constants.js\";\n"]}
|
||||
4
node_modules/@apollo/client/react/hooks/internal/__use.d.ts
generated
vendored
Normal file
4
node_modules/@apollo/client/react/hooks/internal/__use.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
type Use = <T>(promise: Promise<T>) => T;
|
||||
export declare const __use: Use;
|
||||
export {};
|
||||
//# sourceMappingURL=__use.d.ts.map
|
||||
22
node_modules/@apollo/client/react/hooks/internal/__use.js
generated
vendored
Normal file
22
node_modules/@apollo/client/react/hooks/internal/__use.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { wrapPromiseWithState } from "../../../utilities/index.js";
|
||||
import * as React from "rehackt";
|
||||
// Prevent webpack from complaining about our feature detection of the
|
||||
// use property of the React namespace, which is expected not
|
||||
// to exist when using current stable versions, and that's fine.
|
||||
var useKey = "use";
|
||||
var realHook = React[useKey];
|
||||
// This is named with two underscores to allow this hook to evade typical rules of
|
||||
// hooks (i.e. it can be used conditionally)
|
||||
export var __use = realHook ||
|
||||
function __use(promise) {
|
||||
var statefulPromise = wrapPromiseWithState(promise);
|
||||
switch (statefulPromise.status) {
|
||||
case "pending":
|
||||
throw statefulPromise;
|
||||
case "rejected":
|
||||
throw statefulPromise.reason;
|
||||
case "fulfilled":
|
||||
return statefulPromise.value;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=__use.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/internal/__use.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/internal/__use.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"__use.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/__use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,sEAAsE;AACtE,6DAA6D;AAC7D,gEAAgE;AAChE,IAAM,MAAM,GAAG,KAA2B,CAAC;AAC3C,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAoB,CAAC;AAElD,kFAAkF;AAClF,4CAA4C;AAC5C,MAAM,CAAC,IAAM,KAAK,GAChB,QAAQ;IACR,SAAS,KAAK,CAAS,OAAwB;QAC7C,IAAM,eAAe,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEtD,QAAQ,eAAe,CAAC,MAAM,EAAE,CAAC;YAC/B,KAAK,SAAS;gBACZ,MAAM,eAAe,CAAC;YACxB,KAAK,UAAU;gBACb,MAAM,eAAe,CAAC,MAAM,CAAC;YAC/B,KAAK,WAAW;gBACd,OAAO,eAAe,CAAC,KAAK,CAAC;QACjC,CAAC;IACH,CAAC,CAAC","sourcesContent":["import { wrapPromiseWithState } from \"../../../utilities/index.js\";\nimport * as React from \"rehackt\";\n\ntype Use = <T>(promise: Promise<T>) => T;\n// Prevent webpack from complaining about our feature detection of the\n// use property of the React namespace, which is expected not\n// to exist when using current stable versions, and that's fine.\nconst useKey = \"use\" as keyof typeof React;\nconst realHook = React[useKey] as Use | undefined;\n\n// This is named with two underscores to allow this hook to evade typical rules of\n// hooks (i.e. it can be used conditionally)\nexport const __use =\n realHook ||\n function __use<TValue>(promise: Promise<TValue>) {\n const statefulPromise = wrapPromiseWithState(promise);\n\n switch (statefulPromise.status) {\n case \"pending\":\n throw statefulPromise;\n case \"rejected\":\n throw statefulPromise.reason;\n case \"fulfilled\":\n return statefulPromise.value;\n }\n };\n"]}
|
||||
6
node_modules/@apollo/client/react/hooks/internal/index.d.ts
generated
vendored
Normal file
6
node_modules/@apollo/client/react/hooks/internal/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { useDeepMemo } from "./useDeepMemo.js";
|
||||
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
||||
export { useRenderGuard } from "./useRenderGuard.js";
|
||||
export { __use } from "./__use.js";
|
||||
export { wrapHook } from "./wrapHook.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
7
node_modules/@apollo/client/react/hooks/internal/index.js
generated
vendored
Normal file
7
node_modules/@apollo/client/react/hooks/internal/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// These hooks are used internally and are not exported publicly by the library
|
||||
export { useDeepMemo } from "./useDeepMemo.js";
|
||||
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
||||
export { useRenderGuard } from "./useRenderGuard.js";
|
||||
export { __use } from "./__use.js";
|
||||
export { wrapHook } from "./wrapHook.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/internal/index.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/internal/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from \"./useDeepMemo.js\";\nexport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect.js\";\nexport { useRenderGuard } from \"./useRenderGuard.js\";\nexport { __use } from \"./__use.js\";\nexport { wrapHook } from \"./wrapHook.js\";\n"]}
|
||||
3
node_modules/@apollo/client/react/hooks/internal/useDeepMemo.d.ts
generated
vendored
Normal file
3
node_modules/@apollo/client/react/hooks/internal/useDeepMemo.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { DependencyList } from "react";
|
||||
export declare function useDeepMemo<TValue>(memoFn: () => TValue, deps: DependencyList): TValue;
|
||||
//# sourceMappingURL=useDeepMemo.d.ts.map
|
||||
11
node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js
generated
vendored
Normal file
11
node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from "rehackt";
|
||||
import { equal } from "@wry/equality";
|
||||
export function useDeepMemo(memoFn, deps) {
|
||||
var ref = React.useRef(void 0);
|
||||
if (!ref.current || !equal(ref.current.deps, deps)) {
|
||||
// eslint-disable-next-line react-compiler/react-compiler
|
||||
ref.current = { value: memoFn(), deps: deps };
|
||||
}
|
||||
return ref.current.value;
|
||||
}
|
||||
//# sourceMappingURL=useDeepMemo.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useDeepMemo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,IAAoB;IAEpB,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAA0C,KAAK,CAAC,CAAC,CAAC;IAE1E,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,yDAAyD;QACzD,GAAG,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import type { DependencyList } from \"react\";\nimport * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\n\nexport function useDeepMemo<TValue>(\n memoFn: () => TValue,\n deps: DependencyList\n) {\n const ref = React.useRef<{ deps: DependencyList; value: TValue }>(void 0);\n\n if (!ref.current || !equal(ref.current.deps, deps)) {\n // eslint-disable-next-line react-compiler/react-compiler\n ref.current = { value: memoFn(), deps };\n }\n\n return ref.current.value;\n}\n"]}
|
||||
3
node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.d.ts
generated
vendored
Normal file
3
node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as React from "rehackt";
|
||||
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
||||
//# sourceMappingURL=useIsomorphicLayoutEffect.d.ts.map
|
||||
9
node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js
generated
vendored
Normal file
9
node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as React from "rehackt";
|
||||
import { canUseDOM } from "../../../utilities/index.js";
|
||||
// use canUseDOM here instead of canUseLayoutEffect because we want to be able
|
||||
// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine
|
||||
// in useSuspenseQuery tests, but to honor the original comment about the
|
||||
// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left
|
||||
// alone.
|
||||
export var useIsomorphicLayoutEffect = canUseDOM ? React.useLayoutEffect : React.useEffect;
|
||||
//# sourceMappingURL=useIsomorphicLayoutEffect.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useIsomorphicLayoutEffect.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,SAAS;AACT,MAAM,CAAC,IAAM,yBAAyB,GACpC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport { canUseDOM } from \"../../../utilities/index.js\";\n\n// use canUseDOM here instead of canUseLayoutEffect because we want to be able\n// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine\n// in useSuspenseQuery tests, but to honor the original comment about the\n// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left\n// alone.\nexport const useIsomorphicLayoutEffect =\n canUseDOM ? React.useLayoutEffect : React.useEffect;\n"]}
|
||||
2
node_modules/@apollo/client/react/hooks/internal/useRenderGuard.d.ts
generated
vendored
Normal file
2
node_modules/@apollo/client/react/hooks/internal/useRenderGuard.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function useRenderGuard(): () => boolean;
|
||||
//# sourceMappingURL=useRenderGuard.d.ts.map
|
||||
42
node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js
generated
vendored
Normal file
42
node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as React from "rehackt";
|
||||
var Ctx;
|
||||
function noop() { }
|
||||
export function useRenderGuard() {
|
||||
if (!Ctx) {
|
||||
// we want the intialization to be lazy because `createContext` would error on import in a RSC
|
||||
Ctx = React.createContext(null);
|
||||
}
|
||||
return React.useCallback(
|
||||
/**
|
||||
* @returns true if the hook was called during render
|
||||
*/ function () {
|
||||
var orig = console.error;
|
||||
try {
|
||||
console.error = noop;
|
||||
/**
|
||||
* `useContext` can be called conditionally during render, so this is safe.
|
||||
* (Also, during render we would want to throw as a reaction to this anyways, so it
|
||||
* wouldn't even matter if we got the order of hooks mixed up...)
|
||||
*
|
||||
* They cannot however be called outside of Render, and that's what we're testing here.
|
||||
*
|
||||
* Different versions of React have different behaviour on an invalid hook call:
|
||||
*
|
||||
* React 16.8 - 17: throws an error
|
||||
* https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26
|
||||
*
|
||||
* React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.
|
||||
* https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35
|
||||
*/
|
||||
React["useContext" /* hide this from the linter */](Ctx);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
console.error = orig;
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
//# sourceMappingURL=useRenderGuard.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useRenderGuard.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useRenderGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,IAAI,GAAwB,CAAC;AAE7B,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,8FAA8F;QAC9F,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,WAAW;IACtB;;OAEG,CAAC;QACF,IAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YAErB;;;;;;;;;;;;;;eAcG;YACH,KAAK,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"rehackt\";\n\nlet Ctx: React.Context<null>;\n\nfunction noop() {}\nexport function useRenderGuard() {\n if (!Ctx) {\n // we want the intialization to be lazy because `createContext` would error on import in a RSC\n Ctx = React.createContext(null);\n }\n\n return React.useCallback(\n /**\n * @returns true if the hook was called during render\n */ () => {\n const orig = console.error;\n try {\n console.error = noop;\n\n /**\n * `useContext` can be called conditionally during render, so this is safe.\n * (Also, during render we would want to throw as a reaction to this anyways, so it\n * wouldn't even matter if we got the order of hooks mixed up...)\n *\n * They cannot however be called outside of Render, and that's what we're testing here.\n *\n * Different versions of React have different behaviour on an invalid hook call:\n *\n * React 16.8 - 17: throws an error\n * https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26\n *\n * React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.\n * https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35\n */\n React[\"useContext\" /* hide this from the linter */](Ctx);\n return true;\n } catch (e) {\n return false;\n } finally {\n console.error = orig;\n }\n },\n []\n );\n}\n"]}
|
||||
60
node_modules/@apollo/client/react/hooks/internal/wrapHook.d.ts
generated
vendored
Normal file
60
node_modules/@apollo/client/react/hooks/internal/wrapHook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { useQuery, useSuspenseQuery, useBackgroundQuery, useReadQuery, useFragment, useQueryRefHandlers, useSuspenseFragment } from "../index.js";
|
||||
import type { ApolloClient } from "../../../core/ApolloClient.js";
|
||||
import type { ObservableQuery } from "../../../core/ObservableQuery.js";
|
||||
import type { createQueryPreloader } from "../../query-preloader/createQueryPreloader.js";
|
||||
interface WrappableHooks {
|
||||
createQueryPreloader: typeof createQueryPreloader;
|
||||
useQuery: typeof useQuery;
|
||||
useSuspenseQuery: typeof useSuspenseQuery;
|
||||
useSuspenseFragment: typeof useSuspenseFragment;
|
||||
useBackgroundQuery: typeof useBackgroundQuery;
|
||||
useReadQuery: typeof useReadQuery;
|
||||
useFragment: typeof useFragment;
|
||||
useQueryRefHandlers: typeof useQueryRefHandlers;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
* Can be used to correctly type the [Symbol.for("apollo.hook.wrappers")] property of
|
||||
* `QueryManager`, to override/wrap hook functionality.
|
||||
*/
|
||||
export type HookWrappers = {
|
||||
[K in keyof WrappableHooks]?: (originalHook: WrappableHooks[K]) => WrappableHooks[K];
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Makes an Apollo Client hook "wrappable".
|
||||
* That means that the Apollo Client instance can expose a "wrapper" that will be
|
||||
* used to wrap the original hook implementation with additional logic.
|
||||
* @example
|
||||
* ```tsx
|
||||
* // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)
|
||||
* // following this pattern
|
||||
* function useQuery() {
|
||||
* return wrapHook('useQuery', _useQuery, options.client)(query, options);
|
||||
* }
|
||||
* function _useQuery(query, options) {
|
||||
* // original implementation
|
||||
* }
|
||||
*
|
||||
* // this is what a library like `@apollo/client-react-streaming` would do
|
||||
* class ApolloClientWithStreaming extends ApolloClient {
|
||||
* constructor(options) {
|
||||
* super(options);
|
||||
* this.queryManager[Symbol.for("apollo.hook.wrappers")] = {
|
||||
* useQuery: (original) => (query, options) => {
|
||||
* console.log("useQuery was called with options", options);
|
||||
* return original(query, options);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // this will now log the options and then call the original `useQuery`
|
||||
* const client = new ApolloClientWithStreaming({ ... });
|
||||
* useQuery(query, { client });
|
||||
* ```
|
||||
*/
|
||||
export declare function wrapHook<Hook extends (...args: any[]) => any>(hookName: keyof WrappableHooks, useHook: Hook, clientOrObsQuery: ObservableQuery<any> | ApolloClient<any>): Hook;
|
||||
export {};
|
||||
//# sourceMappingURL=wrapHook.d.ts.map
|
||||
43
node_modules/@apollo/client/react/hooks/internal/wrapHook.js
generated
vendored
Normal file
43
node_modules/@apollo/client/react/hooks/internal/wrapHook.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var wrapperSymbol = Symbol.for("apollo.hook.wrappers");
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Makes an Apollo Client hook "wrappable".
|
||||
* That means that the Apollo Client instance can expose a "wrapper" that will be
|
||||
* used to wrap the original hook implementation with additional logic.
|
||||
* @example
|
||||
* ```tsx
|
||||
* // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)
|
||||
* // following this pattern
|
||||
* function useQuery() {
|
||||
* return wrapHook('useQuery', _useQuery, options.client)(query, options);
|
||||
* }
|
||||
* function _useQuery(query, options) {
|
||||
* // original implementation
|
||||
* }
|
||||
*
|
||||
* // this is what a library like `@apollo/client-react-streaming` would do
|
||||
* class ApolloClientWithStreaming extends ApolloClient {
|
||||
* constructor(options) {
|
||||
* super(options);
|
||||
* this.queryManager[Symbol.for("apollo.hook.wrappers")] = {
|
||||
* useQuery: (original) => (query, options) => {
|
||||
* console.log("useQuery was called with options", options);
|
||||
* return original(query, options);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // this will now log the options and then call the original `useQuery`
|
||||
* const client = new ApolloClientWithStreaming({ ... });
|
||||
* useQuery(query, { client });
|
||||
* ```
|
||||
*/
|
||||
export function wrapHook(hookName, useHook, clientOrObsQuery) {
|
||||
var queryManager = clientOrObsQuery["queryManager"];
|
||||
var wrappers = queryManager && queryManager[wrapperSymbol];
|
||||
var wrapper = wrappers && wrappers[hookName];
|
||||
return wrapper ? wrapper(useHook) : useHook;
|
||||
}
|
||||
//# sourceMappingURL=wrapHook.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/internal/wrapHook.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/internal/wrapHook.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"wrapHook.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/wrapHook.ts"],"names":[],"mappings":"AAcA,IAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AA4BzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,QAAQ,CACtB,QAA8B,EAC9B,OAAa,EACb,gBAA0D;IAE1D,IAAM,YAAY,GAChB,gBAKD,CAAC,cAAc,CAAC,CAAC;IAClB,IAAM,QAAQ,GAAG,YAAY,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC;IAC7D,IAAM,OAAO,GACX,QAAQ,IAAK,QAAQ,CAAC,QAAQ,CAAS,CAAC;IAC1C,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC9C,CAAC","sourcesContent":["import type {\n useQuery,\n useSuspenseQuery,\n useBackgroundQuery,\n useReadQuery,\n useFragment,\n useQueryRefHandlers,\n useSuspenseFragment,\n} from \"../index.js\";\nimport type { QueryManager } from \"../../../core/QueryManager.js\";\nimport type { ApolloClient } from \"../../../core/ApolloClient.js\";\nimport type { ObservableQuery } from \"../../../core/ObservableQuery.js\";\nimport type { createQueryPreloader } from \"../../query-preloader/createQueryPreloader.js\";\n\nconst wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n\ninterface WrappableHooks {\n createQueryPreloader: typeof createQueryPreloader;\n useQuery: typeof useQuery;\n useSuspenseQuery: typeof useSuspenseQuery;\n useSuspenseFragment: typeof useSuspenseFragment;\n useBackgroundQuery: typeof useBackgroundQuery;\n useReadQuery: typeof useReadQuery;\n useFragment: typeof useFragment;\n useQueryRefHandlers: typeof useQueryRefHandlers;\n}\n\n/**\n * @internal\n * Can be used to correctly type the [Symbol.for(\"apollo.hook.wrappers\")] property of\n * `QueryManager`, to override/wrap hook functionality.\n */\nexport type HookWrappers = {\n [K in keyof WrappableHooks]?: (\n originalHook: WrappableHooks[K]\n ) => WrappableHooks[K];\n};\n\ninterface QueryManagerWithWrappers<T> extends QueryManager<T> {\n [wrapperSymbol]?: HookWrappers;\n}\n\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook<Hook extends (...args: any[]) => any>(\n hookName: keyof WrappableHooks,\n useHook: Hook,\n clientOrObsQuery: ObservableQuery<any> | ApolloClient<any>\n): Hook {\n const queryManager = (\n clientOrObsQuery as unknown as {\n // both `ApolloClient` and `ObservableQuery` have a `queryManager` property\n // but they're both `private`, so we have to cast around for a bit here.\n queryManager: QueryManagerWithWrappers<any>;\n }\n )[\"queryManager\"];\n const wrappers = queryManager && queryManager[wrapperSymbol];\n const wrapper: undefined | ((wrap: Hook) => Hook) =\n wrappers && (wrappers[hookName] as any);\n return wrapper ? wrapper(useHook) : useHook;\n}\n"]}
|
||||
8
node_modules/@apollo/client/react/hooks/package.json
generated
vendored
Normal file
8
node_modules/@apollo/client/react/hooks/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/react/hooks",
|
||||
"type": "module",
|
||||
"main": "hooks.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
18
node_modules/@apollo/client/react/hooks/useApolloClient.d.ts
generated
vendored
Normal file
18
node_modules/@apollo/client/react/hooks/useApolloClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { ApolloClient } from "../../core/index.js";
|
||||
/**
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { useApolloClient } from '@apollo/client';
|
||||
*
|
||||
* function SomeComponent() {
|
||||
* const client = useApolloClient();
|
||||
* // `client` is now set to the `ApolloClient` instance being used by the
|
||||
* // application (that was configured using something like `ApolloProvider`)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @returns The `ApolloClient` instance being used by the application.
|
||||
*/
|
||||
export declare function useApolloClient(override?: ApolloClient<object>): ApolloClient<object>;
|
||||
//# sourceMappingURL=useApolloClient.d.ts.map
|
||||
25
node_modules/@apollo/client/react/hooks/useApolloClient.js
generated
vendored
Normal file
25
node_modules/@apollo/client/react/hooks/useApolloClient.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import * as React from "rehackt";
|
||||
import { getApolloContext } from "../context/index.js";
|
||||
/**
|
||||
* @example
|
||||
* ```jsx
|
||||
* import { useApolloClient } from '@apollo/client';
|
||||
*
|
||||
* function SomeComponent() {
|
||||
* const client = useApolloClient();
|
||||
* // `client` is now set to the `ApolloClient` instance being used by the
|
||||
* // application (that was configured using something like `ApolloProvider`)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @returns The `ApolloClient` instance being used by the application.
|
||||
*/
|
||||
export function useApolloClient(override) {
|
||||
var context = React.useContext(getApolloContext());
|
||||
var client = override || context.client;
|
||||
invariant(!!client, 58);
|
||||
return client;
|
||||
}
|
||||
//# sourceMappingURL=useApolloClient.js.map
|
||||
1
node_modules/@apollo/client/react/hooks/useApolloClient.js.map
generated
vendored
Normal file
1
node_modules/@apollo/client/react/hooks/useApolloClient.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAC7B,QAA+B;IAE/B,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACrD,IAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAC1C,SAAS,CACP,CAAC,CAAC,MAAM,EACR,oEAAoE;QAClE,0EAA0E;QAC1E,0BAA0B,CAC7B,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\n\n/**\n * @example\n * ```jsx\n * import { useApolloClient } from '@apollo/client';\n *\n * function SomeComponent() {\n * const client = useApolloClient();\n * // `client` is now set to the `ApolloClient` instance being used by the\n * // application (that was configured using something like `ApolloProvider`)\n * }\n * ```\n *\n * @since 3.0.0\n * @returns The `ApolloClient` instance being used by the application.\n */\nexport function useApolloClient(\n override?: ApolloClient<object>\n): ApolloClient<object> {\n const context = React.useContext(getApolloContext());\n const client = override || context.client;\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n \"Wrap the root component in an <ApolloProvider>, or pass an ApolloClient \" +\n \"instance in via options.\"\n );\n\n return client;\n}\n"]}
|
||||
76
node_modules/@apollo/client/react/hooks/useBackgroundQuery.d.ts
generated
vendored
Normal file
76
node_modules/@apollo/client/react/hooks/useBackgroundQuery.d.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import type { DocumentNode, OperationVariables, TypedDocumentNode } from "../../core/index.js";
|
||||
import type { SubscribeToMoreFunction } from "../../core/watchQueryOptions.js";
|
||||
import type { QueryRef } from "../internal/index.js";
|
||||
import type { BackgroundQueryHookOptions, NoInfer } from "../types/types.js";
|
||||
import type { FetchMoreFunction, RefetchFunction } from "./useSuspenseQuery.js";
|
||||
import type { DeepPartial } from "../../utilities/index.js";
|
||||
import type { SkipToken } from "./constants.js";
|
||||
export type UseBackgroundQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
||||
/**
|
||||
* A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
|
||||
*
|
||||
* This function returns _another_ function that you can call to terminate the subscription.
|
||||
*/
|
||||
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
||||
/**
|
||||
* A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
|
||||
*/
|
||||
fetchMore: FetchMoreFunction<TData, TVariables>;
|
||||
/**
|
||||
* Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases.
|
||||
*
|
||||
* @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used.
|
||||
*/
|
||||
refetch: RefetchFunction<TData, TVariables>;
|
||||
};
|
||||
type BackgroundQueryHookOptionsNoInfer<TData, TVariables extends OperationVariables> = BackgroundQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>;
|
||||
export declare function useBackgroundQuery<TData, TVariables extends OperationVariables, TOptions extends Omit<BackgroundQueryHookOptions<TData>, "variables">>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & TOptions): [
|
||||
(QueryRef<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData, TVariables> | (TOptions["skip"] extends boolean ? undefined : never)),
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
|
||||
returnPartialData: true;
|
||||
errorPolicy: "ignore" | "all";
|
||||
}): [
|
||||
QueryRef<DeepPartial<TData> | undefined, TVariables>,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
|
||||
errorPolicy: "ignore" | "all";
|
||||
}): [
|
||||
QueryRef<TData | undefined, TVariables>,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
|
||||
skip: boolean;
|
||||
returnPartialData: true;
|
||||
}): [
|
||||
QueryRef<DeepPartial<TData>, TVariables> | undefined,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
|
||||
returnPartialData: true;
|
||||
}): [
|
||||
QueryRef<DeepPartial<TData>, TVariables>,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
|
||||
skip: boolean;
|
||||
}): [
|
||||
QueryRef<TData, TVariables> | undefined,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [QueryRef<TData, TVariables>, UseBackgroundQueryResult<TData, TVariables>];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): [undefined, UseBackgroundQueryResult<TData, TVariables>];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
|
||||
returnPartialData: true;
|
||||
})): [
|
||||
QueryRef<DeepPartial<TData>, TVariables> | undefined,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SkipToken | BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [
|
||||
QueryRef<TData, TVariables> | undefined,
|
||||
UseBackgroundQueryResult<TData, TVariables>
|
||||
];
|
||||
export {};
|
||||
//# sourceMappingURL=useBackgroundQuery.d.ts.map
|
||||
82
node_modules/@apollo/client/react/hooks/useBackgroundQuery.js
generated
vendored
Normal file
82
node_modules/@apollo/client/react/hooks/useBackgroundQuery.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
import { __spreadArray } from "tslib";
|
||||
import * as React from "rehackt";
|
||||
import { useApolloClient } from "./useApolloClient.js";
|
||||
import { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "../internal/index.js";
|
||||
import { wrapHook } from "./internal/index.js";
|
||||
import { useWatchQueryOptions } from "./useSuspenseQuery.js";
|
||||
import { canonicalStringify } from "../../cache/index.js";
|
||||
export function useBackgroundQuery(query, options) {
|
||||
if (options === void 0) { options = Object.create(null); }
|
||||
return wrapHook("useBackgroundQuery",
|
||||
// eslint-disable-next-line react-compiler/react-compiler
|
||||
useBackgroundQuery_, useApolloClient(typeof options === "object" ? options.client : undefined))(query, options);
|
||||
}
|
||||
function useBackgroundQuery_(query, options) {
|
||||
var client = useApolloClient(options.client);
|
||||
var suspenseCache = getSuspenseCache(client);
|
||||
var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
|
||||
var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
|
||||
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
||||
// This ref tracks the first time query execution is enabled to determine
|
||||
// whether to return a query ref or `undefined`. When initialized
|
||||
// in a skipped state (either via `skip: true` or `skipToken`) we return
|
||||
// `undefined` for the `queryRef` until the query has been enabled. Once
|
||||
// enabled, a query ref is always returned regardless of whether the query is
|
||||
// skipped again later.
|
||||
var didFetchResult = React.useRef(fetchPolicy !== "standby");
|
||||
didFetchResult.current || (didFetchResult.current = fetchPolicy !== "standby");
|
||||
var cacheKey = __spreadArray([
|
||||
query,
|
||||
canonicalStringify(variables)
|
||||
], [].concat(queryKey), true);
|
||||
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
||||
return client.watchQuery(watchQueryOptions);
|
||||
});
|
||||
var _b = React.useState(wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];
|
||||
if (unwrapQueryRef(wrappedQueryRef) !== queryRef) {
|
||||
setWrappedQueryRef(wrapQueryRef(queryRef));
|
||||
}
|
||||
if (queryRef.didChangeOptions(watchQueryOptions)) {
|
||||
var promise = queryRef.applyOptions(watchQueryOptions);
|
||||
updateWrappedQueryRef(wrappedQueryRef, promise);
|
||||
}
|
||||
// This prevents issues where rerendering useBackgroundQuery after the
|
||||
// queryRef has been disposed would cause the hook to return a new queryRef
|
||||
// instance since disposal also removes it from the suspense cache. We add
|
||||
// the queryRef back in the suspense cache so that the next render will reuse
|
||||
// this queryRef rather than initializing a new instance.
|
||||
React.useEffect(function () {
|
||||
// Since the queryRef is disposed async via `setTimeout`, we have to wait a
|
||||
// tick before checking it and adding back to the suspense cache.
|
||||
var id = setTimeout(function () {
|
||||
if (queryRef.disposed) {
|
||||
suspenseCache.add(cacheKey, queryRef);
|
||||
}
|
||||
});
|
||||
return function () { return clearTimeout(id); };
|
||||
// Omitting the deps is intentional. This avoids stale closures and the
|
||||
// conditional ensures we aren't running the logic on each render.
|
||||
});
|
||||
var fetchMore = React.useCallback(function (options) {
|
||||
var promise = queryRef.fetchMore(options);
|
||||
setWrappedQueryRef(wrapQueryRef(queryRef));
|
||||
return promise;
|
||||
}, [queryRef]);
|
||||
var refetch = React.useCallback(function (variables) {
|
||||
var promise = queryRef.refetch(variables);
|
||||
setWrappedQueryRef(wrapQueryRef(queryRef));
|
||||
return promise;
|
||||
}, [queryRef]);
|
||||
React.useEffect(function () { return queryRef.softRetain(); }, [queryRef]);
|
||||
return [
|
||||
didFetchResult.current ? wrappedQueryRef : void 0,
|
||||
{
|
||||
fetchMore: fetchMore,
|
||||
refetch: refetch,
|
||||
// TODO: The internalQueryRef doesn't have TVariables' type information so we have to cast it here
|
||||
subscribeToMore: queryRef.observable
|
||||
.subscribeToMore,
|
||||
},
|
||||
];
|
||||
}
|
||||
//# sourceMappingURL=useBackgroundQuery.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user