@metacall/protocol 0.1.23 → 0.1.25
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/index.d.ts +9 -0
- package/dist/index.js +24 -0
- package/dist/login.js +2 -1
- package/dist/protocol.d.ts +5 -2
- package/dist/protocol.js +8 -2
- package/dist/signup.js +2 -1
- package/package.json +6 -2
- package/src/index.ts +9 -0
- package/src/login.ts +2 -1
- package/src/protocol.ts +7 -4
- package/src/signup.ts +2 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './deployment';
|
|
2
|
+
export * from './language';
|
|
3
|
+
export * from './login';
|
|
4
|
+
export * from './package';
|
|
5
|
+
export * from './plan';
|
|
6
|
+
export * from './token';
|
|
7
|
+
import metacallAPI from './protocol';
|
|
8
|
+
export * from './protocol';
|
|
9
|
+
export default metacallAPI;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
__exportStar(require("./deployment"), exports);
|
|
17
|
+
__exportStar(require("./language"), exports);
|
|
18
|
+
__exportStar(require("./login"), exports);
|
|
19
|
+
__exportStar(require("./package"), exports);
|
|
20
|
+
__exportStar(require("./plan"), exports);
|
|
21
|
+
__exportStar(require("./token"), exports);
|
|
22
|
+
const protocol_1 = __importDefault(require("./protocol"));
|
|
23
|
+
__exportStar(require("./protocol"), exports);
|
|
24
|
+
exports.default = protocol_1.default;
|
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:
|
|
19
|
+
Host: new url_1.URL(baseURL).host,
|
|
19
20
|
Origin: baseURL
|
|
20
21
|
}
|
|
21
22
|
})
|
package/dist/protocol.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ export interface SubscriptionDeploy {
|
|
|
10
10
|
date: number;
|
|
11
11
|
deploy: string;
|
|
12
12
|
}
|
|
13
|
-
export declare
|
|
13
|
+
export declare enum ResourceType {
|
|
14
|
+
Package = "Package",
|
|
15
|
+
Repository = "Repository"
|
|
16
|
+
}
|
|
14
17
|
export interface AddResponse {
|
|
15
18
|
id: string;
|
|
16
19
|
}
|
|
@@ -24,7 +27,7 @@ export interface API {
|
|
|
24
27
|
listSubscriptions(): Promise<SubscriptionMap>;
|
|
25
28
|
listSubscriptionsDeploys(): Promise<SubscriptionDeploy[]>;
|
|
26
29
|
inspect(): Promise<Deployment[]>;
|
|
27
|
-
upload(name: string, blob: unknown, jsons
|
|
30
|
+
upload(name: string, blob: unknown, jsons?: MetaCallJSON[], runners?: string[]): Promise<string>;
|
|
28
31
|
add(url: string, branch: string, jsons: MetaCallJSON[]): Promise<AddResponse>;
|
|
29
32
|
deploy(name: string, env: {
|
|
30
33
|
name: string;
|
package/dist/protocol.js
CHANGED
|
@@ -22,12 +22,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.isProtocolError = void 0;
|
|
25
|
+
exports.ResourceType = exports.isProtocolError = void 0;
|
|
26
26
|
const axios_1 = __importDefault(require("axios"));
|
|
27
27
|
const form_data_1 = __importDefault(require("form-data"));
|
|
28
28
|
const deployment_1 = require("./deployment");
|
|
29
29
|
const isProtocolError = (err) => axios_1.default.isAxiosError(err);
|
|
30
30
|
exports.isProtocolError = isProtocolError;
|
|
31
|
+
var ResourceType;
|
|
32
|
+
(function (ResourceType) {
|
|
33
|
+
ResourceType["Package"] = "Package";
|
|
34
|
+
ResourceType["Repository"] = "Repository";
|
|
35
|
+
})(ResourceType = exports.ResourceType || (exports.ResourceType = {}));
|
|
31
36
|
exports.default = (token, baseURL) => {
|
|
32
37
|
const api = {
|
|
33
38
|
refresh: () => axios_1.default
|
|
@@ -71,6 +76,7 @@ exports.default = (token, baseURL) => {
|
|
|
71
76
|
})
|
|
72
77
|
.then(res => res.data),
|
|
73
78
|
upload: async (name, blob, jsons = [], runners = []) => {
|
|
79
|
+
var _a, _b;
|
|
74
80
|
const fd = new form_data_1.default();
|
|
75
81
|
fd.append('id', name);
|
|
76
82
|
fd.append('type', 'application/x-zip-compressed');
|
|
@@ -83,7 +89,7 @@ exports.default = (token, baseURL) => {
|
|
|
83
89
|
const res = await axios_1.default.post(baseURL + '/api/package/create', fd, {
|
|
84
90
|
headers: {
|
|
85
91
|
Authorization: 'jwt ' + token,
|
|
86
|
-
...fd.getHeaders()
|
|
92
|
+
...((_b = (_a = fd.getHeaders) === null || _a === void 0 ? void 0 : _a.call(fd)) !== null && _b !== void 0 ? _b : {}) // operator chaining to make it compatible with frontend
|
|
87
93
|
}
|
|
88
94
|
});
|
|
89
95
|
return res.data;
|
package/dist/signup.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, alias, baseURL) => {
|
|
8
9
|
const request = {
|
|
9
10
|
email,
|
|
@@ -16,7 +17,7 @@ exports.default = (email, password, alias, baseURL) => {
|
|
|
16
17
|
.post(baseURL + '/signup', request, {
|
|
17
18
|
headers: {
|
|
18
19
|
Accept: 'application/json, text/plain, */*',
|
|
19
|
-
Host:
|
|
20
|
+
Host: new url_1.URL(baseURL).host,
|
|
20
21
|
Origin: baseURL
|
|
21
22
|
}
|
|
22
23
|
})
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metacall/protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Tool for deploying into MetaCall FaaS platform.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js",
|
|
7
|
+
".": "./dist/index.js",
|
|
7
8
|
"./package.json": "./package.json"
|
|
8
9
|
},
|
|
9
10
|
"typesVersions": {
|
|
10
11
|
"*": {
|
|
11
12
|
"*": [
|
|
12
13
|
"dist/*.d.ts"
|
|
14
|
+
],
|
|
15
|
+
".": [
|
|
16
|
+
"./dist/index.d.ts"
|
|
13
17
|
]
|
|
14
18
|
}
|
|
15
19
|
},
|
|
@@ -90,7 +94,7 @@
|
|
|
90
94
|
},
|
|
91
95
|
"devDependencies": {
|
|
92
96
|
"@types/express": "^4.17.13",
|
|
93
|
-
"@types/mocha": "^8.2.
|
|
97
|
+
"@types/mocha": "^8.2.3",
|
|
94
98
|
"@types/node": "^14.14.7",
|
|
95
99
|
"@types/swagger-ui-express": "^4.1.3",
|
|
96
100
|
"@types/yamljs": "^0.2.31",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './deployment';
|
|
2
|
+
export * from './language';
|
|
3
|
+
export * from './login';
|
|
4
|
+
export * from './package';
|
|
5
|
+
export * from './plan';
|
|
6
|
+
export * from './token';
|
|
7
|
+
import metacallAPI from './protocol';
|
|
8
|
+
export * from './protocol';
|
|
9
|
+
export default metacallAPI;
|
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.
|
|
27
|
+
Host: new URL(baseURL).host,
|
|
27
28
|
Origin: baseURL
|
|
28
29
|
}
|
|
29
30
|
})
|
package/src/protocol.ts
CHANGED
|
@@ -37,7 +37,10 @@ export interface SubscriptionDeploy {
|
|
|
37
37
|
deploy: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export
|
|
40
|
+
export enum ResourceType {
|
|
41
|
+
Package = 'Package',
|
|
42
|
+
Repository = 'Repository'
|
|
43
|
+
}
|
|
41
44
|
|
|
42
45
|
export interface AddResponse {
|
|
43
46
|
id: string;
|
|
@@ -57,8 +60,8 @@ export interface API {
|
|
|
57
60
|
upload(
|
|
58
61
|
name: string,
|
|
59
62
|
blob: unknown,
|
|
60
|
-
jsons
|
|
61
|
-
runners
|
|
63
|
+
jsons?: MetaCallJSON[],
|
|
64
|
+
runners?: string[]
|
|
62
65
|
): Promise<string>;
|
|
63
66
|
add(
|
|
64
67
|
url: string,
|
|
@@ -171,7 +174,7 @@ export default (token: string, baseURL: string): API => {
|
|
|
171
174
|
{
|
|
172
175
|
headers: {
|
|
173
176
|
Authorization: 'jwt ' + token,
|
|
174
|
-
...fd.getHeaders()
|
|
177
|
+
...(fd.getHeaders?.() ?? {}) // operator chaining to make it compatible with frontend
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
);
|
package/src/signup.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { URL } from 'url';
|
|
2
3
|
interface Request {
|
|
3
4
|
email: string;
|
|
4
5
|
password: string;
|
|
@@ -23,7 +24,7 @@ export default (
|
|
|
23
24
|
.post<string>(baseURL + '/signup', request, {
|
|
24
25
|
headers: {
|
|
25
26
|
Accept: 'application/json, text/plain, */*',
|
|
26
|
-
Host: baseURL.
|
|
27
|
+
Host: new URL(baseURL).host,
|
|
27
28
|
Origin: baseURL
|
|
28
29
|
}
|
|
29
30
|
})
|