@webiny/app 5.39.2 → 5.39.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IdValue } from "apollo-utilities";
|
|
2
|
+
import { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from "apollo-cache-inmemory";
|
|
3
|
+
export declare class IntrospectionFragmentMatcher implements FragmentMatcherInterface {
|
|
4
|
+
private readonly isReady;
|
|
5
|
+
private readonly possibleTypesMap;
|
|
6
|
+
constructor(options?: {
|
|
7
|
+
introspectionQueryResultData?: IntrospectionResultData;
|
|
8
|
+
});
|
|
9
|
+
match(idValue: IdValue, typeCondition: string, context: ReadStoreContext): boolean;
|
|
10
|
+
private parseIntrospectionResult;
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.IntrospectionFragmentMatcher = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _tsInvariant = require("ts-invariant");
|
|
12
|
+
var IntrospectionFragmentMatcher = /*#__PURE__*/function () {
|
|
13
|
+
function IntrospectionFragmentMatcher(options) {
|
|
14
|
+
(0, _classCallCheck2.default)(this, IntrospectionFragmentMatcher);
|
|
15
|
+
(0, _defineProperty2.default)(this, "possibleTypesMap", {});
|
|
16
|
+
if (options && options.introspectionQueryResultData) {
|
|
17
|
+
this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData);
|
|
18
|
+
this.isReady = true;
|
|
19
|
+
} else {
|
|
20
|
+
this.isReady = false;
|
|
21
|
+
}
|
|
22
|
+
this.match = this.match.bind(this);
|
|
23
|
+
}
|
|
24
|
+
(0, _createClass2.default)(IntrospectionFragmentMatcher, [{
|
|
25
|
+
key: "match",
|
|
26
|
+
value: function match(idValue, typeCondition, context) {
|
|
27
|
+
(0, _tsInvariant.invariant)(this.isReady, "FragmentMatcher.match() was called before FragmentMatcher.init()");
|
|
28
|
+
var obj = context.store.get(idValue.id);
|
|
29
|
+
var isRootQuery = idValue.id === "ROOT_QUERY";
|
|
30
|
+
if (!obj) {
|
|
31
|
+
// https://github.com/apollographql/apollo-client/pull/4620
|
|
32
|
+
return isRootQuery;
|
|
33
|
+
}
|
|
34
|
+
var _obj$__typename = obj.__typename,
|
|
35
|
+
__typename = _obj$__typename === void 0 ? isRootQuery && "Query" : _obj$__typename;
|
|
36
|
+
(0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: ".concat(JSON.stringify(obj)));
|
|
37
|
+
if (__typename === typeCondition) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
var implementingTypes = this.possibleTypesMap[typeCondition];
|
|
41
|
+
if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "parseIntrospectionResult",
|
|
48
|
+
value: function parseIntrospectionResult(introspectionResultData) {
|
|
49
|
+
var typeMap = {};
|
|
50
|
+
introspectionResultData.__schema.types.forEach(function (type) {
|
|
51
|
+
if (type.kind === "UNION" || type.kind === "INTERFACE") {
|
|
52
|
+
typeMap[type.name] = type.possibleTypes.map(function (implementingType) {
|
|
53
|
+
return implementingType.name;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return typeMap;
|
|
58
|
+
}
|
|
59
|
+
}]);
|
|
60
|
+
return IntrospectionFragmentMatcher;
|
|
61
|
+
}();
|
|
62
|
+
exports.IntrospectionFragmentMatcher = IntrospectionFragmentMatcher;
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=IntrospectionFragmentMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_tsInvariant","require","IntrospectionFragmentMatcher","options","_classCallCheck2","default","_defineProperty2","introspectionQueryResultData","possibleTypesMap","parseIntrospectionResult","isReady","match","bind","_createClass2","key","value","idValue","typeCondition","context","invariant","obj","store","get","id","isRootQuery","_obj$__typename","__typename","concat","JSON","stringify","implementingTypes","indexOf","introspectionResultData","typeMap","__schema","types","forEach","type","kind","name","possibleTypes","map","implementingType","exports"],"sources":["IntrospectionFragmentMatcher.ts"],"sourcesContent":["import { IdValue } from \"apollo-utilities\";\nimport { invariant } from \"ts-invariant\";\n\nimport {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData\n} from \"apollo-cache-inmemory\";\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private readonly isReady: boolean;\n private readonly possibleTypesMap: PossibleTypesMap = {};\n\n constructor(options?: { introspectionQueryResultData?: IntrospectionResultData }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(idValue: IdValue, typeCondition: string, context: ReadStoreContext) {\n invariant(this.isReady, \"FragmentMatcher.match() was called before FragmentMatcher.init()\");\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === \"ROOT_QUERY\";\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && \"Query\" } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(obj)}`\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === \"UNION\" || type.kind === \"INTERFACE\") {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType => implementingType.name\n );\n }\n });\n return typeMap;\n }\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAyC,IAS5BC,4BAA4B;EAIrC,SAAAA,6BAAYC,OAAoE,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAH,4BAAA;IAAA,IAAAI,gBAAA,CAAAD,OAAA,4BAF5B,CAAC,CAAC;IAGpD,IAAIF,OAAO,IAAIA,OAAO,CAACI,4BAA4B,EAAE;MACjD,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACC,wBAAwB,CACjDN,OAAO,CAACI,4BACZ,CAAC;MACD,IAAI,CAACG,OAAO,GAAG,IAAI;IACvB,CAAC,MAAM;MACH,IAAI,CAACA,OAAO,GAAG,KAAK;IACxB;IAEA,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI,CAAC;EACtC;EAAC,IAAAC,aAAA,CAAAR,OAAA,EAAAH,4BAAA;IAAAY,GAAA;IAAAC,KAAA,EAED,SAAAJ,MAAaK,OAAgB,EAAEC,aAAqB,EAAEC,OAAyB,EAAE;MAC7E,IAAAC,sBAAS,EAAC,IAAI,CAACT,OAAO,EAAE,kEAAkE,CAAC;MAE3F,IAAMU,GAAG,GAAGF,OAAO,CAACG,KAAK,CAACC,GAAG,CAACN,OAAO,CAACO,EAAE,CAAC;MACzC,IAAMC,WAAW,GAAGR,OAAO,CAACO,EAAE,KAAK,YAAY;MAE/C,IAAI,CAACH,GA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4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"@babel/runtime": "7.22.6",
|
|
19
19
|
"@emotion/styled": "11.10.6",
|
|
20
20
|
"@types/react": "17.0.39",
|
|
21
|
-
"@webiny/i18n": "5.39.
|
|
22
|
-
"@webiny/i18n-react": "5.39.
|
|
23
|
-
"@webiny/plugins": "5.39.
|
|
24
|
-
"@webiny/react-composition": "5.39.
|
|
25
|
-
"@webiny/react-router": "5.39.
|
|
26
|
-
"@webiny/ui": "5.39.
|
|
21
|
+
"@webiny/i18n": "5.39.3-beta.0",
|
|
22
|
+
"@webiny/i18n-react": "5.39.3-beta.0",
|
|
23
|
+
"@webiny/plugins": "5.39.3-beta.0",
|
|
24
|
+
"@webiny/react-composition": "5.39.3-beta.0",
|
|
25
|
+
"@webiny/react-router": "5.39.3-beta.0",
|
|
26
|
+
"@webiny/ui": "5.39.3-beta.0",
|
|
27
27
|
"apollo-cache": "1.3.5",
|
|
28
28
|
"apollo-cache-inmemory": "1.6.6",
|
|
29
29
|
"apollo-client": "2.6.10",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"nanoid": "3.3.4",
|
|
40
40
|
"react": "17.0.2",
|
|
41
41
|
"react-dom": "17.0.2",
|
|
42
|
+
"ts-invariant": "0.10.3",
|
|
42
43
|
"warning": "4.0.3"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
@@ -50,8 +51,8 @@
|
|
|
50
51
|
"@babel/preset-typescript": "7.22.5",
|
|
51
52
|
"@types/lodash": "4.14.195",
|
|
52
53
|
"@types/warning": "3.0.0",
|
|
53
|
-
"@webiny/cli": "5.39.
|
|
54
|
-
"@webiny/project-utils": "5.39.
|
|
54
|
+
"@webiny/cli": "5.39.3-beta.0",
|
|
55
|
+
"@webiny/project-utils": "5.39.3-beta.0",
|
|
55
56
|
"rimraf": "3.0.2",
|
|
56
57
|
"typescript": "4.7.4"
|
|
57
58
|
},
|
|
@@ -70,5 +71,5 @@
|
|
|
70
71
|
]
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "bb0a2c8b43b2caa88f7a2d745a88039a520d124c"
|
|
74
75
|
}
|