@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.
- package/README.md +8 -0
- package/dist/Entities/Logs.d.ts +16 -16
- package/dist/Entities/Logs.js +13 -13
- package/dist/Entities/connection.d.ts +15 -15
- package/dist/Entities/connection.js +13 -13
- package/dist/Entities/errorLogs.d.ts +9 -9
- package/dist/Entities/errorLogs.js +13 -13
- package/dist/Entities/index.d.ts +5 -0
- package/dist/Entities/index.js +21 -0
- package/dist/Entities/messages.d.ts +9 -0
- package/dist/Entities/{QueueMessages.js → messages.js} +13 -13
- package/dist/Entities/webhooks.d.ts +17 -17
- package/dist/Entities/webhooks.js +13 -13
- package/dist/Entities/whatsappMessage.d.ts +63 -0
- package/dist/Entities/{message.js → whatsappMessage.js} +9 -9
- package/dist/Errors/Either.d.ts +15 -15
- package/dist/Errors/Either.js +37 -37
- package/dist/Errors/ErrorHandling.d.ts +10 -10
- package/dist/Errors/ErrorHandling.js +15 -15
- package/dist/Errors/index.d.ts +2 -2
- package/dist/Errors/index.js +18 -18
- package/dist/configs/axiosInterceptors.d.ts +7 -7
- package/dist/configs/axiosInterceptors.js +10 -10
- package/dist/elements/button.d.ts +18 -18
- package/dist/elements/button.js +11 -12
- package/dist/elements/image.d.ts +9 -9
- package/dist/elements/image.js +12 -12
- package/dist/elements/index.d.ts +3 -0
- package/dist/elements/index.js +19 -0
- package/dist/elements/list.d.ts +78 -78
- package/dist/elements/list.js +55 -55
- package/dist/elements/text.d.ts +12 -7
- package/dist/elements/text.js +13 -11
- package/dist/index.d.ts +8 -3
- package/dist/index.js +44 -10
- package/dist/interfaces/IConnection.d.ts +13 -13
- package/dist/interfaces/IConnection.js +2 -2
- package/dist/interfaces/IEventsMessage.d.ts +2 -0
- package/dist/interfaces/IEventsMessage.js +2 -0
- package/dist/interfaces/ILog.d.ts +10 -10
- package/dist/interfaces/ILog.js +2 -2
- package/dist/interfaces/IMessage.d.ts +22 -8
- package/dist/interfaces/IMessage.js +2 -2
- package/dist/interfaces/ISdk.d.ts +16 -13
- package/dist/interfaces/ISdk.js +2 -2
- package/dist/interfaces/IWebhook.d.ts +14 -14
- package/dist/interfaces/IWebhook.js +2 -2
- package/dist/interfaces/index.d.ts +5 -5
- package/dist/interfaces/index.js +21 -21
- package/dist/queue/messageQueue.d.ts +11 -0
- package/dist/queue/messageQueue.js +20 -0
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.js +11 -0
- package/dist/routes/webhooks/index.d.ts +3 -0
- package/dist/routes/webhooks/index.js +13 -0
- package/dist/routes/webhooks/methods/connection.d.ts +3 -0
- package/dist/routes/webhooks/methods/connection.js +41 -0
- package/dist/routes/webhooks/methods/messages.d.ts +3 -0
- package/dist/routes/webhooks/methods/messages.js +21 -0
- package/dist/services/axiosInstances.d.ts +18 -5
- package/dist/services/axiosInstances.js +45 -22
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js +19 -19
- package/dist/services/middlewares/index.d.ts +1 -1
- package/dist/services/middlewares/index.js +5 -5
- package/dist/services/middlewares/validations.d.ts +4 -4
- package/dist/services/middlewares/validations.js +8 -8
- package/dist/services/mutations/connection.d.ts +2 -2
- package/dist/services/mutations/connection.js +49 -49
- package/dist/services/mutations/index.d.ts +3 -3
- package/dist/services/mutations/index.js +19 -19
- package/dist/services/mutations/logs.d.ts +2 -2
- package/dist/services/mutations/logs.js +25 -25
- package/dist/services/mutations/messages.d.ts +2 -0
- package/dist/services/mutations/messages.js +25 -0
- package/dist/services/mutations/validation.d.ts +5 -5
- package/dist/services/mutations/validation.js +15 -15
- package/dist/services/mutations/webhooks.d.ts +2 -2
- package/dist/services/mutations/webhooks.js +49 -49
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +19 -0
- package/dist/types/logs.d.ts +5 -5
- package/dist/types/logs.js +2 -2
- package/dist/types/requestTypes.d.ts +11 -11
- package/dist/types/requestTypes.js +2 -2
- package/dist/types/whatsappTypes.d.ts +68 -0
- package/dist/types/whatsappTypes.js +2 -0
- package/dist/ui/Button.d.ts +27 -0
- package/dist/ui/Button.js +95 -0
- package/dist/useCases/cadastroIncorporado/cadastroIncorporado.d.ts +1 -0
- package/dist/useCases/cadastroIncorporado/cadastroIncorporado.js +7 -0
- package/dist/useCases/connection/index.d.ts +15 -15
- package/dist/useCases/connection/index.js +16 -16
- package/dist/useCases/events/NatyEvents.d.ts +35 -0
- package/dist/useCases/events/NatyEvents.js +13 -0
- package/dist/useCases/index.d.ts +6 -6
- package/dist/useCases/index.js +16 -16
- package/dist/useCases/log/index.d.ts +10 -10
- package/dist/useCases/log/index.js +12 -12
- package/dist/useCases/message/index.d.ts +9 -9
- package/dist/useCases/message/index.js +6 -6
- package/dist/useCases/message/whatsappResponse.d.ts +62 -0
- package/dist/useCases/message/whatsappResponse.js +404 -0
- package/dist/useCases/messages/index.d.ts +10 -0
- package/dist/useCases/messages/index.js +12 -0
- package/dist/useCases/sdk/index.d.ts +19 -15
- package/dist/useCases/sdk/index.js +48 -36
- package/dist/useCases/webhook/index.d.ts +15 -15
- package/dist/useCases/webhook/index.js +16 -16
- package/dist/utils/constants.d.ts +11 -0
- package/dist/utils/constants.js +17 -0
- package/dist/utils/genUuid.d.ts +1 -1
- package/dist/utils/genUuid.js +16 -16
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +17 -17
- package/dist/utils/tryCatch.d.ts +1 -1
- package/dist/utils/tryCatch.js +19 -19
- package/package.json +8 -3
- package/dist/Entities/QueueMessages.d.ts +0 -7
- package/dist/Entities/message.d.ts +0 -4
|
@@ -1,36 +1,48 @@
|
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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,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();
|
|
@@ -0,0 +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 = {}));
|
package/dist/utils/genUuid.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const genId: (str?: string) => string;
|
|
1
|
+
export declare const genId: (str?: string) => string;
|
package/dist/utils/genUuid.js
CHANGED
|
@@ -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;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./tryCatch";
|
|
1
|
+
export * from "./tryCatch";
|
package/dist/utils/index.js
CHANGED
|
@@ -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);
|
package/dist/utils/tryCatch.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Try: (fn: any, ...args: any) => Promise<any>;
|
|
1
|
+
export declare const Try: (fn: any, ...args: any) => Promise<any>;
|
package/dist/utils/tryCatch.js
CHANGED
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@natyapp/meta",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
"author": "IkiraDev",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"
|
|
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"
|
|
19
23
|
},
|
|
20
24
|
"publishConfig": {
|
|
21
25
|
"access": "public"
|
|
@@ -24,9 +28,10 @@
|
|
|
24
28
|
"@types/axios": "^0.14.0",
|
|
25
29
|
"@types/jest": "^29.2.4",
|
|
26
30
|
"@types/node": "^18.11.18",
|
|
31
|
+
"@types/react": "^18.2.47",
|
|
27
32
|
"dotenv": "^16.0.3",
|
|
28
33
|
"jest": "^29.3.1",
|
|
29
|
-
"nodemon": "^2.0.
|
|
34
|
+
"nodemon": "^2.0.22",
|
|
30
35
|
"ts-jest": "^29.0.3",
|
|
31
36
|
"ts-node": "^10.9.1",
|
|
32
37
|
"typescript": "^4.9.4"
|