@metacall/protocol 0.1.21 → 0.1.24

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/dist/login.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const axios_1 = __importDefault(require("axios"));
7
+ const url_1 = require("url");
7
8
  exports.default = (email, password, baseURL) => {
8
9
  const request = {
9
10
  email,
@@ -15,7 +16,7 @@ exports.default = (email, password, baseURL) => {
15
16
  .post(baseURL + '/login', request, {
16
17
  headers: {
17
18
  Accept: 'application/json, text/plain, */*',
18
- Host: baseURL.split('//')[1],
19
+ Host: new url_1.URL(baseURL).host,
19
20
  Origin: baseURL
20
21
  }
21
22
  })
@@ -0,0 +1,2 @@
1
+ declare const _default: (email: string, password: string, alias: string, baseURL: string) => Promise<string>;
2
+ export default _default;
package/dist/signup.js ADDED
@@ -0,0 +1,25 @@
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
+ const axios_1 = __importDefault(require("axios"));
7
+ const url_1 = require("url");
8
+ exports.default = (email, password, alias, baseURL) => {
9
+ const request = {
10
+ email,
11
+ password,
12
+ alias
13
+ };
14
+ if (!baseURL.includes('localhost'))
15
+ request['g-recaptcha-response'] = 'empty';
16
+ return axios_1.default
17
+ .post(baseURL + '/signup', request, {
18
+ headers: {
19
+ Accept: 'application/json, text/plain, */*',
20
+ Host: new url_1.URL(baseURL).host,
21
+ Origin: baseURL
22
+ }
23
+ })
24
+ .then(res => res.data);
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metacall/protocol",
3
- "version": "0.1.21",
3
+ "version": "0.1.24",
4
4
  "description": "Tool for deploying into MetaCall FaaS platform.",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js",
package/src/login.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import axios from 'axios';
2
+ import { URL } from 'url';
2
3
 
3
4
  interface Request {
4
5
  email: string;
@@ -23,7 +24,7 @@ export default (
23
24
  .post<string>(baseURL + '/login', request, {
24
25
  headers: {
25
26
  Accept: 'application/json, text/plain, */*',
26
- Host: baseURL.split('//')[1],
27
+ Host: new URL(baseURL).host,
27
28
  Origin: baseURL
28
29
  }
29
30
  })
package/src/signup.ts ADDED
@@ -0,0 +1,32 @@
1
+ import axios from 'axios';
2
+ import { URL } from 'url';
3
+ interface Request {
4
+ email: string;
5
+ password: string;
6
+ alias: string;
7
+ 'g-recaptcha-response'?: string;
8
+ }
9
+
10
+ export default (
11
+ email: string,
12
+ password: string,
13
+ alias: string,
14
+ baseURL: string
15
+ ): Promise<string> => {
16
+ const request: Request = {
17
+ email,
18
+ password,
19
+ alias
20
+ };
21
+ if (!baseURL.includes('localhost'))
22
+ request['g-recaptcha-response'] = 'empty';
23
+ return axios
24
+ .post<string>(baseURL + '/signup', request, {
25
+ headers: {
26
+ Accept: 'application/json, text/plain, */*',
27
+ Host: new URL(baseURL).host,
28
+ Origin: baseURL
29
+ }
30
+ })
31
+ .then(res => res.data);
32
+ };