@natyapp/meta 1.5.1 → 1.5.2

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 (122) hide show
  1. package/README.md +60 -60
  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 -5
  9. package/dist/Entities/index.js +21 -21
  10. package/dist/Entities/messages.d.ts +9 -9
  11. package/dist/Entities/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 -63
  15. package/dist/Entities/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/apiConfig.d.ts +8 -0
  23. package/dist/configs/apiConfig.js +15 -0
  24. package/dist/configs/axiosInterceptors.d.ts +7 -7
  25. package/dist/configs/axiosInterceptors.js +10 -10
  26. package/dist/elements/button.d.ts +18 -18
  27. package/dist/elements/button.js +11 -11
  28. package/dist/elements/image.d.ts +9 -9
  29. package/dist/elements/image.js +12 -12
  30. package/dist/elements/index.d.ts +3 -3
  31. package/dist/elements/index.js +19 -19
  32. package/dist/elements/list.d.ts +78 -78
  33. package/dist/elements/list.js +55 -55
  34. package/dist/elements/text.d.ts +12 -12
  35. package/dist/elements/text.js +13 -13
  36. package/dist/index.d.ts +8 -8
  37. package/dist/index.js +44 -44
  38. package/dist/interfaces/IApiMetaConfig.d.ts +3 -0
  39. package/dist/interfaces/IApiMetaConfig.js +2 -0
  40. package/dist/interfaces/IConnection.d.ts +13 -13
  41. package/dist/interfaces/IConnection.js +2 -2
  42. package/dist/interfaces/IEventsMessage.d.ts +2 -2
  43. package/dist/interfaces/IEventsMessage.js +2 -2
  44. package/dist/interfaces/ILog.d.ts +10 -10
  45. package/dist/interfaces/ILog.js +2 -2
  46. package/dist/interfaces/IMessage.d.ts +22 -22
  47. package/dist/interfaces/IMessage.js +2 -2
  48. package/dist/interfaces/ISdk.d.ts +16 -16
  49. package/dist/interfaces/ISdk.js +2 -2
  50. package/dist/interfaces/IWebhook.d.ts +14 -14
  51. package/dist/interfaces/IWebhook.js +2 -2
  52. package/dist/interfaces/index.d.ts +5 -5
  53. package/dist/interfaces/index.js +21 -21
  54. package/dist/queue/messageQueue.d.ts +11 -11
  55. package/dist/queue/messageQueue.js +20 -20
  56. package/dist/routes/index.d.ts +3 -3
  57. package/dist/routes/index.js +11 -11
  58. package/dist/routes/webhooks/index.d.ts +3 -3
  59. package/dist/routes/webhooks/index.js +13 -13
  60. package/dist/routes/webhooks/methods/connection.d.ts +3 -3
  61. package/dist/routes/webhooks/methods/connection.js +42 -42
  62. package/dist/routes/webhooks/methods/messages.d.ts +3 -3
  63. package/dist/routes/webhooks/methods/messages.js +21 -21
  64. package/dist/services/axiosInstances.d.ts +18 -18
  65. package/dist/services/axiosInstances.js +45 -44
  66. package/dist/services/index.d.ts +3 -3
  67. package/dist/services/index.js +19 -19
  68. package/dist/services/middlewares/index.d.ts +1 -1
  69. package/dist/services/middlewares/index.js +5 -5
  70. package/dist/services/middlewares/validations.d.ts +4 -4
  71. package/dist/services/middlewares/validations.js +8 -8
  72. package/dist/services/mutations/connection.d.ts +2 -2
  73. package/dist/services/mutations/connection.js +49 -49
  74. package/dist/services/mutations/index.d.ts +3 -3
  75. package/dist/services/mutations/index.js +19 -19
  76. package/dist/services/mutations/logs.d.ts +2 -2
  77. package/dist/services/mutations/logs.js +25 -25
  78. package/dist/services/mutations/messages.d.ts +2 -2
  79. package/dist/services/mutations/messages.js +25 -25
  80. package/dist/services/mutations/validation.d.ts +5 -5
  81. package/dist/services/mutations/validation.js +15 -15
  82. package/dist/services/mutations/webhooks.d.ts +2 -2
  83. package/dist/services/mutations/webhooks.js +49 -49
  84. package/dist/types/index.d.ts +3 -3
  85. package/dist/types/index.js +19 -19
  86. package/dist/types/logs.d.ts +5 -5
  87. package/dist/types/logs.js +2 -2
  88. package/dist/types/requestTypes.d.ts +11 -11
  89. package/dist/types/requestTypes.js +2 -2
  90. package/dist/types/whatsappTypes.d.ts +68 -68
  91. package/dist/types/whatsappTypes.js +2 -2
  92. package/dist/ui/Button.d.ts +27 -27
  93. package/dist/ui/Button.js +95 -95
  94. package/dist/useCases/cadastroIncorporado/cadastroIncorporado.d.ts +1 -1
  95. package/dist/useCases/cadastroIncorporado/cadastroIncorporado.js +7 -7
  96. package/dist/useCases/connection/index.d.ts +15 -15
  97. package/dist/useCases/connection/index.js +16 -16
  98. package/dist/useCases/events/NatyEvents.d.ts +35 -35
  99. package/dist/useCases/events/NatyEvents.js +13 -13
  100. package/dist/useCases/index.d.ts +6 -6
  101. package/dist/useCases/index.js +16 -16
  102. package/dist/useCases/log/index.d.ts +10 -10
  103. package/dist/useCases/log/index.js +12 -12
  104. package/dist/useCases/message/index.d.ts +9 -9
  105. package/dist/useCases/message/index.js +6 -6
  106. package/dist/useCases/message/whatsappResponse.d.ts +62 -63
  107. package/dist/useCases/message/whatsappResponse.js +405 -417
  108. package/dist/useCases/messages/index.d.ts +10 -10
  109. package/dist/useCases/messages/index.js +12 -12
  110. package/dist/useCases/sdk/index.d.ts +20 -19
  111. package/dist/useCases/sdk/index.js +50 -48
  112. package/dist/useCases/webhook/index.d.ts +15 -15
  113. package/dist/useCases/webhook/index.js +16 -16
  114. package/dist/utils/constants.d.ts +11 -11
  115. package/dist/utils/constants.js +17 -17
  116. package/dist/utils/genUuid.d.ts +1 -1
  117. package/dist/utils/genUuid.js +16 -16
  118. package/dist/utils/index.d.ts +1 -1
  119. package/dist/utils/index.js +17 -17
  120. package/dist/utils/tryCatch.d.ts +1 -1
  121. package/dist/utils/tryCatch.js +19 -19
  122. package/package.json +39 -39
@@ -1,10 +1,10 @@
1
- import { MessageEntity } from "../../Entities/messages";
2
- import { Response } from "../../Errors";
3
- import { getAllProps, getAllReturn } from "../../types/requestTypes";
4
- declare class Messages {
5
- getSingle: (id: string) => Promise<Response<"", MessageEntity>>;
6
- getAll: (props: getAllProps) => Promise<Response<"", getAllReturn<MessageEntity>>>;
7
- searchOne: (key: string, value: string) => Promise<Response<"", MessageEntity>>;
8
- }
9
- declare const _default: Messages;
10
- export default _default;
1
+ import { MessageEntity } from "../../Entities/messages";
2
+ import { Response } from "../../Errors";
3
+ import { getAllProps, getAllReturn } from "../../types/requestTypes";
4
+ declare class Messages {
5
+ getSingle: (id: string) => Promise<Response<"", MessageEntity>>;
6
+ getAll: (props: getAllProps) => Promise<Response<"", getAllReturn<MessageEntity>>>;
7
+ searchOne: (key: string, value: string) => Promise<Response<"", MessageEntity>>;
8
+ }
9
+ declare const _default: Messages;
10
+ export default _default;
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const messages_1 = require("../../services/mutations/messages");
4
- const utils_1 = require("../../utils");
5
- class Messages {
6
- constructor() {
7
- this.getSingle = (id) => (0, utils_1.Try)(messages_1.messagesMutations.getSingle, id);
8
- this.getAll = (props) => (0, utils_1.Try)(messages_1.messagesMutations.getAll, props);
9
- this.searchOne = (key, value) => (0, utils_1.Try)(messages_1.messagesMutations.searchOne, key, value);
10
- }
11
- }
12
- exports.default = new Messages();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const messages_1 = require("../../services/mutations/messages");
4
+ const utils_1 = require("../../utils");
5
+ class Messages {
6
+ constructor() {
7
+ this.getSingle = (id) => (0, utils_1.Try)(messages_1.messagesMutations.getSingle, id);
8
+ this.getAll = (props) => (0, utils_1.Try)(messages_1.messagesMutations.getAll, props);
9
+ this.searchOne = (key, value) => (0, utils_1.Try)(messages_1.messagesMutations.searchOne, key, value);
10
+ }
11
+ }
12
+ exports.default = new Messages();
@@ -1,19 +1,20 @@
1
- import { Response } from "../../Errors/ErrorHandling";
2
- import { ConnectErrors, ConnectProps, ISdk } from "../../interfaces/ISdk";
3
- import Connection from "../connection";
4
- import Message from "../message";
5
- import Webhook from "../webhook";
6
- import Log from "../log";
7
- import { Express } from "express";
8
- import { NatyEvents } from "../events/NatyEvents";
9
- export declare class NatyMeta extends NatyEvents implements ISdk {
10
- connected: boolean;
11
- Connection: typeof Connection;
12
- Message: typeof Message;
13
- Webhook: typeof Webhook;
14
- Log: typeof Log;
15
- app: Express;
16
- constructor(app?: Express);
17
- connect({ appToken, pathname, app, }: ConnectProps): Promise<Response<ConnectErrors, boolean>>;
18
- initializeRoutes(path?: string): void;
19
- }
1
+ import { Response } from "../../Errors/ErrorHandling";
2
+ import { ConnectErrors, ConnectProps, ISdk } from "../../interfaces/ISdk";
3
+ import Connection from "../connection";
4
+ import Message from "../message";
5
+ import Webhook from "../webhook";
6
+ import Log from "../log";
7
+ import { Express } from "express";
8
+ import { NatyEvents } from "../events/NatyEvents";
9
+ import { IApiMetaConfig } from "../../interfaces/IApiMetaConfig";
10
+ export declare class NatyMeta extends NatyEvents implements ISdk {
11
+ connected: boolean;
12
+ Connection: typeof Connection;
13
+ Message: typeof Message;
14
+ Webhook: typeof Webhook;
15
+ Log: typeof Log;
16
+ app: Express;
17
+ constructor(apiMeta?: IApiMetaConfig, app?: Express);
18
+ connect({ appToken, pathname, app, }: ConnectProps): Promise<Response<ConnectErrors, boolean>>;
19
+ initializeRoutes(path?: string): void;
20
+ }
@@ -1,48 +1,50 @@
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.NatyMeta = void 0;
7
- const axiosInstances_1 = require("../../services/axiosInstances");
8
- const validations_1 = require("../../services/middlewares/validations");
9
- const tryCatch_1 = require("../../utils/tryCatch");
10
- const connection_1 = __importDefault(require("../connection"));
11
- const message_1 = __importDefault(require("../message"));
12
- const webhook_1 = __importDefault(require("../webhook"));
13
- const log_1 = __importDefault(require("../log"));
14
- const routes_1 = require("../../routes");
15
- const NatyEvents_1 = require("../events/NatyEvents");
16
- class NatyMeta extends NatyEvents_1.NatyEvents {
17
- constructor(app) {
18
- super();
19
- this.connected = false;
20
- if (app) {
21
- this.app = app;
22
- this.connect({ appToken: "" });
23
- }
24
- }
25
- async connect({ appToken, pathname, app, }) {
26
- if (app)
27
- this.app = app;
28
- const confirmAppToken = await (0, tryCatch_1.Try)(validations_1.middlewares.confirmAppToken, `${appToken}`);
29
- // this.emit("connection", {companyId:''});
30
- if (confirmAppToken.isSuccess) {
31
- await (0, axiosInstances_1.updateInterceptor)({ ["x-access-token"]: `${appToken}` });
32
- this.connected = true;
33
- this.Connection = connection_1.default;
34
- this.Message = message_1.default;
35
- this.Webhook = webhook_1.default;
36
- this.Log = log_1.default;
37
- }
38
- else {
39
- this.connected = false;
40
- }
41
- this.initializeRoutes(pathname);
42
- return confirmAppToken;
43
- }
44
- initializeRoutes(path) {
45
- this.app.use(path || "/", (0, routes_1.principalRoute)(this));
46
- }
47
- }
48
- exports.NatyMeta = NatyMeta;
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.NatyMeta = void 0;
7
+ const axiosInstances_1 = require("../../services/axiosInstances");
8
+ const validations_1 = require("../../services/middlewares/validations");
9
+ const tryCatch_1 = require("../../utils/tryCatch");
10
+ const connection_1 = __importDefault(require("../connection"));
11
+ const message_1 = __importDefault(require("../message"));
12
+ const webhook_1 = __importDefault(require("../webhook"));
13
+ const log_1 = __importDefault(require("../log"));
14
+ const routes_1 = require("../../routes");
15
+ const NatyEvents_1 = require("../events/NatyEvents");
16
+ const apiConfig_1 = require("../../configs/apiConfig");
17
+ class NatyMeta extends NatyEvents_1.NatyEvents {
18
+ constructor(apiMeta, app) {
19
+ super();
20
+ this.connected = false;
21
+ apiConfig_1.ApiConfig.getInstance(apiMeta);
22
+ if (app) {
23
+ this.app = app;
24
+ this.connect({ appToken: "" });
25
+ }
26
+ }
27
+ async connect({ appToken, pathname, app, }) {
28
+ if (app)
29
+ this.app = app;
30
+ const confirmAppToken = await (0, tryCatch_1.Try)(validations_1.middlewares.confirmAppToken, `${appToken}`);
31
+ // this.emit("connection", {companyId:''});
32
+ if (confirmAppToken.isSuccess) {
33
+ await (0, axiosInstances_1.updateInterceptor)({ ["x-access-token"]: `${appToken}` });
34
+ this.connected = true;
35
+ this.Connection = connection_1.default;
36
+ this.Message = message_1.default;
37
+ this.Webhook = webhook_1.default;
38
+ this.Log = log_1.default;
39
+ }
40
+ else {
41
+ this.connected = false;
42
+ }
43
+ this.initializeRoutes(pathname);
44
+ return confirmAppToken;
45
+ }
46
+ initializeRoutes(path) {
47
+ this.app.use(path || "/", (0, routes_1.principalRoute)(this));
48
+ }
49
+ }
50
+ exports.NatyMeta = NatyMeta;
@@ -1,15 +1,15 @@
1
- import { WebhooksEntity } from "../../Entities/webhooks";
2
- import { Either } from "../../Errors";
3
- import { IWebhook } from "../../interfaces";
4
- import { getAllProps, getAllReturn } from "../../types/requestTypes";
5
- declare class Webhooks implements IWebhook {
6
- getSingle: (id: string) => Promise<Either<"", WebhooksEntity>>;
7
- getAll: (props: getAllProps) => Promise<Either<"", getAllReturn<WebhooksEntity>>>;
8
- searchOne: (key: string, value: string) => Promise<Either<"", WebhooksEntity>>;
9
- insert: (connection: Partial<WebhooksEntity>) => Promise<Either<"", WebhooksEntity>>;
10
- update: (id: string, connection: Partial<WebhooksEntity>) => Promise<Either<"", WebhooksEntity>>;
11
- updateMany: (webhooks: Partial<WebhooksEntity>[]) => Promise<Either<"", WebhooksEntity[]>>;
12
- deleteOne: (id: string) => Promise<Either<"", WebhooksEntity>>;
13
- }
14
- declare const _default: Webhooks;
15
- export default _default;
1
+ import { WebhooksEntity } from "../../Entities/webhooks";
2
+ import { Either } from "../../Errors";
3
+ import { IWebhook } from "../../interfaces";
4
+ import { getAllProps, getAllReturn } from "../../types/requestTypes";
5
+ declare class Webhooks implements IWebhook {
6
+ getSingle: (id: string) => Promise<Either<"", WebhooksEntity>>;
7
+ getAll: (props: getAllProps) => Promise<Either<"", getAllReturn<WebhooksEntity>>>;
8
+ searchOne: (key: string, value: string) => Promise<Either<"", WebhooksEntity>>;
9
+ insert: (connection: Partial<WebhooksEntity>) => Promise<Either<"", WebhooksEntity>>;
10
+ update: (id: string, connection: Partial<WebhooksEntity>) => Promise<Either<"", WebhooksEntity>>;
11
+ updateMany: (webhooks: Partial<WebhooksEntity>[]) => Promise<Either<"", WebhooksEntity[]>>;
12
+ deleteOne: (id: string) => Promise<Either<"", WebhooksEntity>>;
13
+ }
14
+ declare const _default: Webhooks;
15
+ export default _default;
@@ -1,16 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const services_1 = require("../../services");
4
- const utils_1 = require("../../utils");
5
- class Webhooks {
6
- constructor() {
7
- this.getSingle = (id) => (0, utils_1.Try)(services_1.webhooksMutations.getSingle, id);
8
- this.getAll = (props) => (0, utils_1.Try)(services_1.webhooksMutations.getAll, props);
9
- this.searchOne = (key, value) => (0, utils_1.Try)(services_1.webhooksMutations.searchOne, key, value);
10
- this.insert = (connection) => (0, utils_1.Try)(services_1.webhooksMutations.insert, connection);
11
- this.update = (id, connection) => (0, utils_1.Try)(services_1.webhooksMutations.update, id, connection);
12
- this.updateMany = (webhooks) => (0, utils_1.Try)(services_1.webhooksMutations.updateMany, webhooks);
13
- this.deleteOne = (id) => (0, utils_1.Try)(services_1.webhooksMutations.deleteOne, id);
14
- }
15
- }
16
- exports.default = new Webhooks();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const services_1 = require("../../services");
4
+ const utils_1 = require("../../utils");
5
+ class Webhooks {
6
+ constructor() {
7
+ this.getSingle = (id) => (0, utils_1.Try)(services_1.webhooksMutations.getSingle, id);
8
+ this.getAll = (props) => (0, utils_1.Try)(services_1.webhooksMutations.getAll, props);
9
+ this.searchOne = (key, value) => (0, utils_1.Try)(services_1.webhooksMutations.searchOne, key, value);
10
+ this.insert = (connection) => (0, utils_1.Try)(services_1.webhooksMutations.insert, connection);
11
+ this.update = (id, connection) => (0, utils_1.Try)(services_1.webhooksMutations.update, id, connection);
12
+ this.updateMany = (webhooks) => (0, utils_1.Try)(services_1.webhooksMutations.updateMany, webhooks);
13
+ this.deleteOne = (id) => (0, utils_1.Try)(services_1.webhooksMutations.deleteOne, id);
14
+ }
15
+ }
16
+ exports.default = new Webhooks();
@@ -1,11 +1,11 @@
1
- export declare const events: {
2
- [key in Events.names]: string;
3
- };
4
- export declare namespace Events {
5
- type names = "message" | "connection" | "error";
6
- enum eventNames {
7
- MESSAGE = "message",
8
- CONNECTION = "connection",
9
- ERRORLOG = "error"
10
- }
11
- }
1
+ export declare const events: {
2
+ [key in Events.names]: string;
3
+ };
4
+ export declare namespace Events {
5
+ type names = "message" | "connection" | "error";
6
+ enum eventNames {
7
+ MESSAGE = "message",
8
+ CONNECTION = "connection",
9
+ ERRORLOG = "error"
10
+ }
11
+ }
@@ -1,17 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Events = exports.events = void 0;
4
- exports.events = {
5
- message: "message",
6
- connection: "connection",
7
- error: "error",
8
- };
9
- var Events;
10
- (function (Events) {
11
- let eventNames;
12
- (function (eventNames) {
13
- eventNames["MESSAGE"] = "message";
14
- eventNames["CONNECTION"] = "connection";
15
- eventNames["ERRORLOG"] = "error";
16
- })(eventNames = Events.eventNames || (Events.eventNames = {}));
17
- })(Events = exports.Events || (exports.Events = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Events = exports.events = void 0;
4
+ exports.events = {
5
+ message: "message",
6
+ connection: "connection",
7
+ error: "error",
8
+ };
9
+ var Events;
10
+ (function (Events) {
11
+ let eventNames;
12
+ (function (eventNames) {
13
+ eventNames["MESSAGE"] = "message";
14
+ eventNames["CONNECTION"] = "connection";
15
+ eventNames["ERRORLOG"] = "error";
16
+ })(eventNames = Events.eventNames || (Events.eventNames = {}));
17
+ })(Events = exports.Events || (exports.Events = {}));
@@ -1 +1 @@
1
- export declare const genId: (str?: string) => string;
1
+ export declare const genId: (str?: string) => string;
@@ -1,16 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.genId = void 0;
4
- const genId = (str = "ID") => {
5
- var characters = "abcdefghijklmnopqrstuvwxyz0123456789";
6
- var result = "";
7
- var charactersLength = characters.length;
8
- for (var i = 0; i < 4; i++) {
9
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
10
- }
11
- const randomNumber = Math.floor(Math.random() * Date.now())
12
- .toString()
13
- .substring(2, 7);
14
- return `${str.toUpperCase()}_${result}-${randomNumber}`;
15
- };
16
- exports.genId = genId;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genId = void 0;
4
+ const genId = (str = "ID") => {
5
+ var characters = "abcdefghijklmnopqrstuvwxyz0123456789";
6
+ var result = "";
7
+ var charactersLength = characters.length;
8
+ for (var i = 0; i < 4; i++) {
9
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
10
+ }
11
+ const randomNumber = Math.floor(Math.random() * Date.now())
12
+ .toString()
13
+ .substring(2, 7);
14
+ return `${str.toUpperCase()}_${result}-${randomNumber}`;
15
+ };
16
+ exports.genId = genId;
@@ -1 +1 @@
1
- export * from "./tryCatch";
1
+ export * from "./tryCatch";
@@ -1,17 +1,17 @@
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("./tryCatch"), 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("./tryCatch"), exports);
@@ -1 +1 @@
1
- export declare const Try: (fn: any, ...args: any) => Promise<any>;
1
+ export declare const Try: (fn: any, ...args: any) => Promise<any>;
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Try = void 0;
4
- const Either_1 = require("../Errors/Either");
5
- const ErrorHandling_1 = require("../Errors/ErrorHandling");
6
- const Try = async (fn, ...args) => {
7
- var _a;
8
- try {
9
- const resolver = await fn.apply(null, args);
10
- if ((0, Either_1.isSuccess)(resolver))
11
- (0, Either_1.unwrapEither)(resolver);
12
- return resolver;
13
- }
14
- catch (err) {
15
- const axiosError = { isError: (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data };
16
- return (0, ErrorHandling_1.ErrorHandling)(axiosError);
17
- }
18
- };
19
- exports.Try = Try;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Try = void 0;
4
+ const Either_1 = require("../Errors/Either");
5
+ const ErrorHandling_1 = require("../Errors/ErrorHandling");
6
+ const Try = async (fn, ...args) => {
7
+ var _a;
8
+ try {
9
+ const resolver = await fn.apply(null, args);
10
+ if ((0, Either_1.isSuccess)(resolver))
11
+ (0, Either_1.unwrapEither)(resolver);
12
+ return resolver;
13
+ }
14
+ catch (err) {
15
+ const axiosError = { isError: (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data };
16
+ return (0, ErrorHandling_1.ErrorHandling)(axiosError);
17
+ }
18
+ };
19
+ exports.Try = Try;
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "@natyapp/meta",
3
- "version": "1.5.1",
4
- "description": "",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "scripts": {
8
- "test": "jest --watchAll",
9
- "dev": "nodemon --quiet .",
10
- "build": "rm -rf ./dist && npx tsc --declaration -p tsconfig.json"
11
- },
12
- "keywords": [
13
- "naty"
14
- ],
15
- "author": "IkiraDev",
16
- "license": "ISC",
17
- "dependencies": {
18
- "@types/express": "^4.17.20",
19
- "axios": "^0.26.1",
20
- "events": "^3.3.0",
21
- "express": "^4.18.2",
22
- "react": "^18.2.0"
23
- },
24
- "publishConfig": {
25
- "access": "public"
26
- },
27
- "devDependencies": {
28
- "@types/axios": "^0.14.0",
29
- "@types/jest": "^29.2.4",
30
- "@types/node": "^18.11.18",
31
- "@types/react": "^18.2.47",
32
- "dotenv": "^16.0.3",
33
- "jest": "^29.3.1",
34
- "nodemon": "^2.0.22",
35
- "ts-jest": "^29.0.3",
36
- "ts-node": "^10.9.1",
37
- "typescript": "^4.9.4"
38
- }
39
- }
1
+ {
2
+ "name": "@natyapp/meta",
3
+ "version": "1.5.2",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "scripts": {
8
+ "test": "jest --watchAll",
9
+ "dev": "nodemon --quiet .",
10
+ "build": "rm -rf ./dist && npx tsc --declaration -p tsconfig.json"
11
+ },
12
+ "keywords": [
13
+ "naty"
14
+ ],
15
+ "author": "IkiraDev",
16
+ "license": "ISC",
17
+ "dependencies": {
18
+ "@types/express": "^4.17.20",
19
+ "axios": "^1.7.7",
20
+ "events": "^3.3.0",
21
+ "express": "^4.18.2",
22
+ "react": "^18.2.0"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "devDependencies": {
28
+ "@types/axios": "^0.14.0",
29
+ "@types/jest": "^29.2.4",
30
+ "@types/node": "^18.11.18",
31
+ "@types/react": "^18.2.47",
32
+ "dotenv": "^16.0.3",
33
+ "jest": "^29.3.1",
34
+ "nodemon": "^3.1.7",
35
+ "ts-jest": "^29.0.3",
36
+ "ts-node": "^10.9.1",
37
+ "typescript": "^4.9.4"
38
+ }
39
+ }