Skip to content

Commit 8ed8ecf

Browse files
committed
progress
1 parent 9d21a46 commit 8ed8ecf

3 files changed

Lines changed: 123 additions & 204 deletions

File tree

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848
"@babel/preset-env": "7.4.5",
4949
"@babel/preset-typescript": "7.3.3",
5050
"@babel/register": "7.4.4",
51-
"@graphql-tools/delegate": "6.0.10",
52-
"@graphql-tools/graphql-file-loader": "^7.0.6",
53-
"@graphql-tools/load": "^7.1.9",
54-
"@graphql-tools/schema": "^8.1.2",
55-
"@graphql-tools/stitch": "^8.2.1",
56-
"@graphql-tools/wrap": "^8.0.13",
51+
"@graphql-tools/delegate": "^8.4.3",
52+
"@graphql-tools/graphql-file-loader": "^7.3.3",
53+
"@graphql-tools/load": "^7.5.0",
54+
"@graphql-tools/schema": "^8.3.1",
55+
"@graphql-tools/stitch": "^8.4.3",
56+
"@graphql-tools/wrap": "^8.3.2",
5757
"@heroku/foreman": "2.0.2",
5858
"@sentry/node": "5.18.1",
5959
"accounting": "0.4.1",

src/lib/stitching2/kaws/v2/stitching.ts

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const kawsStitchingEnvironmentV2 = (
4444
marketingCollections: {
4545
selectionSet: `{ internalID }`,
4646
resolve: ({ internalID: artistID }, args, context, info) => {
47-
debugger
4847
return delegateToSchema({
4948
schema: kawsSchema,
5049
operation: "query",
@@ -61,14 +60,16 @@ export const kawsStitchingEnvironmentV2 = (
6160
},
6261
Fair: {
6362
marketingCollections: {
64-
fragment: `
65-
... on Fair {
66-
kawsCollectionSlugs
67-
}
68-
`,
63+
selectionSet: gql`
64+
{
65+
... on Fair {
66+
kawsCollectionSlugs
67+
}
68+
}
69+
`,
6970
resolve: ({ kawsCollectionSlugs: slugs }, args, context, info) => {
7071
if (slugs.length === 0) return []
71-
return info.stitchingInfo.delegateToSchema({
72+
return delegateToSchema({
7273
schema: kawsSchema,
7374
operation: "query",
7475
fieldName: "marketingCollections",
@@ -85,29 +86,33 @@ export const kawsStitchingEnvironmentV2 = (
8586
},
8687
HomePage: {
8788
marketingCollectionsModule: {
88-
fragment: gql`
89+
selectionSet: gql`
90+
{
8991
... on HomePage {
9092
__typename
9193
}
92-
`,
94+
}
95+
`,
9396
resolve: () => {
9497
return {}
9598
},
9699
},
97100
},
98101
HomePageMarketingCollectionsModule: {
99102
results: {
100-
fragment: gql`
101-
... on HomePageMarketingCollectionsModule {
102-
__typename
103+
selectionSet: gql`
104+
{
105+
... on HomePageMarketingCollectionsModule {
106+
__typename
107+
}
103108
}
104109
`,
105110
resolve: async (_source, _args, context, info) => {
106111
try {
107112
// We hard-code the collections slugs here in MP so that the app
108113
// can display different collections based only on an MP change
109114
// (and not an app deploy).
110-
return await info.mergeInfo.delegateToSchema({
115+
return delegateToSchema({
111116
schema: kawsSchema,
112117
operation: "query",
113118
fieldName: "marketingCollections",
@@ -132,17 +137,18 @@ export const kawsStitchingEnvironmentV2 = (
132137
},
133138
Viewer: {
134139
marketingCollections: {
135-
fragment: gql`
136-
...on Viewer {
137-
__typename
140+
selectionSet: gql`
141+
{
142+
... on Viewer {
143+
__typename
144+
}
138145
}
139146
`,
140147
resolve: async (_source, args, context, info) => {
141-
return await info.mergeInfo.delegateToSchema({
148+
return delegateToSchema({
142149
schema: kawsSchema,
143150
operation: "query",
144151
fieldName: "marketingCollections",
145-
146152
args,
147153
context,
148154
info,
@@ -152,16 +158,16 @@ export const kawsStitchingEnvironmentV2 = (
152158
},
153159
MarketingCollection: {
154160
artworksConnection: {
155-
fragment: `
161+
selectionSet: gql`
156162
fragment MarketingCollectionQuery on MarketingCollection {
157163
query {
158164
${Object.keys(filterArtworksArgs).join("\n")}
159165
}
160166
}
161167
`,
162-
resolve: (parent, _args, context, info) => {
168+
resolve: (parent, args, context, info) => {
163169
const query = parent.query
164-
const hasKeyword = Boolean(parent.query.keyword)
170+
const hasKeyword = Boolean(args.keyword)
165171

166172
const existingLoader =
167173
context.unauthenticatedLoaders.filterArtworksLoader
@@ -174,27 +180,29 @@ export const kawsStitchingEnvironmentV2 = (
174180
// TODO: Should this really modify the context in place?
175181
context.unauthenticatedLoaders.filterArtworksLoader = newLoader
176182

177-
return info.mergeInfo.delegateToSchema({
183+
return delegateToSchema({
178184
schema: localSchema,
179185
operation: "query",
180186
fieldName: "artworksConnection",
181187
args: {
182188
...query,
183189
keywordMatchExact: hasKeyword,
184-
..._args,
190+
...args,
185191
},
186192
context,
187193
info,
188194
})
189195
},
190196
},
191197
internalID: {
192-
fragment: `
193-
fragment MarketingCollectionIDQuery on MarketingCollection {
194-
id
195-
}
196-
`,
197-
resolve: ({ id }, _args, _context, _info) => id,
198+
selectionSet: gql`
199+
fragment MarketingCollectionIDQuery on MarketingCollection {
200+
id
201+
}
202+
`,
203+
resolve: ({ id }, _args, _context, _info) => {
204+
return id
205+
},
198206
},
199207
},
200208
},

0 commit comments

Comments
 (0)