@metacall/protocol 0.1.11 → 0.1.14

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.
@@ -9,4 +9,5 @@ interface Language {
9
9
  }
10
10
  export declare const Languages: Record<LanguageId, Language>;
11
11
  export declare const DisplayNameToLanguageId: Record<string, LanguageId>;
12
+ export declare const RunnerToDisplayName: (runner: string) => string;
12
13
  export {};
package/dist/language.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DisplayNameToLanguageId = exports.Languages = void 0;
9
+ exports.RunnerToDisplayName = exports.DisplayNameToLanguageId = exports.Languages = void 0;
10
10
  exports.Languages = {
11
11
  cs: {
12
12
  tag: 'cs',
@@ -76,3 +76,13 @@ exports.Languages = {
76
76
  exports.DisplayNameToLanguageId = Object.keys(exports.Languages).reduce((obj, lang) => Object.assign(obj, {
77
77
  [exports.Languages[lang].displayName]: lang
78
78
  }), {});
79
+ const RunnerToDisplayName = (runner) => {
80
+ const displayNameMap = {
81
+ nodejs: 'NPM',
82
+ python: 'Pip',
83
+ ruby: 'Gem',
84
+ csharp: 'NuGet'
85
+ };
86
+ return displayNameMap[runner] || 'Build';
87
+ };
88
+ exports.RunnerToDisplayName = RunnerToDisplayName;
@@ -4,6 +4,12 @@ import { Plans } from './plan';
4
4
  export declare const isProtocolError: (err: unknown) => boolean;
5
5
  export { AxiosError as ProtocolError };
6
6
  declare type SubscriptionMap = Record<string, number>;
7
+ export interface SubscriptionDeploy {
8
+ id: string;
9
+ plan: Plans;
10
+ date: number;
11
+ deploy: string;
12
+ }
7
13
  export declare type ResourceType = 'Package' | 'Repository';
8
14
  export interface AddResponse {
9
15
  id: string;
@@ -16,6 +22,7 @@ interface API {
16
22
  validate(): Promise<boolean>;
17
23
  deployEnabled(): Promise<boolean>;
18
24
  listSubscriptions(): Promise<SubscriptionMap>;
25
+ listSubscriptionsDeploys(): Promise<SubscriptionDeploy[]>;
19
26
  inspect(): Promise<Deployment[]>;
20
27
  upload(name: string, blob: unknown, jsons: MetaCallJSON[], runners: string[]): Promise<string>;
21
28
  add(url: string, branch: string, jsons: MetaCallJSON[]): Promise<AddResponse>;
package/dist/protocol.js CHANGED
@@ -9,11 +9,14 @@
9
9
  validate: validates the auth token
10
10
  deployEnabled: checks if you're able to deploy
11
11
  listSubscriptions: gives you a list of the subscription available
12
+ listSubscriptionsDeploys: gives you a list of the subscription being used in deploys
12
13
  inspect: gives you are deploys with it's endpoints
13
14
  upload: uploads a zip (package) into the faas
14
15
  deploy: deploys the previously uploaded zip into the faas
15
16
  deployDelete: deletes the deploy and the zip
16
-
17
+ logs: retrieve the logs of a deploy by runner or deployment
18
+ branchList: get the branches of a repository
19
+ fileList: get files of a repository by branch
17
20
  */
18
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
19
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -57,6 +60,11 @@ exports.default = (token, baseURL) => {
57
60
  }
58
61
  return subscriptions;
59
62
  },
63
+ listSubscriptionsDeploys: async () => axios_1.default
64
+ .get(baseURL + '/api/billing/list-subscriptions-deploys', {
65
+ headers: { Authorization: 'jwt ' + token }
66
+ })
67
+ .then(res => res.data),
60
68
  inspect: async () => axios_1.default
61
69
  .get(baseURL + '/api/inspect', {
62
70
  headers: { Authorization: 'jwt ' + token }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metacall/protocol",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
4
4
  "description": "Tool for deploying into MetaCall FaaS platform.",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js",
package/src/language.ts CHANGED
@@ -92,3 +92,14 @@ export const DisplayNameToLanguageId: Record<string, LanguageId> = Object.keys(
92
92
  }),
93
93
  {}
94
94
  );
95
+
96
+ export const RunnerToDisplayName = (runner: string): string => {
97
+ const displayNameMap: Record<string, string> = {
98
+ nodejs: 'NPM',
99
+ python: 'Pip',
100
+ ruby: 'Gem',
101
+ csharp: 'NuGet'
102
+ };
103
+
104
+ return displayNameMap[runner] || 'Build';
105
+ };
package/src/protocol.ts CHANGED
@@ -8,11 +8,14 @@
8
8
  validate: validates the auth token
9
9
  deployEnabled: checks if you're able to deploy
10
10
  listSubscriptions: gives you a list of the subscription available
11
+ listSubscriptionsDeploys: gives you a list of the subscription being used in deploys
11
12
  inspect: gives you are deploys with it's endpoints
12
13
  upload: uploads a zip (package) into the faas
13
14
  deploy: deploys the previously uploaded zip into the faas
14
15
  deployDelete: deletes the deploy and the zip
15
-
16
+ logs: retrieve the logs of a deploy by runner or deployment
17
+ branchList: get the branches of a repository
18
+ fileList: get files of a repository by branch
16
19
  */
17
20
 
18
21
  import axios, { AxiosError, AxiosResponse } from 'axios';
@@ -27,6 +30,13 @@ export { AxiosError as ProtocolError };
27
30
 
28
31
  type SubscriptionMap = Record<string, number>;
29
32
 
33
+ export interface SubscriptionDeploy {
34
+ id: string;
35
+ plan: Plans;
36
+ date: number;
37
+ deploy: string;
38
+ }
39
+
30
40
  export type ResourceType = 'Package' | 'Repository';
31
41
 
32
42
  export interface AddResponse {
@@ -42,6 +52,7 @@ interface API {
42
52
  validate(): Promise<boolean>;
43
53
  deployEnabled(): Promise<boolean>;
44
54
  listSubscriptions(): Promise<SubscriptionMap>;
55
+ listSubscriptionsDeploys(): Promise<SubscriptionDeploy[]>;
45
56
  inspect(): Promise<Deployment[]>;
46
57
  upload(
47
58
  name: string,
@@ -122,6 +133,16 @@ export default (token: string, baseURL: string): API => {
122
133
  return subscriptions;
123
134
  },
124
135
 
136
+ listSubscriptionsDeploys: async (): Promise<SubscriptionDeploy[]> =>
137
+ axios
138
+ .get<SubscriptionDeploy[]>(
139
+ baseURL + '/api/billing/list-subscriptions-deploys',
140
+ {
141
+ headers: { Authorization: 'jwt ' + token }
142
+ }
143
+ )
144
+ .then(res => res.data),
145
+
125
146
  inspect: async (): Promise<Deployment[]> =>
126
147
  axios
127
148
  .get<Deployment[]>(baseURL + '/api/inspect', {