@common-stack/server-stack 7.0.4-alpha.15 → 7.0.4-alpha.17

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.
Files changed (165) hide show
  1. package/package.json +7 -7
  2. package/lib/MainStackServer.cjs +0 -231
  3. package/lib/MainStackServer.cjs.map +0 -1
  4. package/lib/MainStackServer.d.ts +0 -28
  5. package/lib/MainStackServer.mjs +0 -231
  6. package/lib/MainStackServer.mjs.map +0 -1
  7. package/lib/StackServer.cjs +0 -92
  8. package/lib/StackServer.cjs.map +0 -1
  9. package/lib/StackServer.d.ts +0 -20
  10. package/lib/StackServer.mjs +0 -92
  11. package/lib/StackServer.mjs.map +0 -1
  12. package/lib/api/remote-config.cjs +0 -6
  13. package/lib/api/remote-config.cjs.map +0 -1
  14. package/lib/api/remote-config.d.ts +0 -6
  15. package/lib/api/remote-config.mjs +0 -6
  16. package/lib/api/remote-config.mjs.map +0 -1
  17. package/lib/api/resolver.cjs +0 -12
  18. package/lib/api/resolver.cjs.map +0 -1
  19. package/lib/api/resolver.d.ts +0 -10
  20. package/lib/api/resolver.mjs +0 -12
  21. package/lib/api/resolver.mjs.map +0 -1
  22. package/lib/api/root-schema.graphqls.cjs +0 -2
  23. package/lib/api/root-schema.graphqls.cjs.map +0 -1
  24. package/lib/api/root-schema.graphqls.mjs +0 -2
  25. package/lib/api/root-schema.graphqls.mjs.map +0 -1
  26. package/lib/api/scalar.cjs +0 -16
  27. package/lib/api/scalar.cjs.map +0 -1
  28. package/lib/api/scalar.d.ts +0 -2
  29. package/lib/api/scalar.mjs +0 -16
  30. package/lib/api/scalar.mjs.map +0 -1
  31. package/lib/api/schema-builder.cjs +0 -160
  32. package/lib/api/schema-builder.cjs.map +0 -1
  33. package/lib/api/schema-builder.d.ts +0 -24
  34. package/lib/api/schema-builder.mjs +0 -160
  35. package/lib/api/schema-builder.mjs.map +0 -1
  36. package/lib/api/utils.cjs +0 -27
  37. package/lib/api/utils.cjs.map +0 -1
  38. package/lib/api/utils.d.ts +0 -4
  39. package/lib/api/utils.mjs +0 -27
  40. package/lib/api/utils.mjs.map +0 -1
  41. package/lib/config/env-config.cjs +0 -38
  42. package/lib/config/env-config.cjs.map +0 -1
  43. package/lib/config/env-config.d.ts +0 -21
  44. package/lib/config/env-config.mjs +0 -38
  45. package/lib/config/env-config.mjs.map +0 -1
  46. package/lib/config/index.d.ts +0 -1
  47. package/lib/config/moleculer.config.cjs +0 -191
  48. package/lib/config/moleculer.config.cjs.map +0 -1
  49. package/lib/config/moleculer.config.d.ts +0 -20
  50. package/lib/config/moleculer.config.mjs +0 -191
  51. package/lib/config/moleculer.config.mjs.map +0 -1
  52. package/lib/connectors/connection-broker.cjs +0 -61
  53. package/lib/connectors/connection-broker.cjs.map +0 -1
  54. package/lib/connectors/connection-broker.d.ts +0 -26
  55. package/lib/connectors/connection-broker.mjs +0 -61
  56. package/lib/connectors/connection-broker.mjs.map +0 -1
  57. package/lib/connectors/graphql-pubsub-connector.cjs +0 -28
  58. package/lib/connectors/graphql-pubsub-connector.cjs.map +0 -1
  59. package/lib/connectors/graphql-pubsub-connector.d.ts +0 -22
  60. package/lib/connectors/graphql-pubsub-connector.mjs +0 -28
  61. package/lib/connectors/graphql-pubsub-connector.mjs.map +0 -1
  62. package/lib/connectors/mongo-connector.cjs +0 -57
  63. package/lib/connectors/mongo-connector.cjs.map +0 -1
  64. package/lib/connectors/mongo-connector.d.ts +0 -21
  65. package/lib/connectors/mongo-connector.mjs +0 -57
  66. package/lib/connectors/mongo-connector.mjs.map +0 -1
  67. package/lib/connectors/nats-connector.cjs +0 -63
  68. package/lib/connectors/nats-connector.cjs.map +0 -1
  69. package/lib/connectors/nats-connector.d.ts +0 -20
  70. package/lib/connectors/nats-connector.mjs +0 -63
  71. package/lib/connectors/nats-connector.mjs.map +0 -1
  72. package/lib/connectors/redis-connector.cjs +0 -79
  73. package/lib/connectors/redis-connector.cjs.map +0 -1
  74. package/lib/connectors/redis-connector.d.ts +0 -30
  75. package/lib/connectors/redis-connector.mjs +0 -79
  76. package/lib/connectors/redis-connector.mjs.map +0 -1
  77. package/lib/graphql/directives/index.cjs +0 -10
  78. package/lib/graphql/directives/index.cjs.map +0 -1
  79. package/lib/graphql/directives/index.d.ts +0 -7
  80. package/lib/graphql/directives/index.mjs +0 -10
  81. package/lib/graphql/directives/index.mjs.map +0 -1
  82. package/lib/graphql/index.d.ts +0 -2
  83. package/lib/graphql/schema/directives.graphql.cjs +0 -1
  84. package/lib/graphql/schema/directives.graphql.cjs.map +0 -1
  85. package/lib/graphql/schema/directives.graphql.mjs +0 -1
  86. package/lib/graphql/schema/directives.graphql.mjs.map +0 -1
  87. package/lib/graphql/schema/index.cjs +0 -1
  88. package/lib/graphql/schema/index.cjs.map +0 -1
  89. package/lib/graphql/schema/index.d.ts +0 -1
  90. package/lib/graphql/schema/index.mjs +0 -1
  91. package/lib/graphql/schema/index.mjs.map +0 -1
  92. package/lib/index.cjs +0 -1
  93. package/lib/index.cjs.map +0 -1
  94. package/lib/index.d.ts +0 -3
  95. package/lib/index.mjs +0 -1
  96. package/lib/index.mjs.map +0 -1
  97. package/lib/interfaces/dbMigration.d.ts +0 -8
  98. package/lib/interfaces/graphql-request-context.d.ts +0 -15
  99. package/lib/interfaces/index.d.ts +0 -4
  100. package/lib/interfaces/module-interface.d.ts +0 -13
  101. package/lib/interfaces/moleculer.d.ts +0 -7
  102. package/lib/middleware/cors.cjs +0 -26
  103. package/lib/middleware/cors.cjs.map +0 -1
  104. package/lib/middleware/cors.d.ts +0 -6
  105. package/lib/middleware/cors.mjs +0 -26
  106. package/lib/middleware/cors.mjs.map +0 -1
  107. package/lib/middleware/error.cjs +0 -18
  108. package/lib/middleware/error.cjs.map +0 -1
  109. package/lib/middleware/error.d.ts +0 -9
  110. package/lib/middleware/error.mjs +0 -18
  111. package/lib/middleware/error.mjs.map +0 -1
  112. package/lib/middleware/moleculer-inter-namespace.cjs +0 -44
  113. package/lib/middleware/moleculer-inter-namespace.cjs.map +0 -1
  114. package/lib/middleware/moleculer-inter-namespace.d.ts +0 -2
  115. package/lib/middleware/moleculer-inter-namespace.mjs +0 -44
  116. package/lib/middleware/moleculer-inter-namespace.mjs.map +0 -1
  117. package/lib/middleware/sentry.cjs +0 -3
  118. package/lib/middleware/sentry.cjs.map +0 -1
  119. package/lib/middleware/sentry.d.ts +0 -2
  120. package/lib/middleware/sentry.mjs +0 -3
  121. package/lib/middleware/sentry.mjs.map +0 -1
  122. package/lib/middleware/services.cjs +0 -12
  123. package/lib/middleware/services.cjs.map +0 -1
  124. package/lib/middleware/services.d.ts +0 -2
  125. package/lib/middleware/services.mjs +0 -12
  126. package/lib/middleware/services.mjs.map +0 -1
  127. package/lib/plugins/index.d.ts +0 -2
  128. package/lib/plugins/invalidateCachePlugin.cjs +0 -59
  129. package/lib/plugins/invalidateCachePlugin.cjs.map +0 -1
  130. package/lib/plugins/invalidateCachePlugin.d.ts +0 -8
  131. package/lib/plugins/invalidateCachePlugin.mjs +0 -59
  132. package/lib/plugins/invalidateCachePlugin.mjs.map +0 -1
  133. package/lib/plugins/responseCachePlugin.cjs +0 -58
  134. package/lib/plugins/responseCachePlugin.cjs.map +0 -1
  135. package/lib/plugins/responseCachePlugin.d.ts +0 -8
  136. package/lib/plugins/responseCachePlugin.mjs +0 -58
  137. package/lib/plugins/responseCachePlugin.mjs.map +0 -1
  138. package/lib/servers/ExpressApp.cjs +0 -37
  139. package/lib/servers/ExpressApp.cjs.map +0 -1
  140. package/lib/servers/ExpressApp.d.ts +0 -3
  141. package/lib/servers/ExpressApp.mjs +0 -37
  142. package/lib/servers/ExpressApp.mjs.map +0 -1
  143. package/lib/servers/GraphqlServer.cjs +0 -142
  144. package/lib/servers/GraphqlServer.cjs.map +0 -1
  145. package/lib/servers/GraphqlServer.d.ts +0 -23
  146. package/lib/servers/GraphqlServer.mjs +0 -142
  147. package/lib/servers/GraphqlServer.mjs.map +0 -1
  148. package/lib/servers/GraphqlWs.cjs +0 -97
  149. package/lib/servers/GraphqlWs.cjs.map +0 -1
  150. package/lib/servers/GraphqlWs.d.ts +0 -14
  151. package/lib/servers/GraphqlWs.mjs +0 -97
  152. package/lib/servers/GraphqlWs.mjs.map +0 -1
  153. package/lib/servers/WebsocketMultipathUpdate.cjs +0 -63
  154. package/lib/servers/WebsocketMultipathUpdate.cjs.map +0 -1
  155. package/lib/servers/WebsocketMultipathUpdate.d.ts +0 -18
  156. package/lib/servers/WebsocketMultipathUpdate.mjs +0 -63
  157. package/lib/servers/WebsocketMultipathUpdate.mjs.map +0 -1
  158. package/lib/servers/mongodb-migration-update.d.ts +0 -12
  159. package/lib/servers/utils.d.ts +0 -14
  160. package/lib/utils/index.d.ts +0 -1
  161. package/lib/utils/migrations.cjs +0 -26
  162. package/lib/utils/migrations.cjs.map +0 -1
  163. package/lib/utils/migrations.d.ts +0 -8
  164. package/lib/utils/migrations.mjs +0 -26
  165. package/lib/utils/migrations.mjs.map +0 -1
@@ -1,160 +0,0 @@
1
- import*as fs from'fs';import*as path from'path';import {stitchSchemas}from'@graphql-tools/stitch';import {makeExecutableSchema}from'@graphql-tools/schema';import {linkToExecutor}from'@graphql-tools/links';import {schemaFromExecutor,wrapSchema}from'@graphql-tools/wrap';import*as ws from'ws';import {getMainDefinition}from'@apollo/client/utilities';import {WebSocketLink}from'@apollo/client/link/ws';import {split}from'@apollo/client/index.js';import {logger}from'@common-stack/server-core';import {HttpLink}from'@apollo/client/link/http';import*as fetch from'isomorphic-fetch';import {shield}from'graphql-shield';import {applyMiddleware}from'graphql-middleware';import {remoteSchemaDetails}from'./remote-config.mjs';import rootSchemaDef from'./root-schema.graphqls.mjs';import {resolvers}from'./resolver.mjs';import {attachDirectiveResolvers}from'./utils.mjs';import {config}from'../config/env-config.mjs';/// <reference path='../../../../typings/index.d.ts' />
2
- /* eslint-disable class-methods-use-this */
3
- /* eslint-disable no-useless-constructor */
4
- /* eslint-disable import/no-extraneous-dependencies */
5
- class GatewaySchemaBuilder {
6
- options;
7
- constructor(options) {
8
- this.options = options;
9
- }
10
- async build() {
11
- let gatewaySchema;
12
- let ownSchema;
13
- try {
14
- ownSchema = this.createOwnSchema();
15
- const remoteSchema = await this.load();
16
- // techSchema = this.patchSchema(techSchema, 'TechService');
17
- gatewaySchema = stitchSchemas({
18
- subschemas: [ownSchema],
19
- });
20
- // Apply middleware to the schema
21
- if (this.options.middlewares && this.options.middlewares.length > 0) {
22
- gatewaySchema = applyMiddleware(gatewaySchema, ...this.options.middlewares, shield(this.options.rules || {}, {
23
- allowExternalErrors: true,
24
- }));
25
- }
26
- // TODO after updating graphql-tools to v8
27
- // addErrorLoggingToSchema(schema, { log: (e) => logger.error(e as Error) });
28
- }
29
- catch (err) {
30
- logger.error(err, '[Graphql Schema Errors] when building schema:', err.message);
31
- gatewaySchema = ownSchema;
32
- }
33
- return gatewaySchema;
34
- }
35
- async load() {
36
- const schemas = [];
37
- // eslint-disable-next-line no-plusplus
38
- for (let i = 0; i < remoteSchemaDetails.length; i++) {
39
- // eslint-disable-next-line no-await-in-loop
40
- const schema = await this.loadRemoteSchema(remoteSchemaDetails[i]);
41
- schemas.push(schema);
42
- }
43
- return schemas;
44
- }
45
- async createRemoteSchema(service, iteration) {
46
- logger.info('Fetch service [%s] iteration [%s]', service, iteration);
47
- const services = remoteSchemaDetails;
48
- if (!services.length) {
49
- console.warn(`Service ${services} is undefined`);
50
- if (iteration && iteration > 2) {
51
- return Promise.reject(`tried upto ${iteration} attempts, now failing...`);
52
- }
53
- return new Promise((resolve, reject) => {
54
- const timeout = iteration ? 1000 * iteration : 1000;
55
- logger.info('Wait for service startup %s', timeout);
56
- setTimeout(() => {
57
- this.createRemoteSchema(service, iteration ? iteration + 1 : 1)
58
- .then(resolve)
59
- .catch(reject);
60
- }, timeout);
61
- });
62
- }
63
- // instead need to loop it
64
- // https://github.com/j-colter/graphql-gateway/blob/9c64d90a74727d2002d10b06f47e1f4a316070fc/src/schema.js#L50
65
- const url = services[0].uri;
66
- logger.info('fetch service [%s]', url);
67
- // 1. Create apollo Link that's connected to the underlying GraphQL API
68
- const link = new HttpLink({ uri: url, fetch });
69
- const executor = linkToExecutor(link);
70
- // 2. Retrieve schema definition of the underlying GraphQL API
71
- const remoteSchema = await schemaFromExecutor(link);
72
- // 3. Create the executable schema based on schema definition and Apollo Link
73
- return wrapSchema({
74
- schema: remoteSchema,
75
- executor,
76
- });
77
- }
78
- async loadRemoteSchema({ uri, wsUri }) {
79
- try {
80
- const httpLink = new HttpLink({ uri, fetch });
81
- let link = null;
82
- if (wsUri) {
83
- const wsLink = new WebSocketLink({
84
- uri: wsUri,
85
- options: {
86
- reconnect: true,
87
- },
88
- webSocketImpl: ws,
89
- });
90
- link = split(
91
- // split based on operatino type
92
- ({ query }) => {
93
- const { kind, operation } = getMainDefinition(query);
94
- return kind === 'OperationDefinition' && operation === 'subscription';
95
- }, wsLink, httpLink);
96
- }
97
- else {
98
- link = httpLink;
99
- }
100
- const executor = linkToExecutor(link);
101
- const remoteSchema = await schemaFromExecutor(link);
102
- const executableSchema = wrapSchema({
103
- schema: remoteSchema,
104
- executor,
105
- });
106
- return executableSchema;
107
- }
108
- catch (err) {
109
- this.options.logger.error(err, 'fetching schema error: ', err);
110
- return {};
111
- }
112
- }
113
- // disabled after updating to apollo-client to v3 and graphql-tools to v8
114
- // private patchSchema(schema: GraphQLSchema, systemName: string) {
115
- // return transformSchema(schema, [
116
- // new RenameTypes((name: string) => (name === 'StatusInfo' ? `${systemName}StatusInfo` : undefined)),
117
- // new RenameRootFields((_operation: string, name: string) =>
118
- // name === 'status'
119
- // ? `${systemName.substring(0, 1).toLowerCase()}${systemName.substring(1)}Status`
120
- // : name,
121
- // ),
122
- // ]);
123
- // }
124
- createOwnSchema() {
125
- const typeDefs = [rootSchemaDef, this.options.schema].join('\n');
126
- if (config.isDev) {
127
- // @ts-ignore
128
- import('@src/modules/module').then(({ ExternalModules }) => {
129
- const externalSchema = ExternalModules?.schemas || ``;
130
- const writeData = `${externalSchema}`;
131
- const filePath = path.join(process.cwd(), 'generated-schema.graphql');
132
- fs.writeFileSync(filePath, writeData);
133
- });
134
- }
135
- let mergedSchema = makeExecutableSchema({
136
- resolvers: [resolvers, this.options.resolvers],
137
- typeDefs,
138
- resolverValidationOptions: {
139
- requireResolversForResolveType: 'warn',
140
- },
141
- });
142
- try {
143
- // Check if directives are provided and are iterable
144
- if (Array.isArray(this.options.directives) && this.options.directives.length > 0) {
145
- this.options.directives.forEach((transform) => {
146
- mergedSchema = transform(mergedSchema);
147
- });
148
- }
149
- // Handle deprecated directiveResolvers if they exist
150
- if (this.options.directiveResolvers && Object.keys(this.options.directiveResolvers).length !== 0) {
151
- this.options.logger.warn('directiveResolvers deprecated replaced with directives');
152
- mergedSchema = attachDirectiveResolvers(mergedSchema, this.options.directiveResolvers);
153
- }
154
- }
155
- catch (err) {
156
- this.options.logger.error(err, 'Error in schema directives [%j], and directiveResolvers [%j]', this.options.directives, this.options.directiveResolvers);
157
- }
158
- return mergedSchema;
159
- }
160
- }export{GatewaySchemaBuilder};//# sourceMappingURL=schema-builder.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-builder.mjs","sources":["../../src/api/schema-builder.ts"],"sourcesContent":[null],"names":["rootResolver"],"mappings":"04BAAA;AACA;AACA;AACA;MAkCa,oBAAoB,CAAA;AACT,IAAA,OAAA,CAAA;AAApB,IAAA,WAAA,CAAoB,OAAwB,EAAA;QAAxB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAiB;KAAI;AAEzC,IAAA,MAAM,KAAK,GAAA;AACd,QAAA,IAAI,aAAa,CAAC;AAClB,QAAA,IAAI,SAAS,CAAC;AACd,QAAA,IAAI;AACA,YAAA,SAAS,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;AACnC,YAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;YAGvC,aAAa,GAAG,aAAa,CAAC;gBAC1B,UAAU,EAAE,CAAC,SAAS,CAAC;AAC1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AC,OAAO,CAAC,kBAAkB,CAAC,CAAC;aAC1F;SACJ;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACrB,GAAG,EACH,8DAA8D,EAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EACvB,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAClC,CAAC;SACL;AACD,QAAA,OAAO,YAAY,CAAC;KACvB;AACJ"}
package/lib/api/utils.cjs DELETED
@@ -1,27 +0,0 @@
1
- 'use strict';var graphql=require('graphql'),utils=require('@graphql-tools/utils');function attachDirectiveResolvers(schema, directiveResolvers) {
2
- // ... argument validation ...
3
- return utils.mapSchema(schema, {
4
- [utils.MapperKind.OBJECT_FIELD]: (fieldConfig) => {
5
- const newFieldConfig = { ...fieldConfig };
6
- const directives = utils.getDirectives(schema, fieldConfig);
7
- for (const directive of directives) {
8
- const directiveName = directive.name;
9
- if (directiveResolvers[directiveName]) {
10
- const resolver = directiveResolvers[directiveName];
11
- const originalResolver = newFieldConfig.resolve != null ? newFieldConfig.resolve : graphql.defaultFieldResolver;
12
- const directiveArgs = directive.args;
13
- newFieldConfig.resolve = (source, originalArgs, context, info) => {
14
- return resolver(() => new Promise((resolve, reject) => {
15
- const result = originalResolver(source, originalArgs, context, info);
16
- if (result instanceof Error) {
17
- reject(result);
18
- }
19
- resolve(result);
20
- }), source, directiveArgs, context, info);
21
- };
22
- }
23
- }
24
- return newFieldConfig;
25
- },
26
- });
27
- }exports.attachDirectiveResolvers=attachDirectiveResolvers;//# sourceMappingURL=utils.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.cjs","sources":["../../src/api/utils.ts"],"sourcesContent":[null],"names":["mapSchema","MapperKind","getDirectives","defaultFieldResolver"],"mappings":"kFAGgB,SAAA,wBAAwB,CACpC,MAAqB,EACrB,kBAA6C,EAAA;;IAI7C,OAAOA,eAAS,CAAC,MAAM,EAAE;QACrB,CAACC,gBAAU,CAAC,YAAY,GAAG,CAAC,WAAW,KAAI;AACvC,YAAA,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;YAE1C,MAAM,UAAU,GAAGC,mBAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACtD,YAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AAChC,gBAAA,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC;AACrC,gBAAA,IAAI,kBAAkB,CAAC,aAAa,CAAC,EAAE;AACnC,oBAAA,MAAM,QAAQ,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;AACnD,oBAAA,MAAM,gBAAgB,GAClB,cAAc,CAAC,OAAO,IAAI,IAAI,GAAG,cAAc,CAAC,OAAO,GAAGC,4BAAoB,CAAC;AACnF,oBAAA,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC;AACrC,oBAAA,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,KAAI;AAC7D,wBAAA,OAAO,QAAQ,CACX,MACI,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AAC5B,4BAAA,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACrE,4BAAA,IAAI,MAAM,YAAY,KAAK,EAAE;gCACzB,MAAM,CAAC,MAAM,CAAC,CAAC;6BAClB;4BACD,OAAO,CAAC,MAAM,CAAC,CAAC;yBACnB,CAAC,EACN,MAAM,EACN,aAAa,EACb,OAAO,EACP,IAAI,CACP,CAAC;AACN,qBAAC,CAAC;iBACL;aACJ;AAED,YAAA,OAAO,cAAc,CAAC;SACzB;AACJ,KAAA,CAAC,CAAC;AACP"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchema } from 'graphql';
2
- export declare function attachDirectiveResolvers(schema: GraphQLSchema, directiveResolvers: {
3
- [key: string]: Function;
4
- }): GraphQLSchema;
package/lib/api/utils.mjs DELETED
@@ -1,27 +0,0 @@
1
- import {defaultFieldResolver}from'graphql';import {mapSchema,MapperKind,getDirectives}from'@graphql-tools/utils';function attachDirectiveResolvers(schema, directiveResolvers) {
2
- // ... argument validation ...
3
- return mapSchema(schema, {
4
- [MapperKind.OBJECT_FIELD]: (fieldConfig) => {
5
- const newFieldConfig = { ...fieldConfig };
6
- const directives = getDirectives(schema, fieldConfig);
7
- for (const directive of directives) {
8
- const directiveName = directive.name;
9
- if (directiveResolvers[directiveName]) {
10
- const resolver = directiveResolvers[directiveName];
11
- const originalResolver = newFieldConfig.resolve != null ? newFieldConfig.resolve : defaultFieldResolver;
12
- const directiveArgs = directive.args;
13
- newFieldConfig.resolve = (source, originalArgs, context, info) => {
14
- return resolver(() => new Promise((resolve, reject) => {
15
- const result = originalResolver(source, originalArgs, context, info);
16
- if (result instanceof Error) {
17
- reject(result);
18
- }
19
- resolve(result);
20
- }), source, directiveArgs, context, info);
21
- };
22
- }
23
- }
24
- return newFieldConfig;
25
- },
26
- });
27
- }export{attachDirectiveResolvers};//# sourceMappingURL=utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../src/api/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"iHAGgB,SAAA,wBAAwB,CACpC,MAAqB,EACrB,kBAA6C,EAAA;;IAI7C,OAAO,SAAS,CAAC,MAAM,EAAE;QACrB,CAAC,UAAU,CAAC,YAAY,GAAG,CAAC,WAAW,KAAI;AACvC,YAAA,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;YAE1C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACtD,YAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AAChC,gBAAA,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC;AACrC,gBAAA,IAAI,kBAAkB,CAAC,aAAa,CAAC,EAAE;AACnC,oBAAA,MAAM,QAAQ,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;AACnD,oBAAA,MAAM,gBAAgB,GAClB,cAAc,CAAC,OAAO,IAAI,IAAI,GAAG,cAAc,CAAC,OAAO,GAAG,oBAAoB,CAAC;AACnF,oBAAA,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC;AACrC,oBAAA,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,KAAI;AAC7D,wBAAA,OAAO,QAAQ,CACX,MACI,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AAC5B,4BAAA,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACrE,4BAAA,IAAI,MAAM,YAAY,KAAK,EAAE;gCACzB,MAAM,CAAC,MAAM,CAAC,CAAC;6BAClB;4BACD,OAAO,CAAC,MAAM,CAAC,CAAC;yBACnB,CAAC,EACN,MAAM,EACN,aAAa,EACb,OAAO,EACP,IAAI,CACP,CAAC;AACN,qBAAC,CAAC;iBACL;aACJ;AAED,YAAA,OAAO,cAAc,CAAC;SACzB;AACJ,KAAA,CAAC,CAAC;AACP"}
@@ -1,38 +0,0 @@
1
- 'use strict';var envalid=require('envalid');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var envalid__namespace=/*#__PURE__*/_interopNamespaceDefault(envalid);const { str, bool, json, num } = envalid__namespace;
2
- const config = envalid__namespace.cleanEnv(process.env,
3
- /* start */
4
- {
5
- NODE_ENV: str({ default: 'production', choices: ['production', 'staging', 'development', 'test'] }),
6
- NATS_URL: str(),
7
- NATS_USER: str(),
8
- NATS_PW: str(),
9
- GRAPHQL_ENDPOINT: str({ default: '/graphql' }),
10
- BACKEND_URL: str(),
11
- GRAPHQL_URL: str(),
12
- CLIENT_URL: str(),
13
- MONGO_URL: str(),
14
- APP_NAME: str({ default: 'CDMBASE' }),
15
- REDIS_CLUSTER_URL: json({
16
- devDefault: '[{"port":6379,"host":"localhost"}]',
17
- example: '[{"port":6379,"host":"localhost"}]',
18
- }),
19
- REDIS_URL: str({ devDefault: 'localhost' }),
20
- REDIS_CLUSTER_ENABLED: bool({ devDefault: false }),
21
- REDIS_SENTINEL_ENABLED: bool({ devDefault: true }),
22
- CONNECTION_ID: str({ devDefault: 'CONNECTION_ID' }),
23
- NAMESPACE: str({ default: 'default' }),
24
- LOG_LEVEL: str({ default: 'info', choices: ['info', 'debug', 'trace'] }),
25
- METRICS_CONFIG: json({
26
- default: JSON.stringify({
27
- enabled: false,
28
- port: 3030,
29
- path: '/metrics',
30
- }),
31
- devDefault: JSON.stringify({
32
- enabled: false,
33
- port: 3031,
34
- path: '/metrics',
35
- }),
36
- example: '{"enabled":true,"port":3030,"path":"/metrics"}',
37
- }),
38
- } /* end */);exports.config=config;//# sourceMappingURL=env-config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env-config.cjs","sources":["../../src/config/env-config.ts"],"sourcesContent":[null],"names":["envalid"],"mappings":"gZAEA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAGA,kBAAO,CAAC;AAE5B,MAAA,MAAM,GAAGA,kBAAO,CAAC,QAAQ,CAClC,OAAO,CAAC,GAAG;AACX;AACA;IACI,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;IACnG,QAAQ,EAAE,GAAG,EAAE;IACf,SAAS,EAAE,GAAG,EAAE;IAChB,OAAO,EAAE,GAAG,EAAE;IACd,gBAAgB,EAAE,GAAG,CAAC,EAAE,OAAO,EA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_ENV: string;
4
- NATS_URL: string;
5
- NATS_USER: string;
6
- NATS_PW: string;
7
- GRAPHQL_ENDPOINT: string;
8
- BACKEND_URL: string;
9
- GRAPHQL_URL: string;
10
- CLIENT_URL: string;
11
- MONGO_URL: string;
12
- APP_NAME: string;
13
- REDIS_CLUSTER_URL: string;
14
- REDIS_URL: string;
15
- REDIS_CLUSTER_ENABLED: boolean;
16
- REDIS_SENTINEL_ENABLED: boolean;
17
- CONNECTION_ID: string;
18
- NAMESPACE: string;
19
- LOG_LEVEL: string;
20
- METRICS_CONFIG: string;
21
- } & envalid.CleanedEnvAccessors>;
@@ -1,38 +0,0 @@
1
- import*as envalid from'envalid';const { str, bool, json, num } = envalid;
2
- const config = envalid.cleanEnv(process.env,
3
- /* start */
4
- {
5
- NODE_ENV: str({ default: 'production', choices: ['production', 'staging', 'development', 'test'] }),
6
- NATS_URL: str(),
7
- NATS_USER: str(),
8
- NATS_PW: str(),
9
- GRAPHQL_ENDPOINT: str({ default: '/graphql' }),
10
- BACKEND_URL: str(),
11
- GRAPHQL_URL: str(),
12
- CLIENT_URL: str(),
13
- MONGO_URL: str(),
14
- APP_NAME: str({ default: 'CDMBASE' }),
15
- REDIS_CLUSTER_URL: json({
16
- devDefault: '[{"port":6379,"host":"localhost"}]',
17
- example: '[{"port":6379,"host":"localhost"}]',
18
- }),
19
- REDIS_URL: str({ devDefault: 'localhost' }),
20
- REDIS_CLUSTER_ENABLED: bool({ devDefault: false }),
21
- REDIS_SENTINEL_ENABLED: bool({ devDefault: true }),
22
- CONNECTION_ID: str({ devDefault: 'CONNECTION_ID' }),
23
- NAMESPACE: str({ default: 'default' }),
24
- LOG_LEVEL: str({ default: 'info', choices: ['info', 'debug', 'trace'] }),
25
- METRICS_CONFIG: json({
26
- default: JSON.stringify({
27
- enabled: false,
28
- port: 3030,
29
- path: '/metrics',
30
- }),
31
- devDefault: JSON.stringify({
32
- enabled: false,
33
- port: 3031,
34
- path: '/metrics',
35
- }),
36
- example: '{"enabled":true,"port":3030,"path":"/metrics"}',
37
- }),
38
- } /* end */);export{config};//# sourceMappingURL=env-config.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env-config.mjs","sources":["../../src/config/env-config.ts"],"sourcesContent":[null],"names":[],"mappings":"gCAEA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAE5B,MAAA,MAAM,GAAG,OAAO,CAAC,QAAQ,CAClC,OAAO,CAAC,GAAG;AACX;AACA;IACI,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;IACnG,QAAQ,EAAE,GAAG,EAAE;IACf,SAAS,EAAE,GAAG,EAAE;IAChB,OAAO,EAAE,GAAG,EAAE;IACd,gBAAgB,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAC9C,WAAW,EAAE,GAAG,EAAE;IAClB,WAAW,EAAE,GAAG,EAAE;IAClB,UAAU,EAAE,GAAG,EAAE;IACjB,SAAS,EAAE,GAAG,EAAE;IAChB,QAAQ,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACrC,iBAAiB,EAAE,IAAI,CAAC;AACpB,QAAA,UAAU,EAAE,oCAAoC;AAChD,QAAA,OAAO,EAAE,oCAAoC;KAChD,CAAC;IACF,SAAS,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAC3C,qBAAqB,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAClD,sBAAsB,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAClD,aAAa,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;IAEnD,SAAS,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACtC,IAAA,SAAS,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;IACxE,cAAc,EAAE,IAAI,CAAC;AACjB,QAAA,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;AACpB,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,UAAU;SACnB,CAAC;AACF,QAAA,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;AACvB,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,UAAU;SACnB,CAAC;AACF,QAAA,OAAO,EAAE,gDAAgD;KAC5D,CAAC;CACL"}
@@ -1 +0,0 @@
1
- export * from './env-config';
@@ -1,191 +0,0 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var envConfig=require('./env-config.cjs');/**
2
- * Moleculer ServiceBroker configuration file
3
- *
4
- * More info about options:
5
- * https://moleculer.services/docs/0.14/configuration.html
6
- *
7
- *
8
- * Overwrite options in production:
9
- * ================================
10
- * You can overwrite any option with environment variables.
11
- * For example to overwrite the 'logLevel', use `LOGLEVEL=warn` env var.
12
- * To overwrite a nested parameter, e.g. retryPolicy.retries, use `RETRYPOLICY_RETRIES=10` env var.
13
- *
14
- * To overwrite broker’s deeply nested default options, which are not presented in 'moleculer.config.ts',
15
- * via environment variables, use the `MOL_` prefix and double underscore `__` for nested properties in .env file.
16
- * For example, to set the cacher prefix to `MYCACHE`, you should declare an env var as `MOL_CACHER__OPTIONS__PREFIX=MYCACHE`.
17
- */
18
- const brokerConfig = {
19
- // Namespace of nodes to segment your nodes on the same network.
20
- namespace: envConfig.config.NAMESPACE,
21
- // namespace: null,
22
- // Unique node identifier. Must be unique in a namespace.
23
- // nodeID: config.CONNECTION_ID,
24
- // Enable/disable logging or use custom logger. More info: https://moleculer.services/docs/0.14/logging.html
25
- // Available logger types: 'Console', 'File', 'Pino', 'Winston', 'Bunyan', 'debug', 'Log4js', 'Datadog'
26
- logger: {
27
- type: 'Console',
28
- options: {
29
- // Using colors on the output
30
- colors: true,
31
- // Print module names with different colors (like docker-compose for containers)
32
- moduleColors: false,
33
- // Line formatter. It can be 'json', 'short',
34
- // 'simple', 'full', a `Function` or a template string like '{timestamp} {level} {nodeID}/{mod}: {msg}'
35
- formatter: 'full',
36
- // Custom object printer. If not defined, it uses the `util.inspect` method.
37
- objectPrinter: null,
38
- // Auto-padding the module name in order to messages begin at the same column.
39
- autoPadding: false,
40
- },
41
- },
42
- // Default log level for built-in console logger. It can be overwritten in logger options above.
43
- // Available values: trace, debug, info, warn, error, fatal
44
- logLevel: envConfig.config.LOG_LEVEL,
45
- // Define transporter.
46
- // More info: https://moleculer.services/docs/0.14/networking.html
47
- // Note: During the development, you don't need to define it because all services will be loaded locally.
48
- // In production you can set it via `TRANSPORTER=nats://localhost:4222` environment variable.
49
- transporter: envConfig.config.NODE_ENV === 'development'
50
- ? 'TCP'
51
- : {
52
- type: 'NATS',
53
- options: {
54
- url: envConfig.config.NATS_URL,
55
- user: envConfig.config.NATS_USER,
56
- pass: envConfig.config.NATS_PW,
57
- reconnectTimeWait: 1000,
58
- },
59
- },
60
- // Define a cacher.
61
- // More info: https://moleculer.services/docs/0.14/caching.html
62
- // cacher: {
63
- // type: 'Redis',
64
- // enabled: false,
65
- // options: {
66
- // // Redis settings
67
- // redis: {
68
- // }
69
- // }
70
- // },
71
- // Define a serializer.
72
- // Available values: 'JSON', 'Avro', 'ProtoBuf', 'MsgPack', 'Notepack', 'Thrift'.
73
- // More info: https://moleculer.services/docs/0.13/networking.html
74
- serializer: 'JSON',
75
- // Number of milliseconds to wait before reject a request with a RequestTimeout error. Disabled: 0
76
- requestTimeout: 10 * 1000,
77
- // Retry policy settings. More info: https://moleculer.services/docs/0.13/fault-tolerance.html#Retry
78
- retryPolicy: {
79
- // Enable feature
80
- enabled: false,
81
- // Count of retries
82
- retries: 5,
83
- // First delay in milliseconds.
84
- delay: 100,
85
- // Maximum delay in milliseconds.
86
- maxDelay: 1000,
87
- // Backoff factor for delay. 2 means exponential backoff.
88
- factor: 2,
89
- // A function to check failed requests.
90
- check: (err) => err && !!err.retryable,
91
- },
92
- // Limit of calling level. If it reaches the limit, broker will throw an MaxCallLevelError error. (Infinite loop protection)
93
- maxCallLevel: 100,
94
- // Number of seconds to send heartbeat packet to other nodes.
95
- heartbeatInterval: 5,
96
- // Number of seconds to wait before setting node to unavailable status.
97
- heartbeatTimeout: 15,
98
- // tslint:disable-next-line:max-line-length
99
- // Tracking requests and waiting for running requests before shutdowning. More info: https://moleculer.services/docs/0.13/fault-tolerance.html
100
- tracking: {
101
- // Enable feature
102
- enabled: false,
103
- // Number of milliseconds to wait before shutdowning the process
104
- shutdownTimeout: 5000,
105
- },
106
- // Disable built-in request & emit balancer. (Transporter must support it, as well.)
107
- disableBalancer: false,
108
- // Settings of Service Registry. More info: https://moleculer.services/docs/0.14/registry.html
109
- registry: {
110
- // Define balancing strategy. More info: https://moleculer.services/docs/0.14/balancing.html
111
- // Available values: 'RoundRobin', 'Random', 'CpuUsage', 'Latency'
112
- strategy: 'RoundRobin',
113
- // Enable local action call preferring.
114
- preferLocal: true,
115
- },
116
- // Settings of Circuit Breaker. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Circuit-Breaker
117
- circuitBreaker: {
118
- // Enable feature
119
- enabled: false,
120
- // Threshold value. 0.5 means that 50% should be failed for tripping.
121
- threshold: 0.5,
122
- // Minimum request count. Below it, CB does not trip.
123
- minRequestCount: 20,
124
- // Number of seconds for time window.
125
- windowTime: 60,
126
- // Number of milliseconds to switch from open to half-open state
127
- halfOpenTime: 10 * 1000,
128
- // A function to check failed requests.
129
- check: (err) => err && err.code >= 500,
130
- },
131
- // Settings of bulkhead feature. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Bulkhead
132
- bulkhead: {
133
- // Enable feature.
134
- enabled: false,
135
- // Maximum concurrent executions.
136
- concurrency: 10,
137
- // Maximum size of queue
138
- maxQueueSize: 100,
139
- },
140
- // Enable action & event parameter validation. More info: https://moleculer.services/docs/0.14/validating.html
141
- validator: true,
142
- errorHandler: null,
143
- // Enable/disable built-in metrics function. More info: https://moleculer.services/docs/0.14/metrics.html
144
- metrics: {
145
- enabled: envConfig.config.METRICS_CONFIG.enabled,
146
- reporter: {
147
- type: 'Prometheus',
148
- options: {
149
- port: envConfig.config.METRICS_CONFIG.port,
150
- path: envConfig.config.METRICS_CONFIG.path,
151
- defaultLabels: (registry) => ({
152
- namespace: registry.broker.namespace,
153
- nodeID: registry.broker.nodeID,
154
- }),
155
- },
156
- },
157
- },
158
- // Enable built-in tracing function. More info: https://moleculer.services/docs/0.14/tracing.html
159
- tracing: {
160
- enabled: true,
161
- // Available built-in exporters: 'Console', 'Datadog', 'Event', 'EventLegacy', 'Jaeger', 'Zipkin'
162
- exporter: {
163
- type: 'Console', // Console exporter is only for development!
164
- options: {
165
- // Custom logger
166
- logger: null,
167
- // Using colors
168
- colors: true,
169
- // Width of row
170
- width: 100,
171
- // Gauge width in the row
172
- gaugeWidth: 40,
173
- },
174
- },
175
- },
176
- // Register internal services ('$node'). More info: https://moleculer.services/docs/0.13/services.html#Internal-services
177
- internalServices: true,
178
- // Register internal middlewares. More info: https://moleculer.services/docs/0.13/middlewares.html#Internal-middlewares
179
- internalMiddlewares: true,
180
- // Watch the loaded services and hot reload if they changed.
181
- // You can also enable it in Moleculer Runner with `--hot` argument
182
- hotReload: false,
183
- // Register custom middlewares
184
- middlewares: [],
185
- // Called after broker created.
186
- created(broker) { },
187
- // Called after broker starte.
188
- started(broker) { },
189
- // Called after broker stopped.
190
- stopped(broker) { },
191
- };exports.default=brokerConfig;//# sourceMappingURL=moleculer.config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"moleculer.config.cjs","sources":["../../src/config/moleculer.config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AAO,EAAE;AACL,QAAA,OAAO,EAAE,IAAI;;AAEb,QAAA,QAAQ,EAAE;YACN,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE;;AAEL,gBAAA,MAAM,EAAE,IAAI;;AAEZ,gBAAA,MAAM,EAAE,IAAI;;AAEZ,gBAAA,KAAK,EAAE,GAAG;;AAEV,gBAAA,UAAU,EAAE,EAAE;AACjB,aAAA;AACJ,SAAA;AACJ,KAAA;;AAGD,IAAA,gBAAgB,EAAE,IAAI;;AAEtB,IAAA,mBAAmB,EAAE,IAAI;;;AAIzB,IAAA,SAAS,EAAE,KAAK;;AAGhB,IAAA,WAAW,EAAE,EAAE;;IAGf,OAAO,CAAC,MAAM,EAAA,GAAI;;IAGlB,OAAO,CAAC,MAAM,EAAA,GAAI;;IAGlB,OAAO,CAAC,MAAM,EAAA,GAAI;"}
@@ -1,20 +0,0 @@
1
- import { BrokerOptions } from 'moleculer';
2
- /**
3
- * Moleculer ServiceBroker configuration file
4
- *
5
- * More info about options:
6
- * https://moleculer.services/docs/0.14/configuration.html
7
- *
8
- *
9
- * Overwrite options in production:
10
- * ================================
11
- * You can overwrite any option with environment variables.
12
- * For example to overwrite the 'logLevel', use `LOGLEVEL=warn` env var.
13
- * To overwrite a nested parameter, e.g. retryPolicy.retries, use `RETRYPOLICY_RETRIES=10` env var.
14
- *
15
- * To overwrite broker’s deeply nested default options, which are not presented in 'moleculer.config.ts',
16
- * via environment variables, use the `MOL_` prefix and double underscore `__` for nested properties in .env file.
17
- * For example, to set the cacher prefix to `MYCACHE`, you should declare an env var as `MOL_CACHER__OPTIONS__PREFIX=MYCACHE`.
18
- */
19
- declare const brokerConfig: BrokerOptions;
20
- export default brokerConfig;