@betterinternship/core 1.1.22 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"db.types.js","sourceRoot":"","sources":["../../../lib/db/db.types.ts"],"names":[],"mappings":";;;AAggCa,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;CACO,CAAA"}
1
+ {"version":3,"file":"db.types.js","sourceRoot":"","sources":["../../../lib/db/db.types.ts"],"names":[],"mappings":";;;AAqhCa,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;CACO,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from "./db";
2
- export * from "./db.types";
1
+ export * from "./db";
2
+ export * from "./db.types";
@@ -1,19 +1,19 @@
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("./db"), exports);
18
- __exportStar(require("./db.types"), 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("./db"), exports);
18
+ __exportStar(require("./db.types"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- export declare const sendSingleEmail: ({ sender, subject, recipient, content, }: {
2
- sender?: string;
3
- subject: string;
4
- recipient: string;
5
- content: string;
6
- }) => void;
1
+ export declare const sendSingleEmail: ({ sender, subject, recipient, content, }: {
2
+ sender?: string;
3
+ subject: string;
4
+ recipient: string;
5
+ content: string;
6
+ }) => void;
@@ -1,40 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendSingleEmail = void 0;
4
- const nodemailer = require("nodemailer");
5
- const uuid_1 = require("uuid");
6
- const env_1 = require("../env");
7
- const SMTP_EMAIL = env_1.ENV.SMTP_EMAIL;
8
- const SMTP_PASSWORD = env_1.ENV.SMTP_PASSWORD;
9
- if (!SMTP_EMAIL || !SMTP_PASSWORD)
10
- throw Error("[ERROR:ENV]: Missing SMTP setup.");
11
- const transporter = nodemailer.createTransport({
12
- service: "Gmail",
13
- host: "smtp.gmail.com",
14
- port: 465,
15
- secure: true,
16
- auth: {
17
- user: SMTP_EMAIL,
18
- pass: SMTP_PASSWORD,
19
- },
20
- messageId: `${(0, uuid_1.v4)()}${SMTP_EMAIL}`,
21
- });
22
- const sendSingleEmail = ({ sender, subject, recipient, content, }) => {
23
- transporter.sendMail({
24
- from: sender ?? SMTP_EMAIL,
25
- to: recipient,
26
- subject,
27
- html: content,
28
- }, (error, info) => {
29
- if (error) {
30
- console.error("[ERROR] Could not send email.");
31
- console.error("[-----] " + error.message);
32
- }
33
- else {
34
- console.warn("[LOG] Email sent to " + recipient);
35
- }
36
- });
37
- return;
38
- };
39
- exports.sendSingleEmail = sendSingleEmail;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendSingleEmail = void 0;
4
+ const nodemailer = require("nodemailer");
5
+ const uuid_1 = require("uuid");
6
+ const env_1 = require("../env");
7
+ const SMTP_EMAIL = env_1.ENV.SMTP_EMAIL;
8
+ const SMTP_PASSWORD = env_1.ENV.SMTP_PASSWORD;
9
+ if (!SMTP_EMAIL || !SMTP_PASSWORD)
10
+ throw Error("[ERROR:ENV]: Missing SMTP setup.");
11
+ const transporter = nodemailer.createTransport({
12
+ service: "Gmail",
13
+ host: "smtp.gmail.com",
14
+ port: 465,
15
+ secure: true,
16
+ auth: {
17
+ user: SMTP_EMAIL,
18
+ pass: SMTP_PASSWORD,
19
+ },
20
+ messageId: `${(0, uuid_1.v4)()}${SMTP_EMAIL}`,
21
+ });
22
+ const sendSingleEmail = ({ sender, subject, recipient, content, }) => {
23
+ transporter.sendMail({
24
+ from: sender ?? SMTP_EMAIL,
25
+ to: recipient,
26
+ subject,
27
+ html: content,
28
+ }, (error, info) => {
29
+ if (error) {
30
+ console.error("[ERROR] Could not send email.");
31
+ console.error("[-----] " + error.message);
32
+ }
33
+ else {
34
+ console.warn("[LOG] Email sent to " + recipient);
35
+ }
36
+ });
37
+ return;
38
+ };
39
+ exports.sendSingleEmail = sendSingleEmail;
40
40
  //# sourceMappingURL=email.js.map
@@ -1 +1 @@
1
- export * from "./email";
1
+ export * from "./email";
@@ -1,18 +1,18 @@
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("./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("./email"), exports);
18
18
  //# sourceMappingURL=index.js.map
package/dist/lib/env.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const ENV: NodeJS.ProcessEnv;
1
+ export declare const ENV: NodeJS.ProcessEnv;
package/dist/lib/env.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENV = void 0;
4
- const dotenv = require("dotenv");
5
- dotenv.config();
6
- exports.ENV = process.env;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENV = void 0;
4
+ const dotenv = require("dotenv");
5
+ dotenv.config();
6
+ exports.ENV = process.env;
7
7
  //# sourceMappingURL=env.js.map
@@ -1 +1 @@
1
- export * from "./notice";
1
+ export * from "./notice";
@@ -1,18 +1,18 @@
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("./notice"), 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("./notice"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -1,7 +1 @@
1
- import * as amqp from "amqplib/callback_api";
2
- export declare const QueueName: (...args: string[]) => string;
3
- export declare const NoticeAPI: {
4
- assertQueue: (queueId: string, options?: amqp.Options.AssertQueue) => void;
5
- sendToQueue: (queueId: string, content: any) => void;
6
- readFromQueue: (queueId: string) => Promise<amqp.Message | null>;
7
- };
1
+ export declare const NoticeAPI: () => void;
@@ -1,53 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoticeAPI = exports.QueueName = void 0;
4
- const amqp = require("amqplib/callback_api");
5
- const env_1 = require("../env");
6
- const RABBITMQ_URL = env_1.ENV.RABBITMQ_URL;
7
- if (!RABBITMQ_URL)
8
- throw new Error("[ERROR:ENV] Missing RabbitMQ configuration.");
9
- const QueueName = (...args) => {
10
- if (env_1.ENV.ENVIRONMENT === "production")
11
- return args.join(".");
12
- else
13
- return ["dev", ...args].join(".");
14
- };
15
- exports.QueueName = QueueName;
16
- exports.NoticeAPI = (() => {
17
- let onResolve;
18
- let promise = new Promise((resolve) => {
19
- onResolve = resolve;
20
- });
21
- amqp.connect(RABBITMQ_URL, (err, connection) => {
22
- if (err)
23
- throw err;
24
- connection.createChannel((err, channel) => {
25
- if (err)
26
- throw err;
27
- if (!onResolve)
28
- return;
29
- onResolve(channel);
30
- });
31
- });
32
- const assertQueue = (queueId, options) => {
33
- promise = promise.then((channel) => (channel.assertQueue(queueId, { durable: true, ...options }), channel));
34
- };
35
- const sendToQueue = (queueId, content) => {
36
- promise = promise.then((channel) => (channel.sendToQueue(queueId, Buffer.from(JSON.stringify(content))),
37
- console.log(`Message sent to ${queueId}: ${JSON.stringify(content)}.`),
38
- channel));
39
- };
40
- const readFromQueue = async (queueId) => {
41
- let localResolve;
42
- const subPromise = new Promise((resolve) => (localResolve = resolve));
43
- promise = promise.then((channel) => (channel.consume(queueId, (message) => (localResolve(message), message && channel.ack(message))),
44
- channel));
45
- return subPromise;
46
- };
47
- return {
48
- assertQueue,
49
- sendToQueue,
50
- readFromQueue,
51
- };
52
- })();
3
+ exports.NoticeAPI = void 0;
4
+ const NoticeAPI = () => { };
5
+ exports.NoticeAPI = NoticeAPI;
53
6
  //# sourceMappingURL=notice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notice.js","sour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, { RecordModel } from "pocketbase";
2
- export declare const pb: PocketBase;
3
- export interface Message extends RecordModel {
4
- message: string;
5
- sender_id: string;
6
- timestamp: number;
7
- }
8
- export interface Conversation extends RecordModel {
9
- id: string;
10
- contents: Message[];
11
- employer_id: string;
12
- user_id: string;
13
- }
14
- export interface Notification extends RecordModel {
15
- id: string;
16
- conversations: {
17
- [conversationId: string]: {
18
- latest_message: Message;
19
- employer_id: string;
20
- user_id: string;
21
- is_unread: boolean;
22
- };
23
- };
24
- }
1
+ import PocketBase, { RecordModel } from "pocketbase";
2
+ export declare const pb: PocketBase;
3
+ export interface Message extends RecordModel {
4
+ message: string;
5
+ sender_id: string;
6
+ timestamp: number;
7
+ }
8
+ export interface Conversation extends RecordModel {
9
+ id: string;
10
+ contents: Message[];
11
+ employer_id: string;
12
+ user_id: string;
13
+ }
14
+ export interface Notification extends RecordModel {
15
+ id: string;
16
+ conversations: {
17
+ [conversationId: string]: {
18
+ latest_message: Message;
19
+ employer_id: string;
20
+ user_id: string;
21
+ is_unread: boolean;
22
+ };
23
+ };
24
+ }
package/dist/lib/pb/pb.js CHANGED
@@ -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