@conduitplatform/grpc-sdk 0.16.5 → 0.16.7

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 (138) hide show
  1. package/dist/classes/ConduitModule.d.ts +1 -1
  2. package/dist/index.cjs +13779 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.esm.js +13594 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/modules/config/index.d.ts +1 -1
  8. package/package.json +27 -5
  9. package/dist/classes/ConduitAuthorizedResource.js +0 -24
  10. package/dist/classes/ConduitAuthorizedResource.js.map +0 -1
  11. package/dist/classes/ConduitModule.js +0 -112
  12. package/dist/classes/ConduitModule.js.map +0 -1
  13. package/dist/classes/ConduitSchema.js +0 -10
  14. package/dist/classes/ConduitSchema.js.map +0 -1
  15. package/dist/classes/Error.js +0 -24
  16. package/dist/classes/Error.js.map +0 -1
  17. package/dist/classes/HealthCheck.js +0 -30
  18. package/dist/classes/HealthCheck.js.map +0 -1
  19. package/dist/classes/index.js +0 -6
  20. package/dist/classes/index.js.map +0 -1
  21. package/dist/constants/enums/PlatformTypesEnum.js +0 -12
  22. package/dist/constants/enums/PlatformTypesEnum.js.map +0 -1
  23. package/dist/constants/enums/index.js +0 -2
  24. package/dist/constants/enums/index.js.map +0 -1
  25. package/dist/constants/index.js +0 -2
  26. package/dist/constants/index.js.map +0 -1
  27. package/dist/index.js +0 -472
  28. package/dist/index.js.map +0 -1
  29. package/dist/interceptors/grpcSignedToken.js +0 -12
  30. package/dist/interceptors/grpcSignedToken.js.map +0 -1
  31. package/dist/interceptors/index.js +0 -3
  32. package/dist/interceptors/index.js.map +0 -1
  33. package/dist/interceptors/moduleName.js +0 -12
  34. package/dist/interceptors/moduleName.js.map +0 -1
  35. package/dist/interfaces/ConduitMiddleware.js +0 -2
  36. package/dist/interfaces/ConduitMiddleware.js.map +0 -1
  37. package/dist/interfaces/ConduitRoute.js +0 -2
  38. package/dist/interfaces/ConduitRoute.js.map +0 -1
  39. package/dist/interfaces/ConduitRouteReturn.js +0 -61
  40. package/dist/interfaces/ConduitRouteReturn.js.map +0 -1
  41. package/dist/interfaces/ConduitSchemaExtension.js +0 -2
  42. package/dist/interfaces/ConduitSchemaExtension.js.map +0 -1
  43. package/dist/interfaces/GrpcCallback.js +0 -2
  44. package/dist/interfaces/GrpcCallback.js.map +0 -1
  45. package/dist/interfaces/IConduitLogger.js +0 -2
  46. package/dist/interfaces/IConduitLogger.js.map +0 -1
  47. package/dist/interfaces/IConduitMetrics.js +0 -2
  48. package/dist/interfaces/IConduitMetrics.js.map +0 -1
  49. package/dist/interfaces/Indexable.js +0 -2
  50. package/dist/interfaces/Indexable.js.map +0 -1
  51. package/dist/interfaces/Model.js +0 -49
  52. package/dist/interfaces/Model.js.map +0 -1
  53. package/dist/interfaces/Params.js +0 -2
  54. package/dist/interfaces/Params.js.map +0 -1
  55. package/dist/interfaces/ProxyRoute.js +0 -10
  56. package/dist/interfaces/ProxyRoute.js.map +0 -1
  57. package/dist/interfaces/RawQuery.js +0 -2
  58. package/dist/interfaces/RawQuery.js.map +0 -1
  59. package/dist/interfaces/Route.js +0 -9
  60. package/dist/interfaces/Route.js.map +0 -1
  61. package/dist/interfaces/Socket.js +0 -2
  62. package/dist/interfaces/Socket.js.map +0 -1
  63. package/dist/interfaces/UntypedArray.js +0 -2
  64. package/dist/interfaces/UntypedArray.js.map +0 -1
  65. package/dist/interfaces/index.js +0 -17
  66. package/dist/interfaces/index.js.map +0 -1
  67. package/dist/interfaces/types.js +0 -2
  68. package/dist/interfaces/types.js.map +0 -1
  69. package/dist/modules/admin/index.js +0 -24
  70. package/dist/modules/admin/index.js.map +0 -1
  71. package/dist/modules/authentication/index.js +0 -40
  72. package/dist/modules/authentication/index.js.map +0 -1
  73. package/dist/modules/authorization/index.js +0 -49
  74. package/dist/modules/authorization/index.js.map +0 -1
  75. package/dist/modules/chat/index.js +0 -19
  76. package/dist/modules/chat/index.js.map +0 -1
  77. package/dist/modules/config/index.js +0 -138
  78. package/dist/modules/config/index.js.map +0 -1
  79. package/dist/modules/core/index.js +0 -10
  80. package/dist/modules/core/index.js.map +0 -1
  81. package/dist/modules/database/index.js +0 -297
  82. package/dist/modules/database/index.js.map +0 -1
  83. package/dist/modules/email/index.js +0 -37
  84. package/dist/modules/email/index.js.map +0 -1
  85. package/dist/modules/index.js +0 -13
  86. package/dist/modules/index.js.map +0 -1
  87. package/dist/modules/pushNotifications/index.js +0 -51
  88. package/dist/modules/pushNotifications/index.js.map +0 -1
  89. package/dist/modules/router/index.js +0 -27
  90. package/dist/modules/router/index.js.map +0 -1
  91. package/dist/modules/sms/index.js +0 -19
  92. package/dist/modules/sms/index.js.map +0 -1
  93. package/dist/modules/storage/index.js +0 -70
  94. package/dist/modules/storage/index.js.map +0 -1
  95. package/dist/protoUtils/authentication.js +0 -1104
  96. package/dist/protoUtils/authentication.js.map +0 -1
  97. package/dist/protoUtils/authorization.js +0 -1480
  98. package/dist/protoUtils/authorization.js.map +0 -1
  99. package/dist/protoUtils/chat.js +0 -375
  100. package/dist/protoUtils/chat.js.map +0 -1
  101. package/dist/protoUtils/core.js +0 -1897
  102. package/dist/protoUtils/core.js.map +0 -1
  103. package/dist/protoUtils/database.js +0 -2379
  104. package/dist/protoUtils/database.js.map +0 -1
  105. package/dist/protoUtils/email.js +0 -437
  106. package/dist/protoUtils/email.js.map +0 -1
  107. package/dist/protoUtils/google/protobuf/empty.js +0 -40
  108. package/dist/protoUtils/google/protobuf/empty.js.map +0 -1
  109. package/dist/protoUtils/grpc_health_check.js +0 -173
  110. package/dist/protoUtils/grpc_health_check.js.map +0 -1
  111. package/dist/protoUtils/index.js +0 -13
  112. package/dist/protoUtils/index.js.map +0 -1
  113. package/dist/protoUtils/module.js +0 -868
  114. package/dist/protoUtils/module.js.map +0 -1
  115. package/dist/protoUtils/push-notifications.js +0 -689
  116. package/dist/protoUtils/push-notifications.js.map +0 -1
  117. package/dist/protoUtils/router.js +0 -929
  118. package/dist/protoUtils/router.js.map +0 -1
  119. package/dist/protoUtils/sms.js +0 -374
  120. package/dist/protoUtils/sms.js.map +0 -1
  121. package/dist/protoUtils/storage.js +0 -1207
  122. package/dist/protoUtils/storage.js.map +0 -1
  123. package/dist/types/db.js +0 -2
  124. package/dist/types/db.js.map +0 -1
  125. package/dist/types/index.js +0 -23
  126. package/dist/types/index.js.map +0 -1
  127. package/dist/utilities/EventBus.js +0 -71
  128. package/dist/utilities/EventBus.js.map +0 -1
  129. package/dist/utilities/RedisManager.js +0 -19
  130. package/dist/utilities/RedisManager.js.map +0 -1
  131. package/dist/utilities/StateManager.js +0 -70
  132. package/dist/utilities/StateManager.js.map +0 -1
  133. package/dist/utilities/env.js +0 -30
  134. package/dist/utilities/env.js.map +0 -1
  135. package/dist/utilities/index.js +0 -6
  136. package/dist/utilities/index.js.map +0 -1
  137. package/dist/utilities/sleep.js +0 -6
  138. package/dist/utilities/sleep.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /// <reference types="node" resolution-mode="require"/>
1
+ /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  import { ConduitModule } from '../../classes/index.js';
4
4
  import { HealthCheckStatus } from '../../types/index.js';
package/package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "name": "@conduitplatform/grpc-sdk",
3
- "version": "0.16.5",
4
- "main": "dist/index.js",
3
+ "version": "0.16.7",
4
+ "main": "dist/index.cjs",
5
+ "module": "dist/index.esm.js",
5
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "default": "./dist/index.esm.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "require": {
14
+ "default": "./dist/index.cjs",
15
+ "types": "./dist/index.d.ts"
16
+ }
17
+ }
18
+ },
6
19
  "engines": {
7
20
  "node": ">=14"
8
21
  },
@@ -10,13 +23,13 @@
10
23
  "scripts": {
11
24
  "prepublish": "npm run build",
12
25
  "prebuild": "npm run protoc",
13
- "build": "rimraf dist && tsc",
26
+ "build": "rimraf dist && rollup -c",
14
27
  "postbuild": "copyfiles -u 1 src/*.proto src/**/*.json ./dist/",
15
28
  "protoc": "sh build.sh"
16
29
  },
17
30
  "license": "MIT",
18
31
  "dependencies": {
19
- "@grpc/grpc-js": "^1.9.7",
32
+ "@grpc/grpc-js": "^1.10.9",
20
33
  "@grpc/proto-loader": "^0.7.6",
21
34
  "@sesamecare-oss/redlock": "^1.2.0",
22
35
  "abort-controller-x": "^0.4.1",
@@ -25,6 +38,7 @@
25
38
  "fast-jwt": "^3.3.2",
26
39
  "fs-extra": "^11.2.0",
27
40
  "ioredis": "^5.3.2",
41
+ "lodash": "^4.17.21",
28
42
  "lodash-es": "^4.17.21",
29
43
  "nice-grpc": "^2.1.7",
30
44
  "nice-grpc-client-middleware-retry": "^3",
@@ -46,18 +60,26 @@
46
60
  "directory": "libraries/grpc-sdk"
47
61
  },
48
62
  "devDependencies": {
63
+ "@rollup/plugin-commonjs": "^26.0.1",
64
+ "@rollup/plugin-json": "^6.1.0",
65
+ "@rollup/plugin-replace": "^5.0.7",
66
+ "@rollup/plugin-typescript": "^11.1.6",
49
67
  "@types/convict": "^6.1.6",
50
68
  "@types/express": "^4.17.21",
51
69
  "@types/fs-extra": "^11.0.4",
52
70
  "@types/google-protobuf": "^3.15.12",
71
+ "@types/lodash": "^4.17.6",
53
72
  "@types/lodash-es": "^4.17.12",
54
73
  "@types/node": "20.11.24",
55
74
  "copyfiles": "^2.4.1",
56
75
  "rimraf": "^5.0.5",
76
+ "rollup": "^4.18.0",
77
+ "ts-node": "^10.9.2",
57
78
  "ts-proto": "^1.167.1",
79
+ "tslib": "^2.6.3",
58
80
  "typescript": "~5.3.3"
59
81
  },
60
82
  "peerDependencies": {
61
- "@grpc/grpc-js": "^1.9.7"
83
+ "@grpc/grpc-js": "^1.10.9"
62
84
  }
63
85
  }
@@ -1,24 +0,0 @@
1
- export class ConduitAuthorizedResource {
2
- constructor(name, relations, permissions) {
3
- this.relations = [];
4
- this.permissions = [];
5
- this.name = name;
6
- this.relations = Object.keys(relations).map(relation => {
7
- return {
8
- name: relation,
9
- resourceType: Array.isArray(relations[relation])
10
- ? relations[relation]
11
- : [relations[relation]],
12
- };
13
- });
14
- this.permissions = Object.keys(permissions).map(permission => {
15
- return {
16
- name: permission,
17
- roles: Array.isArray(permissions[permission])
18
- ? permissions[permission]
19
- : [permissions[permission]],
20
- };
21
- });
22
- }
23
- }
24
- //# sourceMappingURL=ConduitAuthorizedResource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConduitAuthorizedResource.js","sourceRoot":"","sources":["../../src/classes/ConduitAuthorizedResource.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,yBAAyB;IAKpC,YACE,IAAY,EACZ,SAAiD,EACjD,WAAoD;QAN7C,cAAS,GAAwB,EAAE,CAAC;QACpC,gBAAW,GAA0B,EAAE,CAAC;QAO/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACrD,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;oBAC9C,CAAC,CAAE,SAAS,CAAC,QAAQ,CAAc;oBACnC,CAAC,CAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAc;aACxC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC3D,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;oBAC3C,CAAC,CAAE,WAAW,CAAC,UAAU,CAAc;oBACvC,CAAC,CAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAc;aAC5C,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,112 +0,0 @@
1
- import { getGrpcSignedTokenInterceptor, getModuleNameInterceptor, } from '../interceptors/index.js';
2
- import { createChannel, createClientFactory } from 'nice-grpc';
3
- import { retryMiddleware } from 'nice-grpc-client-middleware-retry';
4
- import { ConduitModuleDefinition, HealthDefinition, } from '../protoUtils/index.js';
5
- import { EventEmitter } from 'events';
6
- import ConduitGrpcSdk from '../index.js';
7
- export class ConduitModule {
8
- constructor(_clientName, _serviceName, _serviceUrl, _grpcToken) {
9
- this._clientName = _clientName;
10
- this._serviceName = _serviceName;
11
- this._serviceUrl = _serviceUrl;
12
- this._grpcToken = _grpcToken;
13
- this.healthCheckEmitter = new EventEmitter();
14
- }
15
- get client() {
16
- return this._client;
17
- }
18
- get healthClient() {
19
- return this._healthClient;
20
- }
21
- get moduleClient() {
22
- return this._moduleClient;
23
- }
24
- get active() {
25
- if (!this.channel) {
26
- return false;
27
- }
28
- const connectivityState = this.channel.getConnectivityState(true);
29
- return connectivityState === 2 || connectivityState === 1 || connectivityState === 0;
30
- }
31
- get healthCheckWatcher() {
32
- return this.healthCheckEmitter;
33
- }
34
- initializeClient(type) {
35
- if (this._client)
36
- return this._client;
37
- this.type = type;
38
- this.openConnection();
39
- return this._client;
40
- }
41
- openConnection() {
42
- if (this.channel) {
43
- // used to make sure a connection attempt is made
44
- this.channel.getConnectivityState(true);
45
- return;
46
- }
47
- // ConduitGrpcSdk.Logger.log(`Opening connection for ${this._serviceName}`);
48
- this.channel = createChannel(this._serviceUrl, undefined, {
49
- 'grpc.max_receive_message_length': 1024 * 1024 * 100,
50
- 'grpc.max_send_message_length': 1024 * 1024 * 100,
51
- });
52
- let clientFactory = createClientFactory()
53
- .use(this._grpcToken
54
- ? getGrpcSignedTokenInterceptor(this._grpcToken)
55
- : getModuleNameInterceptor(this._clientName))
56
- .use(retryMiddleware);
57
- for (const interceptor of ConduitGrpcSdk.interceptors) {
58
- clientFactory = clientFactory.use(interceptor);
59
- }
60
- this._client = clientFactory.create(this.type, this.channel, {
61
- '*': {
62
- // https://grpc.github.io/grpc/core/md_doc_statuscodes.html
63
- retryableStatuses: [1, 10, 14], // handle: cancelled, aborted, unavailable
64
- retryBaseDelayMs: 250,
65
- retryMaxAttempts: 5,
66
- retry: true,
67
- },
68
- });
69
- this._healthClient = clientFactory.create(HealthDefinition, this.channel);
70
- this._moduleClient = clientFactory.create(ConduitModuleDefinition, this.channel);
71
- const monitorChannel = () => {
72
- if (!this.channel)
73
- return;
74
- try {
75
- const state = this.channel.getConnectivityState(true);
76
- this.channel.watchConnectivityState(state, Infinity, monitorChannel);
77
- }
78
- catch (e) { }
79
- };
80
- monitorChannel();
81
- }
82
- closeConnection() {
83
- if (!this.channel)
84
- return;
85
- // ConduitGrpcSdk.Logger.warn(`Closing connection for ${this._serviceName}`);
86
- this.channel.close();
87
- this.channel = undefined;
88
- }
89
- check(service = '') {
90
- return this.healthClient.check({ service }).then((res) => {
91
- return res.status;
92
- });
93
- }
94
- async watch(service = '') {
95
- var _a;
96
- const self = this;
97
- const serviceName = (_a = this.type) === null || _a === void 0 ? void 0 : _a.name;
98
- this.healthCheckEmitter.setMaxListeners(150);
99
- try {
100
- const call = this.healthClient.watch({ service });
101
- for await (const data of call) {
102
- self.healthCheckEmitter.emit(`grpc-health-change:${serviceName}`, data.status);
103
- }
104
- }
105
- catch (error) {
106
- // uncomment for debug when needed
107
- // currently is misleading if left on
108
- // ConduitGrpcSdk.Logger.warn('Connection to gRPC server closed');
109
- }
110
- }
111
- }
112
- //# sourceMappingURL=ConduitModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConduitModule.js","sourceRoot":"","sources":["../../src/classes/ConduitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,0BAA0B,CAA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AAE,CAAC;gBAC9B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,sBAAsB,WAAW,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kCAAkC;YAClC,qCAAqC;YACrC,kEAAkE;QACpE,CAAC;IACH,CAAC;CACF"}
@@ -1,10 +0,0 @@
1
- export class ConduitSchema {
2
- constructor(name, fields, modelOptions, collectionName) {
3
- this.ownerModule = 'unknown';
4
- this.name = name;
5
- this.fields = fields;
6
- this.modelOptions = modelOptions !== null && modelOptions !== void 0 ? modelOptions : {};
7
- this.collectionName = collectionName && collectionName !== '' ? collectionName : '';
8
- }
9
- }
10
- //# sourceMappingURL=ConduitSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConduitSchema.js","sourceRoot":"","sources":["../../src/classes/ConduitSchema.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IAQxB,YACE,IAAY,EACZ,MAAoB,EACpB,YAAmC,EACnC,cAAuB;QAPzB,gBAAW,GAAW,SAAS,CAAC;QAS9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,cAAc,IAAI,cAAc,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,CAAC;CACF"}
@@ -1,24 +0,0 @@
1
- export class ConduitError extends Error {
2
- constructor(name, status, message) {
3
- super(message);
4
- this.name = name;
5
- this.message = message;
6
- this.status = status;
7
- }
8
- static unauthorized(message = 'Unauthorized') {
9
- return new ConduitError('UNAUTHORIZED', 401, message);
10
- }
11
- static notFound(message = 'Resource not found') {
12
- return new ConduitError('NOT_FOUND', 404, message);
13
- }
14
- static forbidden(message = 'Forbidden') {
15
- return new ConduitError('FORBIDDEN', 403, message);
16
- }
17
- static userInput(message = 'Request data are invalid') {
18
- return new ConduitError('USER_INPUT_ERROR', 400, message);
19
- }
20
- static internalServerError(message = 'Something went wrong') {
21
- throw new ConduitError('INTERNAL_SERVER_ERROR', 500, message);
22
- }
23
- }
24
- //# sourceMappingURL=Error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Error.js","sourceRoot":"","sources":["../../src/classes/Error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAKrC,YAAY,IAAY,EAAE,MAAc,EAAE,OAAe;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,UAAkB,cAAc;QAClD,OAAO,IAAI,YAAY,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,UAAkB,oBAAoB;QACpD,OAAO,IAAI,YAAY,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,UAAkB,WAAW;QAC5C,OAAO,IAAI,YAAY,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,UAAkB,0BAA0B;QAC3D,OAAO,IAAI,YAAY,CAAC,kBAAkB,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAC,OAAO,GAAG,sBAAsB;QACzD,MAAM,IAAI,YAAY,CAAC,uBAAuB,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -1,30 +0,0 @@
1
- import { getGrpcSignedTokenInterceptor, getModuleNameInterceptor, } from '../interceptors/index.js';
2
- import { createChannel, createClientFactory } from 'nice-grpc';
3
- import { HealthDefinition } from '../protoUtils/index.js';
4
- import ConduitGrpcSdk from '../index.js';
5
- export async function checkModuleHealth(clientName, serviceUrl, service = '', grpcToken) {
6
- const channel = createChannel(serviceUrl, undefined, {
7
- 'grpc.max_receive_message_length': 1024 * 1024 * 100,
8
- 'grpc.max_send_message_length': 1024 * 1024 * 100,
9
- });
10
- let clientFactory = createClientFactory().use(grpcToken
11
- ? getGrpcSignedTokenInterceptor(grpcToken)
12
- : getModuleNameInterceptor(clientName));
13
- for (const interceptor of ConduitGrpcSdk.interceptors) {
14
- clientFactory = clientFactory.use(interceptor);
15
- }
16
- const _healthClient = clientFactory.create(HealthDefinition, channel);
17
- let error;
18
- const status = await _healthClient
19
- .check({ service })
20
- .then((res) => {
21
- return res.status;
22
- })
23
- .catch(err => (error = err));
24
- channel.close();
25
- if (!error) {
26
- return status;
27
- }
28
- throw error;
29
- }
30
- //# sourceMappingURL=HealthCheck.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HealthCheck.js","sourceRoot":"","sources":["../../src/classes/HealthCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAuB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,cAAc,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAAE,EACpB,SAAkB;IAElB,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE;QACnD,iCAAiC,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;QACpD,8BAA8B,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;KAClD,CAAC,CAAC;IACH,IAAI,aAAa,GAAG,mBAAmB,EAAE,CAAC,GAAG,CAC3C,SAAS;QACP,CAAC,CAAC,6BAA6B,CAAC,SAAS,CAAC;QAC1C,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,CACzC,CAAC;IACF,KAAK,MAAM,WAAW,IAAI,cAAc,CAAC,YAAY,EAAE,CAAC;QACtD,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI,KAAK,CAAC;IACV,MAAM,MAAM,GAAG,MAAM,aAAa;SAC/B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;SAClB,IAAI,CAAC,CAAC,GAAwB,EAAE,EAAE;QACjC,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './Error.js';
2
- export * from './ConduitModule.js';
3
- export * from './HealthCheck.js';
4
- export * from './ConduitSchema.js';
5
- export * from './ConduitAuthorizedResource.js';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC"}
@@ -1,12 +0,0 @@
1
- export var PlatformTypesEnum;
2
- (function (PlatformTypesEnum) {
3
- PlatformTypesEnum["WEB"] = "WEB";
4
- PlatformTypesEnum["ANDROID"] = "ANDROID";
5
- PlatformTypesEnum["IOS"] = "IOS";
6
- PlatformTypesEnum["IPADOS"] = "IPADOS";
7
- PlatformTypesEnum["WINDOWS"] = "WINDOWS";
8
- PlatformTypesEnum["MACOS"] = "MACOS";
9
- PlatformTypesEnum["LINUX"] = "LINUX";
10
- PlatformTypesEnum["CLI"] = "CLI";
11
- })(PlatformTypesEnum || (PlatformTypesEnum = {}));
12
- //# sourceMappingURL=PlatformTypesEnum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformTypesEnum.js","sourceRoot":"","sources":["../../../src/constants/enums/PlatformTypesEnum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,wCAAmB,CAAA;IACnB,gCAAW,CAAA;IACX,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,oCAAe,CAAA;IACf,oCAAe,CAAA;IACf,gCAAW,CAAA;AACb,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B"}
@@ -1,2 +0,0 @@
1
- export * from './PlatformTypesEnum.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './enums/index.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}