@conduitplatform/grpc-sdk 0.15.6 → 0.15.8

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 (61) hide show
  1. package/dist/classes/ConduitAuthorizedResource.d.ts +11 -0
  2. package/dist/classes/ConduitAuthorizedResource.js +29 -0
  3. package/dist/classes/ConduitAuthorizedResource.js.map +1 -0
  4. package/dist/classes/ConduitServiceModule.js +1 -1
  5. package/dist/classes/ConduitServiceModule.js.map +1 -1
  6. package/dist/classes/ManagedModule.js +1 -1
  7. package/dist/classes/ManagedModule.js.map +1 -1
  8. package/dist/classes/index.d.ts +1 -0
  9. package/dist/classes/index.js +1 -0
  10. package/dist/classes/index.js.map +1 -1
  11. package/dist/grpc_health_check.proto +21 -0
  12. package/dist/index.d.ts +13 -4
  13. package/dist/index.js +85 -8
  14. package/dist/index.js.map +1 -1
  15. package/dist/interfaces/Model.d.ts +1 -0
  16. package/dist/interfaces/Model.js.map +1 -1
  17. package/dist/interfaces/RawQuery.d.ts +22 -0
  18. package/dist/interfaces/RawQuery.js +3 -0
  19. package/dist/interfaces/RawQuery.js.map +1 -0
  20. package/dist/interfaces/index.d.ts +1 -0
  21. package/dist/interfaces/index.js +1 -0
  22. package/dist/interfaces/index.js.map +1 -1
  23. package/dist/metrics/MetricsServer.d.ts +2 -2
  24. package/dist/metrics/MetricsServer.js.map +1 -1
  25. package/dist/metrics/index.d.ts +7 -11
  26. package/dist/metrics/index.js +27 -51
  27. package/dist/metrics/index.js.map +1 -1
  28. package/dist/modules/authorization/index.d.ts +5 -2
  29. package/dist/modules/authorization/index.js +9 -0
  30. package/dist/modules/authorization/index.js.map +1 -1
  31. package/dist/modules/database/index.d.ts +2 -1
  32. package/dist/modules/database/index.js +37 -0
  33. package/dist/modules/database/index.js.map +1 -1
  34. package/dist/protoUtils/authorization.d.ts +98 -5
  35. package/dist/protoUtils/authorization.js +223 -5
  36. package/dist/protoUtils/authorization.js.map +1 -1
  37. package/dist/protoUtils/core.d.ts +5 -2
  38. package/dist/protoUtils/core.js +41 -8
  39. package/dist/protoUtils/core.js.map +1 -1
  40. package/dist/protoUtils/database.d.ts +74 -0
  41. package/dist/protoUtils/database.js +340 -1
  42. package/dist/protoUtils/database.js.map +1 -1
  43. package/dist/routing/interfaces/Route.d.ts +9 -0
  44. package/dist/routing/interfaces/Route.js.map +1 -1
  45. package/dist/routing/interfaces/types.d.ts +3 -0
  46. package/dist/routing/wrapRouterFunctions.js +3 -0
  47. package/dist/routing/wrapRouterFunctions.js.map +1 -1
  48. package/dist/utilities/EventBus.js.map +1 -1
  49. package/dist/utilities/RedisManager.d.ts +22 -4
  50. package/dist/utilities/RedisManager.js +10 -7
  51. package/dist/utilities/RedisManager.js.map +1 -1
  52. package/dist/utilities/index.d.ts +2 -1
  53. package/dist/utilities/index.js +2 -7
  54. package/dist/utilities/index.js.map +1 -1
  55. package/dist/utilities/merge.d.ts +1 -0
  56. package/dist/utilities/merge.js +15 -0
  57. package/dist/utilities/merge.js.map +1 -0
  58. package/dist/utilities/sleep.d.ts +1 -0
  59. package/dist/utilities/sleep.js +10 -0
  60. package/dist/utilities/sleep.js.map +1 -0
  61. package/package.json +4 -1
@@ -1,6 +1,24 @@
1
- import { Redis, RedisOptions } from 'ioredis';
1
+ import { Cluster, ClusterOptions, Redis, RedisOptions } from 'ioredis';
2
2
  export declare class RedisManager {
3
- redisConnection: RedisOptions;
4
- constructor(redisIp: string, redisPort: any);
5
- getClient(connectionOps?: RedisOptions): Redis;
3
+ redisConnection: RedisOptions | {
4
+ nodes: {
5
+ host: string;
6
+ port: number;
7
+ }[];
8
+ options: ClusterOptions;
9
+ };
10
+ constructor(redisDetails?: RedisOptions | {
11
+ nodes: {
12
+ host: string;
13
+ port: number;
14
+ }[];
15
+ options: ClusterOptions;
16
+ });
17
+ getClient(options?: RedisOptions | {
18
+ nodes: {
19
+ host: string;
20
+ port: number;
21
+ }[];
22
+ options: ClusterOptions;
23
+ }): Redis | Cluster;
6
24
  }
@@ -17,14 +17,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.RedisManager = void 0;
18
18
  var ioredis_1 = __importDefault(require("ioredis"));
19
19
  var RedisManager = /** @class */ (function () {
20
- function RedisManager(redisIp, redisPort) {
21
- this.redisConnection = {
22
- host: redisIp,
23
- port: redisPort,
24
- };
20
+ function RedisManager(redisDetails) {
21
+ this.redisConnection = __assign({}, redisDetails);
25
22
  }
26
- RedisManager.prototype.getClient = function (connectionOps) {
27
- return new ioredis_1.default(__assign(__assign({}, this.redisConnection), connectionOps));
23
+ RedisManager.prototype.getClient = function (options) {
24
+ if (this.redisConnection.hasOwnProperty('nodes')) {
25
+ var clusterOptions = this.redisConnection;
26
+ return new ioredis_1.default.Cluster(clusterOptions.nodes, clusterOptions.options);
27
+ }
28
+ else {
29
+ return new ioredis_1.default(__assign(__assign({}, this.redisConnection), options));
30
+ }
28
31
  };
29
32
  return RedisManager;
30
33
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"RedisManager.js","sourceRoot":"","sources":["../../src/utilities/RedisManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD;IAGE,sBAAY,OAAe,EAAE,SAAc;QACzC,IAAI,CAAC,eAAe,GAAG;YACrB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,SAAS;SAChB,CAAC;IACJ,CAAC;IAED,gCAAS,GAAT,UAAU,aAA4B;QACpC,OAAO,IAAI,iBAAO,uBAAM,IAAI,CAAC,eAAe,GAAK,aAAa,EAAG,CAAC;IACpE,CAAC;IACH,mBAAC;AAAD,CAAC,AAbD,IAaC;AAbY,oCAAY"}
1
+ {"version":3,"file":"RedisManager.js","sourceRoot":"","sources":["../../src/utilities/RedisManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAgF;AAEhF;IAKE,sBACE,YAEwE;QAExE,IAAI,CAAC,eAAe,gBACf,YAAY,CAChB,CAAC;IACJ,CAAC;IACD,gCAAS,GAAT,UACE,OAEwE;QAExE,IAAI,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;YAChD,IAAM,cAAc,GAAG,IAAI,CAAC,eAG3B,CAAC;YACF,OAAO,IAAI,iBAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;SAC1E;aAAM;YACL,OAAO,IAAI,iBAAO,uBAAO,IAAI,CAAC,eAAgC,GAAK,OAAO,EAAG,CAAC;SAC/E;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BY,oCAAY"}
@@ -1,2 +1,3 @@
1
1
  export * from './linearBackoffTimeout';
2
- export declare function sleep(ms: number): Promise<unknown>;
2
+ export * from './merge';
3
+ export * from './sleep';
@@ -14,12 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.sleep = void 0;
18
17
  __exportStar(require("./linearBackoffTimeout"), exports);
19
- function sleep(ms) {
20
- return new Promise(function (resolve) {
21
- setTimeout(resolve, ms);
22
- });
23
- }
24
- exports.sleep = sleep;
18
+ __exportStar(require("./merge"), exports);
19
+ __exportStar(require("./sleep"), exports);
25
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAuC;AAEvC,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO;QACxB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,sBAIC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,0CAAwB;AACxB,0CAAwB"}
@@ -0,0 +1 @@
1
+ export declare function merge<T extends object>(objA: T, objB: T): {} & T;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.merge = void 0;
4
+ var lodash_1 = require("lodash");
5
+ function merge(objA, objB) {
6
+ var customizer = function (objValue, srcValue) {
7
+ if (Array.isArray(objValue)) {
8
+ // don't merge arrays
9
+ return srcValue;
10
+ }
11
+ };
12
+ return (0, lodash_1.mergeWith)({}, objA, objB, customizer);
13
+ }
14
+ exports.merge = merge;
15
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utilities/merge.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AAEjD,SAAgB,KAAK,CAAmB,IAAO,EAAE,IAAO;IACtD,IAAM,UAAU,GAAG,UAAC,QAAiB,EAAE,QAAiB;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,qBAAqB;YACrB,OAAO,QAAQ,CAAC;SACjB;IACH,CAAC,CAAC;IACF,OAAO,IAAA,kBAAU,EAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAChD,CAAC;AARD,sBAQC"}
@@ -0,0 +1 @@
1
+ export declare function sleep(ms: number): Promise<unknown>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sleep = void 0;
4
+ function sleep(ms) {
5
+ return new Promise(function (resolve) {
6
+ setTimeout(resolve, ms);
7
+ });
8
+ }
9
+ exports.sleep = sleep;
10
+ //# sourceMappingURL=sleep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utilities/sleep.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO;QACxB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,sBAIC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduitplatform/grpc-sdk",
3
- "version": "0.15.6",
3
+ "version": "0.15.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "engines": {
@@ -10,6 +10,7 @@
10
10
  "prepublish": "npm run build",
11
11
  "prebuild": "npm run protoc",
12
12
  "build": "rimraf dist && tsc",
13
+ "postbuild": "copyfiles -u 1 src/*.proto src/**/*.json ./dist/",
13
14
  "protoc": "sh build.sh"
14
15
  },
15
16
  "license": "MIT",
@@ -23,6 +24,7 @@
23
24
  "convict": "^6.2.3",
24
25
  "express": "^4.18.1",
25
26
  "fast-jwt": "^1.6.0",
27
+ "fs-extra": "^10.1.0",
26
28
  "ioredis": "^5.1.0",
27
29
  "lodash": "^4.17.21",
28
30
  "nice-grpc": "^1.2.0",
@@ -47,6 +49,7 @@
47
49
  "devDependencies": {
48
50
  "@types/convict": "^6.1.1",
49
51
  "@types/express": "^4.17.13",
52
+ "@types/fs-extra": "^9.0.13",
50
53
  "@types/google-protobuf": "^3.15.6",
51
54
  "@types/ioredis": "^4.28.10",
52
55
  "@types/lodash": "^4.14.182",