inital upload

This commit is contained in:
jackbeeby
2025-05-15 13:35:49 +10:00
commit 8c53ff1000
9092 changed files with 1833300 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.bench.d.ts.map

View File

@@ -0,0 +1,222 @@
import { attest, bench } from "@ark/attest";
import { expectTypeOf } from "expect-type";
import { setup } from "@ark/attest";
setup({
updateSnapshots: !process.env.CI,
});
function test(name, fn) {
fn(name + ": ");
}
test("unmasks deeply nested fragments", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
expectTypeOf().toEqualTypeOf();
});
});
test("unmasks deeply nested fragments", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
expectTypeOf().toEqualTypeOf();
});
});
test("unmasks deeply nested nullable fragments", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
expectTypeOf().toEqualTypeOf();
});
});
test("unmasks DeepPartial types", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
expectTypeOf().toEqualTypeOf();
});
});
test("Unmasked handles odd types", function (prefix) {
bench(prefix + "empty type instantiations", function () {
attest();
}).types([111, "instantiations"]);
bench(prefix + "empty type functionality", function () {
expectTypeOf().toEqualTypeOf();
});
bench(prefix + "generic record type instantiations", function () {
attest();
}).types([115, "instantiations"]);
bench(prefix + "generic record type functionality", function () {
expectTypeOf().toEqualTypeOf();
});
bench(prefix + "unknown instantiations", function () {
attest();
}).types([47, "instantiations"]);
bench(prefix + "unknown functionality", function () {
expectTypeOf().toBeUnknown();
});
bench(prefix + "any instantiations", function () {
attest();
}).types([48, "instantiations"]);
bench(prefix + "any functionality", function () {
expectTypeOf().toBeAny();
});
});
test("MaybeMasked handles odd types", function (prefix) {
bench(prefix + "empty type instantiations", function () {
attest();
}).types([41, "instantiations"]);
bench(prefix + "empty type functionality", function () {
expectTypeOf().toEqualTypeOf();
});
bench(prefix + "generic record type instantiations", function () {
attest();
}).types([46, "instantiations"]);
bench(prefix + "generic record type functionality", function () {
expectTypeOf().toEqualTypeOf();
});
bench(prefix + "unknown instantiations", function () {
attest();
}).types([41, "instantiations"]);
bench(prefix + "unknown functionality", function () {
expectTypeOf().toBeUnknown();
});
bench(prefix + "any instantiations", function () {
attest();
}).types([43, "instantiations"]);
bench(prefix + "any functionality", function () {
expectTypeOf().toBeAny();
});
});
test("distributed members on MaybeMasked", function (prefix) {
(function unresolvedGeneric() {
bench(prefix + "one unresolved generic mixed with null|undefined", function () {
attest();
}).types([49, "instantiations"]);
})();
(function unresolvedGenerics() {
bench(prefix + "two unresolved generics distribute", function () {
attest();
}).types([50, "instantiations"]);
})();
});
test("deals with overlapping array from parent fragment", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
var _a, _b, _c, _d, _e, _f;
var x = {};
// some fields for hovering
x.id;
x.artists;
(_b = (_a = x.artists) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id;
(_d = (_c = x.artists) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.birthdate;
(_f = (_e = x.artists) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.lastname;
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("base type, multiple fragments on sub-types", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("does not detect `$fragmentRefs` if type contains `any`", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([1, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("leaves tuples alone", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("does not detect `$fragmentRefs` if type is a record type", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([1, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("does not detect `$fragmentRefs` on types with index signatures", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([1, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("detects `$fragmentRefs` on types with index signatures", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([1, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
var y = {};
expectTypeOf(x).branded.toEqualTypeOf();
expectTypeOf(y).toEqualTypeOf();
});
});
test("recursive types: no error 'Type instantiation is excessively deep and possibly infinite.'", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([1, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
test("MaybeMasked can be called with a generic if `mode` is not set to `unmask`", function (prefix) {
function withGenericResult(arg) {
bench(prefix + "Result generic - instantiations", function () {
var maybeMasked = arg;
return maybeMasked;
}).types([1, "instantiations"]);
bench(prefix + "Result generic - functionality", function () {
var maybeMasked = arg;
expectTypeOf(maybeMasked).toEqualTypeOf(arg);
});
}
function withGenericDocument(arg) {
bench(prefix + "Result generic - instantiations", function () {
var maybeMasked = arg;
return maybeMasked;
}).types([1, "instantiations"]);
bench(prefix + "Result generic - functionality", function () {
var maybeMasked = arg;
// cannot use unresolved generic with `expectTypeOf` here so we just try an assignment the other way round
var test = maybeMasked;
return test;
});
}
withGenericResult({});
withGenericDocument({});
});
test("Unmasked handles branded primitive types", function (prefix) {
bench(prefix + "instantiations", function () {
return {};
}).types([5, "instantiations"]);
bench(prefix + "functionality", function () {
var x = {};
expectTypeOf(x).branded.toEqualTypeOf();
});
});
//# sourceMappingURL=types.bench.js.map

File diff suppressed because one or more lines are too long

5
node_modules/@apollo/client/masking/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export type { DataMasking, FragmentType, Masked, MaskedDocumentNode, MaybeMasked, Unmasked, } from "./types.js";
export { disableWarningsSlot } from "./utils.js";
export { maskFragment } from "./maskFragment.js";
export { maskOperation } from "./maskOperation.js";
//# sourceMappingURL=index.d.ts.map

4
node_modules/@apollo/client/masking/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export { disableWarningsSlot } from "./utils.js";
export { maskFragment } from "./maskFragment.js";
export { maskOperation } from "./maskOperation.js";
//# sourceMappingURL=index.js.map

1
node_modules/@apollo/client/masking/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/masking/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export type {\n DataMasking,\n FragmentType,\n Masked,\n MaskedDocumentNode,\n MaybeMasked,\n Unmasked,\n} from \"./types.js\";\nexport { disableWarningsSlot } from \"./utils.js\";\nexport { maskFragment } from \"./maskFragment.js\";\nexport { maskOperation } from \"./maskOperation.js\";\n"]}

122
node_modules/@apollo/client/masking/internal/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,122 @@
import type { Prettify, Primitive, RemoveIndexSignature } from "../../utilities/index.js";
export type IsAny<T> = 0 extends 1 & T ? true : false;
export type UnwrapFragmentRefs<TData> = true extends IsAny<TData> ? TData : TData extends any ? TData extends Primitive ? TData : string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends {
" $fragmentRefs"?: infer FragmentRefs;
} ? UnwrapFragmentRefs<CombineIntersection<Omit<TData, " $fragmentRefs"> | RemoveFragmentName<NonNullable<NonNullable<FragmentRefs>[keyof NonNullable<FragmentRefs>]>>>> : TData extends object ? {
[K in keyof TData]: UnwrapFragmentRefs<TData[K]>;
} : TData : never;
/**
```ts
CombineIntersection<
| { foo: string }
| { __typename: "A"; a: string }
| { __typename: "B"; b1: number }
| { __typename: "B"; b2: string }
> =>
| { foo: string }
| CombineByTypeName<
| { __typename: "A"; a: string }
| { __typename: "B"; b1: number }
| { __typename: "B"; b2: string }
>
```
*/
type CombineIntersection<T> = Exclude<T, {
__typename?: string;
}> | CombineByTypeName<Extract<T, {
__typename?: string;
}>>;
/**
```ts
CombineByTypeName<
| { __typename: "A"; a: string }
| { __typename: "B"; b1: number }
| { __typename: "B"; b2: string }
> =>
| CombineWithArrays<
| { __typename: "A"; a: string }
>
| CombineWithArrays<
| { __typename: "B"; b1: number }
| { __typename: "B"; b2: number }
>
```
*/
type CombineByTypeName<T extends {
__typename?: string;
}> = {
[TypeName in NonNullable<T["__typename"]>]: Prettify<MergeUnions<ExtractByMatchingTypeNames<T, TypeName>>>;
}[NonNullable<T["__typename"]>];
/**
```ts
CombineByTypeName<
| {
__typename: "Person" | "Animatronic" | "CartoonCharacter";
id: number;
name: string;
}
| {
__typename: "Person";
birthdate: string;
}
| {
__typename: "Animatronic";
manufacturer: string;
warrantyEndDate: string;
}
| {
__typename: "CartoonCharacter";
animator: string;
voiceActor: string;
}
>
=>
{
id: number;
name: string;
__typename: "Person";
birthdate: string;
} | {
id: number;
name: string;
__typename: "Animatronic";
manufacturer: string;
warrantyEndDate: string;
} | {
id: number;
name: string;
__typename: "CartoonCharacter";
animator: string;
voiceActor: string;
}
```
*/
type ExtractByMatchingTypeNames<Union extends {
__typename?: string;
}, TypeName extends string> = Union extends any ? TypeName extends NonNullable<Union["__typename"]> ? Omit<Union, "__typename"> & {
[K in keyof Union as K extends "__typename" ? K : never]: TypeName;
} : never : never;
type MergeUnions<TUnion> = MergeUnionsAcc<TUnion, takeOneFromUnion<TUnion>, never>;
type DistributedRequiredExclude<T, U> = T extends any ? Required<T> extends Required<U> ? Required<U> extends Required<T> ? never : T : T : T;
type MergeUnionsAcc<TUnion, Curr, Merged> = [
Curr
] extends [never] ? Merged : MergeUnionsAcc<DistributedRequiredExclude<TUnion, Curr>, takeOneFromUnion<DistributedRequiredExclude<TUnion, Curr>>, [
Merged
] extends [never] ? Curr : MergeObjects<Curr, Merged>>;
type unionToIntersection<T> = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never;
type takeOneFromUnion<T> = unionToIntersection<T extends T ? (x: T) => 0 : never> extends ((x: infer U) => 0) ? U : never;
type MergeObjects<T, U> = Prettify<{
[k in keyof T]: k extends keyof U ? [
NonNullable<T[k]>,
NonNullable<U[k]>
] extends ([
infer TK extends object,
infer UK extends object
]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection<TK[number] | UK[number]>[] | Extract<T[k] | U[k], undefined | null> : T[k] : CombineIntersection<TK | UK> | Extract<T[k] | U[k], undefined | null> : T[k] : T[k];
} & Pick<U, Exclude<keyof U, keyof T>>>;
export type RemoveMaskedMarker<T> = Omit<T, "__masked">;
export type RemoveFragmentName<T> = T extends any ? Omit<T, " $fragmentName"> : T;
type Exact<in out T> = (x: T) => T;
export type ContainsFragmentsRefs<TData, Seen = never> = true extends (IsAny<TData>) ? false : TData extends object ? Exact<TData> extends Seen ? false : " $fragmentRefs" extends keyof RemoveIndexSignature<TData> ? true : ContainsFragmentsRefs<TData[keyof TData], Seen | Exact<TData>> : false;
export {};
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
import type { SelectionSetNode } from "graphql";
import type { FragmentMap } from "../utilities/index.js";
import type { ApolloCache } from "../cache/index.js";
interface MaskingContext {
operationType: "query" | "mutation" | "subscription" | "fragment";
operationName: string | undefined;
fragmentMap: FragmentMap;
cache: ApolloCache<unknown>;
mutableTargets: WeakMap<any, any>;
knownChanged: WeakSet<any>;
}
export declare function maskDefinition(data: Record<string, any>, selectionSet: SelectionSetNode, context: MaskingContext): any;
export {};
//# sourceMappingURL=maskDefinition.d.ts.map

134
node_modules/@apollo/client/masking/maskDefinition.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
import { Kind } from "graphql";
import { getFragmentMaskMode, maybeDeepFreeze, resultKeyNameFromField, } from "../utilities/index.js";
import { disableWarningsSlot } from "./utils.js";
import { invariant } from "../utilities/globals/index.js";
export function maskDefinition(data, selectionSet, context) {
return disableWarningsSlot.withValue(true, function () {
var masked = maskSelectionSet(data, selectionSet, context, false);
if (Object.isFrozen(data)) {
maybeDeepFreeze(masked);
}
return masked;
});
}
function getMutableTarget(data, mutableTargets) {
if (mutableTargets.has(data)) {
return mutableTargets.get(data);
}
var mutableTarget = Array.isArray(data) ? [] : Object.create(null);
mutableTargets.set(data, mutableTarget);
return mutableTarget;
}
function maskSelectionSet(data, selectionSet, context, migration, path) {
var _a;
var knownChanged = context.knownChanged;
var memo = getMutableTarget(data, context.mutableTargets);
if (Array.isArray(data)) {
for (var _i = 0, _b = Array.from(data.entries()); _i < _b.length; _i++) {
var _c = _b[_i], index = _c[0], item = _c[1];
if (item === null) {
memo[index] = null;
continue;
}
var masked = maskSelectionSet(item, selectionSet, context, migration, globalThis.__DEV__ !== false ? "".concat(path || "", "[").concat(index, "]") : void 0);
if (knownChanged.has(masked)) {
knownChanged.add(memo);
}
memo[index] = masked;
}
return knownChanged.has(memo) ? memo : data;
}
for (var _d = 0, _e = selectionSet.selections; _d < _e.length; _d++) {
var selection = _e[_d];
var value = void 0;
// we later want to add acessor warnings to the final result
// so we need a new object to add the accessor warning to
if (migration) {
knownChanged.add(memo);
}
if (selection.kind === Kind.FIELD) {
var keyName = resultKeyNameFromField(selection);
var childSelectionSet = selection.selectionSet;
value = memo[keyName] || data[keyName];
if (value === void 0) {
continue;
}
if (childSelectionSet && value !== null) {
var masked = maskSelectionSet(data[keyName], childSelectionSet, context, migration, globalThis.__DEV__ !== false ? "".concat(path || "", ".").concat(keyName) : void 0);
if (knownChanged.has(masked)) {
value = masked;
}
}
if (!(globalThis.__DEV__ !== false)) {
memo[keyName] = value;
}
if (globalThis.__DEV__ !== false) {
if (migration &&
keyName !== "__typename" &&
// either the field is not present in the memo object
// or it has a `get` descriptor, not a `value` descriptor
// => it is a warning accessor and we can overwrite it
// with another accessor
!((_a = Object.getOwnPropertyDescriptor(memo, keyName)) === null || _a === void 0 ? void 0 : _a.value)) {
Object.defineProperty(memo, keyName, getAccessorWarningDescriptor(keyName, value, path || "", context.operationName, context.operationType));
}
else {
delete memo[keyName];
memo[keyName] = value;
}
}
}
if (selection.kind === Kind.INLINE_FRAGMENT &&
(!selection.typeCondition ||
context.cache.fragmentMatches(selection, data.__typename))) {
value = maskSelectionSet(data, selection.selectionSet, context, migration, path);
}
if (selection.kind === Kind.FRAGMENT_SPREAD) {
var fragmentName = selection.name.value;
var fragment = context.fragmentMap[fragmentName] ||
(context.fragmentMap[fragmentName] =
context.cache.lookupFragment(fragmentName));
invariant(fragment, 47, fragmentName);
var mode = getFragmentMaskMode(selection);
if (mode !== "mask") {
value = maskSelectionSet(data, fragment.selectionSet, context, mode === "migrate", path);
}
}
if (knownChanged.has(value)) {
knownChanged.add(memo);
}
}
if ("__typename" in data && !("__typename" in memo)) {
memo.__typename = data.__typename;
}
// This check prevents cases where masked fields may accidentally be
// returned as part of this object when the fragment also selects
// additional fields from the same child selection.
if (Object.keys(memo).length !== Object.keys(data).length) {
knownChanged.add(memo);
}
return knownChanged.has(memo) ? memo : data;
}
function getAccessorWarningDescriptor(fieldName, value, path, operationName, operationType) {
var getValue = function () {
if (disableWarningsSlot.getValue()) {
return value;
}
globalThis.__DEV__ !== false && invariant.warn(48, operationName ?
"".concat(operationType, " '").concat(operationName, "'")
: "anonymous ".concat(operationType), "".concat(path, ".").concat(fieldName).replace(/^\./, ""));
getValue = function () { return value; };
return value;
};
return {
get: function () {
return getValue();
},
set: function (newValue) {
getValue = function () { return newValue; };
},
enumerable: true,
configurable: true,
};
}
//# sourceMappingURL=maskDefinition.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import type { ApolloCache, DocumentNode, TypedDocumentNode } from "../core/index.js";
/** @internal */
export declare function maskFragment<TData = unknown>(data: TData, document: TypedDocumentNode<TData> | DocumentNode, cache: ApolloCache<unknown>, fragmentName?: string): TData;
//# sourceMappingURL=maskFragment.d.ts.map

43
node_modules/@apollo/client/masking/maskFragment.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { Kind } from "graphql";
import { MapImpl, SetImpl, warnOnImproperCacheImplementation, } from "./utils.js";
import { invariant } from "../utilities/globals/index.js";
import equal from "@wry/equality";
import { maskDefinition } from "./maskDefinition.js";
import { createFragmentMap, getFragmentDefinitions, } from "../utilities/index.js";
/** @internal */
export function maskFragment(data, document, cache, fragmentName) {
if (!cache.fragmentMatches) {
if (globalThis.__DEV__ !== false) {
warnOnImproperCacheImplementation();
}
return data;
}
var fragments = document.definitions.filter(function (node) {
return node.kind === Kind.FRAGMENT_DEFINITION;
});
if (typeof fragmentName === "undefined") {
invariant(fragments.length === 1, 49, fragments.length);
fragmentName = fragments[0].name.value;
}
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
invariant(!!fragment, 50, fragmentName);
if (data == null) {
// Maintain the original `null` or `undefined` value
return data;
}
if (equal(data, {})) {
// Return early and skip the masking algorithm if we don't have any data
// yet. This can happen when cache.diff returns an empty object which is
// used from watchFragment.
return data;
}
return maskDefinition(data, fragment.selectionSet, {
operationType: "fragment",
operationName: fragment.name.value,
fragmentMap: createFragmentMap(getFragmentDefinitions(document)),
cache: cache,
mutableTargets: new MapImpl(),
knownChanged: new SetImpl(),
});
}
//# sourceMappingURL=maskFragment.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"maskFragment.js","sourceRoot":"","sources":["../../src/masking/maskFragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAO/B,OAAO,EACL,OAAO,EACP,OAAO,EACP,iCAAiC,GAClC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAC1B,IAAW,EACX,QAAiD,EACjD,KAA2B,EAC3B,YAAqB;IAErB,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC3B,IAAI,OAAO,EAAE,CAAC;YACZ,iCAAiC,EAAE,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAC3C,UAAC,IAAI;QACH,OAAA,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,mBAAmB;IAAtC,CAAsC,CACzC,CAAC;IAEF,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;QACxC,SAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,2FAA6F,EAC7F,SAAS,CAAC,MAAM,CACjB,CAAC;QACF,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACzC,CAAC;IAED,IAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAC7B,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,EAApC,CAAoC,CACnD,CAAC;IAEF,SAAS,CACP,CAAC,CAAC,QAAQ,EACV,2CAAyC,EACzC,YAAY,CACb,CAAC;IAEF,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,oDAAoD;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QACpB,wEAAwE;QACxE,wEAAwE;QACxE,2BAA2B;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,EAAE;QACjD,aAAa,EAAE,UAAU;QACzB,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK;QAClC,WAAW,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAChE,KAAK,OAAA;QACL,cAAc,EAAE,IAAI,OAAO,EAAE;QAC7B,YAAY,EAAE,IAAI,OAAO,EAAE;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Kind } from \"graphql\";\nimport type { FragmentDefinitionNode } from \"graphql\";\nimport type {\n ApolloCache,\n DocumentNode,\n TypedDocumentNode,\n} from \"../core/index.js\";\nimport {\n MapImpl,\n SetImpl,\n warnOnImproperCacheImplementation,\n} from \"./utils.js\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport equal from \"@wry/equality\";\nimport { maskDefinition } from \"./maskDefinition.js\";\nimport {\n createFragmentMap,\n getFragmentDefinitions,\n} from \"../utilities/index.js\";\n\n/** @internal */\nexport function maskFragment<TData = unknown>(\n data: TData,\n document: TypedDocumentNode<TData> | DocumentNode,\n cache: ApolloCache<unknown>,\n fragmentName?: string\n): TData {\n if (!cache.fragmentMatches) {\n if (__DEV__) {\n warnOnImproperCacheImplementation();\n }\n\n return data;\n }\n\n const fragments = document.definitions.filter(\n (node): node is FragmentDefinitionNode =>\n node.kind === Kind.FRAGMENT_DEFINITION\n );\n\n if (typeof fragmentName === \"undefined\") {\n invariant(\n fragments.length === 1,\n `Found %s fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n fragments.length\n );\n fragmentName = fragments[0].name.value;\n }\n\n const fragment = fragments.find(\n (fragment) => fragment.name.value === fragmentName\n );\n\n invariant(\n !!fragment,\n `Could not find fragment with name \"%s\".`,\n fragmentName\n );\n\n if (data == null) {\n // Maintain the original `null` or `undefined` value\n return data;\n }\n\n if (equal(data, {})) {\n // Return early and skip the masking algorithm if we don't have any data\n // yet. This can happen when cache.diff returns an empty object which is\n // used from watchFragment.\n return data;\n }\n\n return maskDefinition(data, fragment.selectionSet, {\n operationType: \"fragment\",\n operationName: fragment.name.value,\n fragmentMap: createFragmentMap(getFragmentDefinitions(document)),\n cache,\n mutableTargets: new MapImpl(),\n knownChanged: new SetImpl(),\n });\n}\n"]}

View File

@@ -0,0 +1,4 @@
import type { ApolloCache, DocumentNode, TypedDocumentNode } from "../core/index.js";
/** @internal */
export declare function maskOperation<TData = unknown>(data: TData, document: DocumentNode | TypedDocumentNode<TData>, cache: ApolloCache<unknown>): TData;
//# sourceMappingURL=maskOperation.d.ts.map

29
node_modules/@apollo/client/masking/maskOperation.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import { invariant } from "../utilities/globals/index.js";
import { createFragmentMap, getFragmentDefinitions, getOperationDefinition, } from "../utilities/index.js";
import { maskDefinition } from "./maskDefinition.js";
import { MapImpl, SetImpl, warnOnImproperCacheImplementation, } from "./utils.js";
/** @internal */
export function maskOperation(data, document, cache) {
var _a;
if (!cache.fragmentMatches) {
if (globalThis.__DEV__ !== false) {
warnOnImproperCacheImplementation();
}
return data;
}
var definition = getOperationDefinition(document);
invariant(definition, 51);
if (data == null) {
// Maintain the original `null` or `undefined` value
return data;
}
return maskDefinition(data, definition.selectionSet, {
operationType: definition.operation,
operationName: (_a = definition.name) === null || _a === void 0 ? void 0 : _a.value,
fragmentMap: createFragmentMap(getFragmentDefinitions(document)),
cache: cache,
mutableTargets: new MapImpl(),
knownChanged: new SetImpl(),
});
}
//# sourceMappingURL=maskOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"maskOperation.js","sourceRoot":"","sources":["../../src/masking/maskOperation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,OAAO,EACP,OAAO,EACP,iCAAiC,GAClC,MAAM,YAAY,CAAC;AAEpB,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAC3B,IAAW,EACX,QAAiD,EACjD,KAA2B;;IAE3B,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC3B,IAAI,OAAO,EAAE,CAAC;YACZ,iCAAiC,EAAE,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAM,UAAU,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAEpD,SAAS,CACP,UAAU,EACV,6EAA6E,CAC9E,CAAC;IAEF,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,oDAAoD;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,YAAY,EAAE;QACnD,aAAa,EAAE,UAAU,CAAC,SAAS;QACnC,aAAa,EAAE,MAAA,UAAU,CAAC,IAAI,0CAAE,KAAK;QACrC,WAAW,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAChE,KAAK,OAAA;QACL,cAAc,EAAE,IAAI,OAAO,EAAE;QAC7B,YAAY,EAAE,IAAI,OAAO,EAAE;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type {\n ApolloCache,\n DocumentNode,\n TypedDocumentNode,\n} from \"../core/index.js\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport {\n createFragmentMap,\n getFragmentDefinitions,\n getOperationDefinition,\n} from \"../utilities/index.js\";\nimport { maskDefinition } from \"./maskDefinition.js\";\nimport {\n MapImpl,\n SetImpl,\n warnOnImproperCacheImplementation,\n} from \"./utils.js\";\n\n/** @internal */\nexport function maskOperation<TData = unknown>(\n data: TData,\n document: DocumentNode | TypedDocumentNode<TData>,\n cache: ApolloCache<unknown>\n): TData {\n if (!cache.fragmentMatches) {\n if (__DEV__) {\n warnOnImproperCacheImplementation();\n }\n\n return data;\n }\n\n const definition = getOperationDefinition(document);\n\n invariant(\n definition,\n \"Expected a parsed GraphQL document with a query, mutation, or subscription.\"\n );\n\n if (data == null) {\n // Maintain the original `null` or `undefined` value\n return data;\n }\n\n return maskDefinition(data, definition.selectionSet, {\n operationType: definition.operation,\n operationName: definition.name?.value,\n fragmentMap: createFragmentMap(getFragmentDefinitions(document)),\n cache,\n mutableTargets: new MapImpl(),\n knownChanged: new SetImpl(),\n });\n}\n"]}

205
node_modules/@apollo/client/masking/masking.cjs generated vendored Normal file
View File

@@ -0,0 +1,205 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var optimism = require('optimism');
var globals = require('../utilities/globals');
var utilities = require('../utilities');
var graphql = require('graphql');
var equal = require('@wry/equality');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
var MapImpl = utilities.canUseWeakMap ? WeakMap : Map;
var SetImpl = utilities.canUseWeakSet ? WeakSet : Set;
var disableWarningsSlot = new optimism.Slot();
var issuedWarning = false;
function warnOnImproperCacheImplementation() {
if (!issuedWarning) {
issuedWarning = true;
globalThis.__DEV__ !== false && globals.invariant.warn(52);
}
}
function maskDefinition(data, selectionSet, context) {
return disableWarningsSlot.withValue(true, function () {
var masked = maskSelectionSet(data, selectionSet, context, false);
if (Object.isFrozen(data)) {
utilities.maybeDeepFreeze(masked);
}
return masked;
});
}
function getMutableTarget(data, mutableTargets) {
if (mutableTargets.has(data)) {
return mutableTargets.get(data);
}
var mutableTarget = Array.isArray(data) ? [] : Object.create(null);
mutableTargets.set(data, mutableTarget);
return mutableTarget;
}
function maskSelectionSet(data, selectionSet, context, migration, path) {
var _a;
var knownChanged = context.knownChanged;
var memo = getMutableTarget(data, context.mutableTargets);
if (Array.isArray(data)) {
for (var _i = 0, _b = Array.from(data.entries()); _i < _b.length; _i++) {
var _c = _b[_i], index = _c[0], item = _c[1];
if (item === null) {
memo[index] = null;
continue;
}
var masked = maskSelectionSet(item, selectionSet, context, migration, globalThis.__DEV__ !== false ? "".concat(path || "", "[").concat(index, "]") : void 0);
if (knownChanged.has(masked)) {
knownChanged.add(memo);
}
memo[index] = masked;
}
return knownChanged.has(memo) ? memo : data;
}
for (var _d = 0, _e = selectionSet.selections; _d < _e.length; _d++) {
var selection = _e[_d];
var value = void 0;
if (migration) {
knownChanged.add(memo);
}
if (selection.kind === graphql.Kind.FIELD) {
var keyName = utilities.resultKeyNameFromField(selection);
var childSelectionSet = selection.selectionSet;
value = memo[keyName] || data[keyName];
if (value === void 0) {
continue;
}
if (childSelectionSet && value !== null) {
var masked = maskSelectionSet(data[keyName], childSelectionSet, context, migration, globalThis.__DEV__ !== false ? "".concat(path || "", ".").concat(keyName) : void 0);
if (knownChanged.has(masked)) {
value = masked;
}
}
if (!(globalThis.__DEV__ !== false)) {
memo[keyName] = value;
}
if (globalThis.__DEV__ !== false) {
if (migration &&
keyName !== "__typename" &&
!((_a = Object.getOwnPropertyDescriptor(memo, keyName)) === null || _a === void 0 ? void 0 : _a.value)) {
Object.defineProperty(memo, keyName, getAccessorWarningDescriptor(keyName, value, path || "", context.operationName, context.operationType));
}
else {
delete memo[keyName];
memo[keyName] = value;
}
}
}
if (selection.kind === graphql.Kind.INLINE_FRAGMENT &&
(!selection.typeCondition ||
context.cache.fragmentMatches(selection, data.__typename))) {
value = maskSelectionSet(data, selection.selectionSet, context, migration, path);
}
if (selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
var fragmentName = selection.name.value;
var fragment = context.fragmentMap[fragmentName] ||
(context.fragmentMap[fragmentName] =
context.cache.lookupFragment(fragmentName));
globals.invariant(fragment, 47, fragmentName);
var mode = utilities.getFragmentMaskMode(selection);
if (mode !== "mask") {
value = maskSelectionSet(data, fragment.selectionSet, context, mode === "migrate", path);
}
}
if (knownChanged.has(value)) {
knownChanged.add(memo);
}
}
if ("__typename" in data && !("__typename" in memo)) {
memo.__typename = data.__typename;
}
if (Object.keys(memo).length !== Object.keys(data).length) {
knownChanged.add(memo);
}
return knownChanged.has(memo) ? memo : data;
}
function getAccessorWarningDescriptor(fieldName, value, path, operationName, operationType) {
var getValue = function () {
if (disableWarningsSlot.getValue()) {
return value;
}
globalThis.__DEV__ !== false && globals.invariant.warn(48, operationName ?
"".concat(operationType, " '").concat(operationName, "'")
: "anonymous ".concat(operationType), "".concat(path, ".").concat(fieldName).replace(/^\./, ""));
getValue = function () { return value; };
return value;
};
return {
get: function () {
return getValue();
},
set: function (newValue) {
getValue = function () { return newValue; };
},
enumerable: true,
configurable: true,
};
}
function maskFragment(data, document, cache, fragmentName) {
if (!cache.fragmentMatches) {
if (globalThis.__DEV__ !== false) {
warnOnImproperCacheImplementation();
}
return data;
}
var fragments = document.definitions.filter(function (node) {
return node.kind === graphql.Kind.FRAGMENT_DEFINITION;
});
if (typeof fragmentName === "undefined") {
globals.invariant(fragments.length === 1, 49, fragments.length);
fragmentName = fragments[0].name.value;
}
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
globals.invariant(!!fragment, 50, fragmentName);
if (data == null) {
return data;
}
if (equal__default(data, {})) {
return data;
}
return maskDefinition(data, fragment.selectionSet, {
operationType: "fragment",
operationName: fragment.name.value,
fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(document)),
cache: cache,
mutableTargets: new MapImpl(),
knownChanged: new SetImpl(),
});
}
function maskOperation(data, document, cache) {
var _a;
if (!cache.fragmentMatches) {
if (globalThis.__DEV__ !== false) {
warnOnImproperCacheImplementation();
}
return data;
}
var definition = utilities.getOperationDefinition(document);
globals.invariant(definition, 51);
if (data == null) {
return data;
}
return maskDefinition(data, definition.selectionSet, {
operationType: definition.operation,
operationName: (_a = definition.name) === null || _a === void 0 ? void 0 : _a.value,
fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(document)),
cache: cache,
mutableTargets: new MapImpl(),
knownChanged: new SetImpl(),
});
}
exports.disableWarningsSlot = disableWarningsSlot;
exports.maskFragment = maskFragment;
exports.maskOperation = maskOperation;
//# sourceMappingURL=masking.cjs.map

1
node_modules/@apollo/client/masking/masking.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,205 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var optimism = require('optimism');
var globals = require('../utilities/globals');
var utilities = require('../utilities');
var graphql = require('graphql');
var equal = require('@wry/equality');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
var MapImpl = utilities.canUseWeakMap ? WeakMap : Map;
var SetImpl = utilities.canUseWeakSet ? WeakSet : Set;
var disableWarningsSlot = new optimism.Slot();
var issuedWarning = false;
function warnOnImproperCacheImplementation() {
if (!issuedWarning) {
issuedWarning = true;
globalThis.__DEV__ !== false && globals.invariant.warn(52);
}
}
function maskDefinition(data, selectionSet, context) {
return disableWarningsSlot.withValue(true, function () {
var masked = maskSelectionSet(data, selectionSet, context, false);
if (Object.isFrozen(data)) {
utilities.maybeDeepFreeze(masked);
}
return masked;
});
}
function getMutableTarget(data, mutableTargets) {
if (mutableTargets.has(data)) {
return mutableTargets.get(data);
}
var mutableTarget = Array.isArray(data) ? [] : Object.create(null);
mutableTargets.set(data, mutableTarget);
return mutableTarget;
}
function maskSelectionSet(data, selectionSet, context, migration, path) {
var _a;
var knownChanged = context.knownChanged;
var memo = getMutableTarget(data, context.mutableTargets);
if (Array.isArray(data)) {
for (var _i = 0, _b = Array.from(data.entries()); _i < _b.length; _i++) {
var _c = _b[_i], index = _c[0], item = _c[1];
if (item === null) {
memo[index] = null;
continue;
}
var masked = maskSelectionSet(item, selectionSet, context, migration, globalThis.__DEV__ !== false ? "".concat(path || "", "[").concat(index, "]") : void 0);
if (knownChanged.has(masked)) {
knownChanged.add(memo);
}
memo[index] = masked;
}
return knownChanged.has(memo) ? memo : data;
}
for (var _d = 0, _e = selectionSet.selections; _d < _e.length; _d++) {
var selection = _e[_d];
var value = void 0;
if (migration) {
knownChanged.add(memo);
}
if (selection.kind === graphql.Kind.FIELD) {
var keyName = utilities.resultKeyNameFromField(selection);
var childSelectionSet = selection.selectionSet;
value = memo[keyName] || data[keyName];
if (value === void 0) {
continue;
}
if (childSelectionSet && value !== null) {
var masked = maskSelectionSet(data[keyName], childSelectionSet, context, migration, globalThis.__DEV__ !== false ? "".concat(path || "", ".").concat(keyName) : void 0);
if (knownChanged.has(masked)) {
value = masked;
}
}
if (!(globalThis.__DEV__ !== false)) {
memo[keyName] = value;
}
if (globalThis.__DEV__ !== false) {
if (migration &&
keyName !== "__typename" &&
!((_a = Object.getOwnPropertyDescriptor(memo, keyName)) === null || _a === void 0 ? void 0 : _a.value)) {
Object.defineProperty(memo, keyName, getAccessorWarningDescriptor(keyName, value, path || "", context.operationName, context.operationType));
}
else {
delete memo[keyName];
memo[keyName] = value;
}
}
}
if (selection.kind === graphql.Kind.INLINE_FRAGMENT &&
(!selection.typeCondition ||
context.cache.fragmentMatches(selection, data.__typename))) {
value = maskSelectionSet(data, selection.selectionSet, context, migration, path);
}
if (selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
var fragmentName = selection.name.value;
var fragment = context.fragmentMap[fragmentName] ||
(context.fragmentMap[fragmentName] =
context.cache.lookupFragment(fragmentName));
globals.invariant(fragment, 47, fragmentName);
var mode = utilities.getFragmentMaskMode(selection);
if (mode !== "mask") {
value = maskSelectionSet(data, fragment.selectionSet, context, mode === "migrate", path);
}
}
if (knownChanged.has(value)) {
knownChanged.add(memo);
}
}
if ("__typename" in data && !("__typename" in memo)) {
memo.__typename = data.__typename;
}
if (Object.keys(memo).length !== Object.keys(data).length) {
knownChanged.add(memo);
}
return knownChanged.has(memo) ? memo : data;
}
function getAccessorWarningDescriptor(fieldName, value, path, operationName, operationType) {
var getValue = function () {
if (disableWarningsSlot.getValue()) {
return value;
}
globalThis.__DEV__ !== false && globals.invariant.warn(48, operationName ?
"".concat(operationType, " '").concat(operationName, "'")
: "anonymous ".concat(operationType), "".concat(path, ".").concat(fieldName).replace(/^\./, ""));
getValue = function () { return value; };
return value;
};
return {
get: function () {
return getValue();
},
set: function (newValue) {
getValue = function () { return newValue; };
},
enumerable: true,
configurable: true,
};
}
function maskFragment(data, document, cache, fragmentName) {
if (!cache.fragmentMatches) {
if (globalThis.__DEV__ !== false) {
warnOnImproperCacheImplementation();
}
return data;
}
var fragments = document.definitions.filter(function (node) {
return node.kind === graphql.Kind.FRAGMENT_DEFINITION;
});
if (typeof fragmentName === "undefined") {
globals.invariant(fragments.length === 1, 49, fragments.length);
fragmentName = fragments[0].name.value;
}
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
globals.invariant(!!fragment, 50, fragmentName);
if (data == null) {
return data;
}
if (equal__default(data, {})) {
return data;
}
return maskDefinition(data, fragment.selectionSet, {
operationType: "fragment",
operationName: fragment.name.value,
fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(document)),
cache: cache,
mutableTargets: new MapImpl(),
knownChanged: new SetImpl(),
});
}
function maskOperation(data, document, cache) {
var _a;
if (!cache.fragmentMatches) {
if (globalThis.__DEV__ !== false) {
warnOnImproperCacheImplementation();
}
return data;
}
var definition = utilities.getOperationDefinition(document);
globals.invariant(definition, 51);
if (data == null) {
return data;
}
return maskDefinition(data, definition.selectionSet, {
operationType: definition.operation,
operationName: (_a = definition.name) === null || _a === void 0 ? void 0 : _a.value,
fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(document)),
cache: cache,
mutableTargets: new MapImpl(),
knownChanged: new SetImpl(),
});
}
exports.disableWarningsSlot = disableWarningsSlot;
exports.maskFragment = maskFragment;
exports.maskOperation = maskOperation;
//# sourceMappingURL=masking.cjs.map

1
node_modules/@apollo/client/masking/masking.d.cts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from "./index.d.ts";

8
node_modules/@apollo/client/masking/package.json generated vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"name": "@apollo/client/masking",
"type": "module",
"main": "masking.cjs",
"module": "index.js",
"types": "index.d.ts",
"sideEffects": false
}

46
node_modules/@apollo/client/masking/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,46 @@
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
import type { ContainsFragmentsRefs, IsAny, RemoveFragmentName, RemoveMaskedMarker, UnwrapFragmentRefs } from "./internal/types.js";
import type { Prettify } from "../utilities/index.js";
export interface DataMasking {
}
/**
* Marks a type as masked. This is used by `MaybeMasked` when determining
* whether to use the masked or unmasked type.
*/
export type Masked<TData> = TData & {
__masked?: true;
};
/**
* Marks a type as masked. This is a shortcut for
* `TypedDocumentNode<Masked<TData>, TVariables>`
*/
export type MaskedDocumentNode<TData = {
[key: string]: any;
}, TVariables = {
[key: string]: any;
}> = TypedDocumentNode<Masked<TData>, TVariables>;
export type FragmentType<TData> = [
TData
] extends [{
" $fragmentName"?: infer TKey;
}] ? TKey extends string ? {
" $fragmentRefs"?: {
[key in TKey]: TData;
};
} : never : never;
/**
* Returns TData as either masked or unmasked depending on whether masking is
* enabled.
*/
export type MaybeMasked<TData> = DataMasking extends {
mode: "unmask";
} ? TData extends any ? true extends IsAny<TData> ? TData : TData extends {
__masked?: true;
} ? Prettify<RemoveMaskedMarker<TData>> : Unmasked<TData> : never : DataMasking extends {
mode: "preserveTypes";
} ? TData : TData;
/**
* Unmasks a type to provide its full result.
*/
export type Unmasked<TData> = true extends IsAny<TData> ? TData : TData extends object ? true extends ContainsFragmentsRefs<TData> ? UnwrapFragmentRefs<RemoveMaskedMarker<RemoveFragmentName<TData>>> : TData : TData;
//# sourceMappingURL=types.d.ts.map

2
node_modules/@apollo/client/masking/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

1
node_modules/@apollo/client/masking/types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/masking/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport type {\n ContainsFragmentsRefs,\n IsAny,\n RemoveFragmentName,\n RemoveMaskedMarker,\n UnwrapFragmentRefs,\n} from \"./internal/types.js\";\nimport type { Prettify } from \"../utilities/index.js\";\n\nexport interface DataMasking {}\n\n/**\n * Marks a type as masked. This is used by `MaybeMasked` when determining\n * whether to use the masked or unmasked type.\n */\nexport type Masked<TData> = TData & {\n __masked?: true;\n};\n\n/**\n * Marks a type as masked. This is a shortcut for\n * `TypedDocumentNode<Masked<TData>, TVariables>`\n */\nexport type MaskedDocumentNode<\n TData = { [key: string]: any },\n TVariables = { [key: string]: any },\n> = TypedDocumentNode<Masked<TData>, TVariables>;\n\nexport type FragmentType<TData> =\n [TData] extends [{ \" $fragmentName\"?: infer TKey }] ?\n TKey extends string ?\n { \" $fragmentRefs\"?: { [key in TKey]: TData } }\n : never\n : never;\n\n/**\n * Returns TData as either masked or unmasked depending on whether masking is\n * enabled.\n */\nexport type MaybeMasked<TData> =\n DataMasking extends { mode: \"unmask\" } ?\n // distribute TData - in case of a union, do the next steps for each member\n TData extends any ?\n // prevent \"Type instantiation is excessively deep and possibly infinite.\"\n true extends IsAny<TData> ? TData\n : TData extends { __masked?: true } ? Prettify<RemoveMaskedMarker<TData>>\n : Unmasked<TData>\n : never\n : DataMasking extends { mode: \"preserveTypes\" } ? TData\n : TData;\n\n/**\n * Unmasks a type to provide its full result.\n */\nexport type Unmasked<TData> =\n true extends IsAny<TData> ? TData\n : TData extends object ?\n true extends ContainsFragmentsRefs<TData> ?\n UnwrapFragmentRefs<RemoveMaskedMarker<RemoveFragmentName<TData>>>\n : TData\n : TData;\n"]}

11
node_modules/@apollo/client/masking/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
export declare const MapImpl: WeakMapConstructor;
export declare const SetImpl: WeakSetConstructor;
/** @internal */
export declare const disableWarningsSlot: {
readonly id: string;
hasValue(): boolean;
getValue(): boolean | undefined;
withValue<TResult, TArgs extends any[], TThis = any>(value: boolean, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult;
};
export declare function warnOnImproperCacheImplementation(): void;
//# sourceMappingURL=utils.d.ts.map

17
node_modules/@apollo/client/masking/utils.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { Slot } from "optimism";
import { invariant } from "../utilities/globals/index.js";
import { canUseWeakMap, canUseWeakSet } from "../utilities/index.js";
export var MapImpl = canUseWeakMap ? WeakMap : Map;
export var SetImpl = canUseWeakSet ? WeakSet : Set;
// Contextual slot that allows us to disable accessor warnings on fields when in
// migrate mode.
/** @internal */
export var disableWarningsSlot = new Slot();
var issuedWarning = false;
export function warnOnImproperCacheImplementation() {
if (!issuedWarning) {
issuedWarning = true;
globalThis.__DEV__ !== false && invariant.warn(52);
}
}
//# sourceMappingURL=utils.js.map

1
node_modules/@apollo/client/masking/utils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/masking/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,CAAC,IAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACrD,MAAM,CAAC,IAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAErD,gFAAgF;AAChF,gBAAgB;AAChB,gBAAgB;AAChB,MAAM,CAAC,IAAM,mBAAmB,GAAG,IAAI,IAAI,EAAW,CAAC;AAEvD,IAAI,aAAa,GAAG,KAAK,CAAC;AAC1B,MAAM,UAAU,iCAAiC;IAC/C,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,aAAa,GAAG,IAAI,CAAC;QACrB,SAAS,CAAC,IAAI,CACZ,kLAAkL,CACnL,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { Slot } from \"optimism\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { canUseWeakMap, canUseWeakSet } from \"../utilities/index.js\";\n\nexport const MapImpl = canUseWeakMap ? WeakMap : Map;\nexport const SetImpl = canUseWeakSet ? WeakSet : Set;\n\n// Contextual slot that allows us to disable accessor warnings on fields when in\n// migrate mode.\n/** @internal */\nexport const disableWarningsSlot = new Slot<boolean>();\n\nlet issuedWarning = false;\nexport function warnOnImproperCacheImplementation() {\n if (!issuedWarning) {\n issuedWarning = true;\n invariant.warn(\n \"The configured cache does not support data masking which effectively disables it. Please use a cache that supports data masking or disable data masking to silence this warning.\"\n );\n }\n}\n"]}