@betterinternship/core 2.0.3 → 2.0.5
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.d.ts +5 -5
- package/dist/index.js +5 -21
- package/dist/index.js.map +1 -1
- package/dist/lib/broker/broker.d.ts +11 -11
- package/dist/lib/broker/broker.js +77 -81
- package/dist/lib/broker/broker.js.map +1 -1
- package/dist/lib/broker/index.d.ts +1 -1
- package/dist/lib/broker/index.js +1 -17
- package/dist/lib/broker/index.js.map +1 -1
- package/dist/lib/chat/chat.js +183 -189
- package/dist/lib/chat/chat.js.map +1 -1
- package/dist/lib/chat/index.js +2 -18
- package/dist/lib/chat/index.js.map +1 -1
- package/dist/lib/chat/pb.js +15 -19
- package/dist/lib/chat/pb.js.map +1 -1
- package/dist/lib/email/email.d.ts +7 -7
- package/dist/lib/email/email.js +66 -70
- package/dist/lib/email/email.js.map +1 -1
- package/dist/lib/email/index.js +1 -17
- package/dist/lib/email/index.js.map +1 -1
- package/dist/lib/env.js +3 -6
- package/dist/lib/env.js.map +1 -1
- package/dist/lib/forms/fields.client.js +20 -24
- package/dist/lib/forms/fields.client.js.map +1 -1
- package/dist/lib/forms/fields.server.js +1 -2
- package/dist/lib/forms/form-metadata.d.ts +127 -127
- package/dist/lib/forms/form-metadata.js +320 -324
- package/dist/lib/forms/form-metadata.js.map +1 -1
- package/dist/lib/forms/index.js +3 -19
- package/dist/lib/forms/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -1
- package/dist/Code-MOA-Client/lib/legacy/form-metadata-migration.d.ts +0 -91
- package/dist/Code-MOA-Client/lib/legacy/form-metadata-migration.js +0 -225
- package/dist/Code-MOA-Client/lib/legacy/form-metadata-migration.js.map +0 -1
- package/dist/Package.Core/index.d.ts +0 -5
- package/dist/Package.Core/index.js +0 -22
- package/dist/Package.Core/index.js.map +0 -1
- package/dist/Package.Core/lib/forms/index.d.ts +0 -4
- package/dist/Package.Core/lib/forms/index.js +0 -21
- package/dist/Package.Core/lib/forms/index.js.map +0 -1
- package/dist/lib/forms/zschema.d.ts +0 -4
- package/dist/lib/forms/zschema.js +0 -20
- package/dist/lib/forms/zschema.js.map +0 -1
- package/dist/lib/notice/index.d.ts +0 -1
- package/dist/lib/notice/index.js +0 -18
- package/dist/lib/notice/index.js.map +0 -1
- package/dist/lib/notice/notice.d.ts +0 -1
- package/dist/lib/notice/notice.js +0 -6
- package/dist/lib/notice/notice.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './lib/chat';
|
|
2
|
-
export * from './lib/env';
|
|
3
|
-
export * from './lib/broker';
|
|
4
|
-
export * from './lib/email';
|
|
5
|
-
export * from './lib/forms';
|
|
1
|
+
export * from './lib/chat';
|
|
2
|
+
export * from './lib/env';
|
|
3
|
+
export * from './lib/broker';
|
|
4
|
+
export * from './lib/email';
|
|
5
|
+
export * from './lib/forms';
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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/chat"), exports);
|
|
18
|
-
__exportStar(require("./lib/env"), exports);
|
|
19
|
-
__exportStar(require("./lib/broker"), exports);
|
|
20
|
-
__exportStar(require("./lib/email"), exports);
|
|
21
|
-
__exportStar(require("./lib/forms"), exports);
|
|
1
|
+
export * from './lib/chat';
|
|
2
|
+
export * from './lib/env';
|
|
3
|
+
export * from './lib/broker';
|
|
4
|
+
export * from './lib/email';
|
|
5
|
+
export * from './lib/forms';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as amqp from 'amqplib/callback_api';
|
|
2
|
-
export declare const QueueName: (...args: string[]) => string;
|
|
3
|
-
export declare const BrokerAPI: {
|
|
4
|
-
assertQueue: (..._: any[]) => Promise<void>;
|
|
5
|
-
sendToQueue: (..._: any[]) => Promise<void>;
|
|
6
|
-
readFromQueue: (..._: any[]) => Promise<void>;
|
|
7
|
-
} | {
|
|
8
|
-
assertQueue: (queueId: string, options?: amqp.Options.AssertQueue) => void;
|
|
9
|
-
sendToQueue: (queueId: string, content: any) => void;
|
|
10
|
-
readFromQueue: (queueId: string) => Promise<unknown>;
|
|
11
|
-
};
|
|
1
|
+
import * as amqp from 'amqplib/callback_api';
|
|
2
|
+
export declare const QueueName: (...args: string[]) => string;
|
|
3
|
+
export declare const BrokerAPI: {
|
|
4
|
+
assertQueue: (..._: any[]) => Promise<void>;
|
|
5
|
+
sendToQueue: (..._: any[]) => Promise<void>;
|
|
6
|
+
readFromQueue: (..._: any[]) => Promise<void>;
|
|
7
|
+
} | {
|
|
8
|
+
assertQueue: (queueId: string, options?: amqp.Options.AssertQueue) => void;
|
|
9
|
+
sendToQueue: (queueId: string, content: any) => void;
|
|
10
|
+
readFromQueue: (queueId: string) => Promise<unknown>;
|
|
11
|
+
};
|
|
@@ -1,82 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
const
|
|
46
|
-
channels.
|
|
47
|
-
console.log(`[BROKER]
|
|
48
|
-
};
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
channels.writer.
|
|
56
|
-
console.log(`[BROKER] Message "${message.properties.messageId}"
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
resolve
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
sendToQueue,
|
|
79
|
-
readFromQueue,
|
|
80
|
-
};
|
|
81
|
-
})();
|
|
1
|
+
import * as amqp from 'amqplib/callback_api';
|
|
2
|
+
import { ENV } from '../env';
|
|
3
|
+
const RABBITMQ_URL = ENV.RABBITMQ_URL;
|
|
4
|
+
if (!RABBITMQ_URL && ENV.RABBITMQ_ENABLED)
|
|
5
|
+
throw new Error('[ERROR:ENV] Missing RabbitMQ configuration.');
|
|
6
|
+
export const QueueName = (...args) => {
|
|
7
|
+
if (ENV.ENVIRONMENT === 'production')
|
|
8
|
+
return args.join('.');
|
|
9
|
+
else
|
|
10
|
+
return ['dev', ...args].join('.');
|
|
11
|
+
};
|
|
12
|
+
export const BrokerAPI = await (async () => {
|
|
13
|
+
if (!RABBITMQ_URL) {
|
|
14
|
+
return {
|
|
15
|
+
assertQueue: async (..._) => { },
|
|
16
|
+
sendToQueue: async (..._) => { },
|
|
17
|
+
readFromQueue: async (..._) => { },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const connection = await new Promise((resolve) => {
|
|
21
|
+
amqp.connect(RABBITMQ_URL, (err, connection) => {
|
|
22
|
+
if (err)
|
|
23
|
+
throw err;
|
|
24
|
+
resolve(connection);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const createChannel = async () => {
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
connection.createChannel((err, channel) => {
|
|
30
|
+
if (err)
|
|
31
|
+
throw err;
|
|
32
|
+
resolve(channel);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const channels = {
|
|
37
|
+
asserter: await createChannel(),
|
|
38
|
+
reader: await createChannel(),
|
|
39
|
+
writer: await createChannel(),
|
|
40
|
+
};
|
|
41
|
+
const assertQueue = (queueId, options) => {
|
|
42
|
+
channels.asserter.assertQueue(queueId, { durable: true, ...options });
|
|
43
|
+
console.log(`[BROKER] Queue "${queueId}" has been asserted.`);
|
|
44
|
+
};
|
|
45
|
+
const sendToQueue = (queueId, content) => {
|
|
46
|
+
channels.writer.sendToQueue(queueId, Buffer.from(JSON.stringify(content)));
|
|
47
|
+
console.log(`[BROKER] Message sent to queue "${queueId}": ${JSON.stringify(content)}.`);
|
|
48
|
+
};
|
|
49
|
+
const readFromQueue = (queueId) => {
|
|
50
|
+
const resolveFromQueue = (message) => {
|
|
51
|
+
channels.writer.ack(message);
|
|
52
|
+
console.log(`[BROKER] Message "${message.properties.messageId}" resolved from queue "${queueId}".`);
|
|
53
|
+
};
|
|
54
|
+
const rejectFromQueue = (message) => {
|
|
55
|
+
channels.writer.nack(message);
|
|
56
|
+
console.log(`[BROKER] Message "${message.properties.messageId}" rejected from queue "${queueId}".`);
|
|
57
|
+
};
|
|
58
|
+
return new Promise((resolve) => channels.reader.consume(queueId, (message) => {
|
|
59
|
+
const result = {
|
|
60
|
+
content: message?.content.toJSON(),
|
|
61
|
+
resolve: () => message && resolveFromQueue(message),
|
|
62
|
+
reject: () => message && rejectFromQueue(message),
|
|
63
|
+
};
|
|
64
|
+
if (message) {
|
|
65
|
+
resolve(result);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
resolve(null);
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
assertQueue,
|
|
74
|
+
sendToQueue,
|
|
75
|
+
readFromQueue,
|
|
76
|
+
};
|
|
77
|
+
})();
|
|
82
78
|
//# sourceMappingURL=broker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../lib/broker/broker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../lib/broker/broker.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;AACtC,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC,gBAAgB;IACvC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAKjE,MAAM,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,EAAE,CAC7B,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;YAE3C,MAAM,MAAM,GAAG;gBACb,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE;gBAClC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC;gBACnD,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC;aAClD,CAAC;YAGF,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,WAAW;QACX,WAAW;QACX,aAAa;KACd,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './broker';
|
|
1
|
+
export * from './broker';
|
package/dist/lib/broker/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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("./broker"), exports);
|
|
1
|
+
export * from './broker';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/broker/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/broker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|