@pegasimed.com/shared-tools 1.0.32 → 1.0.34

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.
@@ -4,4 +4,5 @@ export declare const CARE_PLAN_ACTIVITY_STATUS: {
4
4
  suspended: string;
5
5
  transfered: string;
6
6
  incomplete: string;
7
+ rebootCarePlan: string;
7
8
  };
@@ -7,5 +7,6 @@ exports.CARE_PLAN_ACTIVITY_STATUS = {
7
7
  suspended: 'suspended',
8
8
  transfered: 'transfered',
9
9
  incomplete: 'incomplete',
10
+ rebootCarePlan: 'reboot-care-plan',
10
11
  };
11
12
  //# sourceMappingURL=carePlanActivityStatus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carePlanActivityStatus.js","sourceRoot":"","sources":["../../src/constants/carePlanActivityStatus.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG;IACvC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;CACzB,CAAC"}
1
+ {"version":3,"file":"carePlanActivityStatus.js","sourceRoot":"","sources":["../../src/constants/carePlanActivityStatus.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG;IACvC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,kBAAkB;CACnC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export declare const CARE_PLAN_CONDITION_ACTIONS: {
2
2
  moveToEvent: string;
3
3
  changeStatus: string;
4
+ rebootCarePlan: string;
4
5
  sendNotification: string;
5
6
  carePlanInscription: string;
6
7
  };
@@ -4,6 +4,7 @@ exports.CARE_PLAN_CONDITION_ACTIONS = void 0;
4
4
  exports.CARE_PLAN_CONDITION_ACTIONS = {
5
5
  moveToEvent: 'move-to-event',
6
6
  changeStatus: 'change-status',
7
+ rebootCarePlan: 'reboot-care-plan',
7
8
  sendNotification: 'send-notification',
8
9
  carePlanInscription: 'care-plan-inscription',
9
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"carePlanConditionActions.js","sourceRoot":"","sources":["../../src/constants/carePlanConditionActions.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GAAG;IACzC,WAAW,EAAE,eAAe;IAC5B,YAAY,EAAE,eAAe;IAC7B,gBAAgB,EAAE,mBAAmB;IACrC,mBAAmB,EAAE,uBAAuB;CAC7C,CAAC"}
1
+ {"version":3,"file":"carePlanConditionActions.js","sourceRoot":"","sources":["../../src/constants/carePlanConditionActions.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GAAG;IACzC,WAAW,EAAE,eAAe;IAC5B,YAAY,EAAE,eAAe;IAC7B,cAAc,EAAE,kBAAkB;IAClC,gBAAgB,EAAE,mBAAmB;IACrC,mBAAmB,EAAE,uBAAuB;CAC7C,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './documents';
2
2
  export * from './functionOperations';
3
3
  export * from './getAllJsonKeyAndValues';
4
+ export * from './intervalWithRetries';
4
5
  export * from './newValueInstance';
5
6
  export * from './removeNullAndUndefinedValues';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./documents"), exports);
18
18
  __exportStar(require("./functionOperations"), exports);
19
19
  __exportStar(require("./getAllJsonKeyAndValues"), exports);
20
+ __exportStar(require("./intervalWithRetries"), exports);
20
21
  __exportStar(require("./newValueInstance"), exports);
21
22
  __exportStar(require("./removeNullAndUndefinedValues"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,uDAAqC;AACrC,2DAAyC;AACzC,qDAAmC;AACnC,iEAA+C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,uDAAqC;AACrC,2DAAyC;AACzC,wDAAsC;AACtC,qDAAmC;AACnC,iEAA+C"}
@@ -0,0 +1,3 @@
1
+ type AsyncFunc = (signal: AbortController) => Promise<any>;
2
+ export declare const intervalWithRetries: (asyncFunc: AsyncFunc, maxRetries: number, intervalTime: number, maxTime?: number) => Promise<-1 | 0 | null | any>;
3
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.intervalWithRetries = void 0;
13
+ const rxjs_1 = require("rxjs");
14
+ const intervalWithRetries = (asyncFunc, maxRetries, intervalTime, maxTime) => {
15
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const controller = new AbortController();
17
+ controller.signal.addEventListener('abort', () => {
18
+ resolve(-1);
19
+ });
20
+ let isTimeout = false;
21
+ if (maxTime && maxTime > 0) {
22
+ (0, rxjs_1.timer)(maxTime).subscribe(() => {
23
+ isTimeout = true;
24
+ resolve(0);
25
+ });
26
+ }
27
+ let tryCount = 1;
28
+ do {
29
+ if (isTimeout) {
30
+ break;
31
+ }
32
+ try {
33
+ resolve(yield asyncFunc(controller));
34
+ break;
35
+ // eslint-disable-next-line
36
+ }
37
+ catch (error) {
38
+ yield new Promise((resolve) => (0, rxjs_1.timer)(intervalTime).subscribe(resolve));
39
+ }
40
+ } while (maxRetries > tryCount++);
41
+ resolve(null);
42
+ }));
43
+ };
44
+ exports.intervalWithRetries = intervalWithRetries;
45
+ //# sourceMappingURL=intervalWithRetries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalWithRetries.js","sourceRoot":"","sources":["../../src/utils/intervalWithRetries.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA6B;AAKtB,MAAM,mBAAmB,GAAG,CACjC,SAAoB,EACpB,UAAkB,EAClB,YAAoB,EACpB,OAAgB,EACc,EAAE;IAChC,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YAC/C,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QACH,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,OAAO,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAA,YAAK,EAAC,OAAO,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;gBAC5B,SAAS,GAAG,IAAI,CAAC;gBACjB,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,GAAG,CAAC;YACF,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM;YACR,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;gBACrC,MAAM;gBACN,2BAA2B;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,YAAK,EAAC,YAAY,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACzE,CAAC;QACH,CAAC,QAAQ,UAAU,GAAG,QAAQ,EAAE,EAAE;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC;AAjCW,QAAA,mBAAmB,uBAiC9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pegasimed.com/shared-tools",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Pegasi shared tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,20 +39,20 @@
39
39
  "type-check": "^0.4.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@pegasimed.com/hl7-dev": "^1.26.50",
42
+ "@pegasimed.com/hl7-dev": "^1.26.51",
43
43
  "@pegasimed.com/testing-tools": "^1.0.43",
44
44
  "@types/mocha": "^10.0.10",
45
- "@types/node": "^22.10.7",
45
+ "@types/node": "^22.10.10",
46
46
  "@types/type-check": "^0.3.31",
47
- "@typescript-eslint/parser": "^8.20.0",
47
+ "@typescript-eslint/parser": "^8.21.0",
48
48
  "commitizen": "^4.3.1",
49
49
  "cz-conventional-changelog": "^3.3.0",
50
- "eslint": "^9.18.0",
50
+ "eslint": "^9.19.0",
51
51
  "eslint-config-prettier": "^10.0.1",
52
- "eslint-plugin-prettier": "^5.2.2",
52
+ "eslint-plugin-prettier": "^5.2.3",
53
53
  "husky": "^9.1.7",
54
- "lint-staged": "^15.4.1",
55
- "mocha": "^11.0.1",
54
+ "lint-staged": "^15.4.2",
55
+ "mocha": "^11.1.0",
56
56
  "nyc": "^17.1.0",
57
57
  "prettier": "^3.4.2",
58
58
  "rimraf": "^6.0.1",