@restorecommerce/facade 1.1.2 → 1.1.4

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.4](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@1.1.3...@restorecommerce/facade@1.1.4) (2022-11-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * command import ([fcbb6c1](https://github.com/restorecommerce/libs/commit/fcbb6c15b708fc63bf38d0dfa65946731cef3e79))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.1.3](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@1.1.2...@restorecommerce/facade@1.1.3) (2022-10-26)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **facade:** fix kafka events for commandInterfaceMeta, build error for lodash, migrated deprecated ApolloGateway serviceList with IntrospectAndCompose, replace deprecated buildFederatedSchema with buildSubgraphSchema ([6d8f4b3](https://github.com/restorecommerce/libs/commit/6d8f4b39a95a19db17075876bc766a6e65ce23d1))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [1.1.2](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@1.1.1...@restorecommerce/facade@1.1.2) (2022-10-14)
7
29
 
8
30
 
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) n-fuse GmbH and other contributors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -11,7 +11,7 @@ const buildFederatedSubscriptionSchema = (subServices, config, namespace, schema
11
11
  const resolvers = (0, resolvers_1.generateSubServiceResolvers)(subServices, config, namespace);
12
12
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
13
13
  // See https://github.com/apollographql/apollo-server/pull/4310
14
- const federatedSchema = (0, federation_1.buildFederatedSchema)({
14
+ const federatedSchema = (0, federation_1.buildSubgraphSchema)({
15
15
  typeDefs: (0, apollo_server_koa_1.gql)((0, index_1.printSchema)(schema)),
16
16
  resolvers
17
17
  });
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ const apollo_server_core_1 = require("apollo-server-core");
26
26
  const http_2 = require("http");
27
27
  const ws_1 = require("ws");
28
28
  const ws_2 = require("graphql-ws/lib/use/ws");
29
- const lodash_1 = require("lodash");
29
+ const _ = require("lodash");
30
30
  const graphql_tools_1 = require("graphql-tools");
31
31
  const graphql_tag_1 = require("graphql-tag");
32
32
  const protos_1 = require("./gql/protos");
@@ -88,7 +88,7 @@ class RestoreCommerceFacade {
88
88
  }
89
89
  else if ('federatedSchema' in schema && 'resolvers' in schema) {
90
90
  this.apolloServices[name] = { schema: schema.federatedSchema, url };
91
- this.allResolvers = lodash_1.default.merge(this.allResolvers, schema.resolvers);
91
+ this.allResolvers = _.merge(this.allResolvers, schema.resolvers);
92
92
  }
93
93
  }
94
94
  onStart(fn) {
@@ -166,7 +166,10 @@ class RestoreCommerceFacade {
166
166
  });
167
167
  const gateway = new gateway_1.ApolloGateway({
168
168
  logger: this.logger,
169
- serviceList,
169
+ // serviceList,
170
+ supergraphSdl: new gateway_1.IntrospectAndCompose({
171
+ subgraphs: serviceList
172
+ }),
170
173
  debug: true,
171
174
  buildService: ({ name, url }) => {
172
175
  var _a;
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedCatalogSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedCatalogSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -8,7 +8,7 @@ const resolvers_1 = require("./resolvers");
8
8
  const schema_1 = require("./schema");
9
9
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
10
10
  // See https://github.com/apollographql/apollo-server/pull/4310
11
- exports.FederatedExampleSchema = (0, federation_1.buildFederatedSchema)({
11
+ exports.FederatedExampleSchema = (0, federation_1.buildSubgraphSchema)({
12
12
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)(schema_1.schema)),
13
13
  resolvers: resolvers_1.resolvers
14
14
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedFulfillmentSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedFulfillmentSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -4,11 +4,13 @@ exports.setupApiKey = exports.bootstrapApiKey = void 0;
4
4
  const uuid = require("uuid");
5
5
  const kafka_client_1 = require("@restorecommerce/kafka-client");
6
6
  const service_config_1 = require("@restorecommerce/service-config");
7
+ const commandinterface_1 = require("@restorecommerce/rc-grpc-clients/dist/generated-server/io/restorecommerce/commandinterface");
7
8
  const Router = require('koa-router');
8
9
  const API_KEY_COMMAND_NAME = 'set_api_key';
9
10
  const API_KEY_COMMAND_EVENT = 'setApiKeyCommand';
10
11
  const API_KEY_COMMAND_RESPONSE = 'setApiKeyResponse';
11
12
  const COMMAND_TOPIC_NAME = 'io.restorecommerce.command';
13
+ (0, kafka_client_1.registerProtoMeta)(commandinterface_1.protoMetadata);
12
14
  const exectueSetAPIKeyCommand = async (apiKey, logger) => {
13
15
  const cfg = (0, service_config_1.createServiceConfig)(process.cwd());
14
16
  if (apiKey && cfg.get('events:kafka')) {
@@ -10,7 +10,7 @@ const graphql_1 = require("graphql");
10
10
  const types_1 = require("../../access-control/gql/types");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedIndexingSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedIndexingSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedInvoicingSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedInvoicingSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedNotificationSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedNotificationSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedOrderingSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedOrderingSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedOstorageSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedOstorageSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedPaymentSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedPaymentSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedResourceSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedResourceSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
@@ -23,5 +23,6 @@ export declare class ResourceSrvGrpcClient extends RestoreCommerceGrpcClient {
23
23
  readonly organization: organizationClient;
24
24
  readonly tax: taxClient;
25
25
  readonly tax_type: tax_typeClient;
26
+ readonly command: any;
26
27
  constructor(address: string, cfg: GrpcClientConfig);
27
28
  }
@@ -13,6 +13,7 @@ const location_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/r
13
13
  const organization_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/organization");
14
14
  const tax_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/tax");
15
15
  const tax_type_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/tax_type");
16
+ const command_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/command");
16
17
  class ResourceSrvGrpcClient extends rc_grpc_clients_1.RestoreCommerceGrpcClient {
17
18
  constructor(address, cfg) {
18
19
  super(address, cfg);
@@ -27,6 +28,7 @@ class ResourceSrvGrpcClient extends rc_grpc_clients_1.RestoreCommerceGrpcClient
27
28
  this.organization = this.createClient(cfg, organization_1.ServiceDefinition, this.channel);
28
29
  this.tax = this.createClient(cfg, tax_1.ServiceDefinition, this.channel);
29
30
  this.tax_type = this.createClient(cfg, tax_type_1.ServiceDefinition, this.channel);
31
+ this.command = this.createClient(cfg, command_1.ServiceDefinition, this.channel);
30
32
  }
31
33
  }
32
34
  exports.ResourceSrvGrpcClient = ResourceSrvGrpcClient;
@@ -10,7 +10,7 @@ const types_1 = require("./types");
10
10
  const graphql_1 = require("graphql");
11
11
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
12
12
  // See https://github.com/apollographql/apollo-server/pull/4310
13
- const FederatedSchedulingSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
13
+ const FederatedSchedulingSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
14
14
  typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
15
15
  resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
16
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restorecommerce/facade",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Facade for Restorecommerce microservices",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -25,9 +25,9 @@
25
25
  "@grpc/grpc-js": "^1.7.1",
26
26
  "@grpc/proto-loader": "^0.7.3",
27
27
  "@restorecommerce/grpc-client": "^1.0.3",
28
- "@restorecommerce/kafka-client": "^1.0.4",
28
+ "@restorecommerce/kafka-client": "^1.0.5",
29
29
  "@restorecommerce/logger": "^1.2.1",
30
- "@restorecommerce/rc-grpc-clients": "^2.0.1",
30
+ "@restorecommerce/rc-grpc-clients": "^2.0.2",
31
31
  "@restorecommerce/service-config": "^1.0.3",
32
32
  "apollo-server-core": "^3.10.3",
33
33
  "apollo-server-koa": "^3.10.3",
@@ -130,5 +130,5 @@
130
130
  }
131
131
  }
132
132
  },
133
- "gitHead": "d4ac2692c0d2552b209cd49a73afc754ccf6cdf3"
133
+ "gitHead": "2ec001696f611681778a13842a9e047f1db08059"
134
134
  }