bpjs-bridge 1.0.10 → 1.0.12

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const redis_1 = require("../lib/redis");
4
+ const pcare_service_1 = require("../services/pcare/pcare.service");
5
+ const config_1 = require("./config");
6
+ // Setup PcareService
7
+ const pcareService = new pcare_service_1.PcareService(config_1.PcareConfig, redis_1.redis);
8
+ describe("PcareService", () => {
9
+ afterAll(() => {
10
+ redis_1.redis.disconnect();
11
+ });
12
+ it("should load environment variables", () => {
13
+ console.log(config_1.PcareConfig);
14
+ expect(config_1.PcareConfig).toBeDefined();
15
+ });
16
+ it("peserta get", async () => {
17
+ await pcareService.flushAll();
18
+ const response = await pcareService.pendaftaran.getByProvider("09-01-2026", "0", "10");
19
+ console.log(response);
20
+ });
21
+ // it("pendaftaran test", async () => {
22
+ // const response = await pcareService.pendaftaran.add({
23
+ // kdProviderPeserta: "0138U013",
24
+ // tglDaftar: "09-01-2026",
25
+ // noKartu: "0002081643219",
26
+ // kdPoli: "001",
27
+ // keluhan: "sakit kepalak",
28
+ // kunjSakit: true,
29
+ // sistole: 0,
30
+ // diastole: 0,
31
+ // beratBadan: 0,
32
+ // tinggiBadan: 0,
33
+ // respRate: 0,
34
+ // lingkarPerut: 0,
35
+ // heartRate: 0,
36
+ // rujukBalik: 0,
37
+ // kdTkp: "10",
38
+ // });
39
+ // console.log(response);
40
+ // });
41
+ });
@@ -1,294 +1,11 @@
1
- export declare const enpoints: readonly [{
2
- readonly name: "diagnosa";
3
- readonly endpoint: "diagnosa/{kodediag}/{start}/{limit}";
4
- readonly method: "GET";
5
- readonly description: "Get Data Diagnosa dari BPJS PCare";
6
- }, {
7
- readonly name: "alergi_jenis";
8
- readonly endpoint: "alergi/jenis/{jenisAlergi}";
9
- readonly method: "GET";
10
- readonly description: "Get Data Alergi berdasarkan jenis";
11
- }, {
12
- readonly name: "dokter";
13
- readonly endpoint: "dokter/{start}/{limit}";
14
- readonly method: "GET";
15
- readonly description: "Get Data Dokter dari BPJS PCare";
16
- }, {
17
- readonly name: "kesadaran";
18
- readonly endpoint: "kesadaran";
19
- readonly method: "GET";
20
- readonly description: "Get Data Kesadaran dari BPJS PCare";
21
- }, {
22
- readonly name: "rujukan_kunjungan";
23
- readonly endpoint: "kunjungan/rujukan/{nomorKunjungan}";
24
- readonly method: "GET";
25
- readonly description: "Get Data Rujukan berdasarkan Nomor Kunjungan";
26
- }, {
27
- readonly name: "riwayat_kunjungan";
28
- readonly endpoint: "kunjungan/peserta/{nomorKartu}";
29
- readonly method: "GET";
30
- readonly description: "Get Data Riwayat Kunjungan berdasarkan Nomor Kartu Peserta";
31
- }, {
32
- readonly name: "tambah_kunjungan";
33
- readonly endpoint: "kunjungan/v1";
34
- readonly method: "POST";
35
- readonly description: "Add Data Kunjungan ke BPJS PCare";
36
- }, {
37
- readonly name: "edit_kunjungan";
38
- readonly endpoint: "kunjungan/v1";
39
- readonly method: "PUT";
40
- readonly description: "Edit Data Kunjungan di BPJS PCare";
41
- }, {
42
- readonly name: "hapus_kunjungan";
43
- readonly endpoint: "kunjungan/{nomorKunjungan}";
44
- readonly method: "DELETE";
45
- readonly description: "Delete Data Kunjungan berdasarkan Nomor Kunjungan";
46
- }, {
47
- readonly name: "dpho";
48
- readonly endpoint: "obat/dpho/{kodeNamaDPHO}/{start}/{limit}";
49
- readonly method: "GET";
50
- readonly description: "Get Data DPHO dari BPJS PCare berdasarkan kode atau nama";
51
- }, {
52
- readonly name: "obat_kunjungan";
53
- readonly endpoint: "obat/kunjungan/{nomorKunjungan}";
54
- readonly method: "GET";
55
- readonly description: "Get Data Obat berdasarkan Nomor Kunjungan";
56
- }, {
57
- readonly name: "tambah_obat";
58
- readonly endpoint: "obat/kunjungan";
59
- readonly method: "POST";
60
- readonly description: "Add Data Obat ke BPJS PCare";
61
- }, {
62
- readonly name: "hapus_obat";
63
- readonly endpoint: "obat/{kdObatSK}/kunjungan/{nomorKunjungan}";
64
- readonly method: "DELETE";
65
- readonly description: "Delete Data Obat berdasarkan kdObatSK dan Nomor Kunjungan";
66
- }, {
67
- readonly name: "provider_rayonisasi";
68
- readonly endpoint: "provider/{start}/{limit}";
69
- readonly method: "GET";
70
- readonly description: "Get Data Provider Rayonisasi dari BPJS PCare";
71
- }, {
72
- readonly name: "icare_validate";
73
- readonly endpoint: "api/pcare/validate";
74
- readonly method: "POST";
75
- readonly description: "API Data Riwayat Pelayanan iCare";
76
- }, {
77
- readonly name: "icare_rs_validate";
78
- readonly endpoint: "api/rs/validate";
79
- readonly method: "POST";
80
- readonly description: "API Data Riwayat Pelayanan iCare RS";
81
- }, {
82
- readonly name: "pendaftaran_by_noUrut";
83
- readonly endpoint: "pendaftaran/noUrut/{noUrut}/tglDaftar/{tglDaftar}";
84
- readonly method: "GET";
85
- readonly description: "Get Data Pendaftaran berdasarkan Nomor Urut dan Tanggal Daftar";
86
- }, {
87
- readonly name: "pendaftaran_provider";
88
- readonly endpoint: "pendaftaran/tglDaftar/{tglDaftar}/{start}/{limit}";
89
- readonly method: "GET";
90
- readonly description: "Get Data Pendaftaran berdasarkan tanggal, start, dan limit";
91
- }, {
92
- readonly name: "tambah_pendaftaran";
93
- readonly endpoint: "pendaftaran";
94
- readonly method: "POST";
95
- readonly description: "Add Data Pendaftaran Baru";
96
- }, {
97
- readonly name: "hapus_pendaftaran";
98
- readonly endpoint: "pendaftaran/peserta/{noKartu}/tglDaftar/{tglDaftar}/noUrut/{noUrut}/kdPoli/{kdPoli}";
99
- readonly method: "DELETE";
100
- readonly description: "Delete Data Pendaftaran berdasarkan Nomor Kartu, Tanggal, Urutan, dan Kode Poli";
101
- }, {
102
- readonly name: "peserta_noka";
103
- readonly endpoint: "peserta/{noKartu}";
104
- readonly method: "GET";
105
- readonly description: "Get Data Peserta berdasarkan Nomor Kartu Peserta";
106
- }, {
107
- readonly name: "peserta_nik_noka";
108
- readonly endpoint: "peserta/{jenisKartu}/{noIdentitas}";
109
- readonly method: "GET";
110
- readonly description: "Get Data Peserta berdasarkan Jenis Kartu (NIK/NOKA) dan Nomor Identitas";
111
- }, {
112
- readonly name: "poli_fktp";
113
- readonly endpoint: "poli/fktp/{start}/{limit}";
114
- readonly method: "GET";
115
- readonly description: "Get Data Poli FKTP dari BPJS PCare";
116
- }, {
117
- readonly name: "prognosa";
118
- readonly endpoint: "prognosa";
119
- readonly method: "GET";
120
- readonly description: "Get Data Prognosa dari BPJS PCare";
121
- }, {
122
- readonly name: "status_pulang";
123
- readonly endpoint: "statuspulang/rawatInap/{rawatInap}";
124
- readonly method: "GET";
125
- readonly description: "Get Status Pulang berdasarkan Rawat Inap (true/false)";
126
- }, {
127
- readonly name: "tindakan_kunjungan";
128
- readonly endpoint: "tindakan/kunjungan/{nomorKunjungan}";
129
- readonly method: "GET";
130
- readonly description: "Get Data Tindakan berdasarkan Nomor Kunjungan";
131
- }, {
132
- readonly name: "referensi_tindakan";
133
- readonly endpoint: "tindakan/kdTkp/{kdTkp}/{start}/{limit}";
134
- readonly method: "GET";
135
- readonly description: "Get Data Referensi Tindakan berdasarkan kdTkp";
136
- }, {
137
- readonly name: "tambah_tindakan";
138
- readonly endpoint: "tindakan";
139
- readonly method: "POST";
140
- readonly description: "Add Data Tindakan";
141
- }, {
142
- readonly name: "edit_tindakan";
143
- readonly endpoint: "tindakan";
144
- readonly method: "PUT";
145
- readonly description: "Edit Data Tindakan";
146
- }, {
147
- readonly name: "hapus_tindakan";
148
- readonly endpoint: "tindakan/{kdTindakanSK}/kunjungan/{nomorKunjungan}";
149
- readonly method: "DELETE";
150
- readonly description: "Delete Data Tindakan berdasarkan kdTindakanSK dan Nomor Kunjungan";
151
- }, {
152
- readonly name: "referensi_spesialis";
153
- readonly endpoint: "spesialis";
154
- readonly method: "GET";
155
- readonly description: "Get Data Referensi Spesialis";
156
- }, {
157
- readonly name: "referensi_subspesialis";
158
- readonly endpoint: "spesialis/{kdSpesialis}/subspesialis";
159
- readonly method: "GET";
160
- readonly description: "Get Data Referensi Sub Spesialis berdasarkan Kode Spesialis";
161
- }, {
162
- readonly name: "referensi_sarana";
163
- readonly endpoint: "spesialis/sarana";
164
- readonly method: "GET";
165
- readonly description: "Get Data Referensi Sarana";
166
- }, {
167
- readonly name: "referensi_khusus";
168
- readonly endpoint: "spesialis/khusus";
169
- readonly method: "GET";
170
- readonly description: "Get Data Referensi Khusus";
171
- }, {
172
- readonly name: "rujuk_subspesialis";
173
- readonly endpoint: "spesialis/rujuk/subspesialis/{kdSubSpesialis}/sarana/{kdSarana}/tglEstRujuk/{tglEstRujuk}";
174
- readonly method: "GET";
175
- readonly description: "Get Data Faskes Rujukan Sub Spesialis";
176
- }, {
177
- readonly name: "rujuk_khusus";
178
- readonly endpoint: "spesialis/rujuk/khusus/{kdKhusus}/noKartu/{noKartu}/tglEstRujuk/{tglEstRujuk}";
179
- readonly method: "GET";
180
- readonly description: "Get Data Faskes Rujukan Khusus";
181
- }, {
182
- readonly name: "rujuk_khusus_subspesialis";
183
- readonly endpoint: "spesialis/rujuk/khusus/{kdKhusus}/subspesialis/{kdSubSpesialis}/noKartu/{noKartu}/tglEstRujuk/{tglEstRujuk}";
184
- readonly method: "GET";
185
- readonly description: "Get Data Faskes Rujukan Khusus untuk THALASEMIA dan HEMOFILI";
186
- }, {
187
- readonly name: "status_pulang";
188
- readonly endpoint: "statuspulang/rawatInap/{rawatInap}";
189
- readonly method: "GET";
190
- readonly description: "Get Data Status Pulang berdasarkan Rawat Inap (true/false)";
191
- }, {
192
- readonly name: "mcu_kunjungan";
193
- readonly endpoint: "MCU/kunjungan/{nomorKunjungan}";
194
- readonly method: "GET";
195
- readonly description: "Get Data MCU berdasarkan Nomor Kunjungan";
196
- }, {
197
- readonly name: "tambah_mcu";
198
- readonly endpoint: "MCU";
199
- readonly method: "POST";
200
- readonly description: "Add Data MCU ke BPJS PCare";
201
- }, {
202
- readonly name: "edit_mcu";
203
- readonly endpoint: "MCU";
204
- readonly method: "PUT";
205
- readonly description: "Edit Data MCU di BPJS PCare";
206
- }, {
207
- readonly name: "hapus_mcu";
208
- readonly endpoint: "MCU/{kdMCU}/kunjungan/{nomorKunjungan}";
209
- readonly method: "DELETE";
210
- readonly description: "Delete Data MCU berdasarkan kdMCU dan Nomor Kunjungan";
211
- }, {
212
- readonly name: "get_club_prolanis";
213
- readonly endpoint: "kelompok/club/{kodeJenisKelompok}";
214
- readonly method: "GET";
215
- readonly description: "Get Data Club Prolanis berdasarkan Kode Jenis Kelompok (01: Diabetes Melitus, 02: Hipertensi)";
216
- }, {
217
- readonly name: "get_kegiatan_kelompok";
218
- readonly endpoint: "kelompok/kegiatan/{tanggal}";
219
- readonly method: "GET";
220
- readonly description: "Get Data Kegiatan Kelompok berdasarkan tanggal (format: dd-mm-yyyy)";
221
- }, {
222
- readonly name: "get_peserta_kegiatan_kelompok";
223
- readonly endpoint: "kelompok/peserta/{eduId}";
224
- readonly method: "GET";
225
- readonly description: "Get Data Peserta Kegiatan Kelompok berdasarkan eduId";
226
- }, {
227
- readonly name: "add_kegiatan_kelompok";
228
- readonly endpoint: "kelompok/kegiatan";
229
- readonly method: "POST";
230
- readonly description: "Add Data Kegiatan Kelompok";
231
- }, {
232
- readonly name: "add_peserta_kegiatan_kelompok";
233
- readonly endpoint: "kelompok/peserta";
234
- readonly method: "POST";
235
- readonly description: "Add Data Peserta Kegiatan Kelompok";
236
- }, {
237
- readonly name: "delete_kegiatan_kelompok";
238
- readonly endpoint: "kelompok/kegiatan/{eduId}";
239
- readonly method: "DELETE";
240
- readonly description: "Delete Data Kegiatan Kelompok berdasarkan eduId";
241
- }, {
242
- readonly name: "delete_peserta_kegiatan_kelompok";
243
- readonly endpoint: "kelompok/peserta/{eduId}/{noKartu}";
244
- readonly method: "DELETE";
245
- readonly description: "Delete Data Peserta Kegiatan Kelompok berdasarkan eduId dan Nomor Kartu Peserta";
246
- }, {
247
- readonly name: "ref_poli_antrol";
248
- readonly endpoint: "ref/poli/tanggal/{tanggal}";
249
- readonly method: "GET";
250
- readonly description: "Melihat referensi poli pada layanan antrean (WS Antrol)";
251
- }, {
252
- readonly name: "ref_dokter_antrol";
253
- readonly endpoint: "ref/dokter/kodepoli/{kodepoli}/tanggal/{tanggal}";
254
- readonly method: "GET";
255
- readonly description: "Melihat daftar dokter berdasarkan poli dan tanggal (WS Antrol)";
256
- }, {
257
- readonly name: "tambah_antrean";
258
- readonly endpoint: "antrean/add";
259
- readonly method: "POST";
260
- readonly description: "Menambah data antrean pasien (WS Antrol)";
261
- }, {
262
- readonly name: "update_status_antrean";
263
- readonly endpoint: "antrean/panggil";
264
- readonly method: "POST";
265
- readonly description: "Update status antrean hadir/tidak hadir (WS Antrol)";
266
- }, {
267
- readonly name: "batal_antrean";
268
- readonly endpoint: "antrean/batal";
269
- readonly method: "POST";
270
- readonly description: "Membatalkan antrean pasien (WS Antrol)";
271
- }, {
272
- readonly name: "scrinning_rekap";
273
- readonly endpoint: "skrinning/rekap";
274
- readonly method: "GET";
275
- readonly description: "Mengambil data rekapitulasi hasil Skrining Riwayat Kesehatan per penyakit";
276
- }, {
277
- readonly name: "scrinning_peserta";
278
- readonly endpoint: "/skrinning/peserta/{nomor_peserta}/{start}/{limit}";
279
- readonly method: "GET";
280
- readonly description: "Mengambil data rekapitulasi Skrining Riwayat Kesehatan per peserta";
281
- }, {
282
- readonly name: "scrinning_diabetes_mellitus";
283
- readonly endpoint: "/skrinning/prolanis/dm/{nomor_peserta}/{start}/{limit}";
284
- readonly method: "GET";
285
- readonly description: "Mengambil data peserta prolanis DM sejak tahun 2017";
286
- }, {
287
- readonly name: "scrinning_hipertensi";
288
- readonly endpoint: "skrinning/prolanis/ht/{nomor_peserta}/{start}/{limit}";
289
- readonly method: "GET";
290
- readonly description: "Mengambil data peserta prolanis HT sejak tahun 2017";
291
- }];
1
+ type endpointType = {
2
+ name: string;
3
+ endpoint: string;
4
+ method: string;
5
+ description: string;
6
+ cacheDuration?: number;
7
+ };
8
+ export declare const enpoints: endpointType[];
292
9
  export declare const BaseUrl: {
293
10
  dev: {
294
11
  url_pcare: string;
@@ -304,3 +21,4 @@ export declare const BaseUrl: {
304
21
  };
305
22
  };
306
23
  export type EndpointName = (typeof enpoints)[number]["name"];
24
+ export {};
@@ -7,36 +7,42 @@ exports.enpoints = [
7
7
  endpoint: "diagnosa/{kodediag}/{start}/{limit}",
8
8
  method: "GET",
9
9
  description: "Get Data Diagnosa dari BPJS PCare",
10
+ cacheDuration: 60,
10
11
  },
11
12
  {
12
13
  name: "alergi_jenis",
13
14
  endpoint: "alergi/jenis/{jenisAlergi}",
14
15
  method: "GET",
15
16
  description: "Get Data Alergi berdasarkan jenis",
17
+ cacheDuration: 60,
16
18
  },
17
19
  {
18
20
  name: "dokter",
19
21
  endpoint: "dokter/{start}/{limit}",
20
22
  method: "GET",
21
23
  description: "Get Data Dokter dari BPJS PCare",
24
+ cacheDuration: 3600,
22
25
  },
23
26
  {
24
27
  name: "kesadaran",
25
28
  endpoint: "kesadaran",
26
29
  method: "GET",
27
30
  description: "Get Data Kesadaran dari BPJS PCare",
31
+ cacheDuration: 3600,
28
32
  },
29
33
  {
30
34
  name: "rujukan_kunjungan",
31
35
  endpoint: "kunjungan/rujukan/{nomorKunjungan}",
32
36
  method: "GET",
33
37
  description: "Get Data Rujukan berdasarkan Nomor Kunjungan",
38
+ cacheDuration: 60,
34
39
  },
35
40
  {
36
41
  name: "riwayat_kunjungan",
37
42
  endpoint: "kunjungan/peserta/{nomorKartu}",
38
43
  method: "GET",
39
44
  description: "Get Data Riwayat Kunjungan berdasarkan Nomor Kartu Peserta",
45
+ cacheDuration: 60,
40
46
  },
41
47
  {
42
48
  name: "tambah_kunjungan",
@@ -61,12 +67,14 @@ exports.enpoints = [
61
67
  endpoint: "obat/dpho/{kodeNamaDPHO}/{start}/{limit}",
62
68
  method: "GET",
63
69
  description: "Get Data DPHO dari BPJS PCare berdasarkan kode atau nama",
70
+ cacheDuration: 3600,
64
71
  },
65
72
  {
66
73
  name: "obat_kunjungan",
67
74
  endpoint: "obat/kunjungan/{nomorKunjungan}",
68
75
  method: "GET",
69
76
  description: "Get Data Obat berdasarkan Nomor Kunjungan",
77
+ cacheDuration: 60,
70
78
  },
71
79
  {
72
80
  name: "tambah_obat",
@@ -85,6 +93,7 @@ exports.enpoints = [
85
93
  endpoint: "provider/{start}/{limit}",
86
94
  method: "GET",
87
95
  description: "Get Data Provider Rayonisasi dari BPJS PCare",
96
+ cacheDuration: 3600,
88
97
  },
89
98
  {
90
99
  name: "icare_validate",
@@ -103,12 +112,14 @@ exports.enpoints = [
103
112
  endpoint: "pendaftaran/noUrut/{noUrut}/tglDaftar/{tglDaftar}",
104
113
  method: "GET",
105
114
  description: "Get Data Pendaftaran berdasarkan Nomor Urut dan Tanggal Daftar",
115
+ cacheDuration: 60,
106
116
  },
107
117
  {
108
118
  name: "pendaftaran_provider",
109
119
  endpoint: "pendaftaran/tglDaftar/{tglDaftar}/{start}/{limit}",
110
120
  method: "GET",
111
121
  description: "Get Data Pendaftaran berdasarkan tanggal, start, dan limit",
122
+ cacheDuration: 60,
112
123
  },
113
124
  {
114
125
  name: "tambah_pendaftaran",
@@ -127,42 +138,49 @@ exports.enpoints = [
127
138
  endpoint: "peserta/{noKartu}",
128
139
  method: "GET",
129
140
  description: "Get Data Peserta berdasarkan Nomor Kartu Peserta",
141
+ cacheDuration: 3600,
130
142
  },
131
143
  {
132
144
  name: "peserta_nik_noka",
133
145
  endpoint: "peserta/{jenisKartu}/{noIdentitas}",
134
146
  method: "GET",
135
147
  description: "Get Data Peserta berdasarkan Jenis Kartu (NIK/NOKA) dan Nomor Identitas",
148
+ cacheDuration: 3600,
136
149
  },
137
150
  {
138
151
  name: "poli_fktp",
139
152
  endpoint: "poli/fktp/{start}/{limit}",
140
153
  method: "GET",
141
154
  description: "Get Data Poli FKTP dari BPJS PCare",
155
+ cacheDuration: 3600,
142
156
  },
143
157
  {
144
158
  name: "prognosa",
145
159
  endpoint: "prognosa",
146
160
  method: "GET",
147
161
  description: "Get Data Prognosa dari BPJS PCare",
162
+ cacheDuration: 3600,
148
163
  },
149
164
  {
150
165
  name: "status_pulang",
151
166
  endpoint: "statuspulang/rawatInap/{rawatInap}",
152
167
  method: "GET",
153
168
  description: "Get Status Pulang berdasarkan Rawat Inap (true/false)",
169
+ cacheDuration: 3600,
154
170
  },
155
171
  {
156
172
  name: "tindakan_kunjungan",
157
173
  endpoint: "tindakan/kunjungan/{nomorKunjungan}",
158
174
  method: "GET",
159
175
  description: "Get Data Tindakan berdasarkan Nomor Kunjungan",
176
+ cacheDuration: 60,
160
177
  },
161
178
  {
162
179
  name: "referensi_tindakan",
163
180
  endpoint: "tindakan/kdTkp/{kdTkp}/{start}/{limit}",
164
181
  method: "GET",
165
182
  description: "Get Data Referensi Tindakan berdasarkan kdTkp",
183
+ cacheDuration: 3600,
166
184
  },
167
185
  {
168
186
  name: "tambah_tindakan",
@@ -187,54 +205,56 @@ exports.enpoints = [
187
205
  endpoint: "spesialis",
188
206
  method: "GET",
189
207
  description: "Get Data Referensi Spesialis",
208
+ cacheDuration: 3600,
190
209
  },
191
210
  {
192
211
  name: "referensi_subspesialis",
193
212
  endpoint: "spesialis/{kdSpesialis}/subspesialis",
194
213
  method: "GET",
195
214
  description: "Get Data Referensi Sub Spesialis berdasarkan Kode Spesialis",
215
+ cacheDuration: 3600,
196
216
  },
197
217
  {
198
218
  name: "referensi_sarana",
199
219
  endpoint: "spesialis/sarana",
200
220
  method: "GET",
201
221
  description: "Get Data Referensi Sarana",
222
+ cacheDuration: 3600,
202
223
  },
203
224
  {
204
225
  name: "referensi_khusus",
205
226
  endpoint: "spesialis/khusus",
206
227
  method: "GET",
207
228
  description: "Get Data Referensi Khusus",
229
+ cacheDuration: 3600,
208
230
  },
209
231
  {
210
232
  name: "rujuk_subspesialis",
211
233
  endpoint: "spesialis/rujuk/subspesialis/{kdSubSpesialis}/sarana/{kdSarana}/tglEstRujuk/{tglEstRujuk}",
212
234
  method: "GET",
213
235
  description: "Get Data Faskes Rujukan Sub Spesialis",
236
+ cacheDuration: 3600,
214
237
  },
215
238
  {
216
239
  name: "rujuk_khusus",
217
240
  endpoint: "spesialis/rujuk/khusus/{kdKhusus}/noKartu/{noKartu}/tglEstRujuk/{tglEstRujuk}",
218
241
  method: "GET",
219
242
  description: "Get Data Faskes Rujukan Khusus",
243
+ cacheDuration: 3600,
220
244
  },
221
245
  {
222
246
  name: "rujuk_khusus_subspesialis",
223
247
  endpoint: "spesialis/rujuk/khusus/{kdKhusus}/subspesialis/{kdSubSpesialis}/noKartu/{noKartu}/tglEstRujuk/{tglEstRujuk}",
224
248
  method: "GET",
225
249
  description: "Get Data Faskes Rujukan Khusus untuk THALASEMIA dan HEMOFILI",
226
- },
227
- {
228
- name: "status_pulang",
229
- endpoint: "statuspulang/rawatInap/{rawatInap}",
230
- method: "GET",
231
- description: "Get Data Status Pulang berdasarkan Rawat Inap (true/false)",
250
+ cacheDuration: 3600,
232
251
  },
233
252
  {
234
253
  name: "mcu_kunjungan",
235
254
  endpoint: "MCU/kunjungan/{nomorKunjungan}",
236
255
  method: "GET",
237
256
  description: "Get Data MCU berdasarkan Nomor Kunjungan",
257
+ cacheDuration: 60,
238
258
  },
239
259
  {
240
260
  name: "tambah_mcu",
@@ -259,18 +279,21 @@ exports.enpoints = [
259
279
  endpoint: "kelompok/club/{kodeJenisKelompok}",
260
280
  method: "GET",
261
281
  description: "Get Data Club Prolanis berdasarkan Kode Jenis Kelompok (01: Diabetes Melitus, 02: Hipertensi)",
282
+ cacheDuration: 3600,
262
283
  },
263
284
  {
264
285
  name: "get_kegiatan_kelompok",
265
286
  endpoint: "kelompok/kegiatan/{tanggal}",
266
287
  method: "GET",
267
288
  description: "Get Data Kegiatan Kelompok berdasarkan tanggal (format: dd-mm-yyyy)",
289
+ cacheDuration: 60,
268
290
  },
269
291
  {
270
292
  name: "get_peserta_kegiatan_kelompok",
271
293
  endpoint: "kelompok/peserta/{eduId}",
272
294
  method: "GET",
273
295
  description: "Get Data Peserta Kegiatan Kelompok berdasarkan eduId",
296
+ cacheDuration: 60,
274
297
  },
275
298
  {
276
299
  name: "add_kegiatan_kelompok",
@@ -301,12 +324,14 @@ exports.enpoints = [
301
324
  endpoint: "ref/poli/tanggal/{tanggal}",
302
325
  method: "GET",
303
326
  description: "Melihat referensi poli pada layanan antrean (WS Antrol)",
327
+ cacheDuration: 60,
304
328
  },
305
329
  {
306
330
  name: "ref_dokter_antrol",
307
331
  endpoint: "ref/dokter/kodepoli/{kodepoli}/tanggal/{tanggal}",
308
332
  method: "GET",
309
333
  description: "Melihat daftar dokter berdasarkan poli dan tanggal (WS Antrol)",
334
+ cacheDuration: 60,
310
335
  },
311
336
  {
312
337
  name: "tambah_antrean",
@@ -331,24 +356,28 @@ exports.enpoints = [
331
356
  endpoint: "skrinning/rekap",
332
357
  method: "GET",
333
358
  description: "Mengambil data rekapitulasi hasil Skrining Riwayat Kesehatan per penyakit",
359
+ cacheDuration: 60,
334
360
  },
335
361
  {
336
362
  name: "scrinning_peserta",
337
363
  endpoint: "/skrinning/peserta/{nomor_peserta}/{start}/{limit}",
338
364
  method: "GET",
339
365
  description: "Mengambil data rekapitulasi Skrining Riwayat Kesehatan per peserta",
366
+ cacheDuration: 60,
340
367
  },
341
368
  {
342
369
  name: "scrinning_diabetes_mellitus",
343
370
  endpoint: "/skrinning/prolanis/dm/{nomor_peserta}/{start}/{limit}",
344
371
  method: "GET",
345
372
  description: "Mengambil data peserta prolanis DM sejak tahun 2017",
373
+ cacheDuration: 60,
346
374
  },
347
375
  {
348
376
  name: "scrinning_hipertensi",
349
377
  endpoint: "skrinning/prolanis/ht/{nomor_peserta}/{start}/{limit}",
350
378
  method: "GET",
351
379
  description: "Mengambil data peserta prolanis HT sejak tahun 2017",
380
+ cacheDuration: 60,
352
381
  },
353
382
  ];
354
383
  exports.BaseUrl = {
@@ -18,6 +18,7 @@ const createBpjsClient = (config) => {
18
18
  req.headers["X-cons-id"] = headers["X-cons-id"];
19
19
  req.headers["X-timestamp"] = headers["X-timestamp"];
20
20
  req.headers["X-signature"] = headers["X-signature"];
21
+ req.headers["X-authorization"] = headers["X-Authorization"];
21
22
  req.headers["X-Authorization"] = headers["X-Authorization"];
22
23
  req.headers.user_key = headers["userKey"];
23
24
  req.headers.Accept = headers["Accept"];
@@ -58,6 +59,9 @@ const createBpjsClient = (config) => {
58
59
  res.data = `[HTTP CLIENT ERROR => URL : ${res.config.baseURL}/${res.config.url} ] => ${"NO_CONTENT_IN_RESPONSE"}`;
59
60
  res.status = 204;
60
61
  res.statusText = "No Content";
62
+ if (res.config.method?.toLowerCase() === "delete") {
63
+ return res;
64
+ }
61
65
  const AxiosError = {
62
66
  name: "BpjsResponseError",
63
67
  code: "NO_CONTENT_IN_RESPONSE",
@@ -72,7 +76,21 @@ const createBpjsClient = (config) => {
72
76
  headers: res.headers,
73
77
  config: res.config,
74
78
  },
75
- toJSON: () => ({}),
79
+ toJSON: () => ({
80
+ name: "BpjsResponseError",
81
+ code: "NO_CONTENT_IN_RESPONSE",
82
+ message: res.data,
83
+ status: res.status,
84
+ config: res.config,
85
+ isAxiosError: true,
86
+ response: {
87
+ data: res.data,
88
+ status: res.status,
89
+ statusText: res.statusText,
90
+ headers: res.headers,
91
+ config: res.config,
92
+ },
93
+ }),
76
94
  };
77
95
  return Promise.reject(AxiosError);
78
96
  }, (err) => {
@@ -30,11 +30,11 @@ export declare class BaseService {
30
30
  * @param pattern - Pola kunci untuk menghapus (misal: 'user_*' untuk menghapus semua kunci yang diawali 'user_')
31
31
  * Menghapus beberapa kunci berdasarkan pola (pattern)
32
32
  */
33
- private deleteKeysByPattern;
33
+ deleteKeysByPattern(pattern: string): Promise<void>;
34
34
  /**
35
35
  * Membersihkan seluruh cache Redis
36
36
  */
37
- private flushAll;
37
+ flushAll(): Promise<void>;
38
38
  /**
39
39
  * Memanggil endpoint BPJS berdasarkan nama dan parameter yang diberikan
40
40
  * @param name
@@ -31,7 +31,7 @@ class BaseService {
31
31
  * @param value - Data yang akan disimpan
32
32
  * @param expInSecond - Waktu kadaluarsa dalam detik (default: 3600)
33
33
  */
34
- async set(key, value, expInSecond = 3600) {
34
+ async set(key, value, expInSecond) {
35
35
  if (typeof expInSecond !== "number") {
36
36
  expInSecond = 3600;
37
37
  }
@@ -163,13 +163,21 @@ class BaseService {
163
163
  method: "GET",
164
164
  });
165
165
  if (this.redisClient && typeof res.data !== "string") {
166
- await this.set(cacheKey, res.data);
166
+ await this.set(cacheKey, res.data, endpointConfig?.cacheDuration ?? undefined);
167
167
  }
168
168
  return res;
169
169
  case "POST":
170
- return await this.client.post(endpoint, body);
170
+ return await this.client.post(endpoint, body, {
171
+ headers: {
172
+ "Content-Type": "text/plain",
173
+ },
174
+ });
171
175
  case "PUT":
172
- return await this.client.put(endpoint, body);
176
+ return await this.client.put(endpoint, body, {
177
+ headers: {
178
+ "Content-Type": "text/plain",
179
+ },
180
+ });
173
181
  case "DELETE":
174
182
  return await this.client.delete(endpoint, body);
175
183
  default:
@@ -177,7 +185,7 @@ class BaseService {
177
185
  }
178
186
  }
179
187
  catch (error) {
180
- // console.log("Error in callEndpoint:", error);
188
+ console.log("Error in callEndpoint:", error);
181
189
  throw globalErroModule_1.BpjsErrorFactory.fromAxios(error);
182
190
  }
183
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpjs-bridge",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Integrasi BPJS PCare, Antrean FKTP, VClaim, dan iCare dengan dukungan Redis Cache, Logging, dan Modular Service Architecture. ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",