Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Aug 31, 2021
1 parent 9a68b90 commit 0aa71e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
12 changes: 4 additions & 8 deletions src/lib/stitching2/kaws/v2/stitching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from "schema/v2/filterArtworksConnection"
import gql from "lib/gql"
import { printType } from "lib/stitching/lib/printType"
import { delegateToSchema } from "@graphql-tools/delegate"

export const kawsStitchingEnvironmentV2 = (
localSchema: GraphQLSchema,
Expand Down Expand Up @@ -41,17 +42,12 @@ export const kawsStitchingEnvironmentV2 = (
resolvers: {
Artist: {
marketingCollections: {
fragment: `
... on Artist {
internalID
}
`,
selectionSet: `{ internalID }`,
resolve: ({ internalID: artistID }, args, context, info) => {
return info.mergeInfo.delegateToSchema({
return delegateToSchema({
schema: kawsSchema,
operation: "query",
fieldName: "marketingCollections",

args: {
artistID,
...args,
Expand All @@ -71,7 +67,7 @@ export const kawsStitchingEnvironmentV2 = (
`,
resolve: ({ kawsCollectionSlugs: slugs }, args, context, info) => {
if (slugs.length === 0) return []
return info.mergeInfo.delegateToSchema({
return info.stitchingInfo.delegateToSchema({
schema: kawsSchema,
operation: "query",
fieldName: "marketingCollections",
Expand Down
15 changes: 9 additions & 6 deletions src/lib/stitching2/mergeSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ export const incrementalMergeSchemas2 = async (localSchema) => {
}

const kawsSchema = await executableKawsSchema()
subschemas.push(kawsSchema.schema)
useStitchingEnvironment(
kawsStitchingEnvironmentV2(localSchema, kawsSchema.schema)
)
subschemas.push(kawsSchema)
useStitchingEnvironment(kawsStitchingEnvironmentV2(localSchema, kawsSchema))

const stitchedSchemas = stitchSchemas({
const stitchedSchema = stitchSchemas({
subschemas,
resolvers: extensionResolvers,
typeDefs: extensionSchemas,
})

// Because __allowedLegacyNames isn't in the public API
Object.defineProperty(stitchedSchema, "__allowedLegacyNames", {
value: ["__id"],
})

// debugger

return stitchedSchemas
return stitchedSchema
}

0 comments on commit 0aa71e4

Please sign in to comment.