@betterinternship/core 1.1.23 → 1.1.24

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/index.js CHANGED
@@ -1,22 +1,22 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/db"), exports);
18
- __exportStar(require("./lib/chat"), exports);
19
- __exportStar(require("./lib/env"), exports);
20
- __exportStar(require("./lib/notice"), exports);
21
- __exportStar(require("./lib/email"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/db"), exports);
18
+ __exportStar(require("./lib/chat"), exports);
19
+ __exportStar(require("./lib/env"), exports);
20
+ __exportStar(require("./lib/notice"), exports);
21
+ __exportStar(require("./lib/email"), exports);
22
22
  //# sourceMappingURL=index.js.map
@@ -1,51 +1,51 @@
1
- import { RecordModel } from "pocketbase";
2
- export interface Message {
3
- message: string;
4
- sender_id: string;
5
- timestamp: number;
6
- digested?: boolean;
7
- }
8
- export interface Consumer extends RecordModel {
9
- email: string;
10
- last_reads: {
11
- [conversationId: string]: Message;
12
- };
13
- last_unreads: {
14
- [conversationId: string]: Message;
15
- };
16
- conversations: string[];
17
- }
18
- export interface Conversation extends RecordModel {
19
- id: string;
20
- subscribers: string[];
21
- contents: Message[];
22
- last_message: Message;
23
- }
24
- export declare class ConsumerService {
25
- findOne(id: string): Promise<Consumer>;
26
- findAll(): Promise<Consumer[]>;
27
- register(id: string, email: string): Promise<Consumer>;
28
- setLastRead(id: string, conversationId: string, message: Message): Promise<RecordModel>;
29
- authenticateAs(id: string): Promise<{
30
- token: string;
31
- user: import("pocketbase").AuthRecord;
32
- }>;
33
- }
34
- export declare class MessageService {
35
- private readonly consumerService;
36
- private readonly conversationService;
37
- private updateConversationUnread;
38
- send(senderId: string, conversationId: string, messageContent: string): Promise<Message>;
39
- read(consumerId: string, conversationId: string): Promise<Message>;
40
- digest(consumerId: string, conversationId: string): Promise<Message>;
41
- }
42
- export declare class ConversationService {
43
- consumerService: ConsumerService;
44
- findOne(id: string): Promise<Conversation>;
45
- appendMessage(conversationId: string, message: Message): Promise<Conversation>;
46
- subscribe(subscriberId: string, conversationId: string): Promise<Conversation>;
47
- getSubscriptions(subscriberId: any): Promise<Conversation[]>;
48
- findExisting(userId: string, employerId: string): Promise<Conversation>;
49
- checkIfSubscribed(subscriberId: string, conversationId: string): Promise<boolean>;
50
- create(userId: string, employerId: string): Promise<Conversation>;
51
- }
1
+ import { RecordModel } from "pocketbase";
2
+ export interface Message {
3
+ message: string;
4
+ sender_id: string;
5
+ timestamp: number;
6
+ digested?: boolean;
7
+ }
8
+ export interface Consumer extends RecordModel {
9
+ email: string;
10
+ last_reads: {
11
+ [conversationId: string]: Message;
12
+ };
13
+ last_unreads: {
14
+ [conversationId: string]: Message;
15
+ };
16
+ conversations: string[];
17
+ }
18
+ export interface Conversation extends RecordModel {
19
+ id: string;
20
+ subscribers: string[];
21
+ contents: Message[];
22
+ last_message: Message;
23
+ }
24
+ export declare class ConsumerService {
25
+ findOne(id: string): Promise<Consumer>;
26
+ findAll(): Promise<Consumer[]>;
27
+ register(id: string, email: string): Promise<Consumer>;
28
+ setLastRead(id: string, conversationId: string, message: Message): Promise<RecordModel>;
29
+ authenticateAs(id: string): Promise<{
30
+ token: string;
31
+ user: import("pocketbase").AuthRecord;
32
+ }>;
33
+ }
34
+ export declare class MessageService {
35
+ private readonly consumerService;
36
+ private readonly conversationService;
37
+ private updateConversationUnread;
38
+ send(senderId: string, conversationId: string, messageContent: string): Promise<Message>;
39
+ read(consumerId: string, conversationId: string): Promise<Message>;
40
+ digest(consumerId: string, conversationId: string): Promise<Message>;
41
+ }
42
+ export declare class ConversationService {
43
+ consumerService: ConsumerService;
44
+ findOne(id: string): Promise<Conversation>;
45
+ appendMessage(conversationId: string, message: Message): Promise<Conversation>;
46
+ subscribe(subscriberId: string, conversationId: string): Promise<Conversation>;
47
+ getSubscriptions(subscriberId: any): Promise<Conversation[]>;
48
+ findExisting(userId: string, employerId: string): Promise<Conversation>;
49
+ checkIfSubscribed(subscriberId: string, conversationId: string): Promise<boolean>;
50
+ create(userId: string, employerId: string): Promise<Conversation>;
51
+ }
@@ -1,179 +1,179 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConversationService = exports.MessageService = exports.ConsumerService = void 0;
4
- const uuid_1 = require("uuid");
5
- const pb_1 = require("./pb");
6
- const generator = require("generate-password");
7
- class ConsumerService {
8
- async findOne(id) {
9
- return await pb_1.pb.collection("users").getOne(id);
10
- }
11
- async findAll() {
12
- return await pb_1.pb.collection("users").getFullList();
13
- }
14
- async register(id, email) {
15
- try {
16
- return await pb_1.pb.collection("users").getOne(id);
17
- }
18
- catch (error) {
19
- const e = error;
20
- if (e.status !== 404)
21
- throw error;
22
- }
23
- const password = generator.generate({
24
- length: 10,
25
- numbers: true,
26
- symbols: true,
27
- uppercase: true,
28
- lowercase: true,
29
- strict: true,
30
- });
31
- return await pb_1.pb.collection("users").create({
32
- id,
33
- email,
34
- password,
35
- passwordConfirm: password,
36
- last_reads: {},
37
- last_unreads: {},
38
- conversations: [],
39
- });
40
- }
41
- async setLastRead(id, conversationId, message) {
42
- const subscriber = (await pb_1.pb.collection("users").getOne(id));
43
- const last_reads = subscriber.last_reads;
44
- const last_unreads = subscriber.last_unreads;
45
- return await pb_1.pb.collection("users").update(id, {
46
- last_reads: {
47
- ...last_reads,
48
- [conversationId]: message,
49
- },
50
- last_unreads: {
51
- ...last_unreads,
52
- [conversationId]: message,
53
- },
54
- });
55
- }
56
- async authenticateAs(id) {
57
- const asUser = await pb_1.pb.collection("users").impersonate(id, 60 * 60 * 24);
58
- const token = asUser.authStore.token;
59
- const record = asUser.authStore.record;
60
- return { token, user: record };
61
- }
62
- }
63
- exports.ConsumerService = ConsumerService;
64
- class MessageService {
65
- consumerService = new ConsumerService();
66
- conversationService = new ConversationService();
67
- async updateConversationUnread(subscriberId, conversationId, message) {
68
- let subscriber;
69
- try {
70
- subscriber = await this.consumerService.findOne(subscriberId);
71
- }
72
- catch (error) {
73
- const e = error;
74
- if (e.status !== 404)
75
- throw error;
76
- subscriber = await this.consumerService.register(subscriberId, "");
77
- }
78
- await pb_1.pb.collection("users").update(subscriberId, {
79
- last_unreads: {
80
- ...subscriber.last_unreads,
81
- [conversationId]: message,
82
- },
83
- });
84
- }
85
- async send(senderId, conversationId, messageContent) {
86
- const message = {
87
- sender_id: senderId,
88
- message: messageContent,
89
- timestamp: new Date().getTime(),
90
- };
91
- const conversation = await this.conversationService.appendMessage(conversationId, message);
92
- await this.consumerService.setLastRead(senderId, conversationId, message);
93
- await Promise.all(conversation.subscribers.map((subscriberId) => this.updateConversationUnread(subscriberId, conversationId, message)));
94
- return message;
95
- }
96
- async read(consumerId, conversationId) {
97
- const consumer = await pb_1.pb.collection("users").getOne(consumerId);
98
- const conversation = await pb_1.pb
99
- .collection("conversations")
100
- .getOne(conversationId);
101
- await pb_1.pb.collection("users").update(consumerId, {
102
- last_reads: {
103
- ...consumer.last_reads,
104
- [conversationId]: conversation.last_message,
105
- },
106
- });
107
- return conversation.last_message;
108
- }
109
- async digest(consumerId, conversationId) {
110
- const consumer = await pb_1.pb.collection("users").getOne(consumerId);
111
- const conversation = await pb_1.pb
112
- .collection("conversations")
113
- .getOne(conversationId);
114
- await pb_1.pb.collection("users").update(consumerId, {
115
- last_unreads: {
116
- ...consumer.last_unreads,
117
- [conversationId]: {
118
- ...conversation.last_message,
119
- digested: true,
120
- },
121
- },
122
- });
123
- return { ...conversation.last_message, digested: true };
124
- }
125
- }
126
- exports.MessageService = MessageService;
127
- class ConversationService {
128
- consumerService = new ConsumerService();
129
- async findOne(id) {
130
- return await pb_1.pb.collection("conversations").getOne(id);
131
- }
132
- async appendMessage(conversationId, message) {
133
- const conversation = await this.findOne(conversationId);
134
- return await pb_1.pb.collection("conversations").update(conversationId, {
135
- contents: [...conversation.contents, message],
136
- last_message: message,
137
- });
138
- }
139
- async subscribe(subscriberId, conversationId) {
140
- const conversation = await this.findOne(conversationId);
141
- const subscriber = await this.consumerService.findOne(subscriberId);
142
- await pb_1.pb.collection("users").update(subscriberId, {
143
- conversations: [...subscriber.conversations, conversationId],
144
- });
145
- return await pb_1.pb.collection("conversations").update(conversationId, {
146
- subscribers: [...conversation.subscribers, subscriberId],
147
- });
148
- }
149
- async getSubscriptions(subscriberId) {
150
- return await pb_1.pb.collection("conversations").getFullList({
151
- filter: `subscribers ~ '${subscriberId}'`,
152
- });
153
- }
154
- async findExisting(userId, employerId) {
155
- return await pb_1.pb
156
- .collection("conversations")
157
- .getFirstListItem(`subscribers ~ '${userId}' && subscribers ~ '${employerId}'`);
158
- }
159
- async checkIfSubscribed(subscriberId, conversationId) {
160
- const conversation = await this.findOne(conversationId);
161
- if (!conversation)
162
- return false;
163
- if (!conversation.subscribers.includes(subscriberId))
164
- return false;
165
- return true;
166
- }
167
- async create(userId, employerId) {
168
- const conversationId = (0, uuid_1.v4)();
169
- const newConversation = await pb_1.pb.collection("conversations").create({
170
- id: conversationId,
171
- subscribers: [userId, employerId],
172
- contents: [],
173
- last_message: {},
174
- });
175
- return newConversation;
176
- }
177
- }
178
- exports.ConversationService = ConversationService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConversationService = exports.MessageService = exports.ConsumerService = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const pb_1 = require("./pb");
6
+ const generator = require("generate-password");
7
+ class ConsumerService {
8
+ async findOne(id) {
9
+ return await pb_1.pb.collection("users").getOne(id);
10
+ }
11
+ async findAll() {
12
+ return await pb_1.pb.collection("users").getFullList();
13
+ }
14
+ async register(id, email) {
15
+ try {
16
+ return await pb_1.pb.collection("users").getOne(id);
17
+ }
18
+ catch (error) {
19
+ const e = error;
20
+ if (e.status !== 404)
21
+ throw error;
22
+ }
23
+ const password = generator.generate({
24
+ length: 10,
25
+ numbers: true,
26
+ symbols: true,
27
+ uppercase: true,
28
+ lowercase: true,
29
+ strict: true,
30
+ });
31
+ return await pb_1.pb.collection("users").create({
32
+ id,
33
+ email,
34
+ password,
35
+ passwordConfirm: password,
36
+ last_reads: {},
37
+ last_unreads: {},
38
+ conversations: [],
39
+ });
40
+ }
41
+ async setLastRead(id, conversationId, message) {
42
+ const subscriber = (await pb_1.pb.collection("users").getOne(id));
43
+ const last_reads = subscriber.last_reads;
44
+ const last_unreads = subscriber.last_unreads;
45
+ return await pb_1.pb.collection("users").update(id, {
46
+ last_reads: {
47
+ ...last_reads,
48
+ [conversationId]: message,
49
+ },
50
+ last_unreads: {
51
+ ...last_unreads,
52
+ [conversationId]: message,
53
+ },
54
+ });
55
+ }
56
+ async authenticateAs(id) {
57
+ const asUser = await pb_1.pb.collection("users").impersonate(id, 60 * 60 * 24);
58
+ const token = asUser.authStore.token;
59
+ const record = asUser.authStore.record;
60
+ return { token, user: record };
61
+ }
62
+ }
63
+ exports.ConsumerService = ConsumerService;
64
+ class MessageService {
65
+ consumerService = new ConsumerService();
66
+ conversationService = new ConversationService();
67
+ async updateConversationUnread(subscriberId, conversationId, message) {
68
+ let subscriber;
69
+ try {
70
+ subscriber = await this.consumerService.findOne(subscriberId);
71
+ }
72
+ catch (error) {
73
+ const e = error;
74
+ if (e.status !== 404)
75
+ throw error;
76
+ subscriber = await this.consumerService.register(subscriberId, "");
77
+ }
78
+ await pb_1.pb.collection("users").update(subscriberId, {
79
+ last_unreads: {
80
+ ...subscriber.last_unreads,
81
+ [conversationId]: message,
82
+ },
83
+ });
84
+ }
85
+ async send(senderId, conversationId, messageContent) {
86
+ const message = {
87
+ sender_id: senderId,
88
+ message: messageContent,
89
+ timestamp: new Date().getTime(),
90
+ };
91
+ const conversation = await this.conversationService.appendMessage(conversationId, message);
92
+ await this.consumerService.setLastRead(senderId, conversationId, message);
93
+ await Promise.all(conversation.subscribers.map((subscriberId) => this.updateConversationUnread(subscriberId, conversationId, message)));
94
+ return message;
95
+ }
96
+ async read(consumerId, conversationId) {
97
+ const consumer = await pb_1.pb.collection("users").getOne(consumerId);
98
+ const conversation = await pb_1.pb
99
+ .collection("conversations")
100
+ .getOne(conversationId);
101
+ await pb_1.pb.collection("users").update(consumerId, {
102
+ last_reads: {
103
+ ...consumer.last_reads,
104
+ [conversationId]: conversation.last_message,
105
+ },
106
+ });
107
+ return conversation.last_message;
108
+ }
109
+ async digest(consumerId, conversationId) {
110
+ const consumer = await pb_1.pb.collection("users").getOne(consumerId);
111
+ const conversation = await pb_1.pb
112
+ .collection("conversations")
113
+ .getOne(conversationId);
114
+ await pb_1.pb.collection("users").update(consumerId, {
115
+ last_unreads: {
116
+ ...consumer.last_unreads,
117
+ [conversationId]: {
118
+ ...conversation.last_message,
119
+ digested: true,
120
+ },
121
+ },
122
+ });
123
+ return { ...conversation.last_message, digested: true };
124
+ }
125
+ }
126
+ exports.MessageService = MessageService;
127
+ class ConversationService {
128
+ consumerService = new ConsumerService();
129
+ async findOne(id) {
130
+ return await pb_1.pb.collection("conversations").getOne(id);
131
+ }
132
+ async appendMessage(conversationId, message) {
133
+ const conversation = await this.findOne(conversationId);
134
+ return await pb_1.pb.collection("conversations").update(conversationId, {
135
+ contents: [...conversation.contents, message],
136
+ last_message: message,
137
+ });
138
+ }
139
+ async subscribe(subscriberId, conversationId) {
140
+ const conversation = await this.findOne(conversationId);
141
+ const subscriber = await this.consumerService.findOne(subscriberId);
142
+ await pb_1.pb.collection("users").update(subscriberId, {
143
+ conversations: [...subscriber.conversations, conversationId],
144
+ });
145
+ return await pb_1.pb.collection("conversations").update(conversationId, {
146
+ subscribers: [...conversation.subscribers, subscriberId],
147
+ });
148
+ }
149
+ async getSubscriptions(subscriberId) {
150
+ return await pb_1.pb.collection("conversations").getFullList({
151
+ filter: `subscribers ~ '${subscriberId}'`,
152
+ });
153
+ }
154
+ async findExisting(userId, employerId) {
155
+ return await pb_1.pb
156
+ .collection("conversations")
157
+ .getFirstListItem(`subscribers ~ '${userId}' && subscribers ~ '${employerId}'`);
158
+ }
159
+ async checkIfSubscribed(subscriberId, conversationId) {
160
+ const conversation = await this.findOne(conversationId);
161
+ if (!conversation)
162
+ return false;
163
+ if (!conversation.subscribers.includes(subscriberId))
164
+ return false;
165
+ return true;
166
+ }
167
+ async create(userId, employerId) {
168
+ const conversationId = (0, uuid_1.v4)();
169
+ const newConversation = await pb_1.pb.collection("conversations").create({
170
+ id: conversationId,
171
+ subscribers: [userId, employerId],
172
+ contents: [],
173
+ last_message: {},
174
+ });
175
+ return newConversation;
176
+ }
177
+ }
178
+ exports.ConversationService = ConversationService;
179
179
  //# sourceMappingURL=chat.js.map
@@ -1,2 +1,2 @@
1
- import PocketBase from "pocketbase";
2
- export declare const pb: PocketBase;
1
+ import PocketBase from "pocketbase";
2
+ export declare const pb: PocketBase;
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pb = void 0;
4
- const pocketbase_1 = require("pocketbase");
5
- const env_1 = require("../env");
6
- exports.pb = new pocketbase_1.default(env_1.ENV.PB_URL);
7
- void exports.pb
8
- .collection("_superusers")
9
- .authWithPassword(env_1.ENV.PB_ADMIN_EMAIL, env_1.ENV.PB_ADMIN_PASSWORD);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pb = void 0;
4
+ const pocketbase_1 = require("pocketbase");
5
+ const env_1 = require("../env");
6
+ exports.pb = new pocketbase_1.default(env_1.ENV.PB_URL);
7
+ void exports.pb
8
+ .collection("_superusers")
9
+ .authWithPassword(env_1.ENV.PB_ADMIN_EMAIL, env_1.ENV.PB_ADMIN_PASSWORD);
10
10
  //# sourceMappingURL=pb.js.map
@@ -664,21 +664,39 @@ export declare const db: import("@supabase/supabase-js").SupabaseClient<Database
664
664
  };
665
665
  sessions: {
666
666
  Row: {
667
+ employer_id: string | null;
667
668
  id: string;
668
669
  owner_id: string;
669
670
  timestamp: string;
671
+ user_id: string | null;
670
672
  };
671
673
  Insert: {
674
+ employer_id?: string | null;
672
675
  id?: string;
673
676
  owner_id: string;
674
677
  timestamp?: string;
678
+ user_id?: string | null;
675
679
  };
676
680
  Update: {
681
+ employer_id?: string | null;
677
682
  id?: string;
678
683
  owner_id?: string;
679
684
  timestamp?: string;
685
+ user_id?: string | null;
680
686
  };
681
- Relationships: [];
687
+ Relationships: [{
688
+ foreignKeyName: "sessions_employer_id_fkey";
689
+ columns: ["employer_id"];
690
+ isOneToOne: false;
691
+ referencedRelation: "employers";
692
+ referencedColumns: ["id"];
693
+ }, {
694
+ foreignKeyName: "sessions_user_id_fkey";
695
+ columns: ["user_id"];
696
+ isOneToOne: false;
697
+ referencedRelation: "users";
698
+ referencedColumns: ["id"];
699
+ }];
682
700
  };
683
701
  user_activity: {
684
702
  Row: {
package/dist/lib/db/db.js CHANGED
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleDBError = exports.db = void 0;
4
- const supabase_js_1 = require("@supabase/supabase-js");
5
- const env_1 = require("../env");
6
- const DB_URL = env_1.ENV.SUPABASE_URL;
7
- const DB_SERVICE_KEY = env_1.ENV.SUPABASE_SERVICE_ROLE_KEY;
8
- if (!DB_URL || !DB_SERVICE_KEY)
9
- throw new Error("[ERROR:ENV] Missing Supabase configuration.");
10
- exports.db = (0, supabase_js_1.createClient)(DB_URL, DB_SERVICE_KEY);
11
- const handleDBError = (error, description = "") => {
12
- switch (error.code) {
13
- case "PGRST116":
14
- throw new Error(description, { cause: "DB_RECORD_NOT_FOUND" });
15
- case "23505":
16
- throw new Error(description, { cause: "DB_RECORD_ALREADY_EXISTS" });
17
- case "23503":
18
- throw new Error(description, { cause: "DB_REFERENCED_ERROR_NOT_FOUND" });
19
- default:
20
- throw new Error(description, { cause: "DB_OPERATION_FAILED" });
21
- }
22
- };
23
- exports.handleDBError = handleDBError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleDBError = exports.db = void 0;
4
+ const supabase_js_1 = require("@supabase/supabase-js");
5
+ const env_1 = require("../env");
6
+ const DB_URL = env_1.ENV.SUPABASE_URL;
7
+ const DB_SERVICE_KEY = env_1.ENV.SUPABASE_SERVICE_ROLE_KEY;
8
+ if (!DB_URL || !DB_SERVICE_KEY)
9
+ throw new Error("[ERROR:ENV] Missing Supabase configuration.");
10
+ exports.db = (0, supabase_js_1.createClient)(DB_URL, DB_SERVICE_KEY);
11
+ const handleDBError = (error, description = "") => {
12
+ switch (error.code) {
13
+ case "PGRST116":
14
+ throw new Error(description, { cause: "DB_RECORD_NOT_FOUND" });
15
+ case "23505":
16
+ throw new Error(description, { cause: "DB_RECORD_ALREADY_EXISTS" });
17
+ case "23503":
18
+ throw new Error(description, { cause: "DB_REFERENCED_ERROR_NOT_FOUND" });
19
+ default:
20
+ throw new Error(description, { cause: "DB_OPERATION_FAILED" });
21
+ }
22
+ };
23
+ exports.handleDBError = handleDBError;
24
24
  //# sourceMappingURL=db.js.map