@natyapp/meta 1.0.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 (85) hide show
  1. package/README.md +52 -0
  2. package/dist/Entities/Logs.d.ts +16 -0
  3. package/dist/Entities/Logs.js +13 -0
  4. package/dist/Entities/QueueMessages.d.ts +7 -0
  5. package/dist/Entities/QueueMessages.js +13 -0
  6. package/dist/Entities/connection.d.ts +15 -0
  7. package/dist/Entities/connection.js +13 -0
  8. package/dist/Entities/errorLogs.d.ts +9 -0
  9. package/dist/Entities/errorLogs.js +13 -0
  10. package/dist/Entities/message.d.ts +4 -0
  11. package/dist/Entities/message.js +9 -0
  12. package/dist/Entities/webhooks.d.ts +17 -0
  13. package/dist/Entities/webhooks.js +13 -0
  14. package/dist/Errors/Either.d.ts +15 -0
  15. package/dist/Errors/Either.js +37 -0
  16. package/dist/Errors/ErrorHandling.d.ts +10 -0
  17. package/dist/Errors/ErrorHandling.js +15 -0
  18. package/dist/Errors/index.d.ts +2 -0
  19. package/dist/Errors/index.js +18 -0
  20. package/dist/configs/axiosInterceptors.d.ts +7 -0
  21. package/dist/configs/axiosInterceptors.js +10 -0
  22. package/dist/elements/button.d.ts +18 -0
  23. package/dist/elements/button.js +12 -0
  24. package/dist/elements/image.d.ts +9 -0
  25. package/dist/elements/image.js +12 -0
  26. package/dist/elements/list.d.ts +78 -0
  27. package/dist/elements/list.js +55 -0
  28. package/dist/elements/text.d.ts +7 -0
  29. package/dist/elements/text.js +11 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +10 -0
  32. package/dist/interfaces/IConnection.d.ts +13 -0
  33. package/dist/interfaces/IConnection.js +2 -0
  34. package/dist/interfaces/ILog.d.ts +10 -0
  35. package/dist/interfaces/ILog.js +2 -0
  36. package/dist/interfaces/IMessage.d.ts +8 -0
  37. package/dist/interfaces/IMessage.js +2 -0
  38. package/dist/interfaces/ISdk.d.ts +13 -0
  39. package/dist/interfaces/ISdk.js +2 -0
  40. package/dist/interfaces/IWebhook.d.ts +14 -0
  41. package/dist/interfaces/IWebhook.js +2 -0
  42. package/dist/interfaces/index.d.ts +5 -0
  43. package/dist/interfaces/index.js +21 -0
  44. package/dist/services/axiosInstances.d.ts +5 -0
  45. package/dist/services/axiosInstances.js +22 -0
  46. package/dist/services/index.d.ts +3 -0
  47. package/dist/services/index.js +19 -0
  48. package/dist/services/middlewares/index.d.ts +1 -0
  49. package/dist/services/middlewares/index.js +5 -0
  50. package/dist/services/middlewares/validations.d.ts +4 -0
  51. package/dist/services/middlewares/validations.js +8 -0
  52. package/dist/services/mutations/connection.d.ts +2 -0
  53. package/dist/services/mutations/connection.js +49 -0
  54. package/dist/services/mutations/index.d.ts +3 -0
  55. package/dist/services/mutations/index.js +19 -0
  56. package/dist/services/mutations/logs.d.ts +2 -0
  57. package/dist/services/mutations/logs.js +25 -0
  58. package/dist/services/mutations/validation.d.ts +5 -0
  59. package/dist/services/mutations/validation.js +15 -0
  60. package/dist/services/mutations/webhooks.d.ts +2 -0
  61. package/dist/services/mutations/webhooks.js +49 -0
  62. package/dist/types/logs.d.ts +5 -0
  63. package/dist/types/logs.js +2 -0
  64. package/dist/types/requestTypes.d.ts +11 -0
  65. package/dist/types/requestTypes.js +2 -0
  66. package/dist/useCases/connection/index.d.ts +15 -0
  67. package/dist/useCases/connection/index.js +16 -0
  68. package/dist/useCases/index.d.ts +6 -0
  69. package/dist/useCases/index.js +16 -0
  70. package/dist/useCases/log/index.d.ts +10 -0
  71. package/dist/useCases/log/index.js +12 -0
  72. package/dist/useCases/message/index.d.ts +9 -0
  73. package/dist/useCases/message/index.js +6 -0
  74. package/dist/useCases/sdk/index.d.ts +15 -0
  75. package/dist/useCases/sdk/index.js +36 -0
  76. package/dist/useCases/webhook/index.d.ts +15 -0
  77. package/dist/useCases/webhook/index.js +16 -0
  78. package/dist/utils/genUuid.d.ts +1 -0
  79. package/dist/utils/genUuid.js +16 -0
  80. package/dist/utils/index.d.ts +1 -0
  81. package/dist/utils/index.js +17 -0
  82. package/dist/utils/tryCatch.d.ts +1 -0
  83. package/dist/utils/tryCatch.js +19 -0
  84. package/index.ts +11 -0
  85. package/package.json +31 -0
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # SDK MICROSSERVIÇO SECRETARIA NATY / META
2
+
3
+ ## `_UNDER DEVELOPMENT_ `
4
+
5
+ <!-- `(Will not work until March, please wait the Release)` -->
6
+
7
+ <!-- ## HOW WILL WORK -->
8
+
9
+ ##### First we will import and Initialize the sdk package
10
+
11
+ 1. importing the package
12
+
13
+ ```
14
+ import SDKMeta from "NatyMeta"
15
+ ```
16
+
17
+ 2. initialize the class
18
+
19
+ ```
20
+ const SDK = new NatyMeta()
21
+ // you can use new sdk(`YOUR-APP-TOKEN`) to connect right on the class creation
22
+ ```
23
+
24
+ 3. connect your app token (if you dont use your token on class creation)
25
+
26
+ ```
27
+ const connectSDK = await SDK.connect( {apptoken: { `YOUR-APP-TOKEN` } } )
28
+
29
+ if(connectSDK.isError) throw new Error(connectSDK.isError.message)
30
+
31
+ console.log(connectSDK.isSuccess)
32
+ // Do what you need with the data... (connectSDK.isSuccess)
33
+ ```
34
+
35
+ 3. than set your application context to use all the individual classes
36
+
37
+ #### In this example:
38
+
39
+ - Retun of any Promise is {isSuccess:AuthReturnType, isError:ErrorHandlingType}
40
+ - If successed method (like the SDK.connect example too),
41
+ the sdk will abstract and will handle properly with the token for you,
42
+ the token will be automatic joined into axios instance header
43
+ - ErrorHandling type { code: number, message: string | Object }
44
+ - On the exemple, we are using "throw new Error" on every ErrorHandling to
45
+ stop and handle it on a simple way, but u can work at your way like
46
+ returning an alert using some alert lib like toastfy for the user.
47
+
48
+ <!-- ## Click on [NatyMeta](https://whatsapp.secretarianaty.com) for more information. -->
49
+
50
+ ##### (The link will be avalible soon)
51
+
52
+ ###### All Rights Reserved for Ikiradev
@@ -0,0 +1,16 @@
1
+ import { typeLog } from "../types/logs";
2
+ export declare class LogsEntity {
3
+ id: string;
4
+ _id: string;
5
+ type: typeLog;
6
+ owner?: string;
7
+ url?: string;
8
+ method?: string;
9
+ remoteIP?: string;
10
+ errorCode?: string;
11
+ objectData?: object;
12
+ isActive: boolean;
13
+ updatedAt: string;
14
+ createdAt: string;
15
+ constructor(props: Omit<LogsEntity, "_id" | "updatedAt" | "createdAt" | "id" | "isActive">, id?: string);
16
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogsEntity = void 0;
4
+ const genUuid_1 = require("../utils/genUuid");
5
+ class LogsEntity {
6
+ constructor(props, id) {
7
+ this.isActive = true;
8
+ if (!id)
9
+ this.id = (0, genUuid_1.genId)("LOG");
10
+ Object.assign(this, props);
11
+ }
12
+ }
13
+ exports.LogsEntity = LogsEntity;
@@ -0,0 +1,7 @@
1
+ export declare class QueueEntity {
2
+ id: string;
3
+ connectionId: string;
4
+ method: Object;
5
+ isActive: boolean;
6
+ constructor(props: Omit<QueueEntity, "id" | "isActive">, id?: string);
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueueEntity = void 0;
4
+ const genUuid_1 = require("../utils/genUuid");
5
+ class QueueEntity {
6
+ constructor(props, id) {
7
+ this.isActive = true;
8
+ if (!id)
9
+ this.id = (0, genUuid_1.genId)("queue");
10
+ Object.assign(this, props);
11
+ }
12
+ }
13
+ exports.QueueEntity = QueueEntity;
@@ -0,0 +1,15 @@
1
+ export declare class ConnectionEntity {
2
+ id: string;
3
+ companyId: string;
4
+ appId: string;
5
+ appSecret: string;
6
+ accessToken: string;
7
+ businessId: string;
8
+ phoneNumberId: string;
9
+ phoneNumber: number;
10
+ isActive: boolean;
11
+ _id: string;
12
+ updatedAt: string;
13
+ createdAt: string;
14
+ constructor(props: Omit<ConnectionEntity, "_id" | "updatedAt" | "createdAt" | "id" | "isActive">, id?: string);
15
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionEntity = void 0;
4
+ const genUuid_1 = require("../utils/genUuid");
5
+ class ConnectionEntity {
6
+ constructor(props, id) {
7
+ this.isActive = true;
8
+ if (!id)
9
+ this.id = (0, genUuid_1.genId)("connection");
10
+ Object.assign(this, props);
11
+ }
12
+ }
13
+ exports.ConnectionEntity = ConnectionEntity;
@@ -0,0 +1,9 @@
1
+ export declare class ErrorLogEntity {
2
+ id: string;
3
+ connectionId: string;
4
+ errorFrom: string;
5
+ statusCode: number;
6
+ error: Error;
7
+ isActive: boolean;
8
+ constructor(props: Omit<ErrorLogEntity, "id" | "isActive">, id?: string);
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorLogEntity = void 0;
4
+ const genUuid_1 = require("../utils/genUuid");
5
+ class ErrorLogEntity {
6
+ constructor(props, id) {
7
+ this.isActive = true;
8
+ if (!id)
9
+ this.id = (0, genUuid_1.genId)("error");
10
+ Object.assign(this, props);
11
+ }
12
+ }
13
+ exports.ErrorLogEntity = ErrorLogEntity;
@@ -0,0 +1,4 @@
1
+ export declare class Message {
2
+ type: string;
3
+ constructor(props: Message);
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Message = void 0;
4
+ class Message {
5
+ constructor(props) {
6
+ Object.assign(this, props);
7
+ }
8
+ }
9
+ exports.Message = Message;
@@ -0,0 +1,17 @@
1
+ export declare class WebhooksEntity {
2
+ id: string;
3
+ companyId: string;
4
+ connection: {
5
+ url: string;
6
+ active: boolean;
7
+ };
8
+ messages: {
9
+ url: string;
10
+ active: boolean;
11
+ };
12
+ isActive: boolean;
13
+ _id: string;
14
+ updatedAt: string;
15
+ createdAt: string;
16
+ constructor(props: Omit<WebhooksEntity, "_id" | "updatedAt" | "createdAt" | "id" | "isActive">, id?: string);
17
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebhooksEntity = void 0;
4
+ const genUuid_1 = require("../utils/genUuid");
5
+ class WebhooksEntity {
6
+ constructor(props, id) {
7
+ this.isActive = true;
8
+ if (!id)
9
+ this.id = (0, genUuid_1.genId)("queue");
10
+ Object.assign(this, props);
11
+ }
12
+ }
13
+ exports.WebhooksEntity = WebhooksEntity;
@@ -0,0 +1,15 @@
1
+ export type isError<T> = {
2
+ isError: T;
3
+ isSuccess?: never;
4
+ };
5
+ export type isSuccess<U> = {
6
+ isError?: never;
7
+ isSuccess: U;
8
+ };
9
+ export type Either<T, U> = NonNullable<isError<T> | isSuccess<U>>;
10
+ export type UnwrapEither = <T, U>(e: Either<T, U>) => NonNullable<T | U>;
11
+ export declare const unwrapEither: UnwrapEither;
12
+ export declare const isError: <T, U>(e: Either<T, U>) => e is isError<T>;
13
+ export declare const isSuccess: <T, U>(e: Either<T, U>) => e is isSuccess<U>;
14
+ export declare const throwError: <T>(value: T) => isError<T>;
15
+ export declare const throwSuccess: <U>(value: U) => isSuccess<U>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throwSuccess = exports.throwError = exports.isSuccess = exports.isError = exports.unwrapEither = void 0;
4
+ const unwrapEither = ({ isError, isSuccess, }) => {
5
+ if (isSuccess !== undefined && isError !== undefined) {
6
+ throw new Error(`Received both isError and isSuccess values at runtime when opening an Either\nisError: ${JSON.stringify(isError)}\nisSuccess: ${JSON.stringify(isSuccess)}`);
7
+ /*
8
+ We're throwing in this function because this can only occur at runtime if something
9
+ happens that the TypeScript compiler couldn't anticipate. That means the application
10
+ is in an unexpected state and we should terminate immediately.
11
+ */
12
+ }
13
+ if (isError !== undefined) {
14
+ return isError; // Typescript is getting confused and returning this type as `T | undefined` unless we add the type assertion
15
+ }
16
+ if (isSuccess !== undefined) {
17
+ return isSuccess;
18
+ }
19
+ throw new Error(`Received no isError or isSuccess values at runtime when opening Either`);
20
+ };
21
+ exports.unwrapEither = unwrapEither;
22
+ const isError = (e) => {
23
+ return e.isError !== undefined;
24
+ };
25
+ exports.isError = isError;
26
+ const isSuccess = (e) => {
27
+ return e.isSuccess !== undefined;
28
+ };
29
+ exports.isSuccess = isSuccess;
30
+ const throwError = (value) => ({
31
+ isError: value,
32
+ });
33
+ exports.throwError = throwError;
34
+ const throwSuccess = (value) => ({
35
+ isSuccess: value,
36
+ });
37
+ exports.throwSuccess = throwSuccess;
@@ -0,0 +1,10 @@
1
+ export declare const ErrorHandling: (message?: string | Object | any[], code?: number) => ErrorReturnType;
2
+ export type Response<E, S> = {
3
+ isSuccess: S;
4
+ isError: E;
5
+ };
6
+ type ErrorReturnType = {
7
+ code: number;
8
+ message: string | Object;
9
+ };
10
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorHandling = void 0;
4
+ const ErrorHandling = (message, code) => {
5
+ if (typeof message === "object")
6
+ return {
7
+ code: 500,
8
+ message,
9
+ };
10
+ return {
11
+ code: code ? code : message ? 400 : 500,
12
+ message: message || "Erro interno do servidor",
13
+ };
14
+ };
15
+ exports.ErrorHandling = ErrorHandling;
@@ -0,0 +1,2 @@
1
+ export * from "./Either";
2
+ export * from "./ErrorHandling";
@@ -0,0 +1,18 @@
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("./Either"), exports);
18
+ __exportStar(require("./ErrorHandling"), exports);
@@ -0,0 +1,7 @@
1
+ export declare const configInterceptors: {
2
+ Accept: string;
3
+ "Content-Type": string;
4
+ "Access-Control-Allow-Headers": string;
5
+ "Access-Control-Allow-Origin": string;
6
+ "Access-Control-Allow-Methods": string;
7
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configInterceptors = void 0;
4
+ exports.configInterceptors = {
5
+ ["Accept"]: "application/json",
6
+ ["Content-Type"]: "application/json; charset=utf-8",
7
+ ["Access-Control-Allow-Headers"]: "Content-Type",
8
+ ["Access-Control-Allow-Origin"]: "*",
9
+ ["Access-Control-Allow-Methods"]: "OPTIONS,POST,GET,PUT,PATCH,DELETE",
10
+ };
@@ -0,0 +1,18 @@
1
+ export declare class Button {
2
+ type: string;
3
+ body: {
4
+ text: string;
5
+ };
6
+ action: {
7
+ buttons: btnType[];
8
+ };
9
+ constructor(props: Button);
10
+ }
11
+ type btnType = {
12
+ type: "reply";
13
+ reply: {
14
+ id: string;
15
+ title: string;
16
+ };
17
+ };
18
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = void 0;
4
+ class Button {
5
+ // interactive: Buttons,
6
+ constructor(props) {
7
+ this.type = "interactive";
8
+ this.body = { text: "" };
9
+ Object.assign(this, props);
10
+ }
11
+ }
12
+ exports.Button = Button;
@@ -0,0 +1,9 @@
1
+ export declare class Button {
2
+ messaging_product: string;
3
+ to: number;
4
+ type: string;
5
+ text: {
6
+ body: string;
7
+ };
8
+ constructor(props: Button);
9
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = void 0;
4
+ class Button {
5
+ constructor(props) {
6
+ this.messaging_product = "whatsapp";
7
+ this.type = "text";
8
+ this.text = { body: "" };
9
+ Object.assign(this, props);
10
+ }
11
+ }
12
+ exports.Button = Button;
@@ -0,0 +1,78 @@
1
+ export declare class List implements list {
2
+ type: "list";
3
+ header: {
4
+ type: "text";
5
+ text: string;
6
+ };
7
+ body: {
8
+ text: string;
9
+ };
10
+ footer: {
11
+ text: string;
12
+ };
13
+ action: actionType;
14
+ constructor(props: {
15
+ title: string;
16
+ subtitle: string;
17
+ footer?: string;
18
+ buttonTitle: string;
19
+ });
20
+ insertSection(title: string | undefined, btns: rowType[]): void;
21
+ }
22
+ interface list {
23
+ type: "list";
24
+ header?: {
25
+ type: "text";
26
+ text: string;
27
+ };
28
+ body?: {
29
+ text: string;
30
+ };
31
+ footer?: {
32
+ text: string;
33
+ };
34
+ action: actionType;
35
+ }
36
+ type actionType = {
37
+ button: string;
38
+ sections: sectionType[];
39
+ };
40
+ type sectionType = {
41
+ title: string;
42
+ rows: rowType[];
43
+ };
44
+ type rowType = {
45
+ id: string;
46
+ title: string;
47
+ description: string;
48
+ };
49
+ export declare const ListTeste: ({ subtitle, footer, buttonTitle, name, }: {
50
+ subtitle?: string | undefined;
51
+ footer?: string | undefined;
52
+ buttonTitle: string;
53
+ name: string;
54
+ }) => {
55
+ type: string;
56
+ header: {
57
+ type: string;
58
+ text: string;
59
+ };
60
+ body: {
61
+ text: string | undefined;
62
+ };
63
+ footer: {
64
+ text: string | undefined;
65
+ };
66
+ action: {
67
+ button: string;
68
+ sections: {
69
+ title: string;
70
+ rows: {
71
+ id: string;
72
+ title: string;
73
+ description: string;
74
+ }[];
75
+ }[];
76
+ };
77
+ };
78
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListTeste = exports.List = void 0;
4
+ class List {
5
+ constructor(props) {
6
+ this.type = "list";
7
+ this.header = { type: "text", text: "" };
8
+ this.body = { text: "" };
9
+ this.footer = { text: "" };
10
+ this.action = { button: "", sections: [] };
11
+ this.header.text = props.title;
12
+ this.body.text = props.subtitle;
13
+ this.footer.text = props.footer || "";
14
+ this.action.button = props.buttonTitle;
15
+ }
16
+ insertSection(title = "teste", btns) {
17
+ let newSection = { title, rows: btns };
18
+ this.action.sections.push(newSection);
19
+ }
20
+ }
21
+ exports.List = List;
22
+ const ListTeste = ({ subtitle, footer, buttonTitle, name, }) => ({
23
+ type: "list",
24
+ header: {
25
+ type: "text",
26
+ text: `Olá, sou ${name}`,
27
+ },
28
+ body: {
29
+ text: subtitle,
30
+ },
31
+ footer: {
32
+ text: footer,
33
+ },
34
+ action: {
35
+ button: buttonTitle,
36
+ sections: [
37
+ {
38
+ title: "Ações",
39
+ rows: [
40
+ {
41
+ id: "ticket",
42
+ title: "Abrir Ticket",
43
+ description: "Clique aqui para solicitar um ticket suporte.",
44
+ },
45
+ {
46
+ id: "suporte",
47
+ title: "Atendente",
48
+ description: "Clique aqui para solicitar um atendimento direto",
49
+ },
50
+ ],
51
+ },
52
+ ],
53
+ },
54
+ });
55
+ exports.ListTeste = ListTeste;
@@ -0,0 +1,7 @@
1
+ export declare class Text {
2
+ type: string;
3
+ text: {
4
+ body: string;
5
+ };
6
+ constructor(text: string);
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Text = void 0;
4
+ class Text {
5
+ constructor(text) {
6
+ this.type = "text";
7
+ this.text = { body: "" };
8
+ this.text.body = text;
9
+ }
10
+ }
11
+ exports.Text = Text;
@@ -0,0 +1,3 @@
1
+ import { NatyMeta, Log, Webhook, Connection, Message } from "./useCases";
2
+ export { NatyMeta, Connection, Message, Webhook, Log };
3
+ export default NatyMeta;
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Log = exports.Webhook = exports.Message = exports.Connection = exports.NatyMeta = void 0;
4
+ const useCases_1 = require("./useCases");
5
+ Object.defineProperty(exports, "NatyMeta", { enumerable: true, get: function () { return useCases_1.NatyMeta; } });
6
+ Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return useCases_1.Log; } });
7
+ Object.defineProperty(exports, "Webhook", { enumerable: true, get: function () { return useCases_1.Webhook; } });
8
+ Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return useCases_1.Connection; } });
9
+ Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return useCases_1.Message; } });
10
+ exports.default = useCases_1.NatyMeta;
@@ -0,0 +1,13 @@
1
+ import { ConnectionEntity } from "../Entities/connection";
2
+ import { Either } from "../Errors";
3
+ import { getAllProps, getAllReturn } from "../types/requestTypes";
4
+ export interface IConnection {
5
+ insert(connection: Partial<ConnectionEntity>): Promise<Either<connectionErrors, ConnectionEntity>>;
6
+ getSingle(id: string): Promise<Either<connectionErrors, ConnectionEntity>>;
7
+ SearchOne(key: string, value: string): Promise<Either<connectionErrors, ConnectionEntity>>;
8
+ getAll(props: getAllProps): Promise<Either<connectionErrors, getAllReturn<ConnectionEntity>>>;
9
+ update(id: string, connection: Partial<ConnectionEntity>): Promise<Either<connectionErrors, ConnectionEntity>>;
10
+ updateMany(connection: Partial<ConnectionEntity>[]): Promise<Either<connectionErrors, ConnectionEntity[]>>;
11
+ deleteOne(id: string): Promise<Either<connectionErrors, ConnectionEntity>>;
12
+ }
13
+ export type connectionErrors = "";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { LogsEntity } from "../Entities/Logs";
2
+ import { Either } from "../Errors";
3
+ import { getAllProps, getAllReturn } from "../types/requestTypes";
4
+ export interface ILog {
5
+ getSingle(key: string): Promise<Either<logErrors, LogsEntity>>;
6
+ getAll(props: getAllProps): Promise<Either<logErrors, getAllReturn<LogsEntity>>>;
7
+ searchOne(key: keyof LogsEntity, value: string): Promise<Either<logErrors, LogsEntity>>;
8
+ }
9
+ type logErrors = "";
10
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Button } from "../elements/button";
2
+ import { List } from "../elements/list";
3
+ import { Text } from "../elements/text";
4
+ export interface IMessage {
5
+ text: Text;
6
+ button: typeof Button;
7
+ list: List;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { Response } from "../Errors/ErrorHandling";
2
+ import { Connection, Log, Message, Webhook } from "../useCases";
3
+ export interface ISdk {
4
+ connect({ appToken, }: ConnectProps): Promise<Response<ConnectErrors, boolean>>;
5
+ Connection: typeof Connection;
6
+ Message: typeof Message;
7
+ Webhook: typeof Webhook;
8
+ Log: typeof Log;
9
+ }
10
+ export type ConnectProps = {
11
+ appToken: string;
12
+ };
13
+ export type ConnectErrors = "AppToken inválido";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +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 {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });