@henrylabs-interview/payment-processor 0.2.14 → 0.2.15

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.
@@ -29,27 +29,12 @@ export async function readHistory() {
29
29
  export async function writeHistory(params) {
30
30
  const history = await readHistory();
31
31
  const now = Date.now();
32
- const existingIndex = history.findIndex((v) => v.id === params.id);
33
- let record;
34
- if (existingIndex !== -1) {
35
- // Replace existing record
36
- record = {
37
- ...history[existingIndex],
38
- ...params,
39
- createdAt: history[existingIndex]?.createdAt ?? now,
40
- updatedAt: now,
41
- };
42
- history[existingIndex] = record;
43
- }
44
- else {
45
- // Add new record
46
- record = {
47
- ...params,
48
- createdAt: now,
49
- updatedAt: now,
50
- };
51
- history.push(record);
52
- }
32
+ const record = {
33
+ ...params,
34
+ createdAt: now,
35
+ updatedAt: now,
36
+ };
37
+ history.push(record);
53
38
  await Bun.write(path, JSON.stringify(history, null, 2));
54
39
  return record;
55
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henrylabs-interview/payment-processor",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",