@provis/provis-common-be-module 2.3.24 → 2.3.25

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 (135) hide show
  1. package/package.json +1 -1
  2. package/dist/class/main.repository.d.ts +0 -27
  3. package/dist/class/main.repository.js +0 -303
  4. package/dist/constants/brokerage.d.ts +0 -25
  5. package/dist/constants/brokerage.js +0 -30
  6. package/dist/constants/claim/document-container.d.ts +0 -14
  7. package/dist/constants/claim/document-container.js +0 -65
  8. package/dist/constants/claim/generalInsurance.d.ts +0 -535
  9. package/dist/constants/claim/generalInsurance.js +0 -18
  10. package/dist/constants/claim/kalog.d.ts +0 -28
  11. package/dist/constants/claim/kalog.js +0 -186
  12. package/dist/constants/claim/loket.d.ts +0 -36
  13. package/dist/constants/claim/loket.js +0 -290
  14. package/dist/constants/claim/motorVehicle.d.ts +0 -158
  15. package/dist/constants/claim/motorVehicle.js +0 -139
  16. package/dist/constants/claim/status.d.ts +0 -137
  17. package/dist/constants/claim/status.js +0 -160
  18. package/dist/constants/claim/travel.d.ts +0 -358
  19. package/dist/constants/claim/travel.js +0 -268
  20. package/dist/constants/config.d.ts +0 -2
  21. package/dist/constants/config.js +0 -23
  22. package/dist/constants/currency.d.ts +0 -2
  23. package/dist/constants/currency.js +0 -7
  24. package/dist/constants/index.d.ts +0 -5
  25. package/dist/constants/index.js +0 -11
  26. package/dist/constants/join.d.ts +0 -5
  27. package/dist/constants/join.js +0 -2
  28. package/dist/constants/loket.d.ts +0 -17
  29. package/dist/constants/loket.js +0 -19
  30. package/dist/constants/martialStatus.d.ts +0 -2
  31. package/dist/constants/martialStatus.js +0 -32
  32. package/dist/constants/operator.d.ts +0 -2
  33. package/dist/constants/operator.js +0 -12
  34. package/dist/constants/product/cargo.d.ts +0 -39
  35. package/dist/constants/product/cargo.js +0 -41
  36. package/dist/constants/product/mv/clause.d.ts +0 -52
  37. package/dist/constants/product/mv/clause.js +0 -214
  38. package/dist/constants/product/mv/merk.d.ts +0 -7
  39. package/dist/constants/product/mv/merk.js +0 -111
  40. package/dist/constants/product/mv/mv.d.ts +0 -48
  41. package/dist/constants/product/mv/mv.js +0 -215
  42. package/dist/constants/product/mv/plat.d.ts +0 -7
  43. package/dist/constants/product/mv/plat.js +0 -334
  44. package/dist/constants/product/mv.d.ts +0 -30
  45. package/dist/constants/product/mv.js +0 -158
  46. package/dist/constants/product/occupation.d.ts +0 -5
  47. package/dist/constants/product/occupation.js +0 -25
  48. package/dist/constants/product/policy.d.ts +0 -31
  49. package/dist/constants/product/policy.js +0 -33
  50. package/dist/constants/product.d.ts +0 -72
  51. package/dist/constants/product.js +0 -394
  52. package/dist/constants/quotation.d.ts +0 -32
  53. package/dist/constants/quotation.js +0 -38
  54. package/dist/constants/report.d.ts +0 -46
  55. package/dist/constants/report.js +0 -60
  56. package/dist/constants/vesselList.d.ts +0 -5
  57. package/dist/constants/vesselList.js +0 -116
  58. package/dist/helpers/addDateTime.d.ts +0 -6
  59. package/dist/helpers/addDateTime.js +0 -30
  60. package/dist/helpers/amountDescription.d.ts +0 -1
  61. package/dist/helpers/amountDescription.js +0 -44
  62. package/dist/helpers/axiosGet.d.ts +0 -8
  63. package/dist/helpers/axiosGet.js +0 -47
  64. package/dist/helpers/axiosPost.d.ts +0 -8
  65. package/dist/helpers/axiosPost.js +0 -46
  66. package/dist/helpers/axiosPut.d.ts +0 -8
  67. package/dist/helpers/axiosPut.js +0 -46
  68. package/dist/helpers/calculateByType.d.ts +0 -5
  69. package/dist/helpers/calculateByType.js +0 -19
  70. package/dist/helpers/calculateForNullable.d.ts +0 -5
  71. package/dist/helpers/calculateForNullable.js +0 -47
  72. package/dist/helpers/combineObj.d.ts +0 -2
  73. package/dist/helpers/combineObj.js +0 -17
  74. package/dist/helpers/compareDiffObj.d.ts +0 -2
  75. package/dist/helpers/compareDiffObj.js +0 -14
  76. package/dist/helpers/convertCurrencySymbol.d.ts +0 -2
  77. package/dist/helpers/convertCurrencySymbol.js +0 -20
  78. package/dist/helpers/convertDateTimeFormat.d.ts +0 -6
  79. package/dist/helpers/convertDateTimeFormat.js +0 -113
  80. package/dist/helpers/convertObjToNumber.d.ts +0 -2
  81. package/dist/helpers/convertObjToNumber.js +0 -14
  82. package/dist/helpers/convertToCurrency.d.ts +0 -2
  83. package/dist/helpers/convertToCurrency.js +0 -21
  84. package/dist/helpers/excelDateToJsDate.d.ts +0 -4
  85. package/dist/helpers/excelDateToJsDate.js +0 -30
  86. package/dist/helpers/filterObj.d.ts +0 -2
  87. package/dist/helpers/filterObj.js +0 -9
  88. package/dist/helpers/generateHashString.d.ts +0 -2
  89. package/dist/helpers/generateHashString.js +0 -15
  90. package/dist/helpers/generateRelationId.d.ts +0 -2
  91. package/dist/helpers/generateRelationId.js +0 -15
  92. package/dist/helpers/getCargoType.d.ts +0 -2
  93. package/dist/helpers/getCargoType.js +0 -9
  94. package/dist/helpers/getCurrentDate.d.ts +0 -2
  95. package/dist/helpers/getCurrentDate.js +0 -11
  96. package/dist/helpers/getDiffValue.d.ts +0 -2
  97. package/dist/helpers/getDiffValue.js +0 -24
  98. package/dist/helpers/getObjByKeys.d.ts +0 -2
  99. package/dist/helpers/getObjByKeys.js +0 -19
  100. package/dist/helpers/index.d.ts +0 -25
  101. package/dist/helpers/index.js +0 -51
  102. package/dist/helpers/loop.d.ts +0 -2
  103. package/dist/helpers/loop.js +0 -21
  104. package/dist/helpers/loopBackward.d.ts +0 -2
  105. package/dist/helpers/loopBackward.js +0 -21
  106. package/dist/helpers/mergeObj.d.ts +0 -2
  107. package/dist/helpers/mergeObj.js +0 -16
  108. package/dist/helpers/readExcel.d.ts +0 -5
  109. package/dist/helpers/readExcel.js +0 -115
  110. package/dist/helpers/searchValue.d.ts +0 -4
  111. package/dist/helpers/searchValue.js +0 -63
  112. package/dist/index.d.ts +0 -3
  113. package/dist/index.js +0 -7
  114. package/dist/interface/axios.interface.d.ts +0 -5
  115. package/dist/interface/axios.interface.js +0 -2
  116. package/dist/interface/find.all.count.interface.d.ts +0 -10
  117. package/dist/interface/find.all.count.interface.js +0 -2
  118. package/dist/interface/multi.join.interface.d.ts +0 -9
  119. package/dist/interface/multi.join.interface.js +0 -2
  120. package/dist/interface/read.excel.interface.d.ts +0 -12
  121. package/dist/interface/read.excel.interface.js +0 -2
  122. package/dist/interface/search.conditions.interface.d.ts +0 -8
  123. package/dist/interface/search.conditions.interface.js +0 -2
  124. package/dist/interface/search.initial.interface.d.ts +0 -8
  125. package/dist/interface/search.initial.interface.js +0 -2
  126. package/dist/interface/search.query.interface.d.ts +0 -5
  127. package/dist/interface/search.query.interface.js +0 -3
  128. package/dist/interface/search.summary.interface.d.ts +0 -9
  129. package/dist/interface/search.summary.interface.js +0 -2
  130. package/dist/interface/search.value.interface.d.ts +0 -6
  131. package/dist/interface/search.value.interface.js +0 -3
  132. package/dist/interface/summary.field.interface.d.ts +0 -4
  133. package/dist/interface/summary.field.interface.js +0 -3
  134. package/dist/interface/user.interface.d.ts +0 -4
  135. package/dist/interface/user.interface.js +0 -2
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../constants/config");
4
- exports.default = ({ datetime, addDatetime, type, }) => {
5
- try {
6
- switch (type) {
7
- case config_1.default.date_time_type_for_days: /** addDatetime = 2 => how many date */
8
- return (datetime + (parseInt(addDatetime) * 3600000 * 24));
9
- case config_1.default.date_time_type_for_time: /** addDatetime = 18:00:00 => only time */
10
- const time = addDatetime.split(':'); // 0->hour, 1->minute, 2->second
11
- return (datetime
12
- + (parseInt(time[0]) * 3600000)
13
- + (parseInt(time[1]) * 60000)
14
- + (parseInt(time[2]) * 1000));
15
- case config_1.default.date_time_type_for_set_time:
16
- const date = new Date(datetime); /** addDatetime = 18:00:00 => only time */
17
- const settime = addDatetime.split(':'); // 0->hour, 1->minute, 2->second
18
- date.setHours(parseInt(settime[0]));
19
- date.setMinutes(parseInt(settime[1]));
20
- date.setSeconds(parseInt(settime[2]));
21
- return date.getTime();
22
- default:
23
- return null;
24
- }
25
- }
26
- catch (err) {
27
- console.log(`[error] ${err.message}`);
28
- return null;
29
- }
30
- };
@@ -1 +0,0 @@
1
- export default function terbilang(value: number): string;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function terbilang(value) {
4
- const satuan = ['', 'satu', 'dua', 'tiga', 'empat', 'lima', 'enam', 'tujuh', 'delapan', 'sembilan'];
5
- const belasan = ['sepuluh', 'sebelas', 'dua belas', 'tiga belas', 'empat belas', 'lima belas', 'enam belas', 'tujuh belas', 'delapan belas', 'sembilan belas'];
6
- const puluhan = ['', '', 'dua puluh', 'tiga puluh', 'empat puluh', 'lima puluh', 'enam puluh', 'tujuh puluh', 'delapan puluh', 'sembilan puluh'];
7
- let result = '';
8
- if (value < 10) {
9
- result = satuan[value];
10
- }
11
- else if (value < 20) {
12
- result = belasan[value - 10];
13
- }
14
- else if (value < 100) {
15
- result = puluhan[Math.floor(value / 10)] + ' ' + satuan[value % 10];
16
- }
17
- else if (value < 200) {
18
- result = 'seratus ' + terbilang(value - 100);
19
- }
20
- else if (value < 1000) {
21
- result = satuan[Math.floor(value / 100)] + ' ratus ' + terbilang(value % 100);
22
- }
23
- else if (value < 2000) {
24
- result = 'seribu ' + terbilang(value - 1000);
25
- }
26
- else if (value < 1000000) {
27
- result = terbilang(Math.floor(value / 1000)) + ' ribu ' + terbilang(value % 1000);
28
- }
29
- else if (value < 1000000000) {
30
- result = terbilang(Math.floor(value / 1000000)) + ' juta ' + terbilang(value % 1000000);
31
- }
32
- else if (value < 1000000000000) {
33
- result = terbilang(Math.floor(value / 1000000000)) + ' milyar ' + terbilang(value % 1000000000);
34
- }
35
- else if (value < 1000000000000000) {
36
- result = terbilang(Math.floor(value / 1000000000000)) + ' triliun ' + terbilang(value % 1000000000000);
37
- }
38
- else {
39
- result = 'Angka terlalu besar';
40
- }
41
- // Menghilangkan spasi yang double
42
- return result.replace(/\s+/g, ' ').trim();
43
- }
44
- exports.default = terbilang;
@@ -1,8 +0,0 @@
1
- import IAxios from '../interface/axios.interface';
2
- declare const _default: ({ url, headers, params, callback, }: {
3
- url: string;
4
- headers: any;
5
- params?: any;
6
- callback?: (response: any) => Promise<IAxios<any>>;
7
- }) => Promise<IAxios<any>>;
8
- export default _default;
@@ -1,47 +0,0 @@
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
- const axios_1 = require("axios");
13
- const generateRelationId_1 = require("./generateRelationId");
14
- const getCurrentDate_1 = require("./getCurrentDate");
15
- const constants_1 = require("../constants");
16
- exports.default = ({ url, headers, params, callback, }) => __awaiter(void 0, void 0, void 0, function* () {
17
- return yield axios_1.default.get(url, {
18
- params,
19
- headers: Object.assign({ 'Content-Type': 'application/json', 'X-Correlation-Id': (0, generateRelationId_1.default)(24), 'X-Transmission-Date-Time': (0, getCurrentDate_1.default)() }, headers),
20
- }).then((result) => __awaiter(void 0, void 0, void 0, function* () {
21
- if (result.data.statusCode === constants_1.config.HTTP_STATUS_OK) {
22
- if (callback) {
23
- return yield callback(result.data).catch((err) => {
24
- console.log(`[error][${(0, getCurrentDate_1.default)()}]. Error: ${err.message}`);
25
- return {
26
- statusCode: constants_1.config.HTTP_STATUS_SERVER_ERROR,
27
- message: err.message,
28
- };
29
- });
30
- }
31
- else {
32
- return {
33
- statusCode: result.data.statusCode,
34
- data: result.data.data,
35
- };
36
- }
37
- }
38
- else {
39
- return {
40
- statusCode: result.data.statusCode,
41
- message: result.data.message,
42
- };
43
- }
44
- })).catch((err) => {
45
- throw new Error(err);
46
- });
47
- });
@@ -1,8 +0,0 @@
1
- import IAxios from '../interface/axios.interface';
2
- declare const _default: ({ url, headers, body, callback, }: {
3
- url: string;
4
- headers: any;
5
- body: any;
6
- callback?: (response: any) => Promise<IAxios<any>>;
7
- }) => Promise<IAxios<any>>;
8
- export default _default;
@@ -1,46 +0,0 @@
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
- const axios_1 = require("axios");
13
- const generateRelationId_1 = require("./generateRelationId");
14
- const getCurrentDate_1 = require("./getCurrentDate");
15
- const constants_1 = require("../constants");
16
- exports.default = ({ url, headers, body, callback, }) => __awaiter(void 0, void 0, void 0, function* () {
17
- return yield axios_1.default.post(url, body, {
18
- headers: Object.assign({ 'Content-Type': 'application/json', 'X-Correlation-Id': (0, generateRelationId_1.default)(24), 'X-Transmission-Date-Time': (0, getCurrentDate_1.default)() }, headers),
19
- }).then((result) => __awaiter(void 0, void 0, void 0, function* () {
20
- if (result.data.statusCode === constants_1.config.HTTP_STATUS_OK) {
21
- if (callback) {
22
- return yield callback(result.data).catch((err) => {
23
- console.log(`[error][${(0, getCurrentDate_1.default)()}]. Error: ${err.message}`);
24
- return {
25
- statusCode: constants_1.config.HTTP_STATUS_SERVER_ERROR,
26
- message: err.message,
27
- };
28
- });
29
- }
30
- else {
31
- return {
32
- statusCode: result.data.statusCode,
33
- data: result.data.data,
34
- };
35
- }
36
- }
37
- else {
38
- return {
39
- statusCode: result.data.statusCode,
40
- message: result.data.message,
41
- };
42
- }
43
- })).catch((err) => {
44
- throw new Error(err);
45
- });
46
- });
@@ -1,8 +0,0 @@
1
- import IAxios from '../interface/axios.interface';
2
- declare const _default: ({ url, headers, body, callback, }: {
3
- url: string;
4
- headers: any;
5
- body: any;
6
- callback?: (response: any) => Promise<IAxios<any>>;
7
- }) => Promise<IAxios<any>>;
8
- export default _default;
@@ -1,46 +0,0 @@
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
- const axios_1 = require("axios");
13
- const constants_1 = require("../constants");
14
- const generateRelationId_1 = require("./generateRelationId");
15
- const getCurrentDate_1 = require("./getCurrentDate");
16
- exports.default = ({ url, headers, body, callback, }) => __awaiter(void 0, void 0, void 0, function* () {
17
- return yield axios_1.default.put(url, body, {
18
- headers: Object.assign({ 'Content-Type': 'application/json', 'X-Correlation-Id': (0, generateRelationId_1.default)(24), 'X-Transmission-Date-Time': (0, getCurrentDate_1.default)() }, headers),
19
- }).then((result) => __awaiter(void 0, void 0, void 0, function* () {
20
- if (result.data.statusCode === constants_1.config.HTTP_STATUS_OK) {
21
- if (callback) {
22
- return yield callback(result.data).catch((err) => {
23
- console.log(`[error][${(0, getCurrentDate_1.default)()}]. Error: ${err.message}`);
24
- return {
25
- statusCode: constants_1.config.HTTP_STATUS_SERVER_ERROR,
26
- message: err.message,
27
- };
28
- });
29
- }
30
- else {
31
- return {
32
- statusCode: result.data.statusCode,
33
- data: result.data.data,
34
- };
35
- }
36
- }
37
- else {
38
- return {
39
- statusCode: result.data.statusCode,
40
- message: result.data.message,
41
- };
42
- }
43
- })).catch((err) => {
44
- throw new Error(err);
45
- });
46
- });
@@ -1,5 +0,0 @@
1
- export default function (request: {
2
- amount: number;
3
- rate: number;
4
- type: string;
5
- }): number | null;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const brokerage_1 = require("../constants/brokerage");
4
- function default_1(request) {
5
- try {
6
- switch (request.type.toLowerCase()) {
7
- case brokerage_1.default.TYPE_BROKERAGE_FIX_AMOUNT.code:
8
- return request.rate;
9
- case brokerage_1.default.TYPE_BROKERAGE_PERCENTAGE.code:
10
- return request.rate * request.amount / 100;
11
- default:
12
- return null;
13
- }
14
- }
15
- catch (_a) {
16
- return null;
17
- }
18
- }
19
- exports.default = default_1;
@@ -1,5 +0,0 @@
1
- declare function sum(a: number | null, b: number | null): number;
2
- declare function minus(a: number | null, b: number | null): number;
3
- declare function multiple(a: number | null, b: number | null): number;
4
- declare function divide(a: number | null, b: number | null): number;
5
- export { sum, minus, multiple, divide, };
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.divide = exports.multiple = exports.minus = exports.sum = void 0;
4
- function sum(a, b) {
5
- try {
6
- if (a == null && b == null)
7
- return null;
8
- return (a ? Number(a) : 0) + (b ? Number(b) : 0);
9
- }
10
- catch (_a) {
11
- return null;
12
- }
13
- }
14
- exports.sum = sum;
15
- function minus(a, b) {
16
- try {
17
- if (a == null && b == null)
18
- return null;
19
- return (a ? Number(a) : 0) - (b ? Number(b) : 0);
20
- }
21
- catch (_a) {
22
- return null;
23
- }
24
- }
25
- exports.minus = minus;
26
- function multiple(a, b) {
27
- try {
28
- if (a == null && b == null)
29
- return null;
30
- return (a ? Number(a) : 0) * (b ? Number(b) : 0);
31
- }
32
- catch (_a) {
33
- return null;
34
- }
35
- }
36
- exports.multiple = multiple;
37
- function divide(a, b) {
38
- try {
39
- if (a == null && b == null)
40
- return null;
41
- return (a ? Number(a) : 0) - (b ? Number(b) : 0);
42
- }
43
- catch (_a) {
44
- return null;
45
- }
46
- }
47
- exports.divide = divide;
@@ -1,2 +0,0 @@
1
- declare const _default: (obj1: any, obj2: any) => any;
2
- export default _default;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const lodash_1 = require("lodash");
4
- exports.default = (obj1, obj2) => {
5
- const combine = Object.assign({}, obj2);
6
- for (const key in obj1) {
7
- if (combine[key]) {
8
- if ((0, lodash_1.isEmpty)(combine[key])) {
9
- combine[key] = obj1[key];
10
- }
11
- }
12
- else {
13
- combine[key] = obj1[key];
14
- }
15
- }
16
- return combine;
17
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (oldObj: any, newObj: any) => any;
2
- export default _default;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
4
- exports.default = (oldObj, newObj) => {
5
- return [...Object.keys(newObj), ...Object.keys(oldObj)].reduce((arr, key) => {
6
- if (newObj[key] === undefined)
7
- return Object.assign(Object.assign({}, arr), { [key]: oldObj[key] });
8
- if (oldObj[key] === undefined)
9
- return Object.assign(Object.assign({}, arr), { [key]: newObj[key] });
10
- if (oldObj[key] != newObj[key])
11
- return Object.assign(Object.assign({}, arr), { [key]: oldObj[key] });
12
- return arr;
13
- }, {});
14
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (currencyCode: string) => string | null;
2
- export default _default;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getCurrentDate_1 = require("./getCurrentDate");
4
- const currency_1 = require("../constants/currency");
5
- exports.default = (currencyCode) => {
6
- try {
7
- switch (currencyCode) {
8
- case currency_1.default.CURRENCY_IDR:
9
- return 'Rp.';
10
- case currency_1.default.CURRENCY_USD:
11
- return '$';
12
- default:
13
- throw new Error(`this currency code ${currencyCode} is not found`);
14
- }
15
- }
16
- catch (err) {
17
- console.log(`[error][${(0, getCurrentDate_1.default)()}] Convert to currency error: ${err.message}`);
18
- return '-';
19
- }
20
- };
@@ -1,6 +0,0 @@
1
- declare const _default: ({ initialValue, dateTimeFormatFrom, dateTimeFormatTo, }: {
2
- initialValue: string | Date | number;
3
- dateTimeFormatFrom: string;
4
- dateTimeFormatTo: string;
5
- }) => Date | number | string;
6
- export default _default;
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../constants/config");
4
- const getCurrentDate_1 = require("./getCurrentDate");
5
- const monthIndo = [
6
- 'Januari',
7
- 'Februari',
8
- 'Maret',
9
- 'April',
10
- 'Mei',
11
- "Juni",
12
- 'Juli',
13
- 'Agustus',
14
- 'September',
15
- 'Oktober',
16
- 'November',
17
- 'Desember',
18
- ];
19
- const monthEng = [
20
- 'January',
21
- 'February',
22
- 'March',
23
- 'April',
24
- 'May',
25
- "June",
26
- 'July',
27
- 'August',
28
- 'September',
29
- 'October',
30
- 'November',
31
- 'December',
32
- ];
33
- exports.default = ({ initialValue, dateTimeFormatFrom, dateTimeFormatTo, }) => {
34
- try {
35
- if (!initialValue) {
36
- throw new Error('initial value is not found');
37
- }
38
- let dateValue = new Date();
39
- switch (dateTimeFormatFrom) {
40
- case config_1.default.date_simple_format:
41
- const splitValue = initialValue.toString().split('-'); // 2020-03-30
42
- dateValue.setFullYear(parseInt(splitValue[0]), parseInt(splitValue[1]) - 1, parseInt(splitValue[2]));
43
- dateValue.setHours(0);
44
- dateValue.setMinutes(0);
45
- dateValue.setSeconds(0);
46
- break;
47
- case config_1.default.date_format_full_datetime_without_milisecond_with_separator:
48
- let spaceValue = initialValue.toString().split(' '); // 2020-03-30 23:12:21
49
- if (spaceValue.length < 2) {
50
- spaceValue = initialValue.toString().split('T');
51
- if (spaceValue.length < 2) {
52
- throw new Error(`initial value ${initialValue} is undeclare`);
53
- }
54
- }
55
- const yearDateValue = spaceValue[0].split('-');
56
- dateValue.setFullYear(parseInt(yearDateValue[0]), parseInt(yearDateValue[1]) - 1, parseInt(yearDateValue[2]));
57
- const timeValue = spaceValue[1].split(':');
58
- dateValue.setHours(parseInt(timeValue[0]));
59
- dateValue.setMinutes(parseInt(timeValue[1]));
60
- dateValue.setSeconds(parseInt(timeValue[2]));
61
- break;
62
- case config_1.default.date_format_timestamp:
63
- dateValue = (!(initialValue instanceof Date) ? new Date(initialValue) : initialValue);
64
- break;
65
- default:
66
- throw new Error('dateTimeFormatFrom is undefined');
67
- }
68
- switch (dateTimeFormatTo) {
69
- case config_1.default.date_simple_format_withoud_dash:
70
- return `${dateValue.getFullYear()}${(dateValue.getMonth() < 9 ? (`0${(dateValue.getMonth() + 1)}`) : (dateValue.getMonth() + 1))}${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())}`;
71
- case config_1.default.date_format_full_datetime_with_separator:
72
- return `${dateValue.getFullYear()}-\
73
- ${(dateValue.getMonth() < 9 ? (`0${(dateValue.getMonth() + 1)}`) : (dateValue.getMonth() + 1))}-\
74
- ${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())} \
75
- ${(dateValue.getHours() < 10 ? (`0${dateValue.getHours()}`) : dateValue.getHours())}:\
76
- ${(dateValue.getMinutes() < 10 ? (`0${dateValue.getMinutes()}`) : dateValue.getMinutes())}:\
77
- ${(dateValue.getSeconds() < 10 ? (`0${dateValue.getSeconds()}`) : dateValue.getSeconds())}.\
78
- ${dateValue.getMilliseconds()}`;
79
- case config_1.default.date_format_full_datetime_without_milisecond_with_separator:
80
- return `${dateValue.getFullYear()}-\
81
- ${(dateValue.getMonth() < 9 ? (`0${(dateValue.getMonth() + 1)}`) : (dateValue.getMonth() + 1))}-\
82
- ${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())} \
83
- ${(dateValue.getHours() < 10 ? (`0${dateValue.getHours()}`) : dateValue.getHours())}:\
84
- ${(dateValue.getMinutes() < 10 ? (`0${dateValue.getMinutes()}`) : dateValue.getMinutes())}:\
85
- ${(dateValue.getSeconds() < 10 ? (`0${dateValue.getSeconds()}`) : dateValue.getSeconds())}`;
86
- case config_1.default.date_format_full_datetime_only:
87
- return `${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())}-\
88
- ${(dateValue.getMonth() < 9 ? (`0${(dateValue.getMonth() + 1)}`) : (dateValue.getMonth() + 1))}-\
89
- ${dateValue.getFullYear()} \
90
- ${(dateValue.getHours() < 10 ? (`0${dateValue.getHours()}`) : dateValue.getHours())}:\
91
- ${(dateValue.getMinutes() < 10 ? (`0${dateValue.getMinutes()}`) : dateValue.getMinutes())}:\
92
- ${(dateValue.getSeconds() < 10 ? (`0${dateValue.getSeconds()}`) : dateValue.getSeconds())}`;
93
- case config_1.default.date_simple_format:
94
- return `${dateValue.getFullYear()}-${(dateValue.getMonth() < 9 ?
95
- (`0${(dateValue.getMonth() + 1)}`) : (dateValue.getMonth() + 1))}-${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())}`;
96
- case config_1.default.date_format_timestamp:
97
- return dateValue.getTime();
98
- case config_1.default.date_format_indonesia_format:
99
- return `${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())} ${monthIndo[dateValue.getMonth()]} ${dateValue.getFullYear()}`;
100
- case config_1.default.date_format_english_format:
101
- return `${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())} ${monthEng[dateValue.getMonth()]} ${dateValue.getFullYear()}`;
102
- case config_1.default.date_simple_indonesia_format:
103
- return `${(dateValue.getDate() < 10 ? (`0${dateValue.getDate()}`) : dateValue.getDate())}-${(dateValue.getMonth() < 9 ?
104
- (`0${(dateValue.getMonth() + 1)}`) : (dateValue.getMonth() + 1))}-${dateValue.getFullYear()}`;
105
- default:
106
- throw new Error('s is undefined');
107
- }
108
- }
109
- catch (err) {
110
- console.log(`[error][${(0, getCurrentDate_1.default)()}]. initialValue: ${initialValue}, dateTimeFormatFrom: ${dateTimeFormatFrom}, dateTimeFormatTo: ${dateTimeFormatTo}. Error: ${err.message}`);
111
- return '';
112
- }
113
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (obj: number | string | null) => number;
2
- export default _default;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (obj) => {
4
- try {
5
- if (obj === null || obj === undefined)
6
- return 0;
7
- if (typeof obj === 'string')
8
- return parseFloat(obj);
9
- return obj;
10
- }
11
- catch (_a) {
12
- return 0;
13
- }
14
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (decimal: number | string, isCheckNegative?: boolean) => string | null;
2
- export default _default;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getCurrentDate_1 = require("./getCurrentDate");
4
- exports.default = (decimal, isCheckNegative = false) => {
5
- try {
6
- if (decimal === undefined || decimal === null)
7
- return '-';
8
- let currency = (typeof decimal === 'string') ? decimal = parseFloat(decimal) : decimal;
9
- if (decimal === 0)
10
- return '-';
11
- if (isCheckNegative && currency < 0) {
12
- currency = currency * -1;
13
- return `(${currency.toLocaleString(undefined, { minimumFractionDigits: 0 })})`;
14
- }
15
- return currency.toLocaleString(undefined, { minimumFractionDigits: 0 });
16
- }
17
- catch (err) {
18
- console.log(`[error][${(0, getCurrentDate_1.default)()}] Convert to currency error: ${err.message}`);
19
- return '-';
20
- }
21
- };
@@ -1,4 +0,0 @@
1
- declare const _default: ({ initialValue, }: {
2
- initialValue: number;
3
- }) => Date | number | string;
4
- export default _default;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = ({ initialValue, }) => {
4
- try {
5
- if (!initialValue) {
6
- throw new Error('initial value is not found');
7
- }
8
- const datePattern = /^\d{2}-\d{2}-\d{4}$/;
9
- if (datePattern.test(String(initialValue))) {
10
- const parts = String(initialValue).split('-');
11
- const day = parseInt(parts[0]);
12
- const month = parseInt(parts[1]);
13
- const year = parseInt(parts[2]);
14
- return `${year}-${month}-${day}`;
15
- }
16
- const utc_days = Math.floor(initialValue - 25569);
17
- const utc_value = utc_days * 86400;
18
- const date_info = new Date(utc_value * 1000);
19
- const fractional_day = initialValue - Math.floor(initialValue) + 0.0000001;
20
- let total_seconds = Math.floor(86400 * fractional_day);
21
- const seconds = total_seconds % 60;
22
- total_seconds -= seconds;
23
- const hours = Math.floor(total_seconds / (60 * 60));
24
- const minutes = Math.floor(total_seconds / 60) % 60;
25
- return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate(), hours, minutes, seconds);
26
- }
27
- catch (err) {
28
- throw new Error(`error convert ${err.message}`);
29
- }
30
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (obj: any, filters: string[]) => {};
2
- export default _default;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
4
- exports.default = (obj, filters) => {
5
- return Object.keys(obj).filter((key) => !filters.includes(key)).reduce((value, key) => {
6
- value[key] = obj[key];
7
- return value;
8
- }, {});
9
- };
@@ -1,2 +0,0 @@
1
- declare const _default: (message: string) => Promise<string>;
2
- export default _default;
@@ -1,15 +0,0 @@
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
- const sha512 = require("js-sha512");
13
- exports.default = (message) => __awaiter(void 0, void 0, void 0, function* () {
14
- return sha512.sha512(message);
15
- });
@@ -1,2 +0,0 @@
1
- declare const _default: (totalLength?: number) => string;
2
- export default _default;