@powerhousedao/reactor-api 1.29.15-dev.1 → 1.29.15-dev.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/subgraphs/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAMnC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAG/D,qBAAa,eAAe;;IAKxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAT5B,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,aAAa,CAA2B;gBAG7B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,OAAO,EAAE,oBAAoB,EAC7B,gBAAgB,EAAE,EAAE,EACpB,cAAc,EAAE,eAAe,EAC/B,SAAS,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAa;IAS3D,IAAI;IAmBJ,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,SAAK,EAAE,IAAI,SAAK;IAsBpE,YAAY;IAQlB,0BAA0B,4BAExB;IAEF,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,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CAwHxD"}
|
|
@@ -78,38 +78,7 @@ export class SubgraphManager {
|
|
|
78
78
|
this.contextFields = { ...this.contextFields, ...fields };
|
|
79
79
|
}
|
|
80
80
|
setSupergraph(supergraph, subgraphs) {
|
|
81
|
-
// Set the supergraph with its subgraphs
|
|
82
81
|
this.subgraphs.set(supergraph, subgraphs);
|
|
83
|
-
// Also register this supergraph as a subgraph of the /graphql supergraph
|
|
84
|
-
if (supergraph !== "" && supergraph !== "graphql") {
|
|
85
|
-
// Create a virtual subgraph for the supergraph
|
|
86
|
-
const supergraphSubgraph = {
|
|
87
|
-
name: "supergraph",
|
|
88
|
-
path: `/${supergraph}`,
|
|
89
|
-
// These are required by the ISubgraph interface
|
|
90
|
-
resolvers: {},
|
|
91
|
-
typeDefs: {}, // Cast empty object to DocumentNode
|
|
92
|
-
reactor: this.reactor,
|
|
93
|
-
operationalStore: this.operationalStore,
|
|
94
|
-
onSetup: async () => { },
|
|
95
|
-
};
|
|
96
|
-
// Add it to the /graphql supergraph
|
|
97
|
-
if (!this.subgraphs.has("graphql")) {
|
|
98
|
-
this.subgraphs.set("graphql", []);
|
|
99
|
-
console.log(`> Created /graphql supergraph`);
|
|
100
|
-
}
|
|
101
|
-
// Check if the supergraph is already registered as a subgraph
|
|
102
|
-
const existingSubgraph = this.subgraphs
|
|
103
|
-
.get("graphql")
|
|
104
|
-
?.find((s) => s.name === supergraph);
|
|
105
|
-
if (!existingSubgraph) {
|
|
106
|
-
// We need to cast the ISubgraph to Subgraph since the Map expects Subgraph[]
|
|
107
|
-
this.subgraphs
|
|
108
|
-
.get("graphql")
|
|
109
|
-
?.push(supergraphSubgraph);
|
|
110
|
-
console.log(`> Registered /${supergraph} as a subgraph of /graphql`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
82
|
this.updateRouter();
|
|
114
83
|
}
|
|
115
84
|
#createApolloServer(schema) {
|
|
@@ -137,10 +106,6 @@ export class SubgraphManager {
|
|
|
137
106
|
for (const [supergraph, subgraphs] of this.subgraphs.entries()) {
|
|
138
107
|
const supergraphEndpoints = {};
|
|
139
108
|
for (const subgraph of subgraphs) {
|
|
140
|
-
if (subgraph.name === "supergraph") {
|
|
141
|
-
supergraphEndpoints[subgraph.path] = undefined;
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
109
|
const subgraphConfig = this.#getLocalSubgraphConfig(subgraph.name);
|
|
145
110
|
if (!subgraphConfig)
|
|
146
111
|
continue;
|
|
@@ -161,7 +126,6 @@ export class SubgraphManager {
|
|
|
161
126
|
if (supergraphServer) {
|
|
162
127
|
const path = `/${supergraph}`;
|
|
163
128
|
this.#setupApolloExpressMiddleware(supergraphServer, router, path);
|
|
164
|
-
console.log(`> Updated Apollo Gateway at ${path}`);
|
|
165
129
|
}
|
|
166
130
|
}
|
|
167
131
|
}
|