@powerhousedao/reactor-api 1.29.7-dev.0 → 1.29.8-dev.1

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,EAAiB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAG/D,qBAAa,eAAe;;IAMxB,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;IATjC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAkC;gBAGhC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,OAAO,EAAE,oBAAoB,EAC7B,gBAAgB,EAAE,EAAE,EACpB,cAAc,EAAE,eAAe;IAS5C,IAAI;IAmBJ,YAAY;IAQlB,OAAO,CAAC,kBAAkB;YAWZ,cAAc;IAiC5B,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,4BAA4B;IAsB9B,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,SAAK;IA8B/D,0BAA0B,4BAExB;IAEF,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGvD"}
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,EAAiB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAG/D,qBAAa,eAAe;;IAMxB,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;IATjC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAkC;gBAGhC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,OAAO,EAAE,oBAAoB,EAC7B,gBAAgB,EAAE,EAAE,EACpB,cAAc,EAAE,eAAe;IAS5C,IAAI;IAmBJ,YAAY;IAQlB,OAAO,CAAC,kBAAkB;YAWZ,cAAc;YAoCd,mBAAmB;IA8BjC,OAAO,CAAC,4BAA4B;IAsB9B,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,SAAK;IA8B/D,0BAA0B,4BAExB;IAEF,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGvD"}
@@ -80,29 +80,43 @@ export class SubgraphManager {
80
80
  }
81
81
  }
82
82
  if (Object.keys(supergraphEndpoints).length > 0) {
83
- const supergraphServer = this.createApolloGateway(supergraphEndpoints);
84
- await supergraphServer.start();
85
- const path = `/${supergraph}`;
86
- this.setupApolloExpressMiddleware(supergraphServer, router, path);
83
+ const supergraphServer = await this.createApolloGateway(supergraphEndpoints);
84
+ if (supergraphServer) {
85
+ const path = `/${supergraph}`;
86
+ this.setupApolloExpressMiddleware(supergraphServer, router, path);
87
+ console.log(`> Updated Apollo Gateway at ${path}`);
88
+ }
87
89
  }
88
90
  }
89
91
  }
90
- createApolloGateway(endpoints) {
91
- const gateway = new ApolloGateway({
92
- supergraphSdl: new IntrospectAndCompose({
93
- subgraphs: Object.keys(endpoints).map((path) => ({
94
- name: path.replaceAll("/", ""),
95
- url: `http://localhost:${process.env.PORT ?? 4001}${path}`,
96
- })),
97
- }),
98
- });
99
- return new ApolloServer({
100
- gateway,
101
- plugins: [
102
- ApolloServerPluginInlineTraceDisabled(),
103
- ApolloServerPluginLandingPageLocalDefault(),
104
- ],
105
- });
92
+ async createApolloGateway(endpoints) {
93
+ try {
94
+ const gateway = new ApolloGateway({
95
+ supergraphSdl: new IntrospectAndCompose({
96
+ subgraphs: Object.keys(endpoints).map((path) => ({
97
+ name: path.replaceAll("/", ""),
98
+ url: `http://localhost:${process.env.PORT ?? 4001}${path}`,
99
+ })),
100
+ }),
101
+ });
102
+ const server = new ApolloServer({
103
+ gateway,
104
+ plugins: [
105
+ ApolloServerPluginInlineTraceDisabled(),
106
+ ApolloServerPluginLandingPageLocalDefault(),
107
+ ],
108
+ });
109
+ await server.start();
110
+ return server;
111
+ }
112
+ catch (e) {
113
+ if (e instanceof Error) {
114
+ console.error("> " + e.message);
115
+ }
116
+ else {
117
+ console.error("> Could not create Apollo Gateway");
118
+ }
119
+ }
106
120
  }
107
121
  setupApolloExpressMiddleware(server, router, path) {
108
122
  router.use(path,