From 968e49e427cc2c5f0052b2d9cf0f6e70e8d04caf Mon Sep 17 00:00:00 2001 From: James Porlante Date: Fri, 9 Nov 2018 14:22:40 +0700 Subject: [PATCH 1/4] (chore) update graphql packages --- .../server/no-meteor/schemas/schema.graphql | 7 ++-- package-lock.json | 33 +++++++++++++++---- package.json | 4 +-- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql b/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql index 408f8aabfa0..0975ea3b8a2 100644 --- a/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql +++ b/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql @@ -55,14 +55,13 @@ type ExampleIOUPaymentData { fullName: String! } -# These should be defined in their respective plugin schemas, but `extend union` isn't working yet -union PaymentData = ExampleIOUPaymentData | StripeCardPaymentData | MarketplaceStripeCardPaymentData +# Use `extend union` to define a payment plugin's PaymentData type +union PaymentData = ExampleIOUPaymentData -# These should be defined in their respective plugin schemas, but `extend enum` isn't working yet +# Use `extend enum` to add a plugin's payment method name "The name of a payment method, which is how payment methods are keyed" enum PaymentMethodName { iou_example - stripe_card } "An example" diff --git a/package-lock.json b/package-lock.json index c4b0f82041c..3b3f0a0ac15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7185,9 +7185,9 @@ } }, "graphql": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-0.13.1.tgz", - "integrity": "sha512-awNp3LTrQ7dJDSX3p3PBuxNDC+WFSOrWeV6+l4Xeh2PQJVOFyQ9SZPonXRz2WZc7aIxLZsf2nDZuuuc0qyEq/A==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.0.2.tgz", + "integrity": "sha512-gUC4YYsaiSJT1h40krG3J+USGlwhzNTXSb4IOZljn9ag5Tj+RkoXrWp+Kh7WyE3t1NCfab5kzCuxBIvOMERMXw==", "requires": { "iterall": "1.2.2" } @@ -7261,15 +7261,34 @@ "integrity": "sha512-qnNmof9pAqj/LUzs3lStP0Gw1qhdVCUS7Ab7+SUB6KD5aX1uqxWQRwMnOGTkhKuLvLNIs1TvNz+iS9kUGl1MhA==" }, "graphql-tools": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/graphql-tools/-/graphql-tools-3.1.1.tgz", - "integrity": "sha512-yHvPkweUB0+Q/GWH5wIG60bpt8CTwBklCSzQdEHmRUgAdEQKxw+9B7zB3dG7wB3Ym7M7lfrS4Ej+jtDZfA2UXg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/graphql-tools/-/graphql-tools-4.0.3.tgz", + "integrity": "sha512-NNZM0WSnVLX1zIMUxu7SjzLZ4prCp15N5L2T2ro02OVyydZ0fuCnZYRnx/yK9xjGWbZA0Q58yEO//Bv/psJWrg==", "requires": { - "apollo-link": "1.2.2", + "apollo-link": "1.2.3", "apollo-utilities": "1.0.16", "deprecated-decorator": "0.1.6", "iterall": "1.2.2", "uuid": "3.3.2" + }, + "dependencies": { + "apollo-link": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.3.tgz", + "integrity": "sha512-iL9yS2OfxYhigme5bpTbmRyC+Htt6tyo2fRMHT3K1XRL/C5IQDDz37OjpPy4ndx7WInSvfSZaaOTKFja9VWqSw==", + "requires": { + "apollo-utilities": "1.0.16", + "zen-observable-ts": "0.8.10" + } + }, + "zen-observable-ts": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.10.tgz", + "integrity": "sha512-5vqMtRggU/2GhePC9OU4sYEWOdvmayp2k3gjPf4F0mXwB3CSbbNznfDUvDJx9O2ZTa1EIXdJhPchQveFKwNXPQ==", + "requires": { + "zen-observable": "0.8.8" + } + } } }, "graphql.js": { diff --git a/package.json b/package.json index ad69ea18973..f41aa232c65 100644 --- a/package.json +++ b/package.json @@ -68,12 +68,12 @@ "fibers": "^2.0.0", "flatten-obj": "^3.1.1", "font-awesome": "^4.7.0", - "graphql": "0.13.1", + "graphql": "14.0.2", "graphql-fields": "1.1.0", "graphql-iso-date": "3.5.0", "graphql-relay": "0.5.5", "graphql-tag": "2.9.2", - "graphql-tools": "3.1.1", + "graphql-tools": "4.0.3", "graphql.js": "0.4.20", "handlebars": "^4.0.11", "history": "^4.7.2", From 36b4972fccf53a32056fd9451b75af9843128f4a Mon Sep 17 00:00:00 2001 From: James Porlante Date: Fri, 9 Nov 2018 14:38:39 +0700 Subject: [PATCH 2/4] (chore) correct the description for PaymentData --- .../core/payments/server/no-meteor/schemas/schema.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql b/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql index 0975ea3b8a2..3fed9926a2e 100644 --- a/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql +++ b/imports/plugins/core/payments/server/no-meteor/schemas/schema.graphql @@ -56,6 +56,7 @@ type ExampleIOUPaymentData { } # Use `extend union` to define a payment plugin's PaymentData type +"Data identifying a payment for an order" union PaymentData = ExampleIOUPaymentData # Use `extend enum` to add a plugin's payment method name From cdf514e525444030555f78595502eee878549aeb Mon Sep 17 00:00:00 2001 From: Aaron James Porlante Date: Mon, 12 Nov 2018 12:52:56 +0700 Subject: [PATCH 3/4] (fix) remove redundant PaymentMethodName --- .../payments-example/server/no-meteor/schemas/schema.graphql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/imports/plugins/included/payments-example/server/no-meteor/schemas/schema.graphql b/imports/plugins/included/payments-example/server/no-meteor/schemas/schema.graphql index 8bcd4454ff0..bede4a81bbc 100644 --- a/imports/plugins/included/payments-example/server/no-meteor/schemas/schema.graphql +++ b/imports/plugins/included/payments-example/server/no-meteor/schemas/schema.graphql @@ -27,7 +27,3 @@ input PlaceOrderWithExampleIOUPaymentInput { "The information necessary to pay. Collect this information from the shopper during a checkout flow." payment: ExampleIOUPaymentInput! } - -extend enum PaymentMethodName { - iou_example -} From 4aa953c4186094ff3660517e38c3668b6276f0b0 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Tue, 13 Nov 2018 15:12:04 -0600 Subject: [PATCH 4/4] test: adjust unit test expectations for updated GraphQL pkgs --- .../core/server/no-meteor/resolvers/ConnectionCursor.test.js | 2 +- .../core/core/server/no-meteor/resolvers/ConnectionLimitInt.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionCursor.test.js b/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionCursor.test.js index 59b2e275c07..204370ec622 100644 --- a/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionCursor.test.js +++ b/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionCursor.test.js @@ -18,7 +18,7 @@ describe("serialization", () => { describe("value parsing", () => { test("handles null or undefined", () => { - expect(ConnectionCursor.parseValue(undefined)).toBe(undefined); + expect(ConnectionCursor.parseValue(undefined)).toBe(null); expect(ConnectionCursor.parseValue(null)).toBe(null); }); diff --git a/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionLimitInt.js b/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionLimitInt.js index 059cc209ad9..c274b4edae0 100644 --- a/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionLimitInt.js +++ b/imports/plugins/core/core/server/no-meteor/resolvers/ConnectionLimitInt.js @@ -8,8 +8,7 @@ const MAX_LIMIT = 200; * @private */ function parseValue(value) { - // Note that we do not have to do isNaN(value) check here because GraphQLScalarType will not call this for isNaN. - // Instead it automatically changes isNaN to undefined. + if (value === undefined || isNaN(value)) return undefined; if (typeof value !== "number") return MAX_LIMIT; return Math.min(Math.max(1, value), MAX_LIMIT); }