@noildm/contracts 1.0.11 → 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,2 @@
1
+ import { RabbitExchangeConfig } from '../shared/rabbit-exchange-config.interface';
2
+ export declare const EXCHANGE_MAIL: RabbitExchangeConfig;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXCHANGE_MAIL = void 0;
4
+ exports.EXCHANGE_MAIL = {
5
+ name: 'mail',
6
+ type: 'direct',
7
+ };
@@ -0,0 +1,7 @@
1
+ export interface SendMailRequest {
2
+ from?: string;
3
+ toEmail: string;
4
+ subject: string;
5
+ text: string;
6
+ html?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { AmqpBaseRequest } from "../../shared/amqp-base-request.interface";
2
+ import { QueueDeclaration } from "../../shared/queue-declaration.interface";
3
+ import { SendMailRequest } from "./request-type";
4
+ export declare namespace SendMailContract {
5
+ const queue: QueueDeclaration<unknown>;
6
+ type request = AmqpBaseRequest<SendMailRequest>;
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SendMailContract = void 0;
4
+ const mail_exchange_1 = require("../../exchanges/mail.exchange");
5
+ var SendMailContract;
6
+ (function (SendMailContract) {
7
+ SendMailContract.queue = {
8
+ exchange: mail_exchange_1.EXCHANGE_MAIL,
9
+ queue: `${mail_exchange_1.EXCHANGE_MAIL.name}-send`,
10
+ routingKey: `${mail_exchange_1.EXCHANGE_MAIL.name}-send`,
11
+ queueOptions: { durable: true },
12
+ };
13
+ })(SendMailContract || (exports.SendMailContract = SendMailContract = {}));
@@ -0,0 +1,8 @@
1
+ export interface AmqpBaseRequest<T = unknown> {
2
+ type: string;
3
+ payload: T;
4
+ requestId: string;
5
+ timeStamp: string;
6
+ exchange?: string;
7
+ routingKey?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { AmqpBaseRequest } from './amqp-base-request.interface';
2
+ export interface AmqpBaseResponse<T = unknown> extends AmqpBaseRequest<T> {
3
+ error?: {
4
+ code: string;
5
+ message: string;
6
+ };
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,30 @@
1
+ import { RabbitExchangeConfig } from "./rabbit-exchange-config.interface";
2
+ interface QueueOptions<ConsumeOptions> {
3
+ durable?: boolean;
4
+ exclusive?: boolean;
5
+ autoDelete?: boolean;
6
+ arguments?: any;
7
+ messageTtl?: number;
8
+ expires?: number;
9
+ deadLetterExchange?: string;
10
+ deadLetterRoutingKey?: string;
11
+ maxLength?: number;
12
+ maxPriority?: number;
13
+ bindQueueArguments?: any;
14
+ /**
15
+ * Set this to the name of the channel you want to consume messages from to enable this feature.
16
+ *
17
+ * If channel does not exist or you haven't specified one, it will use the default channel.
18
+ *
19
+ * For channel to exist it needs to be created in module config.
20
+ */
21
+ channel?: string;
22
+ consumerOptions?: ConsumeOptions;
23
+ }
24
+ export interface QueueDeclaration<ConsumeOptions> {
25
+ exchange: RabbitExchangeConfig;
26
+ routingKey: string;
27
+ queue: string;
28
+ queueOptions: QueueOptions<ConsumeOptions>;
29
+ }
30
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ export interface RabbitExchangeConfig {
2
+ name: string;
3
+ type: 'topic' | 'direct' | 'fanout';
4
+ options?: AssertExchange;
5
+ }
6
+ interface AssertExchange {
7
+ durable?: boolean;
8
+ internal?: boolean;
9
+ autoDelete?: boolean;
10
+ alternateExchange?: string;
11
+ arguments?: unknown | unknown[];
12
+ }
13
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export * as AuthProto from './gen/auth';
2
+ export * as UserProto from './gen/user';
3
+ export * from './contracts/exchanges/mail.exchange';
4
+ export * from './contracts/queues/mail/request-type';
5
+ export * from './contracts/queues/mail/send-mail.contract';
package/dist/index.js ADDED
@@ -0,0 +1,44 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.UserProto = exports.AuthProto = void 0;
40
+ exports.AuthProto = __importStar(require("./gen/auth"));
41
+ exports.UserProto = __importStar(require("./gen/user"));
42
+ __exportStar(require("./contracts/exchanges/mail.exchange"), exports);
43
+ __exportStar(require("./contracts/queues/mail/request-type"), exports);
44
+ __exportStar(require("./contracts/queues/mail/send-mail.contract"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noildm/contracts",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Protobuf and RabbitMQ contracts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",