@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.
- package/README.md +60 -60
- 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 -5
- package/dist/Entities/index.js +21 -21
- package/dist/Entities/messages.d.ts +9 -9
- package/dist/Entities/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 -63
- package/dist/Entities/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/apiConfig.d.ts +8 -0
- package/dist/configs/apiConfig.js +15 -0
- 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 -11
- package/dist/elements/image.d.ts +9 -9
- package/dist/elements/image.js +12 -12
- package/dist/elements/index.d.ts +3 -3
- package/dist/elements/index.js +19 -19
- package/dist/elements/list.d.ts +78 -78
- package/dist/elements/list.js +55 -55
- package/dist/elements/text.d.ts +12 -12
- package/dist/elements/text.js +13 -13
- package/dist/index.d.ts +8 -8
- package/dist/index.js +44 -44
- package/dist/interfaces/IApiMetaConfig.d.ts +3 -0
- package/dist/interfaces/IApiMetaConfig.js +2 -0
- package/dist/interfaces/IConnection.d.ts +13 -13
- package/dist/interfaces/IConnection.js +2 -2
- package/dist/interfaces/IEventsMessage.d.ts +2 -2
- package/dist/interfaces/IEventsMessage.js +2 -2
- package/dist/interfaces/ILog.d.ts +10 -10
- package/dist/interfaces/ILog.js +2 -2
- package/dist/interfaces/IMessage.d.ts +22 -22
- package/dist/interfaces/IMessage.js +2 -2
- package/dist/interfaces/ISdk.d.ts +16 -16
- 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 -11
- package/dist/queue/messageQueue.js +20 -20
- package/dist/routes/index.d.ts +3 -3
- package/dist/routes/index.js +11 -11
- package/dist/routes/webhooks/index.d.ts +3 -3
- package/dist/routes/webhooks/index.js +13 -13
- package/dist/routes/webhooks/methods/connection.d.ts +3 -3
- package/dist/routes/webhooks/methods/connection.js +42 -42
- package/dist/routes/webhooks/methods/messages.d.ts +3 -3
- package/dist/routes/webhooks/methods/messages.js +21 -21
- package/dist/services/axiosInstances.d.ts +18 -18
- package/dist/services/axiosInstances.js +45 -44
- 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 -2
- package/dist/services/mutations/messages.js +25 -25
- 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 -3
- package/dist/types/index.js +19 -19
- 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 -68
- package/dist/types/whatsappTypes.js +2 -2
- package/dist/ui/Button.d.ts +27 -27
- package/dist/ui/Button.js +95 -95
- package/dist/useCases/cadastroIncorporado/cadastroIncorporado.d.ts +1 -1
- package/dist/useCases/cadastroIncorporado/cadastroIncorporado.js +7 -7
- 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 -35
- package/dist/useCases/events/NatyEvents.js +13 -13
- 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 -63
- package/dist/useCases/message/whatsappResponse.js +405 -417
- package/dist/useCases/messages/index.d.ts +10 -10
- package/dist/useCases/messages/index.js +12 -12
- package/dist/useCases/sdk/index.d.ts +20 -19
- package/dist/useCases/sdk/index.js +50 -48
- package/dist/useCases/webhook/index.d.ts +15 -15
- package/dist/useCases/webhook/index.js +16 -16
- package/dist/utils/constants.d.ts +11 -11
- package/dist/utils/constants.js +17 -17
- 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 +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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
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
|
+
}
|
package/dist/utils/constants.js
CHANGED
|
@@ -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 = {}));
|
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,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@natyapp/meta",
|
|
3
|
-
"version": "1.5.
|
|
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": "^
|
|
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": "^
|
|
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
|
+
}
|