@kumbify/sdk 1.0.1
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 +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/kmail/KMailServer.d.ts +9 -0
- package/dist/kmail/KMailServer.js +38 -0
- package/dist/kmail/KMailServer.js.map +1 -0
- package/dist/kmail/interfaces.d.ts +16 -0
- package/dist/kmail/interfaces.js +3 -0
- package/dist/kmail/interfaces.js.map +1 -0
- package/dist/kmail/types.d.ts +16 -0
- package/dist/kmail/types.js +3 -0
- package/dist/kmail/types.js.map +1 -0
- package/dist/ksms/KSMSServer.d.ts +8 -0
- package/dist/ksms/KSMSServer.js +29 -0
- package/dist/ksms/KSMSServer.js.map +1 -0
- package/dist/ksms/interfaces.d.ts +0 -0
- package/dist/ksms/interfaces.js +1 -0
- package/dist/ksms/interfaces.js.map +1 -0
- package/dist/utils/helpers.d.ts +4 -0
- package/dist/utils/helpers.js +8 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/types.d.ts +24 -0
- package/dist/utils/types.js +3 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Kumbify SDK
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./kmail/KMailServer"), exports);
|
|
18
|
+
__exportStar(require("./ksms/KSMSServer"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,oDAAkC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IKMailResponseMail, IKMailSendMailSimpleMessage, IKMailSendMailTemplateMessage } from "../utils/types";
|
|
2
|
+
export declare class KMailServer {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
constructor({ apiKey }: {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
});
|
|
7
|
+
sendSimpleMail({ ...data }: IKMailSendMailSimpleMessage): Promise<IKMailResponseMail>;
|
|
8
|
+
sendTemplateMail({ ...data }: IKMailSendMailTemplateMessage): Promise<IKMailResponseMail>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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.KMailServer = void 0;
|
|
7
|
+
const helpers_1 = require("@/utils/helpers");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
class KMailServer {
|
|
10
|
+
apiKey;
|
|
11
|
+
constructor({ apiKey }) {
|
|
12
|
+
this.apiKey = apiKey;
|
|
13
|
+
}
|
|
14
|
+
async sendSimpleMail({ ...data }) {
|
|
15
|
+
try {
|
|
16
|
+
const response = await axios_1.default.post(helpers_1.APP_CONFIG.KMAIL_URL + "/send", {
|
|
17
|
+
...data,
|
|
18
|
+
}, { headers: { "kumbi-api-key": "Bearer " + this.apiKey } });
|
|
19
|
+
return response.data;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
throw new Error("Failed while send simple mail: " + err);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async sendTemplateMail({ ...data }) {
|
|
26
|
+
try {
|
|
27
|
+
const response = await axios_1.default.post(helpers_1.APP_CONFIG.KMAIL_URL + "/send", {
|
|
28
|
+
...data,
|
|
29
|
+
}, { headers: { "kumbi-api-key": "Bearer " + this.apiKey } });
|
|
30
|
+
return response.data;
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
throw new Error("Failed while send simple mail: " + err);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.KMailServer = KMailServer;
|
|
38
|
+
//# sourceMappingURL=KMailServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KMailServer.js","sourceRoot":"","sources":["../../src/kmail/KMailServer.ts"],"names":[],"mappings":";;;;;;AACA,6CAA6C;AAE7C,kDAA0B;AAE1B,MAAa,WAAW;IACtB,MAAM,CAAC;IACP,YAAY,EAAE,MAAM,EAAsB;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EAAE,GAAG,IAAI,EAA+B;QAC3D,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,oBAAU,CAAC,SAAS,GAAG,OAAO,EAC9B;gBACE,GAAG,IAAI;aACR,EACD,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAC1D,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,GAAG,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAE,GAAG,IAAI,EAAiC;QAC/D,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,oBAAU,CAAC,SAAS,GAAG,OAAO,EAC9B;gBACE,GAAG,IAAI;aACR,EACD,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAC1D,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,GAAG,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;CACF;AApCD,kCAoCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type IKMailSendMailSimpleMessage = {
|
|
2
|
+
from_address: string;
|
|
3
|
+
to_address: string[];
|
|
4
|
+
subject: string;
|
|
5
|
+
body_html: string;
|
|
6
|
+
body_text: string;
|
|
7
|
+
};
|
|
8
|
+
export type IKMailSendMailTemplateMessage = {
|
|
9
|
+
from_address: string;
|
|
10
|
+
to_address: string[];
|
|
11
|
+
template_name: string;
|
|
12
|
+
template_data: Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
export type IKMailResponseMail = {
|
|
15
|
+
success: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/kmail/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type IKMailSendMailSimpleMessage = {
|
|
2
|
+
from_address: string;
|
|
3
|
+
to_address: string[];
|
|
4
|
+
subject: string;
|
|
5
|
+
body_html: string;
|
|
6
|
+
body_text: string;
|
|
7
|
+
};
|
|
8
|
+
export type IKMailSendMailTemplateMessage = {
|
|
9
|
+
from_address: string;
|
|
10
|
+
to_address: string[];
|
|
11
|
+
template_name: string;
|
|
12
|
+
template_data: Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
export type IKMailResponseMail = {
|
|
15
|
+
success: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/kmail/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.KSMSServer = void 0;
|
|
7
|
+
const helpers_1 = require("@/utils/helpers");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
class KSMSServer {
|
|
10
|
+
apiKey;
|
|
11
|
+
constructor({ apiKey }) {
|
|
12
|
+
this.apiKey = apiKey;
|
|
13
|
+
}
|
|
14
|
+
async sendSMS({ message, from, to }) {
|
|
15
|
+
try {
|
|
16
|
+
const response = await axios_1.default.post(helpers_1.APP_CONFIG.KSMS_URL + "/send", {
|
|
17
|
+
body: message,
|
|
18
|
+
to,
|
|
19
|
+
from,
|
|
20
|
+
}, { headers: { "kumbi-api-key": "Bearer " + this.apiKey } });
|
|
21
|
+
return response.data;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw new Error("Failed while send sms: ", error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.KSMSServer = KSMSServer;
|
|
29
|
+
//# sourceMappingURL=KSMSServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KSMSServer.js","sourceRoot":"","sources":["../../src/ksms/KSMSServer.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA6C;AAE7C,kDAA0B;AAE1B,MAAa,UAAU;IACrB,MAAM,CAAC;IAEP,YAAY,EAAE,MAAM,EAAsB;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAoB;QACnD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,oBAAU,CAAC,QAAQ,GAAG,OAAO,EAC7B;gBACE,IAAI,EAAE,OAAO;gBACb,EAAE;gBACF,IAAI;aACL,EACD,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAC1D,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;CACF;AAxBD,gCAwBC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/ksms/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APP_CONFIG = void 0;
|
|
4
|
+
exports.APP_CONFIG = {
|
|
5
|
+
KSMS_URL: "https://oi.kumbify.com/api/sms",
|
|
6
|
+
KMAIL_URL: "https://oi.kumbify.com/api/email",
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,QAAQ,EAAE,gCAAgC;IAC1C,SAAS,EAAE,kCAAkC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type IKMailSendMailSimpleMessage = {
|
|
2
|
+
from_address: string;
|
|
3
|
+
to_address: string[];
|
|
4
|
+
subject: string;
|
|
5
|
+
body_html: string;
|
|
6
|
+
body_text: string;
|
|
7
|
+
};
|
|
8
|
+
export type IKMailSendMailTemplateMessage = {
|
|
9
|
+
from_address: string;
|
|
10
|
+
to_address: string[];
|
|
11
|
+
template_name: string;
|
|
12
|
+
template_data: Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
export type IKMailResponseMail = {
|
|
15
|
+
success: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type IKSMSSendMessage = {
|
|
18
|
+
message: string;
|
|
19
|
+
to: string[];
|
|
20
|
+
from: string;
|
|
21
|
+
};
|
|
22
|
+
export type IKSMSResponseMessage = {
|
|
23
|
+
success: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kumbify/sdk",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Oficial Kumbify SDK to integrate our services in your applications",
|
|
5
|
+
"homepage": "https://github.com/ricardocastl3/kumbify-sdk#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ricardocastl3/kumbify-sdk/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/ricardocastl3/kumbify-sdk.git"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"author": "Kumbify",
|
|
23
|
+
"type": "commonjs",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"changeset": "changeset",
|
|
26
|
+
"version-pack": "changeset version",
|
|
27
|
+
"publish-pack": "changeset publish"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@changesets/cli": "^2.29.8",
|
|
31
|
+
"typescript": "^5.9.3"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"axios": "^1.13.5"
|
|
35
|
+
}
|
|
36
|
+
}
|