houdini 0.13.3 → 0.13.7-alpha.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.
- package/build/cmd/generators/artifacts/index.js +14 -2
- package/build/cmd/generators/artifacts/selection.js +7 -1
- package/build/cmd/generators/typescript/addReferencedInputTypes.js +2 -1
- package/build/cmd/generators/typescript/index.js +1 -1
- package/build/cmd/transforms/schema.js +1 -1
- package/build/cmd.js +34 -7
- package/build/runtime/cache/cache.d.ts +15 -5
- package/build/runtime/cache/cache.js +210 -161
- package/build/runtime/cache/lists.js +1 -12
- package/build/runtime/mutation.d.ts +4 -1
- package/build/runtime/mutation.js +40 -11
- package/build/runtime/network.d.ts +15 -2
- package/build/runtime/network.js +44 -57
- package/build/runtime/pagination.js +53 -45
- package/build/runtime/query.d.ts +5 -1
- package/build/runtime/query.js +41 -26
- package/build/runtime/scalars.d.ts +5 -0
- package/build/runtime/scalars.js +43 -1
- package/build/runtime/types.d.ts +3 -0
- package/build/runtime/utils.js +18 -1
- package/build/runtime-cjs/cache/cache.d.ts +15 -5
- package/build/runtime-cjs/cache/cache.js +210 -161
- package/build/runtime-cjs/cache/lists.js +1 -12
- package/build/runtime-cjs/mutation.d.ts +4 -1
- package/build/runtime-cjs/mutation.js +40 -11
- package/build/runtime-cjs/network.d.ts +15 -2
- package/build/runtime-cjs/network.js +44 -57
- package/build/runtime-cjs/pagination.js +53 -45
- package/build/runtime-cjs/query.d.ts +5 -1
- package/build/runtime-cjs/query.js +41 -26
- package/build/runtime-cjs/scalars.d.ts +5 -0
- package/build/runtime-cjs/scalars.js +43 -1
- package/build/runtime-cjs/types.d.ts +3 -0
- package/build/runtime-cjs/utils.js +18 -1
- package/build/runtime-esm/cache/cache.d.ts +15 -5
- package/build/runtime-esm/cache/cache.js +140 -89
- package/build/runtime-esm/cache/list.d.ts +35 -0
- package/build/runtime-esm/cache/list.js +203 -0
- package/build/runtime-esm/cache/lists.js +1 -12
- package/build/runtime-esm/cache/record.d.ts +40 -0
- package/build/runtime-esm/cache/record.js +195 -0
- package/build/runtime-esm/mutation.d.ts +4 -1
- package/build/runtime-esm/mutation.js +40 -6
- package/build/runtime-esm/network.d.ts +15 -2
- package/build/runtime-esm/network.js +41 -35
- package/build/runtime-esm/pagination.js +36 -17
- package/build/runtime-esm/query.d.ts +5 -1
- package/build/runtime-esm/query.js +28 -14
- package/build/runtime-esm/scalars.d.ts +5 -0
- package/build/runtime-esm/scalars.js +39 -0
- package/build/runtime-esm/types.d.ts +3 -0
- package/build/runtime-esm/utils.js +18 -1
- package/cmd/generators/artifacts/artifacts.test.ts +30 -14
- package/cmd/generators/artifacts/index.ts +20 -4
- package/cmd/generators/artifacts/pagination.test.ts +5 -0
- package/cmd/generators/artifacts/policy.test.ts +145 -2
- package/cmd/generators/artifacts/selection.ts +8 -1
- package/cmd/generators/schema/schema.test.ts +3 -3
- package/cmd/generators/typescript/addReferencedInputTypes.ts +4 -1
- package/cmd/generators/typescript/index.ts +5 -3
- package/cmd/generators/typescript/typescript.test.ts +19 -19
- package/cmd/transforms/fragmentVariables.test.ts +16 -8
- package/cmd/transforms/paginate.test.ts +7 -2
- package/cmd/transforms/schema.ts +42 -42
- package/package.json +3 -3
- package/runtime/cache/cache.ts +172 -105
- package/runtime/cache/lists.ts +1 -14
- package/runtime/cache/tests/availability.test.ts +84 -29
- package/runtime/cache/tests/gc.test.ts +15 -10
- package/runtime/cache/tests/list.test.ts +12 -12
- package/runtime/cache/tests/readwrite.test.ts +1123 -0
- package/runtime/cache/tests/scalars.test.ts +5 -5
- package/runtime/cache/tests/subscriptions.test.ts +235 -745
- package/runtime/mutation.ts +51 -8
- package/runtime/network.ts +55 -38
- package/runtime/pagination.ts +45 -16
- package/runtime/query.ts +47 -24
- package/runtime/scalars.test.ts +322 -14
- package/runtime/scalars.ts +57 -0
- package/runtime/types.ts +3 -0
- package/runtime/utils.ts +20 -1
|
@@ -185,7 +185,7 @@ function artifactGenerator(config, docs) {
|
|
|
185
185
|
].concat(
|
|
186
186
|
// and an artifact for every document
|
|
187
187
|
docs.map(function (doc) { return __awaiter(_this, void 0, void 0, function () {
|
|
188
|
-
var document, name, generate, rawString, docKind, operations, fragments, rootType, selectionSet, operation, matchingFragment, inputs, artifact, cacheDirective, policy, file;
|
|
188
|
+
var document, name, generate, rawString, docKind, operations, fragments, rootType, selectionSet, operation, matchingFragment, inputs, artifact, cacheDirective, args, policy, partial, file;
|
|
189
189
|
var _a, _b, _c, _d, _e, _f;
|
|
190
190
|
return __generator(this, function (_g) {
|
|
191
191
|
switch (_g.label) {
|
|
@@ -271,16 +271,28 @@ function artifactGenerator(config, docs) {
|
|
|
271
271
|
if (docKind === 'HoudiniQuery') {
|
|
272
272
|
cacheDirective = (_e = operations[0].directives) === null || _e === void 0 ? void 0 : _e.find(function (directive) { return directive.name.value === config.cacheDirective; });
|
|
273
273
|
if (cacheDirective) {
|
|
274
|
-
|
|
274
|
+
args = ((_f = cacheDirective.arguments) === null || _f === void 0 ? void 0 : _f.reduce(function (acc, arg) {
|
|
275
|
+
var _a;
|
|
276
|
+
return (__assign(__assign({}, acc), (_a = {}, _a[arg.name.value] = arg, _a)));
|
|
277
|
+
}, {})) || {};
|
|
278
|
+
policy = args[config.cachePolicyArg];
|
|
275
279
|
if (policy && policy.value.kind === 'EnumValue') {
|
|
276
280
|
artifact.policy = policy.value.value;
|
|
277
281
|
}
|
|
278
282
|
else {
|
|
279
283
|
artifact.policy = config.defaultCachePolicy;
|
|
280
284
|
}
|
|
285
|
+
partial = args[config.cachePartialArg];
|
|
286
|
+
if (partial && partial.value.kind === 'BooleanValue') {
|
|
287
|
+
artifact.partial = partial.value.value;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
artifact.partial = config.defaultPartial;
|
|
291
|
+
}
|
|
281
292
|
}
|
|
282
293
|
else {
|
|
283
294
|
artifact.policy = config.defaultCachePolicy;
|
|
295
|
+
artifact.partial = config.defaultPartial;
|
|
284
296
|
}
|
|
285
297
|
}
|
|
286
298
|
file = AST.program([
|
|
@@ -100,11 +100,14 @@ function selection(_a) {
|
|
|
100
100
|
var attributeName = ((_d = field.alias) === null || _d === void 0 ? void 0 : _d.value) || field.name.value;
|
|
101
101
|
// if we are looking at __typename, its a string (not defined in the schema)
|
|
102
102
|
var fieldType = void 0;
|
|
103
|
+
var nullable = false;
|
|
103
104
|
if (field.name.value === '__typename') {
|
|
104
105
|
fieldType = config.schema.getType('String');
|
|
105
106
|
}
|
|
106
107
|
else {
|
|
107
|
-
|
|
108
|
+
var typeRef = type.getFields()[field.name.value].type;
|
|
109
|
+
fieldType = houdini_common_1.getRootType(typeRef);
|
|
110
|
+
nullable = !graphql.isNonNullType(typeRef);
|
|
108
111
|
}
|
|
109
112
|
var typeName = fieldType.toString();
|
|
110
113
|
// make sure we include the attribute in the path
|
|
@@ -114,6 +117,9 @@ function selection(_a) {
|
|
|
114
117
|
type: typeName,
|
|
115
118
|
keyRaw: fieldKey_1.default(config, field),
|
|
116
119
|
};
|
|
120
|
+
if (nullable) {
|
|
121
|
+
fieldObj.nullable = true;
|
|
122
|
+
}
|
|
117
123
|
// is there an operation for this field
|
|
118
124
|
var operationKey = pathSoFar.join(',');
|
|
119
125
|
if (operations[operationKey]) {
|
|
@@ -74,7 +74,8 @@ function addReferencedInputTypes(config, body, visitedTypes, rootType) {
|
|
|
74
74
|
var field = _c.value;
|
|
75
75
|
// walk down the referenced fields and build stuff back up
|
|
76
76
|
addReferencedInputTypes(config, body, visitedTypes, field.type);
|
|
77
|
-
|
|
77
|
+
// check if the type is optional so we can label the value as omitable
|
|
78
|
+
members.push(AST.tsPropertySignature(AST.identifier(field.name), AST.tsTypeAnnotation(typeReference_1.tsTypeReference(config, field)), graphql.isNullableType(field.type)));
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -231,7 +231,7 @@ function generateOperationTypeDefs(config, body, definition, selections, visited
|
|
|
231
231
|
// merge all of the variables into a single object
|
|
232
232
|
body.push(AST.exportNamedDeclaration(AST.tsTypeAliasDeclaration(AST.identifier(inputTypeName), AST.tsTypeLiteral((definition.variableDefinitions || []).map(function (definition) {
|
|
233
233
|
// add a property describing the variable to the root object
|
|
234
|
-
return AST.tsPropertySignature(AST.identifier(definition.variable.name.value), AST.tsTypeAnnotation(typeReference_1.tsTypeReference(config, definition)));
|
|
234
|
+
return AST.tsPropertySignature(AST.identifier(definition.variable.name.value), AST.tsTypeAnnotation(typeReference_1.tsTypeReference(config, definition)), definition.type.kind !== 'NonNullType');
|
|
235
235
|
})))));
|
|
236
236
|
}
|
|
237
237
|
return [2 /*return*/];
|
|
@@ -63,7 +63,7 @@ function graphqlExtensions(config, documents) {
|
|
|
63
63
|
return __awaiter(this, void 0, void 0, function () {
|
|
64
64
|
var internalSchema;
|
|
65
65
|
return __generator(this, function (_a) {
|
|
66
|
-
internalSchema = "\
|
|
66
|
+
internalSchema = "\nenum CachePolicy {\n\t" + types_1.CachePolicy.CacheAndNetwork + "\n\t" + types_1.CachePolicy.CacheOnly + "\n\t" + types_1.CachePolicy.CacheOrNetwork + "\n\t" + types_1.CachePolicy.NetworkOnly + "\n}\n\n\"\"\"\n\t@" + config.listDirective + " is used to mark a field for the runtime as a place to add or remove\n\tentities in mutations\n\"\"\"\ndirective @" + config.listDirective + "(" + config.listNameArg + ": String!, connection: Boolean) on FIELD\n\n\"\"\"\n\t@" + config.listPrependDirective + " is used to tell the runtime to add the result to the end of the list\n\"\"\"\ndirective @" + config.listPrependDirective + "(\n\t" + config.listDirectiveParentIDArg + ": ID\n) on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.listAppendDirective + " is used to tell the runtime to add the result to the start of the list\n\"\"\"\ndirective @" + config.listAppendDirective + "(" + config.listDirectiveParentIDArg + ": ID) on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.listParentDirective + " is used to provide a parentID without specifying position or in situations\n\twhere it doesn't make sense (eg when deleting a node.)\n\"\"\"\ndirective @" + config.listParentDirective + "(value: ID!) on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.whenDirective + " is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.)\n\"\"\"\ndirective @" + config.whenDirective + " on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.whenNotDirective + " is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.)\n\"\"\"\ndirective @" + config.whenNotDirective + " on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.argumentsDirective + " is used to define the arguments of a fragment\n\"\"\"\ndirective @" + config.argumentsDirective + " on FRAGMENT_DEFINITION\n\n\"\"\"\n\t@" + config.cacheDirective + " is used to specify cache rules for a query\n\"\"\"\ndirective @" + config.cacheDirective + "(" + config.cachePolicyArg + ": CachePolicy, " + config.cachePartialArg + ": Boolean) on QUERY\n";
|
|
67
67
|
config.newSchema += internalSchema;
|
|
68
68
|
// add the static extra bits that will be used by other transforms
|
|
69
69
|
config.schema = merge_1.mergeSchemas({
|
package/build/cmd.js
CHANGED
|
@@ -665,7 +665,7 @@ var CachePolicy$1;
|
|
|
665
665
|
// a place to hold conventions and magic strings
|
|
666
666
|
var Config = /** @class */ (function () {
|
|
667
667
|
function Config(_a) {
|
|
668
|
-
var schema = _a.schema, schemaPath = _a.schemaPath, sourceGlob = _a.sourceGlob, apiUrl = _a.apiUrl, _b = _a.quiet, quiet = _b === void 0 ? false : _b, filepath = _a.filepath, _c = _a.framework, framework = _c === void 0 ? 'sapper' : _c, _d = _a.module, module = _d === void 0 ? 'commonjs' : _d, staticSite = _a.static, scalars = _a.scalars, cacheBufferSize = _a.cacheBufferSize, definitionsPath = _a.definitionsPath, _e = _a.defaultCachePolicy, defaultCachePolicy = _e === void 0 ? CachePolicy$1.NetworkOnly : _e;
|
|
668
|
+
var schema = _a.schema, schemaPath = _a.schemaPath, sourceGlob = _a.sourceGlob, apiUrl = _a.apiUrl, _b = _a.quiet, quiet = _b === void 0 ? false : _b, filepath = _a.filepath, _c = _a.framework, framework = _c === void 0 ? 'sapper' : _c, _d = _a.module, module = _d === void 0 ? 'commonjs' : _d, staticSite = _a.static, scalars = _a.scalars, cacheBufferSize = _a.cacheBufferSize, definitionsPath = _a.definitionsPath, _e = _a.defaultCachePolicy, defaultCachePolicy = _e === void 0 ? CachePolicy$1.NetworkOnly : _e, _f = _a.defaultPartial, defaultPartial = _f === void 0 ? false : _f;
|
|
669
669
|
this.framework = 'sapper';
|
|
670
670
|
this.module = 'commonjs';
|
|
671
671
|
this.newSchema = '';
|
|
@@ -718,6 +718,7 @@ var Config = /** @class */ (function () {
|
|
|
718
718
|
this.scalars = scalars;
|
|
719
719
|
this.cacheBufferSize = cacheBufferSize;
|
|
720
720
|
this.defaultCachePolicy = defaultCachePolicy;
|
|
721
|
+
this.defaultPartial = defaultPartial;
|
|
721
722
|
this.definitionsFile = definitionsPath;
|
|
722
723
|
// if we are building a sapper project, we want to put the runtime in
|
|
723
724
|
// src/node_modules so that we can access @sapper/app and interact
|
|
@@ -958,6 +959,13 @@ var Config = /** @class */ (function () {
|
|
|
958
959
|
enumerable: false,
|
|
959
960
|
configurable: true
|
|
960
961
|
});
|
|
962
|
+
Object.defineProperty(Config.prototype, "cachePartialArg", {
|
|
963
|
+
get: function () {
|
|
964
|
+
return 'partial';
|
|
965
|
+
},
|
|
966
|
+
enumerable: false,
|
|
967
|
+
configurable: true
|
|
968
|
+
});
|
|
961
969
|
Object.defineProperty(Config.prototype, "cachePolicyArg", {
|
|
962
970
|
get: function () {
|
|
963
971
|
return 'policy';
|
|
@@ -54446,7 +54454,7 @@ function graphqlExtensions(config, documents) {
|
|
|
54446
54454
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
54447
54455
|
var internalSchema;
|
|
54448
54456
|
return __generator$1(this, function (_a) {
|
|
54449
|
-
internalSchema = "\
|
|
54457
|
+
internalSchema = "\nenum CachePolicy {\n\t" + CachePolicy.CacheAndNetwork + "\n\t" + CachePolicy.CacheOnly + "\n\t" + CachePolicy.CacheOrNetwork + "\n\t" + CachePolicy.NetworkOnly + "\n}\n\n\"\"\"\n\t@" + config.listDirective + " is used to mark a field for the runtime as a place to add or remove\n\tentities in mutations\n\"\"\"\ndirective @" + config.listDirective + "(" + config.listNameArg + ": String!, connection: Boolean) on FIELD\n\n\"\"\"\n\t@" + config.listPrependDirective + " is used to tell the runtime to add the result to the end of the list\n\"\"\"\ndirective @" + config.listPrependDirective + "(\n\t" + config.listDirectiveParentIDArg + ": ID\n) on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.listAppendDirective + " is used to tell the runtime to add the result to the start of the list\n\"\"\"\ndirective @" + config.listAppendDirective + "(" + config.listDirectiveParentIDArg + ": ID) on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.listParentDirective + " is used to provide a parentID without specifying position or in situations\n\twhere it doesn't make sense (eg when deleting a node.)\n\"\"\"\ndirective @" + config.listParentDirective + "(value: ID!) on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.whenDirective + " is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.)\n\"\"\"\ndirective @" + config.whenDirective + " on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.whenNotDirective + " is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.)\n\"\"\"\ndirective @" + config.whenNotDirective + " on FRAGMENT_SPREAD\n\n\"\"\"\n\t@" + config.argumentsDirective + " is used to define the arguments of a fragment\n\"\"\"\ndirective @" + config.argumentsDirective + " on FRAGMENT_DEFINITION\n\n\"\"\"\n\t@" + config.cacheDirective + " is used to specify cache rules for a query\n\"\"\"\ndirective @" + config.cacheDirective + "(" + config.cachePolicyArg + ": CachePolicy, " + config.cachePartialArg + ": Boolean) on QUERY\n";
|
|
54450
54458
|
config.newSchema += internalSchema;
|
|
54451
54459
|
// add the static extra bits that will be used by other transforms
|
|
54452
54460
|
config.schema = mergeSchemas({
|
|
@@ -77220,11 +77228,14 @@ function selection(_a) {
|
|
|
77220
77228
|
var attributeName = ((_d = field.alias) === null || _d === void 0 ? void 0 : _d.value) || field.name.value;
|
|
77221
77229
|
// if we are looking at __typename, its a string (not defined in the schema)
|
|
77222
77230
|
var fieldType = void 0;
|
|
77231
|
+
var nullable = false;
|
|
77223
77232
|
if (field.name.value === '__typename') {
|
|
77224
77233
|
fieldType = config.schema.getType('String');
|
|
77225
77234
|
}
|
|
77226
77235
|
else {
|
|
77227
|
-
|
|
77236
|
+
var typeRef = type.getFields()[field.name.value].type;
|
|
77237
|
+
fieldType = getRootType(typeRef);
|
|
77238
|
+
nullable = !graphql.isNonNullType(typeRef);
|
|
77228
77239
|
}
|
|
77229
77240
|
var typeName = fieldType.toString();
|
|
77230
77241
|
// make sure we include the attribute in the path
|
|
@@ -77234,6 +77245,9 @@ function selection(_a) {
|
|
|
77234
77245
|
type: typeName,
|
|
77235
77246
|
keyRaw: fieldKey(config, field),
|
|
77236
77247
|
};
|
|
77248
|
+
if (nullable) {
|
|
77249
|
+
fieldObj.nullable = true;
|
|
77250
|
+
}
|
|
77237
77251
|
// is there an operation for this field
|
|
77238
77252
|
var operationKey = pathSoFar.join(',');
|
|
77239
77253
|
if (operations[operationKey]) {
|
|
@@ -77695,7 +77709,7 @@ function artifactGenerator(config, docs) {
|
|
|
77695
77709
|
].concat(
|
|
77696
77710
|
// and an artifact for every document
|
|
77697
77711
|
docs.map(function (doc) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
77698
|
-
var document, name, generate, rawString, docKind, operations, fragments, rootType, selectionSet, operation, matchingFragment, inputs, artifact, cacheDirective, policy, file;
|
|
77712
|
+
var document, name, generate, rawString, docKind, operations, fragments, rootType, selectionSet, operation, matchingFragment, inputs, artifact, cacheDirective, args, policy, partial, file;
|
|
77699
77713
|
var _a, _b, _c, _d, _e, _f;
|
|
77700
77714
|
return __generator$1(this, function (_g) {
|
|
77701
77715
|
switch (_g.label) {
|
|
@@ -77781,16 +77795,28 @@ function artifactGenerator(config, docs) {
|
|
|
77781
77795
|
if (docKind === 'HoudiniQuery') {
|
|
77782
77796
|
cacheDirective = (_e = operations[0].directives) === null || _e === void 0 ? void 0 : _e.find(function (directive) { return directive.name.value === config.cacheDirective; });
|
|
77783
77797
|
if (cacheDirective) {
|
|
77784
|
-
|
|
77798
|
+
args = ((_f = cacheDirective.arguments) === null || _f === void 0 ? void 0 : _f.reduce(function (acc, arg) {
|
|
77799
|
+
var _a;
|
|
77800
|
+
return (__assign$1(__assign$1({}, acc), (_a = {}, _a[arg.name.value] = arg, _a)));
|
|
77801
|
+
}, {})) || {};
|
|
77802
|
+
policy = args[config.cachePolicyArg];
|
|
77785
77803
|
if (policy && policy.value.kind === 'EnumValue') {
|
|
77786
77804
|
artifact.policy = policy.value.value;
|
|
77787
77805
|
}
|
|
77788
77806
|
else {
|
|
77789
77807
|
artifact.policy = config.defaultCachePolicy;
|
|
77790
77808
|
}
|
|
77809
|
+
partial = args[config.cachePartialArg];
|
|
77810
|
+
if (partial && partial.value.kind === 'BooleanValue') {
|
|
77811
|
+
artifact.partial = partial.value.value;
|
|
77812
|
+
}
|
|
77813
|
+
else {
|
|
77814
|
+
artifact.partial = config.defaultPartial;
|
|
77815
|
+
}
|
|
77791
77816
|
}
|
|
77792
77817
|
else {
|
|
77793
77818
|
artifact.policy = config.defaultCachePolicy;
|
|
77819
|
+
artifact.partial = config.defaultPartial;
|
|
77794
77820
|
}
|
|
77795
77821
|
}
|
|
77796
77822
|
file = AST$5.program([
|
|
@@ -78147,7 +78173,8 @@ function addReferencedInputTypes(config, body, visitedTypes, rootType) {
|
|
|
78147
78173
|
var field = _c.value;
|
|
78148
78174
|
// walk down the referenced fields and build stuff back up
|
|
78149
78175
|
addReferencedInputTypes(config, body, visitedTypes, field.type);
|
|
78150
|
-
|
|
78176
|
+
// check if the type is optional so we can label the value as omitable
|
|
78177
|
+
members.push(AST$2.tsPropertySignature(AST$2.identifier(field.name), AST$2.tsTypeAnnotation(tsTypeReference(config, field)), graphql.isNullableType(field.type)));
|
|
78151
78178
|
}
|
|
78152
78179
|
}
|
|
78153
78180
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -78556,7 +78583,7 @@ function generateOperationTypeDefs(config, body, definition, selections, visited
|
|
|
78556
78583
|
// merge all of the variables into a single object
|
|
78557
78584
|
body.push(AST.exportNamedDeclaration(AST.tsTypeAliasDeclaration(AST.identifier(inputTypeName), AST.tsTypeLiteral((definition.variableDefinitions || []).map(function (definition) {
|
|
78558
78585
|
// add a property describing the variable to the root object
|
|
78559
|
-
return AST.tsPropertySignature(AST.identifier(definition.variable.name.value), AST.tsTypeAnnotation(tsTypeReference(config, definition)));
|
|
78586
|
+
return AST.tsPropertySignature(AST.identifier(definition.variable.name.value), AST.tsTypeAnnotation(tsTypeReference(config, definition)), definition.type.kind !== 'NonNullType');
|
|
78560
78587
|
})))));
|
|
78561
78588
|
}
|
|
78562
78589
|
return [2 /*return*/];
|
|
@@ -14,10 +14,13 @@ export declare class Cache {
|
|
|
14
14
|
selection: SubscriptionSelection;
|
|
15
15
|
variables?: {};
|
|
16
16
|
parent?: string;
|
|
17
|
-
layer?: LayerID;
|
|
17
|
+
layer?: LayerID | null;
|
|
18
18
|
applyUpdates?: boolean;
|
|
19
19
|
}): LayerID;
|
|
20
|
-
read(...args: Parameters<CacheInternal['getSelection']>):
|
|
20
|
+
read(...args: Parameters<CacheInternal['getSelection']>): {
|
|
21
|
+
data: GraphQLObject | null;
|
|
22
|
+
partial: boolean;
|
|
23
|
+
};
|
|
21
24
|
subscribe(spec: SubscriptionSpec, variables?: {}): void;
|
|
22
25
|
unsubscribe(spec: SubscriptionSpec, variables?: {}): void;
|
|
23
26
|
list(name: string, parentID?: string): List;
|
|
@@ -57,7 +60,11 @@ declare class CacheInternal {
|
|
|
57
60
|
selection: SubscriptionSelection;
|
|
58
61
|
parent?: string;
|
|
59
62
|
variables?: {};
|
|
60
|
-
}):
|
|
63
|
+
}): {
|
|
64
|
+
data: GraphQLObject | null;
|
|
65
|
+
partial: boolean;
|
|
66
|
+
hasData: boolean;
|
|
67
|
+
};
|
|
61
68
|
id(type: string, data: {
|
|
62
69
|
id?: string;
|
|
63
70
|
} | null): string | null;
|
|
@@ -70,7 +77,11 @@ declare class CacheInternal {
|
|
|
70
77
|
fields: SubscriptionSelection;
|
|
71
78
|
variables?: {};
|
|
72
79
|
linkedList: LinkedList;
|
|
73
|
-
}):
|
|
80
|
+
}): {
|
|
81
|
+
data: LinkedList<GraphQLValue>;
|
|
82
|
+
partial: boolean;
|
|
83
|
+
hasData: boolean;
|
|
84
|
+
};
|
|
74
85
|
extractNestedListIDs({ value, abstract, recordID, key, linkedType, fields, variables, applyUpdates, specs, layer, startingWith, }: {
|
|
75
86
|
value: GraphQLValue[];
|
|
76
87
|
recordID: string;
|
|
@@ -87,7 +98,6 @@ declare class CacheInternal {
|
|
|
87
98
|
nestedIDs: LinkedList;
|
|
88
99
|
newIDs: (string | null)[];
|
|
89
100
|
};
|
|
90
|
-
isDataAvailable(target: SubscriptionSelection, variables: {}, parentID?: string): boolean;
|
|
91
101
|
collectGarbage(): void;
|
|
92
102
|
}
|
|
93
103
|
export declare const rootID = "_ROOT_";
|