@payhos/api 3.0.0 → 3.1.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/api.service.js +2 -2
- package/api.service.js.map +1 -1
- package/config.d.ts +3 -4
- package/config.js +13 -14
- package/config.js.map +1 -1
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/model.d.ts +1 -0
- package/model.js.map +1 -1
- package/package.json +2 -2
package/api.service.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.apiHandler = {
|
|
|
11
11
|
* Sends a POST request to the PAYHOS API and returns typed response data.
|
|
12
12
|
*/
|
|
13
13
|
post: async (path, body, headers) => {
|
|
14
|
-
const url = `${config_1.
|
|
14
|
+
const url = `${(0, config_1.apiUrl)()}/v1/api/${path}`;
|
|
15
15
|
const res = await axios_1.default.post(url, body, { headers });
|
|
16
16
|
return res.data;
|
|
17
17
|
},
|
|
@@ -19,7 +19,7 @@ exports.apiHandler = {
|
|
|
19
19
|
* Sends a GET request to the PAYHOS API and returns typed response data.
|
|
20
20
|
*/
|
|
21
21
|
get: async (path, headers) => {
|
|
22
|
-
const url = `${config_1.
|
|
22
|
+
const url = `${(0, config_1.apiUrl)()}/v1/api/${path}`;
|
|
23
23
|
const res = await axios_1.default.get(url, { headers });
|
|
24
24
|
return res.data;
|
|
25
25
|
}
|
package/api.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../src/api.service.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../src/api.service.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AAE1B,qCAAkC;AAElC;;GAEG;AACU,QAAA,UAAU,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,KAAK,EAAK,IAAY,EAAE,IAAyB,EAAE,OAA+B,EAAE,EAAE;QAC1F,MAAM,GAAG,GAAG,GAAG,IAAA,eAAM,GAAE,WAAW,IAAI,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,IAAsB,CAAC;IACpC,CAAC;IACD;;OAEG;IACH,GAAG,EAAE,KAAK,EAAK,IAAY,EAAE,OAA+B,EAAE,EAAE;QAC9D,MAAM,GAAG,GAAG,GAAG,IAAA,eAAM,GAAE,WAAW,IAAI,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC,IAAsB,CAAC;IACpC,CAAC;CACF,CAAA;AAED;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE;IAC3C,OAAO;QACL,aAAa,EAAE,UAAU,MAAM,EAAE;QACjC,cAAc,EAAE,kBAAkB;QAClC,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC,CAAA;AANY,QAAA,UAAU,cAMtB;AAED;;GAEG;AACI,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAAxE,QAAA,KAAK,SAAmE"}
|
package/config.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare let baseUrl: string;
|
|
1
|
+
export declare let isProduction: boolean;
|
|
2
|
+
export declare function setProduction(prod: boolean): void;
|
|
3
|
+
export declare function apiUrl(): "https://api-server.payhos.com" | "http://localhost:8850";
|
package/config.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// const platform: string = 'dev';
|
|
8
|
-
const platform = 'prod';
|
|
9
|
-
/**
|
|
10
|
-
* Base URL used by sdk request helpers.
|
|
11
|
-
*/
|
|
12
|
-
exports.baseUrl = 'a';
|
|
13
|
-
if (platform === 'dev') {
|
|
14
|
-
exports.baseUrl = 'http://localhost:8850';
|
|
3
|
+
exports.apiUrl = exports.setProduction = exports.isProduction = void 0;
|
|
4
|
+
exports.isProduction = true;
|
|
5
|
+
function setProduction(prod) {
|
|
6
|
+
exports.isProduction = prod;
|
|
15
7
|
}
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
exports.setProduction = setProduction;
|
|
9
|
+
function apiUrl() {
|
|
10
|
+
if (exports.isProduction) {
|
|
11
|
+
return 'https://api-server.payhos.com';
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return 'http://localhost:8850';
|
|
15
|
+
}
|
|
18
16
|
}
|
|
17
|
+
exports.apiUrl = apiUrl;
|
|
19
18
|
//# sourceMappingURL=config.js.map
|
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAW,QAAA,YAAY,GAAG,IAAI,CAAC;AAE/B,SAAgB,aAAa,CAAC,IAAa;IACzC,oBAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAFD,sCAEC;AAED,SAAgB,MAAM;IACpB,IAAI,oBAAY,EAAE,CAAC;QACjB,OAAO,+BAA+B,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,OAAO,uBAAuB,CAAC;IACjC,CAAC;AACH,CAAC;AAND,wBAMC"}
|
package/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const sms_1 = require("./sms");
|
|
|
8
8
|
const ai_1 = require("./ai");
|
|
9
9
|
const translator_1 = require("./translator");
|
|
10
10
|
const log_1 = require("./log");
|
|
11
|
+
const config_1 = require("./config");
|
|
11
12
|
tslib_1.__exportStar(require("./model"), exports);
|
|
12
13
|
/**
|
|
13
14
|
* Root PAYHOS SDK class that exposes feature clients.
|
|
@@ -18,6 +19,9 @@ class PayHos {
|
|
|
18
19
|
*/
|
|
19
20
|
constructor(opts) {
|
|
20
21
|
const logger = new log_1.Log(opts.logger);
|
|
22
|
+
if (opts.production !== undefined) {
|
|
23
|
+
(0, config_1.setProduction)(opts.production);
|
|
24
|
+
}
|
|
21
25
|
this.sms = new sms_1.SMS(opts.apiKey, logger);
|
|
22
26
|
this.email = new email_1.Email(opts.apiKey, logger);
|
|
23
27
|
this.prerender = new prerender_1.PreRender(opts.apiKey, logger);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAChC,2CAAwC;AACxC,+BAA4B;AAC5B,6BAA0B;AAC1B,6CAA0C;AAE1C,+BAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAChC,2CAAwC;AACxC,+BAA4B;AAC5B,6BAA0B;AAC1B,6CAA0C;AAE1C,+BAA4B;AAC5B,qCAAyC;AAEzC,kDAAwB;AAExB;;GAEG;AACH,MAAa,MAAM;IAsBjB;;OAEG;IACH,YAAY,IAAmB;QAC7B,MAAM,MAAM,GAAG,IAAI,SAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAClC,IAAA,sBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,SAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,EAAE,GAAG,IAAI,OAAE,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACF;AAtCD,wBAsCC"}
|
package/model.d.ts
CHANGED
package/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;AAgGA,MAAa,aAAa;IAA1B;QACU,YAAO,GAA2B,EAAE,CAAC;IAa/C,CAAC;IAXQ,OAAO,CAAC,GAAW,EAAE,KAAa;QACvC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5B,CAAC;IAEM,OAAO,CAAC,GAAW;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAEM,UAAU,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF;AAdD,sCAcC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payhos/api",
|
|
3
3
|
"description": "An API package for payhos's API built for JavaScript and Typescript developers",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "mocha --require ts-node/register test/**/*.ts",
|
|
9
|
-
"deploy": "node copy-models && tsc && node copy-assets && cd dist && npm publish --access=public",
|
|
9
|
+
"deploy": "node copy-models && tsc && node copy-assets && cd dist && npm stage publish --access=public",
|
|
10
10
|
"unpublish": "npm unpublish @payhos/api@2.3.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|