@metacall/protocol 0.1.21 → 0.1.23

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