@common-stack/server-stack 0.5.29

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/lib/config/env-config.cjs +20 -0
  4. package/lib/config/env-config.cjs.map +1 -0
  5. package/lib/config/env-config.d.ts +15 -0
  6. package/lib/config/env-config.mjs +20 -0
  7. package/lib/config/env-config.mjs.map +1 -0
  8. package/lib/config/index.d.ts +1 -0
  9. package/lib/config/moleculer.config.cjs +195 -0
  10. package/lib/config/moleculer.config.cjs.map +1 -0
  11. package/lib/config/moleculer.config.d.ts +20 -0
  12. package/lib/config/moleculer.config.mjs +195 -0
  13. package/lib/config/moleculer.config.mjs.map +1 -0
  14. package/lib/connectors/connection-broker.cjs +57 -0
  15. package/lib/connectors/connection-broker.cjs.map +1 -0
  16. package/lib/connectors/connection-broker.d.ts +51 -0
  17. package/lib/connectors/connection-broker.mjs +57 -0
  18. package/lib/connectors/connection-broker.mjs.map +1 -0
  19. package/lib/connectors/graphql-pubsub-connector.cjs +25 -0
  20. package/lib/connectors/graphql-pubsub-connector.cjs.map +1 -0
  21. package/lib/connectors/graphql-pubsub-connector.d.ts +22 -0
  22. package/lib/connectors/graphql-pubsub-connector.mjs +25 -0
  23. package/lib/connectors/graphql-pubsub-connector.mjs.map +1 -0
  24. package/lib/connectors/mongo-connector.cjs +52 -0
  25. package/lib/connectors/mongo-connector.cjs.map +1 -0
  26. package/lib/connectors/mongo-connector.d.ts +21 -0
  27. package/lib/connectors/mongo-connector.mjs +52 -0
  28. package/lib/connectors/mongo-connector.mjs.map +1 -0
  29. package/lib/connectors/nats-connector.cjs +59 -0
  30. package/lib/connectors/nats-connector.cjs.map +1 -0
  31. package/lib/connectors/nats-connector.d.ts +20 -0
  32. package/lib/connectors/nats-connector.mjs +59 -0
  33. package/lib/connectors/nats-connector.mjs.map +1 -0
  34. package/lib/connectors/redis-connector.cjs +54 -0
  35. package/lib/connectors/redis-connector.cjs.map +1 -0
  36. package/lib/connectors/redis-connector.d.ts +31 -0
  37. package/lib/connectors/redis-connector.mjs +54 -0
  38. package/lib/connectors/redis-connector.mjs.map +1 -0
  39. package/lib/index.cjs +1 -0
  40. package/lib/index.cjs.map +1 -0
  41. package/lib/index.d.ts +1 -0
  42. package/lib/index.mjs +1 -0
  43. package/lib/index.mjs.map +1 -0
  44. package/lib/interface.d.ts +7 -0
  45. package/lib/middleware/moleculer-inter-namespace.cjs +44 -0
  46. package/lib/middleware/moleculer-inter-namespace.cjs.map +1 -0
  47. package/lib/middleware/moleculer-inter-namespace.d.ts +2 -0
  48. package/lib/middleware/moleculer-inter-namespace.mjs +44 -0
  49. package/lib/middleware/moleculer-inter-namespace.mjs.map +1 -0
  50. package/lib/stack-server.cjs +78 -0
  51. package/lib/stack-server.cjs.map +1 -0
  52. package/lib/stack-server.d.ts +20 -0
  53. package/lib/stack-server.mjs +78 -0
  54. package/lib/stack-server.mjs.map +1 -0
  55. package/package.json +40 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017 CDMBase LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+
2
+
3
+ ## To run tests
4
+
5
+ `npm link`
6
+ `npm link @xtermstack/xterm-core`
7
+ `npm install`
8
+ `tsc`
9
+ `npm run test`
10
+
@@ -0,0 +1,20 @@
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 } = 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
+ MONGO_URL: str(),
10
+ REDIS_CLUSTER_URL: json({
11
+ devDefault: '[{"port":6379,"host":"localhost"}]',
12
+ example: '[{"port":6379,"host":"localhost"}]',
13
+ }),
14
+ REDIS_URL: str({ devDefault: 'localhost' }),
15
+ REDIS_CLUSTER_ENABLED: bool({ devDefault: false }),
16
+ REDIS_SENTINEL_ENABLED: bool({ devDefault: true }),
17
+ CONNECTION_ID: str({ devDefault: 'CONNECTION_ID' }),
18
+ NAMESPACE: str({ default: 'default' }),
19
+ LOG_LEVEL: str({ default: 'info', choices: ['info', 'debug', 'trace'] }),
20
+ } /* end */);exports.config=config;//# sourceMappingURL=env-config.cjs.map
@@ -0,0 +1 @@
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,GAAGA,kBAAO,CAAC;AAEvB,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,SAAS,EAAE,GAAG,EAAE;IAChB,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;IACnD,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;CAC3E"}
@@ -0,0 +1,15 @@
1
+ import * as envalid from 'envalid';
2
+ export declare const config: Readonly<{
3
+ NODE_ENV: string;
4
+ NATS_URL: string;
5
+ NATS_USER: string;
6
+ NATS_PW: string;
7
+ MONGO_URL: string;
8
+ REDIS_CLUSTER_URL: string;
9
+ REDIS_URL: string;
10
+ REDIS_CLUSTER_ENABLED: boolean;
11
+ REDIS_SENTINEL_ENABLED: boolean;
12
+ CONNECTION_ID: string;
13
+ NAMESPACE: string;
14
+ LOG_LEVEL: string;
15
+ } & envalid.CleanedEnvAccessors>;
@@ -0,0 +1,20 @@
1
+ import*as envalid from'envalid';const { str, bool, json } = 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
+ MONGO_URL: str(),
10
+ REDIS_CLUSTER_URL: json({
11
+ devDefault: '[{"port":6379,"host":"localhost"}]',
12
+ example: '[{"port":6379,"host":"localhost"}]',
13
+ }),
14
+ REDIS_URL: str({ devDefault: 'localhost' }),
15
+ REDIS_CLUSTER_ENABLED: bool({ devDefault: false }),
16
+ REDIS_SENTINEL_ENABLED: bool({ devDefault: true }),
17
+ CONNECTION_ID: str({ devDefault: 'CONNECTION_ID' }),
18
+ NAMESPACE: str({ default: 'default' }),
19
+ LOG_LEVEL: str({ default: 'info', choices: ['info', 'debug', 'trace'] }),
20
+ } /* end */);export{config};//# sourceMappingURL=env-config.mjs.map
@@ -0,0 +1 @@
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,OAAO,CAAC;AAEvB,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,SAAS,EAAE,GAAG,EAAE;IAChB,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;IACnD,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;CAC3E"}
@@ -0,0 +1 @@
1
+ export * from './env-config';
@@ -0,0 +1,195 @@
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: false,
146
+ // Available built-in reporters: 'Console', 'CSV', 'Event', 'Prometheus', 'Datadog', 'StatsD'
147
+ reporter: {
148
+ type: 'Prometheus',
149
+ options: {
150
+ // HTTP port
151
+ port: 3030,
152
+ // HTTP URL path
153
+ path: '/metrics',
154
+ // Default labels which are appended to all metrics labels
155
+ defaultLabels: (registry) => ({
156
+ namespace: registry.broker.namespace,
157
+ nodeID: registry.broker.nodeID,
158
+ }),
159
+ },
160
+ },
161
+ },
162
+ // Enable built-in tracing function. More info: https://moleculer.services/docs/0.14/tracing.html
163
+ tracing: {
164
+ enabled: true,
165
+ // Available built-in exporters: 'Console', 'Datadog', 'Event', 'EventLegacy', 'Jaeger', 'Zipkin'
166
+ exporter: {
167
+ type: 'Console',
168
+ options: {
169
+ // Custom logger
170
+ logger: null,
171
+ // Using colors
172
+ colors: true,
173
+ // Width of row
174
+ width: 100,
175
+ // Gauge width in the row
176
+ gaugeWidth: 40,
177
+ },
178
+ },
179
+ },
180
+ // Register internal services ('$node'). More info: https://moleculer.services/docs/0.13/services.html#Internal-services
181
+ internalServices: true,
182
+ // Register internal middlewares. More info: https://moleculer.services/docs/0.13/middlewares.html#Internal-middlewares
183
+ internalMiddlewares: true,
184
+ // Watch the loaded services and hot reload if they changed.
185
+ // You can also enable it in Moleculer Runner with `--hot` argument
186
+ hotReload: false,
187
+ // Register custom middlewares
188
+ middlewares: [],
189
+ // Called after broker created.
190
+ created(broker) { },
191
+ // Called after broker starte.
192
+ started(broker) { },
193
+ // Called after broker stopped.
194
+ stopped(broker) { },
195
+ };exports.default=brokerConfig;//# sourceMappingURL=moleculer.config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moleculer.config.cjs","sources":["../../src/config/moleculer.config.ts"],"sourcesContent":[null],"names":["config"],"mappings":"gHAIA;;;;;;;;;;;;;;;;AAgBG;AACH,MAAM,YAAY,GAAkB;;IAEhC,SAAS,EAAEA,gBAAM,CAAC,SAAS;;;;;;AAO3B,IAAA,MAAM,EAAE;AACJ,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE;;AAEL,YAAA,MAAM,EAAE,IAAI;;AAEZ,YAAA,YAAY,EAAE,KAAK;;;AAGnB,YAAA,SAAS,EAAE,MAAM;;AAEjB,YAAA,aAAa,EAAE,IAAI;;AAEnB,YAAA,WAAW,EAAE,KAAK;AACrB,SAAA;AACJ,KAAA;;;IAGD,QAAQ,EAAEA,gBAAM,CAAC,SAAgB;;;;;AAMjC,IAAA,WAAW,EACPA,gBAAM,CAAC,QAAQ,KAAK,aAAa;AAC7B,UAAE,KAAK;AACP,UAAG;AACG,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE;gBACL,GAAG,EAAEA,gBAAM,CAAC,QAAQ;gBACpB,IAAI,EAAEA,gBAAM,CAAC,SAAS;gBACtB,IAAI,EAAEA,gBAAM,CAAC,OAAO;AACpB,gBAAA,iBAAiB,EAAE,IAAI;AAC1B,aAAA;AACgB,SAAA;;;;;;;;;;;;;;;AAmB/B,IAAA,UAAU,EAAE,MAAM;;IAGlB,cAAc,EAAE,EAAE,GAAG,IAAI;;AAGzB,IAAA,WAAW,EAAE;;AAET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AE,IAAI;;AAEV,gBAAA,IAAI,EAAE,UAAU;;AAEhB,gBAAA,aAAa,EAAE,CAAC,QAAQ,MAAM;AAC1B,oBAAA,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;AACpC,oBAAA,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;iBACjC,CAAC;AACL,aAAA;AACJ,SAAA;AACJ,KAAA;;AAGD,IAAA,OAAO,EAAE;AACL,QAAA,OAAO,EAAE,IAAI;;AAEb,QAAA,QAAQ,EAAE;AACN,YAAA,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;"}
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,195 @@
1
+ import {config}from'./env-config.mjs';/**
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: 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: 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: config.NODE_ENV === 'development'
50
+ ? 'TCP'
51
+ : {
52
+ type: 'NATS',
53
+ options: {
54
+ url: config.NATS_URL,
55
+ user: config.NATS_USER,
56
+ pass: 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: false,
146
+ // Available built-in reporters: 'Console', 'CSV', 'Event', 'Prometheus', 'Datadog', 'StatsD'
147
+ reporter: {
148
+ type: 'Prometheus',
149
+ options: {
150
+ // HTTP port
151
+ port: 3030,
152
+ // HTTP URL path
153
+ path: '/metrics',
154
+ // Default labels which are appended to all metrics labels
155
+ defaultLabels: (registry) => ({
156
+ namespace: registry.broker.namespace,
157
+ nodeID: registry.broker.nodeID,
158
+ }),
159
+ },
160
+ },
161
+ },
162
+ // Enable built-in tracing function. More info: https://moleculer.services/docs/0.14/tracing.html
163
+ tracing: {
164
+ enabled: true,
165
+ // Available built-in exporters: 'Console', 'Datadog', 'Event', 'EventLegacy', 'Jaeger', 'Zipkin'
166
+ exporter: {
167
+ type: 'Console',
168
+ options: {
169
+ // Custom logger
170
+ logger: null,
171
+ // Using colors
172
+ colors: true,
173
+ // Width of row
174
+ width: 100,
175
+ // Gauge width in the row
176
+ gaugeWidth: 40,
177
+ },
178
+ },
179
+ },
180
+ // Register internal services ('$node'). More info: https://moleculer.services/docs/0.13/services.html#Internal-services
181
+ internalServices: true,
182
+ // Register internal middlewares. More info: https://moleculer.services/docs/0.13/middlewares.html#Internal-middlewares
183
+ internalMiddlewares: true,
184
+ // Watch the loaded services and hot reload if they changed.
185
+ // You can also enable it in Moleculer Runner with `--hot` argument
186
+ hotReload: false,
187
+ // Register custom middlewares
188
+ middlewares: [],
189
+ // Called after broker created.
190
+ created(broker) { },
191
+ // Called after broker starte.
192
+ started(broker) { },
193
+ // Called after broker stopped.
194
+ stopped(broker) { },
195
+ };export{brokerConfig as default};//# sourceMappingURL=moleculer.config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moleculer.config.mjs","sources":["../../src/config/moleculer.config.ts"],"sourcesContent":[null],"names":[],"mappings":"sCAIA;;;;;;;;;;;;;;;;AAgBG;AACH,MAAM,YAAY,GAAkB;;IAEhC,SAAS,EAAE,MAAM,CAAC,SAAS;;;;;;AAO3B,IAAA,MAAM,EAAE;AACJ,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,OAAO,EAAE;;AAEL,YAAA,MAAM,EAAE,IAAI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BAAmB,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;"}
@@ -0,0 +1,57 @@
1
+ 'use strict';var mongoConnector=require('./mongo-connector.cjs'),natsConnector=require('./nats-connector.cjs'),redisConnector=require('./redis-connector.cjs'),envConfig=require('../config/env-config.cjs'),graphqlPubsubConnector=require('./graphql-pubsub-connector.cjs');/* eslint-disable no-underscore-dangle */
2
+ /**
3
+ * Connection broker class
4
+ *
5
+ * @class ConnectionBroker
6
+ */
7
+ class ConnectionBroker {
8
+ /**
9
+ * Creates an instance of ConnectionBroker.
10
+ * @param {*} options
11
+ * @memberof ConnectionBroker
12
+ */
13
+ constructor(transporter, logger) {
14
+ if (typeof transporter === 'string') {
15
+ if (transporter === 'TCP') {
16
+ this._graphqlPubsubConnector = new graphqlPubsubConnector.GraphqlPubSubConnector({ logger, type: 'TCP' });
17
+ }
18
+ else if (transporter === 'NATS') {
19
+ this._natsConnector = new natsConnector.NatsConnector({});
20
+ this._graphqlPubsubConnector = new graphqlPubsubConnector.GraphqlPubSubConnector({
21
+ logger,
22
+ type: 'NATS',
23
+ client: this._natsConnector,
24
+ });
25
+ }
26
+ }
27
+ else if (transporter && 'type' in transporter && transporter.type === 'NATS') {
28
+ // Ensure transporter.options is defined and properly typed if needed
29
+ this._natsConnector = new natsConnector.NatsConnector(transporter.options);
30
+ this._graphqlPubsubConnector = new graphqlPubsubConnector.GraphqlPubSubConnector({
31
+ logger,
32
+ type: 'NATS',
33
+ client: this._natsConnector,
34
+ });
35
+ }
36
+ // Ensure config.MONGO_URL is properly typed as string in your config
37
+ this._mongoConnector = new mongoConnector.MongoConnector(envConfig.config.MONGO_URL);
38
+ this._redisConnector = new redisConnector.RedisConnector(); // Pass constructor options if needed
39
+ }
40
+ get mongoConnection() {
41
+ return this._mongoConnector.connect();
42
+ }
43
+ get redisDataloaderClient() {
44
+ return this._redisConnector.getRedisDataloaderClient();
45
+ }
46
+ get natsConnection() {
47
+ return this._natsConnector.connect();
48
+ }
49
+ get graphqlPubsub() {
50
+ return this._graphqlPubsubConnector.getClient();
51
+ }
52
+ async stop() {
53
+ this._mongoConnector && (await this._mongoConnector.disconnect());
54
+ this._redisConnector && (await this._redisConnector.disconnect());
55
+ this._natsConnector && (await this._natsConnector.disconnect());
56
+ }
57
+ }exports.ConnectionBroker=ConnectionBroker;//# sourceMappingURL=connection-broker.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-broker.cjs","sources":["../../src/connectors/connection-broker.ts"],"sourcesContent":[null],"names":["GraphqlPubSubConnector","NatsConnector","MongoConnector","config","RedisConnector"],"mappings":"8QAAA;AAYA;;;;AAIG;MACU,gBAAgB,CAAA;AASzB;;;;AAIG;IACH,WAAY,CAAA,WAA4B,EAAE,MAAe,EAAA;AACrD,QAAA,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACjC,IAAI,WAAW,KAAK,KAAK,EAAE;AACvB,gBAAA,IAAI,CAAC,uBAAuB,GAAG,IAAIA,6CAAsB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACtF,aAAA;iBAAM,IAAI,WAAW,KAAK,MAAM,EAAE;gBAC/B,IAAI,CAAC,cAAc,GAAG,IAAIC,2BAAa,CAAC,EAAE,CAAC,CAAC;AAC5C,gBAAA,IAAI,CAAC,uBAAuB,GAAG,IAAID,6CAAsB,CAAC;oBACtD,MAAM;AACN,oBAAA,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,IAAI,CAAC,cAAc;AAC9B,iBAAA,CAAC,CAAC;AACN,aAAA;AACJ,SAAA;aAAM,IAAI,WAAW,IAAI,MAAM,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,EAAE;;YAE5E,IAAI,CAAC,cAAc,GAAG,IAAIC,2BAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAC7D,YAAA,IAAI,CAAC,uBAAuB,GAAG,IAAID,6CAAsB,CAAC;gBACtD,MAAM;AACN,gBAAA,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,IAAI,CAAC,cAAc;AAC9B,aAAA,CAAC,CAAC;AACN,SAAA;;QAGD,IAAI,CAAC,eAAe,GAAG,IAAIE,6BAAc,CAACC,gBAAM,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,eAAe,GAAG,IAAIC,6BAAc,EAAE,CAAC;KAC/C;AAED,IAAA,IAAW,eAAe,GAAA;AACtB,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;KACzC;AAED,IAAA,IAAW,qBAAqB,GAAA;AAC5B,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,EAAE,CAAC;KAC1D;AAED,IAAA,IAAW,cAAc,GAAA;AACrB,QAAA,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;KACxC;AAED,IAAA,IAAW,aAAa,GAAA;AACpB,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAAC,SAAS,EAAE,CAAC;KACnD;AAEM,IAAA,MAAM,IAAI,GAAA;AACb,QAAA,IAAI,CAAC,eAAe,KAAK,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;AAClE,QAAA,IAAI,CAAC,eAAe,KAAK,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;AAClE,QAAA,IAAI,CAAC,cAAc,KAAK,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC;KACnE;AACJ"}
@@ -0,0 +1,51 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ import { CdmLogger } from '@cdm-logger/core';
27
+ import { TransporterType } from '../interface';
28
+ type ILogger = CdmLogger.ILogger;
29
+ /**
30
+ * Connection broker class
31
+ *
32
+ * @class ConnectionBroker
33
+ */
34
+ export declare class ConnectionBroker {
35
+ private _mongoConnector;
36
+ private _redisConnector;
37
+ private _natsConnector;
38
+ private _graphqlPubsubConnector;
39
+ /**
40
+ * Creates an instance of ConnectionBroker.
41
+ * @param {*} options
42
+ * @memberof ConnectionBroker
43
+ */
44
+ constructor(transporter: TransporterType, logger: ILogger);
45
+ get mongoConnection(): Promise<import("mongoose").Connection>;
46
+ get redisDataloaderClient(): import("apollo-server-cache-redis").RedisClusterCache | import("apollo-server-cache-redis").RedisCache;
47
+ get natsConnection(): import("nats").Client | Promise<import("nats").Client>;
48
+ get graphqlPubsub(): Promise<import("graphql-nats-subscriptions").NatsPubSub | import("graphql-subscriptions").PubSub>;
49
+ stop(): Promise<void>;
50
+ }
51
+ export {};