@pegasimed.com/shared-tools 1.0.7 → 1.0.11
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.
- package/dist/constants/patterns.js +1 -1
- package/dist/constants/patterns.js.map +1 -1
- package/dist/custom-variable-resolvers/pipelines/calculateAge.d.ts +1 -0
- package/dist/custom-variable-resolvers/pipelines/calculateAge.js +9 -0
- package/dist/custom-variable-resolvers/pipelines/calculateAge.js.map +1 -0
- package/dist/custom-variable-resolvers/pipelines/index.d.ts +2 -0
- package/dist/custom-variable-resolvers/pipelines/index.js +2 -0
- package/dist/custom-variable-resolvers/pipelines/index.js.map +1 -1
- package/dist/custom-variable-resolvers/pipelines/toDate.d.ts +3 -0
- package/dist/custom-variable-resolvers/pipelines/toDate.js +12 -0
- package/dist/custom-variable-resolvers/pipelines/toDate.js.map +1 -0
- package/dist/utils/newValueInstance.d.ts +2 -1
- package/dist/utils/newValueInstance.js +18 -5
- package/dist/utils/newValueInstance.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PATTERN_VARIABLES_STRUCTURE = void 0;
|
|
4
|
-
exports.PATTERN_VARIABLES_STRUCTURE = /\[\[[a-zA-Z0-9
|
|
4
|
+
exports.PATTERN_VARIABLES_STRUCTURE = /\[\[[a-zA-Z0-9áéíóúÁÉÍÓÚüÜñÑ\-\.\_, \(\)]+( \| [a-zA-Z0-9]+(: [a-zA-Z0-9áéíóúÁÉÍÓÚüÜñÑ ,{}\+\-/*()&\.<=>\|\?'"_\-\^]+)*)*\]\]/g;
|
|
5
5
|
//# sourceMappingURL=patterns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/constants/patterns.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GACtC,
|
|
1
|
+
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/constants/patterns.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GACtC,gIAAgI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const calculateAge: (birthDate: string) => number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateAge = void 0;
|
|
4
|
+
const moment = require("moment");
|
|
5
|
+
const calculateAge = (birthDate) => {
|
|
6
|
+
return moment().diff(moment(birthDate), 'years');
|
|
7
|
+
};
|
|
8
|
+
exports.calculateAge = calculateAge;
|
|
9
|
+
//# sourceMappingURL=calculateAge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateAge.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/calculateAge.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAE3B,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAU,EAAE;IACxD,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './arrayFilter';
|
|
2
2
|
export * from './arrayJoin';
|
|
3
3
|
export * from './arrayMap';
|
|
4
|
+
export * from './calculateAge';
|
|
4
5
|
export * from './documentSelect';
|
|
5
6
|
export * from './toBoolean';
|
|
7
|
+
export * from './toDate';
|
|
6
8
|
export * from './toLowerCase';
|
|
7
9
|
export * from './toNumber';
|
|
8
10
|
export * from './toReplaceString';
|
|
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./arrayFilter"), exports);
|
|
18
18
|
__exportStar(require("./arrayJoin"), exports);
|
|
19
19
|
__exportStar(require("./arrayMap"), exports);
|
|
20
|
+
__exportStar(require("./calculateAge"), exports);
|
|
20
21
|
__exportStar(require("./documentSelect"), exports);
|
|
21
22
|
__exportStar(require("./toBoolean"), exports);
|
|
23
|
+
__exportStar(require("./toDate"), exports);
|
|
22
24
|
__exportStar(require("./toLowerCase"), exports);
|
|
23
25
|
__exportStar(require("./toNumber"), exports);
|
|
24
26
|
__exportStar(require("./toReplaceString"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,mDAAiC;AACjC,8CAA4B;AAC5B,gDAA8B;AAC9B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,iDAA+B;AAC/B,mDAAiC;AACjC,8CAA4B;AAC5B,2CAAyB;AACzB,gDAA8B;AAC9B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,gDAA8B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
type MomentFormat = 'LTS' | 'LT' | 'L' | 'l' | 'LL' | 'll' | 'LLL' | 'lll' | 'LLLL' | 'llll' | 'YYYY-MM-DDTHH:mm:ssZ' | 'YYYY-MM-DD HH:mm:ss' | 'YYYY-MM-DD' | 'YYYY-MM' | 'YYYY' | 'MM-DD' | 'MM/DD/YYYY' | 'hh:mm:ss' | 'HH:mm:ss' | 'HH:mm' | 'hh:mm' | 'dd' | 'ddd' | 'dddd' | 'a' | 'A' | 'Z' | 'ZZ' | 'X' | 'x';
|
|
2
|
+
export declare const toDate: (date: string, format?: MomentFormat) => Date | string;
|
|
3
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toDate = void 0;
|
|
4
|
+
const moment = require("moment");
|
|
5
|
+
const toDate = (date, format) => {
|
|
6
|
+
if (!Date.parse(date)) {
|
|
7
|
+
throw new Error('Invalid date');
|
|
8
|
+
}
|
|
9
|
+
return format ? moment(date).format(format || '') : new Date(date);
|
|
10
|
+
};
|
|
11
|
+
exports.toDate = toDate;
|
|
12
|
+
//# sourceMappingURL=toDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toDate.js","sourceRoot":"","sources":["../../../src/custom-variable-resolvers/pipelines/toDate.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAkC3B,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,MAAqB,EAAiB,EAAE;IAC3E,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC,CAAC;AANW,QAAA,MAAM,UAMjB"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const newValueInstance: (data:
|
|
1
|
+
export declare const newValueInstance: (data: object) => any;
|
|
2
|
+
export declare const newIntrinsicInstance: (data: any) => any;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newValueInstance = void 0;
|
|
3
|
+
exports.newIntrinsicInstance = exports.newValueInstance = void 0;
|
|
4
4
|
const type_check_1 = require("type-check");
|
|
5
5
|
const newValueInstance = (data) => {
|
|
6
|
-
|
|
6
|
+
return JSON.parse(JSON.stringify(data));
|
|
7
|
+
};
|
|
8
|
+
exports.newValueInstance = newValueInstance;
|
|
9
|
+
const newIntrinsicInstance = (data) => {
|
|
10
|
+
var _a;
|
|
11
|
+
let newValue = data;
|
|
7
12
|
if ((0, type_check_1.typeCheck)('String', data)) {
|
|
8
13
|
return String(data);
|
|
9
14
|
}
|
|
@@ -16,19 +21,27 @@ const newValueInstance = (data) => {
|
|
|
16
21
|
if ((0, type_check_1.typeCheck)('Date', data)) {
|
|
17
22
|
return new Date(data);
|
|
18
23
|
}
|
|
19
|
-
if ((0, type_check_1.typeCheck)('
|
|
24
|
+
if ((0, type_check_1.typeCheck)('Undefined', data)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if ((0, type_check_1.typeCheck)('Null', data)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if ((0, type_check_1.typeCheck)('Object', data) && ((_a = data === null || data === void 0 ? void 0 : data.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Object') {
|
|
20
31
|
newValue = Object.assign({}, data);
|
|
21
32
|
for (const key of Object.keys(newValue)) {
|
|
22
33
|
newValue[key] = (0, exports.newValueInstance)(newValue[key]);
|
|
23
34
|
}
|
|
35
|
+
return newValue;
|
|
24
36
|
}
|
|
25
37
|
if ((0, type_check_1.typeCheck)('Array', data)) {
|
|
26
38
|
newValue = [...data];
|
|
27
39
|
for (let i = 0; i < newValue.length; i++) {
|
|
28
40
|
newValue[i] = (0, exports.newValueInstance)(newValue[i]);
|
|
29
41
|
}
|
|
42
|
+
return newValue;
|
|
30
43
|
}
|
|
31
|
-
return newValue;
|
|
44
|
+
return newValue.toString();
|
|
32
45
|
};
|
|
33
|
-
exports.
|
|
46
|
+
exports.newIntrinsicInstance = newIntrinsicInstance;
|
|
34
47
|
//# sourceMappingURL=newValueInstance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newValueInstance.js","sourceRoot":"","sources":["../../src/utils/newValueInstance.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEhC,MAAM,gBAAgB,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"newValueInstance.js","sourceRoot":"","sources":["../../src/utils/newValueInstance.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEhC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEK,MAAM,oBAAoB,GAAG,CAAC,IAAS,EAAE,EAAE;;IAChD,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,IAAI,IAAA,sBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;QAC/B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,0CAAE,IAAI,MAAK,QAAQ,EAAE,CAAC;QACtE,QAAQ,qBAAQ,IAAI,CAAE,CAAC;QAEvB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAA,wBAAgB,EAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,IAAA,sBAAS,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;QAC7B,QAAQ,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAA,wBAAgB,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC7B,CAAC,CAAC;AA7CW,QAAA,oBAAoB,wBA6C/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pegasimed.com/shared-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Pegasi shared tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/devops-pegasi/shared-tools#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"moment": "^2.30.1",
|
|
35
36
|
"type-check": "^0.4.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|