@natyapp/meta 1.1.0 → 1.3.0

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.
Files changed (120) hide show
  1. package/README.md +8 -0
  2. package/dist/Entities/Logs.d.ts +16 -16
  3. package/dist/Entities/Logs.js +13 -13
  4. package/dist/Entities/connection.d.ts +15 -15
  5. package/dist/Entities/connection.js +13 -13
  6. package/dist/Entities/errorLogs.d.ts +9 -9
  7. package/dist/Entities/errorLogs.js +13 -13
  8. package/dist/Entities/index.d.ts +5 -0
  9. package/dist/Entities/index.js +21 -0
  10. package/dist/Entities/messages.d.ts +9 -0
  11. package/dist/Entities/{QueueMessages.js → messages.js} +13 -13
  12. package/dist/Entities/webhooks.d.ts +17 -17
  13. package/dist/Entities/webhooks.js +13 -13
  14. package/dist/Entities/whatsappMessage.d.ts +63 -0
  15. package/dist/Entities/{message.js → whatsappMessage.js} +9 -9
  16. package/dist/Errors/Either.d.ts +15 -15
  17. package/dist/Errors/Either.js +37 -37
  18. package/dist/Errors/ErrorHandling.d.ts +10 -10
  19. package/dist/Errors/ErrorHandling.js +15 -15
  20. package/dist/Errors/index.d.ts +2 -2
  21. package/dist/Errors/index.js +18 -18
  22. package/dist/configs/axiosInterceptors.d.ts +7 -7
  23. package/dist/configs/axiosInterceptors.js +10 -10
  24. package/dist/elements/button.d.ts +18 -18
  25. package/dist/elements/button.js +11 -12
  26. package/dist/elements/image.d.ts +9 -9
  27. package/dist/elements/image.js +12 -12
  28. package/dist/elements/index.d.ts +3 -0
  29. package/dist/elements/index.js +19 -0
  30. package/dist/elements/list.d.ts +78 -78
  31. package/dist/elements/list.js +55 -55
  32. package/dist/elements/text.d.ts +12 -7
  33. package/dist/elements/text.js +13 -11
  34. package/dist/index.d.ts +8 -3
  35. package/dist/index.js +44 -10
  36. package/dist/interfaces/IConnection.d.ts +13 -13
  37. package/dist/interfaces/IConnection.js +2 -2
  38. package/dist/interfaces/IEventsMessage.d.ts +2 -0
  39. package/dist/interfaces/IEventsMessage.js +2 -0
  40. package/dist/interfaces/ILog.d.ts +10 -10
  41. package/dist/interfaces/ILog.js +2 -2
  42. package/dist/interfaces/IMessage.d.ts +22 -8
  43. package/dist/interfaces/IMessage.js +2 -2
  44. package/dist/interfaces/ISdk.d.ts +16 -13
  45. package/dist/interfaces/ISdk.js +2 -2
  46. package/dist/interfaces/IWebhook.d.ts +14 -14
  47. package/dist/interfaces/IWebhook.js +2 -2
  48. package/dist/interfaces/index.d.ts +5 -5
  49. package/dist/interfaces/index.js +21 -21
  50. package/dist/queue/messageQueue.d.ts +11 -0
  51. package/dist/queue/messageQueue.js +20 -0
  52. package/dist/routes/index.d.ts +3 -0
  53. package/dist/routes/index.js +11 -0
  54. package/dist/routes/webhooks/index.d.ts +3 -0
  55. package/dist/routes/webhooks/index.js +13 -0
  56. package/dist/routes/webhooks/methods/connection.d.ts +3 -0
  57. package/dist/routes/webhooks/methods/connection.js +41 -0
  58. package/dist/routes/webhooks/methods/messages.d.ts +3 -0
  59. package/dist/routes/webhooks/methods/messages.js +21 -0
  60. package/dist/services/axiosInstances.d.ts +18 -5
  61. package/dist/services/axiosInstances.js +45 -22
  62. package/dist/services/index.d.ts +3 -3
  63. package/dist/services/index.js +19 -19
  64. package/dist/services/middlewares/index.d.ts +1 -1
  65. package/dist/services/middlewares/index.js +5 -5
  66. package/dist/services/middlewares/validations.d.ts +4 -4
  67. package/dist/services/middlewares/validations.js +8 -8
  68. package/dist/services/mutations/connection.d.ts +2 -2
  69. package/dist/services/mutations/connection.js +49 -49
  70. package/dist/services/mutations/index.d.ts +3 -3
  71. package/dist/services/mutations/index.js +19 -19
  72. package/dist/services/mutations/logs.d.ts +2 -2
  73. package/dist/services/mutations/logs.js +25 -25
  74. package/dist/services/mutations/messages.d.ts +2 -0
  75. package/dist/services/mutations/messages.js +25 -0
  76. package/dist/services/mutations/validation.d.ts +5 -5
  77. package/dist/services/mutations/validation.js +15 -15
  78. package/dist/services/mutations/webhooks.d.ts +2 -2
  79. package/dist/services/mutations/webhooks.js +49 -49
  80. package/dist/types/index.d.ts +3 -0
  81. package/dist/types/index.js +19 -0
  82. package/dist/types/logs.d.ts +5 -5
  83. package/dist/types/logs.js +2 -2
  84. package/dist/types/requestTypes.d.ts +11 -11
  85. package/dist/types/requestTypes.js +2 -2
  86. package/dist/types/whatsappTypes.d.ts +68 -0
  87. package/dist/types/whatsappTypes.js +2 -0
  88. package/dist/ui/Button.d.ts +27 -0
  89. package/dist/ui/Button.js +95 -0
  90. package/dist/useCases/cadastroIncorporado/cadastroIncorporado.d.ts +1 -0
  91. package/dist/useCases/cadastroIncorporado/cadastroIncorporado.js +7 -0
  92. package/dist/useCases/connection/index.d.ts +15 -15
  93. package/dist/useCases/connection/index.js +16 -16
  94. package/dist/useCases/events/NatyEvents.d.ts +35 -0
  95. package/dist/useCases/events/NatyEvents.js +13 -0
  96. package/dist/useCases/index.d.ts +6 -6
  97. package/dist/useCases/index.js +16 -16
  98. package/dist/useCases/log/index.d.ts +10 -10
  99. package/dist/useCases/log/index.js +12 -12
  100. package/dist/useCases/message/index.d.ts +9 -9
  101. package/dist/useCases/message/index.js +6 -6
  102. package/dist/useCases/message/whatsappResponse.d.ts +62 -0
  103. package/dist/useCases/message/whatsappResponse.js +404 -0
  104. package/dist/useCases/messages/index.d.ts +10 -0
  105. package/dist/useCases/messages/index.js +12 -0
  106. package/dist/useCases/sdk/index.d.ts +19 -15
  107. package/dist/useCases/sdk/index.js +48 -36
  108. package/dist/useCases/webhook/index.d.ts +15 -15
  109. package/dist/useCases/webhook/index.js +16 -16
  110. package/dist/utils/constants.d.ts +11 -0
  111. package/dist/utils/constants.js +17 -0
  112. package/dist/utils/genUuid.d.ts +1 -1
  113. package/dist/utils/genUuid.js +16 -16
  114. package/dist/utils/index.d.ts +1 -1
  115. package/dist/utils/index.js +17 -17
  116. package/dist/utils/tryCatch.d.ts +1 -1
  117. package/dist/utils/tryCatch.js +19 -19
  118. package/package.json +8 -3
  119. package/dist/Entities/QueueMessages.d.ts +0 -7
  120. package/dist/Entities/message.d.ts +0 -4
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,14 @@
1
- import { WebhooksEntity } from "../Entities/webhooks";
2
- import { Either } from "../Errors";
3
- import { getAllProps, getAllReturn } from "../types/requestTypes";
4
- export interface IWebhook {
5
- insert(webhook: Partial<WebhooksEntity>): Promise<Either<webhookErrors, WebhooksEntity>>;
6
- getSingle(id: string): Promise<Either<webhookErrors, WebhooksEntity>>;
7
- searchOne(key: string, value: string): Promise<Either<webhookErrors, WebhooksEntity>>;
8
- getAll(props: getAllProps): Promise<Either<webhookErrors, getAllReturn<WebhooksEntity>>>;
9
- update(id: string, connection: Partial<WebhooksEntity>): Promise<Either<webhookErrors, WebhooksEntity>>;
10
- updateMany(connection: Partial<WebhooksEntity>[]): Promise<Either<webhookErrors, WebhooksEntity[]>>;
11
- deleteOne(id: string): Promise<Either<webhookErrors, WebhooksEntity>>;
12
- }
13
- type webhookErrors = "";
14
- export {};
1
+ import { WebhooksEntity } from "../Entities/webhooks";
2
+ import { Either } from "../Errors";
3
+ import { getAllProps, getAllReturn } from "../types/requestTypes";
4
+ export interface IWebhook {
5
+ insert(webhook: Partial<WebhooksEntity>): Promise<Either<webhookErrors, WebhooksEntity>>;
6
+ getSingle(id: string): Promise<Either<webhookErrors, WebhooksEntity>>;
7
+ searchOne(key: string, value: string): Promise<Either<webhookErrors, WebhooksEntity>>;
8
+ getAll(props: getAllProps): Promise<Either<webhookErrors, getAllReturn<WebhooksEntity>>>;
9
+ update(id: string, connection: Partial<WebhooksEntity>): Promise<Either<webhookErrors, WebhooksEntity>>;
10
+ updateMany(connection: Partial<WebhooksEntity>[]): Promise<Either<webhookErrors, WebhooksEntity[]>>;
11
+ deleteOne(id: string): Promise<Either<webhookErrors, WebhooksEntity>>;
12
+ }
13
+ type webhookErrors = "";
14
+ export {};
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
- export * from "./IConnection";
2
- export * from "./IWebhook";
3
- export * from "./IMessage";
4
- export * from "./ILog";
5
- export * from "./ISdk";
1
+ export * from "./IConnection";
2
+ export * from "./IWebhook";
3
+ export * from "./IMessage";
4
+ export * from "./ILog";
5
+ export * from "./ISdk";
@@ -1,21 +1,21 @@
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("./IConnection"), exports);
18
- __exportStar(require("./IWebhook"), exports);
19
- __exportStar(require("./IMessage"), exports);
20
- __exportStar(require("./ILog"), exports);
21
- __exportStar(require("./ISdk"), 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("./IConnection"), exports);
18
+ __exportStar(require("./IWebhook"), exports);
19
+ __exportStar(require("./IMessage"), exports);
20
+ __exportStar(require("./ILog"), exports);
21
+ __exportStar(require("./ISdk"), exports);
@@ -0,0 +1,11 @@
1
+ import { WhatsappMessage } from "../Entities/whatsappMessage";
2
+ export declare class MessageQueue {
3
+ private queueItems;
4
+ constructor();
5
+ addQueueItemForTopic(queueItem: IMessageQueueItem, topic: string): void;
6
+ processSingleItemForQueueTopic(topic: string, itemId: string): void;
7
+ }
8
+ export interface IMessageQueueItem {
9
+ id: string;
10
+ value: WhatsappMessage;
11
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageQueue = void 0;
4
+ class MessageQueue {
5
+ constructor() {
6
+ this.queueItems = {};
7
+ }
8
+ addQueueItemForTopic(queueItem, topic) {
9
+ if (this.queueItems[topic] === undefined) {
10
+ this.queueItems[topic] = [queueItem];
11
+ }
12
+ else {
13
+ this.queueItems[topic].push(queueItem);
14
+ }
15
+ }
16
+ processSingleItemForQueueTopic(topic, itemId) {
17
+ this.queueItems[topic] = this.queueItems[topic].filter((item) => item.id !== itemId);
18
+ }
19
+ }
20
+ exports.MessageQueue = MessageQueue;
@@ -0,0 +1,3 @@
1
+ import { Router } from "express";
2
+ import { NatyMeta } from "../useCases";
3
+ export declare const principalRoute: (naty: NatyMeta) => Router;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.principalRoute = void 0;
4
+ const express_1 = require("express");
5
+ const webhooks_1 = require("./webhooks");
6
+ const principalRoute = (naty) => {
7
+ const router = (0, express_1.Router)();
8
+ router.use("/webhooks", (0, webhooks_1.webhooksRouter)(naty));
9
+ return router;
10
+ };
11
+ exports.principalRoute = principalRoute;
@@ -0,0 +1,3 @@
1
+ import { Router } from "express";
2
+ import { NatyMeta } from "../../useCases";
3
+ export declare const webhooksRouter: (events: NatyMeta) => Router;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webhooksRouter = void 0;
4
+ const express_1 = require("express");
5
+ const messages_1 = require("./methods/messages");
6
+ const connection_1 = require("./methods/connection");
7
+ const webhooksRouter = (events) => {
8
+ const router = (0, express_1.Router)();
9
+ router.use("/messages", (0, messages_1.messagesRouter)(events));
10
+ router.use("/connections", (0, connection_1.connectionRouter)(events));
11
+ return router;
12
+ };
13
+ exports.webhooksRouter = webhooksRouter;
@@ -0,0 +1,3 @@
1
+ import { Router } from "express";
2
+ import { NatyMeta } from "../../../useCases";
3
+ export declare const connectionRouter: (naty: NatyMeta) => Router;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.connectionRouter = void 0;
4
+ const express_1 = require("express");
5
+ const whatsappResponse_1 = require("../../../useCases/message/whatsappResponse");
6
+ const services_1 = require("../../../services");
7
+ const connectionRouter = (naty) => {
8
+ const router = (0, express_1.Router)();
9
+ router.post("/", async (req, res) => {
10
+ var _a;
11
+ const { companyId, message, data } = req.body;
12
+ let dataReturn = {
13
+ companyId,
14
+ message: message,
15
+ data,
16
+ };
17
+ if (message === "confirm_connection") {
18
+ try {
19
+ const connectionId = (_a = data["hub.verify_token"]) === null || _a === void 0 ? void 0 : _a.split("/")[0];
20
+ const connectionInfo = (await services_1.connectionMutations.SearchOne("id", connectionId)).isSuccess;
21
+ if (!connectionInfo)
22
+ throw new Error("Não foi possível encontrar Connection");
23
+ dataReturn.connection = connectionInfo[0];
24
+ if (!dataReturn.connection)
25
+ throw new Error("Nao foi possível encontrar Connection");
26
+ const whatsAppResponse = new whatsappResponse_1.WhatsappResponse(companyId, dataReturn.connection.phoneNumberId);
27
+ const accountInfo = await whatsAppResponse.get_account_info();
28
+ if (!accountInfo)
29
+ throw new Error("Não foi possível encontrar Account");
30
+ dataReturn.accountInfo = accountInfo;
31
+ }
32
+ catch (err) {
33
+ console.log(err);
34
+ }
35
+ }
36
+ naty.emit("connection", dataReturn);
37
+ res.json({ connection: req.body });
38
+ });
39
+ return router;
40
+ };
41
+ exports.connectionRouter = connectionRouter;
@@ -0,0 +1,3 @@
1
+ import { Router } from "express";
2
+ import { NatyMeta } from "../../../useCases";
3
+ export declare const messagesRouter: (naty: NatyMeta) => Router;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.messagesRouter = void 0;
4
+ const express_1 = require("express");
5
+ // import db from "../../mock/response.json";
6
+ const whatsappMessage_1 = require("../../../Entities/whatsappMessage");
7
+ const whatsappResponse_1 = require("../../../useCases/message/whatsappResponse");
8
+ const messagesRouter = (naty) => {
9
+ const router = (0, express_1.Router)();
10
+ router.post("/", (req, res) => {
11
+ var _a, _b, _c, _d, _e, _f, _g;
12
+ const { companyId, data } = req.body;
13
+ // console.log({ messageValue });
14
+ const phone_number_id = (_c = (_b = (_a = data.entry[0]) === null || _a === void 0 ? void 0 : _a.changes[0]) === null || _b === void 0 ? void 0 : _b.value.metadata) === null || _c === void 0 ? void 0 : _c.phone_number_id;
15
+ const clientNumber = (_g = (_f = (_e = (_d = data.entry[0]) === null || _d === void 0 ? void 0 : _d.changes[0]) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.contacts[0]) === null || _g === void 0 ? void 0 : _g.wa_id;
16
+ naty.emit("message", new whatsappResponse_1.WhatsappResponse(companyId, phone_number_id, clientNumber, new whatsappMessage_1.WhatsappMessage(data)));
17
+ res.json(true);
18
+ });
19
+ return router;
20
+ };
21
+ exports.messagesRouter = messagesRouter;
@@ -1,5 +1,18 @@
1
- declare const api: import("axios").AxiosInstance;
2
- export { api };
3
- export declare const updateInterceptor: (interceptors: {
4
- [key: string]: string;
5
- }, callback?: ((bool: boolean) => void) | undefined) => Promise<number>;
1
+ export declare const newAxiosInstance: ({ url, phone_number_id, accessToken, }: {
2
+ url?: string | undefined;
3
+ phone_number_id?: string | undefined;
4
+ accessToken: string;
5
+ }) => import("axios").AxiosInstance;
6
+ export declare const axiosInstanceForDownloadMedia: ({ url, accessToken, }: {
7
+ url?: string | undefined;
8
+ accessToken: string;
9
+ }) => import("axios").AxiosInstance;
10
+ export declare const axiosInstanceGeneral: ({ url, accessToken, }: {
11
+ url?: string | undefined;
12
+ accessToken: string;
13
+ }) => import("axios").AxiosInstance;
14
+ declare const api: import("axios").AxiosInstance;
15
+ export { api };
16
+ export declare const updateInterceptor: (interceptors: {
17
+ [key: string]: string;
18
+ }, callback?: ((bool: boolean) => void) | undefined) => Promise<number>;
@@ -1,22 +1,45 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateInterceptor = exports.api = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const axiosInterceptors_1 = require("../configs/axiosInterceptors");
9
- const api = axios_1.default.create({
10
- baseURL: "https://whatsapi.secretarianaty.com/v1",
11
- headers: axiosInterceptors_1.configInterceptors,
12
- });
13
- exports.api = api;
14
- const updateInterceptor = async (interceptors, callback) => {
15
- return api.interceptors.request.use((config) => {
16
- // if (!config.headers) config.headers = configInterceptors;
17
- config.headers = Object.assign(Object.assign(Object.assign({}, config.headers), axiosInterceptors_1.configInterceptors), interceptors);
18
- callback && callback(true);
19
- return config;
20
- });
21
- };
22
- exports.updateInterceptor = updateInterceptor;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateInterceptor = exports.api = exports.axiosInstanceGeneral = exports.axiosInstanceForDownloadMedia = exports.newAxiosInstance = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const axiosInterceptors_1 = require("../configs/axiosInterceptors");
9
+ const newAxiosInstance = ({ url = "https://graph.facebook.com/v18.0/", phone_number_id, accessToken, }) => axios_1.default.create({
10
+ baseURL: url + phone_number_id,
11
+ headers: {
12
+ Authorization: `Bearer ${accessToken}`,
13
+ },
14
+ });
15
+ exports.newAxiosInstance = newAxiosInstance;
16
+ const axiosInstanceForDownloadMedia = ({ url = "https://graph.facebook.com/v18.0/media/", accessToken, }) => axios_1.default.create({
17
+ baseURL: url,
18
+ headers: {
19
+ Authorization: `Bearer ${accessToken}`,
20
+ },
21
+ });
22
+ exports.axiosInstanceForDownloadMedia = axiosInstanceForDownloadMedia;
23
+ const axiosInstanceGeneral = ({ url = "https://graph.facebook.com/v18.0/", accessToken, }) => axios_1.default.create({
24
+ baseURL: url,
25
+ headers: {
26
+ Authorization: `Bearer ${accessToken}`,
27
+ },
28
+ params: { query: { access_token: accessToken }, access_token: accessToken },
29
+ });
30
+ exports.axiosInstanceGeneral = axiosInstanceGeneral;
31
+ const api = axios_1.default.create({
32
+ // baseURL: "https://whatsapi.secretarianaty.com/v1",
33
+ baseURL: "https://meta.api.secretarianaty.com/v1",
34
+ headers: axiosInterceptors_1.configInterceptors,
35
+ });
36
+ exports.api = api;
37
+ const updateInterceptor = async (interceptors, callback) => {
38
+ return api.interceptors.request.use((config) => {
39
+ // if (!config.headers) config.headers = configInterceptors;
40
+ config.headers = Object.assign(Object.assign(Object.assign({}, config.headers), axiosInterceptors_1.configInterceptors), interceptors);
41
+ callback && callback(true);
42
+ return config;
43
+ });
44
+ };
45
+ exports.updateInterceptor = updateInterceptor;
@@ -1,3 +1,3 @@
1
- export * from "./mutations";
2
- export * from "./axiosInstances";
3
- export * from "./middlewares";
1
+ export * from "./mutations";
2
+ export * from "./axiosInstances";
3
+ export * from "./middlewares";
@@ -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("./mutations"), exports);
18
- __exportStar(require("./axiosInstances"), exports);
19
- __exportStar(require("./middlewares"), 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("./mutations"), exports);
18
+ __exportStar(require("./axiosInstances"), exports);
19
+ __exportStar(require("./middlewares"), exports);
@@ -1 +1 @@
1
- export { middlewares } from "./validations";
1
+ export { middlewares } from "./validations";
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.middlewares = void 0;
4
- var validations_1 = require("./validations");
5
- Object.defineProperty(exports, "middlewares", { enumerable: true, get: function () { return validations_1.middlewares; } });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.middlewares = void 0;
4
+ var validations_1 = require("./validations");
5
+ Object.defineProperty(exports, "middlewares", { enumerable: true, get: function () { return validations_1.middlewares; } });
@@ -1,4 +1,4 @@
1
- import { Response } from "../../Errors/ErrorHandling";
2
- export declare const middlewares: {
3
- confirmAppToken: (appToken: string) => Promise<Response<void, boolean>>;
4
- };
1
+ import { Response } from "../../Errors/ErrorHandling";
2
+ export declare const middlewares: {
3
+ confirmAppToken: (appToken: string) => Promise<Response<void, boolean>>;
4
+ };
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.middlewares = void 0;
4
- const validation_1 = require("../mutations/validation");
5
- const tryCatch_1 = require("../../utils/tryCatch");
6
- exports.middlewares = {
7
- confirmAppToken: async (appToken) => await (0, tryCatch_1.Try)(validation_1.validateMutations.confirmAppToken, appToken),
8
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.middlewares = void 0;
4
+ const validation_1 = require("../mutations/validation");
5
+ const tryCatch_1 = require("../../utils/tryCatch");
6
+ exports.middlewares = {
7
+ confirmAppToken: async (appToken) => await (0, tryCatch_1.Try)(validation_1.validateMutations.confirmAppToken, appToken),
8
+ };
@@ -1,2 +1,2 @@
1
- import { IConnection } from "../../interfaces";
2
- export declare const connectionMutations: IConnection;
1
+ import { IConnection } from "../../interfaces";
2
+ export declare const connectionMutations: IConnection;
@@ -1,49 +1,49 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.connectionMutations = void 0;
4
- const Either_1 = require("../../Errors/Either");
5
- const axiosInstances_1 = require("../axiosInstances");
6
- exports.connectionMutations = {
7
- insert: async (connection) => {
8
- const call = await axiosInstances_1.api.post(`/connections`, connection);
9
- if (!call.data)
10
- return (0, Either_1.throwError)("");
11
- return (0, Either_1.throwSuccess)(call.data);
12
- },
13
- getSingle: async (id) => {
14
- const call = await axiosInstances_1.api.get(`/connections/${id}`);
15
- if (!call.data)
16
- return (0, Either_1.throwError)("");
17
- return (0, Either_1.throwSuccess)(call.data);
18
- },
19
- SearchOne: async (key, value) => {
20
- const call = await axiosInstances_1.api.get(`/connections`, { params: { key, value } });
21
- if (!call.data)
22
- return (0, Either_1.throwError)("");
23
- return (0, Either_1.throwSuccess)(call.data);
24
- },
25
- getAll: async (props) => {
26
- const call = await axiosInstances_1.api.get(`/connections`, { params: props });
27
- if (!call.data)
28
- return (0, Either_1.throwError)("");
29
- return (0, Either_1.throwSuccess)(call.data);
30
- },
31
- update: async (id, connection) => {
32
- const call = await axiosInstances_1.api.patch(`/connections/${id}`, connection);
33
- if (!call.data)
34
- return (0, Either_1.throwError)("");
35
- return (0, Either_1.throwSuccess)(call.data);
36
- },
37
- updateMany: async (connection) => {
38
- const call = await axiosInstances_1.api.patch(`/connections`, connection);
39
- if (!call.data)
40
- return (0, Either_1.throwError)("");
41
- return (0, Either_1.throwSuccess)(call.data);
42
- },
43
- deleteOne: async (id) => {
44
- const call = await axiosInstances_1.api.delete(`/connections/${id}`);
45
- if (!call.data)
46
- return (0, Either_1.throwError)("");
47
- return (0, Either_1.throwSuccess)(call.data);
48
- },
49
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.connectionMutations = void 0;
4
+ const Either_1 = require("../../Errors/Either");
5
+ const axiosInstances_1 = require("../axiosInstances");
6
+ exports.connectionMutations = {
7
+ insert: async (connection) => {
8
+ const call = await axiosInstances_1.api.post(`/connections`, connection);
9
+ if (!call.data)
10
+ return (0, Either_1.throwError)("");
11
+ return (0, Either_1.throwSuccess)(call.data);
12
+ },
13
+ getSingle: async (id) => {
14
+ const call = await axiosInstances_1.api.get(`/connections/${id}`);
15
+ if (!call.data)
16
+ return (0, Either_1.throwError)("");
17
+ return (0, Either_1.throwSuccess)(call.data);
18
+ },
19
+ SearchOne: async (key, value) => {
20
+ const call = await axiosInstances_1.api.get(`/connections`, { params: { key, value } });
21
+ if (!call.data)
22
+ return (0, Either_1.throwError)("");
23
+ return (0, Either_1.throwSuccess)(call.data);
24
+ },
25
+ getAll: async (props) => {
26
+ const call = await axiosInstances_1.api.get(`/connections`, { params: props });
27
+ if (!call.data)
28
+ return (0, Either_1.throwError)("");
29
+ return (0, Either_1.throwSuccess)(call.data);
30
+ },
31
+ update: async (id, connection) => {
32
+ const call = await axiosInstances_1.api.patch(`/connections/${id}`, connection);
33
+ if (!call.data)
34
+ return (0, Either_1.throwError)("");
35
+ return (0, Either_1.throwSuccess)(call.data);
36
+ },
37
+ updateMany: async (connection) => {
38
+ const call = await axiosInstances_1.api.patch(`/connections`, connection);
39
+ if (!call.data)
40
+ return (0, Either_1.throwError)("");
41
+ return (0, Either_1.throwSuccess)(call.data);
42
+ },
43
+ deleteOne: async (id) => {
44
+ const call = await axiosInstances_1.api.delete(`/connections/${id}`);
45
+ if (!call.data)
46
+ return (0, Either_1.throwError)("");
47
+ return (0, Either_1.throwSuccess)(call.data);
48
+ },
49
+ };
@@ -1,3 +1,3 @@
1
- export * from "./connection";
2
- export * from "./logs";
3
- export * from "./webhooks";
1
+ export * from "./connection";
2
+ export * from "./logs";
3
+ export * from "./webhooks";
@@ -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("./connection"), exports);
18
- __exportStar(require("./logs"), exports);
19
- __exportStar(require("./webhooks"), 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("./connection"), exports);
18
+ __exportStar(require("./logs"), exports);
19
+ __exportStar(require("./webhooks"), exports);
@@ -1,2 +1,2 @@
1
- import { ILog } from "../../interfaces";
2
- export declare const logsMutations: ILog;
1
+ import { ILog } from "../../interfaces";
2
+ export declare const logsMutations: ILog;