caprover-api 0.0.1
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/.prettierrc.json +6 -0
- package/.vscode/settings.json +6 -0
- package/.yarnrc.yml +1 -0
- package/README.md +44 -0
- package/dist/api/ApiManager.d.ts +114 -0
- package/dist/api/ApiManager.js +486 -0
- package/dist/api/ErrorFactory.d.ts +26 -0
- package/dist/api/ErrorFactory.js +35 -0
- package/dist/api/HttpClient.d.ts +16 -0
- package/dist/api/HttpClient.js +130 -0
- package/dist/example.d.ts +1 -0
- package/dist/example.js +30 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +43 -0
- package/dist/models/AppDefinition.d.ts +105 -0
- package/dist/models/AppDefinition.js +2 -0
- package/dist/models/AppDefinitionsResponse.d.ts +7 -0
- package/dist/models/AppDefinitionsResponse.js +2 -0
- package/dist/models/AppDeleteResponse.d.ts +3 -0
- package/dist/models/AppDeleteResponse.js +2 -0
- package/dist/models/AutomatedCleanupConfigs.d.ts +12 -0
- package/dist/models/AutomatedCleanupConfigs.js +15 -0
- package/dist/models/BackupMeta.d.ts +19 -0
- package/dist/models/BackupMeta.js +2 -0
- package/dist/models/BuildLogsResponse.d.ts +8 -0
- package/dist/models/BuildLogsResponse.js +2 -0
- package/dist/models/CapRoverTheme.d.ts +10 -0
- package/dist/models/CapRoverTheme.js +2 -0
- package/dist/models/CaptainInfo.d.ts +6 -0
- package/dist/models/CaptainInfo.js +2 -0
- package/dist/models/ContainerProps.d.ts +3 -0
- package/dist/models/ContainerProps.js +2 -0
- package/dist/models/DockerAuthObj.d.ts +11 -0
- package/dist/models/DockerAuthObj.js +2 -0
- package/dist/models/DockerSecret.d.ts +4 -0
- package/dist/models/DockerSecret.js +2 -0
- package/dist/models/DockerService.d.ts +99 -0
- package/dist/models/DockerService.js +2 -0
- package/dist/models/GoAccessInfo.d.ts +7 -0
- package/dist/models/GoAccessInfo.js +2 -0
- package/dist/models/GoAccessReportResponse.d.ts +6 -0
- package/dist/models/GoAccessReportResponse.js +2 -0
- package/dist/models/IBuiltImage.d.ts +4 -0
- package/dist/models/IBuiltImage.js +2 -0
- package/dist/models/ICaptainDefinition.d.ts +7 -0
- package/dist/models/ICaptainDefinition.js +2 -0
- package/dist/models/IGoAccessInfo.d.ts +7 -0
- package/dist/models/IGoAccessInfo.js +2 -0
- package/dist/models/IHashMapGeneric.d.ts +3 -0
- package/dist/models/IHashMapGeneric.js +2 -0
- package/dist/models/IImageSource.d.ts +12 -0
- package/dist/models/IImageSource.js +2 -0
- package/dist/models/IOneClickAppModels.d.ts +45 -0
- package/dist/models/IOneClickAppModels.js +2 -0
- package/dist/models/IProFeatures.d.ts +32 -0
- package/dist/models/IProFeatures.js +14 -0
- package/dist/models/IRegistryInfo.d.ts +21 -0
- package/dist/models/IRegistryInfo.js +8 -0
- package/dist/models/IServerBlockDetails.d.ts +17 -0
- package/dist/models/IServerBlockDetails.js +2 -0
- package/dist/models/IVersionInfo.d.ts +6 -0
- package/dist/models/IVersionInfo.js +2 -0
- package/dist/models/LoadBalancerInfo.d.ts +9 -0
- package/dist/models/LoadBalancerInfo.js +2 -0
- package/dist/models/LogsResponse.d.ts +3 -0
- package/dist/models/LogsResponse.js +2 -0
- package/dist/models/NetDataInfo.d.ts +27 -0
- package/dist/models/NetDataInfo.js +2 -0
- package/dist/models/NginxConfig.d.ts +10 -0
- package/dist/models/NginxConfig.js +2 -0
- package/dist/models/OneClickAppDefinitionResponse.d.ts +3 -0
- package/dist/models/OneClickAppDefinitionResponse.js +2 -0
- package/dist/models/OneClickAppRepositories.d.ts +3 -0
- package/dist/models/OneClickAppRepositories.js +2 -0
- package/dist/models/OneClickAppResponse.d.ts +4 -0
- package/dist/models/OneClickAppResponse.js +2 -0
- package/dist/models/OtherTypes.d.ts +29 -0
- package/dist/models/OtherTypes.js +2 -0
- package/dist/models/ProjectDefinition.d.ts +6 -0
- package/dist/models/ProjectDefinition.js +2 -0
- package/dist/models/ProjectsResponse.d.ts +4 -0
- package/dist/models/ProjectsResponse.js +2 -0
- package/dist/models/RegistriesResponse.d.ts +5 -0
- package/dist/models/RegistriesResponse.js +2 -0
- package/dist/models/ServerDockerInfo.d.ts +14 -0
- package/dist/models/ServerDockerInfo.js +2 -0
- package/dist/models/UnusedImagesResponse.d.ts +6 -0
- package/dist/models/UnusedImagesResponse.js +2 -0
- package/dist/models/index.d.ts +40 -0
- package/dist/models/index.js +56 -0
- package/package.json +30 -0
- package/src/api/ApiManager.ts +825 -0
- package/src/api/ErrorFactory.ts +35 -0
- package/src/api/HttpClient.ts +143 -0
- package/src/example.ts +36 -0
- package/src/index.ts +5 -0
- package/src/models/AppDefinition.ts +124 -0
- package/src/models/AppDefinitionsResponse.ts +8 -0
- package/src/models/AppDeleteResponse.ts +3 -0
- package/src/models/AutomatedCleanupConfigs.ts +18 -0
- package/src/models/BackupMeta.ts +26 -0
- package/src/models/BuildLogsResponse.ts +5 -0
- package/src/models/CapRoverTheme.ts +11 -0
- package/src/models/CaptainInfo.ts +6 -0
- package/src/models/ContainerProps.ts +3 -0
- package/src/models/DockerAuthObj.ts +25 -0
- package/src/models/DockerSecret.ts +4 -0
- package/src/models/DockerService.ts +117 -0
- package/src/models/GoAccessInfo.ts +7 -0
- package/src/models/GoAccessReportResponse.ts +6 -0
- package/src/models/IBuiltImage.ts +4 -0
- package/src/models/ICaptainDefinition.ts +7 -0
- package/src/models/IGoAccessInfo.ts +7 -0
- package/src/models/IHashMapGeneric.ts +3 -0
- package/src/models/IImageSource.ts +10 -0
- package/src/models/IOneClickAppModels.ts +51 -0
- package/src/models/IProFeatures.ts +39 -0
- package/src/models/IRegistryInfo.ts +30 -0
- package/src/models/IServerBlockDetails.ts +18 -0
- package/src/models/IVersionInfo.ts +6 -0
- package/src/models/LoadBalancerInfo.ts +11 -0
- package/src/models/LogsResponse.ts +3 -0
- package/src/models/NetDataInfo.ts +27 -0
- package/src/models/NginxConfig.ts +10 -0
- package/src/models/OneClickAppDefinitionResponse.ts +3 -0
- package/src/models/OneClickAppRepositories.ts +3 -0
- package/src/models/OneClickAppResponse.ts +5 -0
- package/src/models/OtherTypes.ts +32 -0
- package/src/models/ProjectDefinition.ts +6 -0
- package/src/models/ProjectsResponse.ts +5 -0
- package/src/models/RegistriesResponse.ts +6 -0
- package/src/models/ServerDockerInfo.ts +14 -0
- package/src/models/UnusedImagesResponse.ts +3 -0
- package/src/models/index.ts +41 -0
- package/tsconfig.json +14 -0
- package/tslint.json +46 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ErrorFactory {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.OKAY = 100;
|
|
6
|
+
this.OKAY_BUILD_STARTED = 101;
|
|
7
|
+
this.OK_PARTIALLY = 102;
|
|
8
|
+
this.STATUS_ERROR_GENERIC = 1000;
|
|
9
|
+
this.STATUS_ERROR_CAPTAIN_NOT_INITIALIZED = 1001;
|
|
10
|
+
this.STATUS_ERROR_USER_NOT_INITIALIZED = 1101;
|
|
11
|
+
this.STATUS_ERROR_NOT_AUTHORIZED = 1102;
|
|
12
|
+
this.STATUS_ERROR_ALREADY_EXIST = 1103;
|
|
13
|
+
this.STATUS_ERROR_BAD_NAME = 1104;
|
|
14
|
+
this.STATUS_WRONG_PASSWORD = 1105;
|
|
15
|
+
this.STATUS_AUTH_TOKEN_INVALID = 1106;
|
|
16
|
+
this.VERIFICATION_FAILED = 1107;
|
|
17
|
+
this.ILLEGAL_OPERATION = 1108;
|
|
18
|
+
this.BUILD_ERROR = 1109;
|
|
19
|
+
this.ILLEGAL_PARAMETER = 1110;
|
|
20
|
+
this.NOT_FOUND = 1111;
|
|
21
|
+
this.AUTHENTICATION_FAILED = 1112;
|
|
22
|
+
this.STATUS_PASSWORD_BACK_OFF = 1113;
|
|
23
|
+
this.STATUS_ERROR_OTP_REQUIRED = 1114;
|
|
24
|
+
this.UNKNOWN_ERROR = 1999;
|
|
25
|
+
}
|
|
26
|
+
createError(status, message) {
|
|
27
|
+
let e = new Error(message || 'null');
|
|
28
|
+
e.captainStatus = status;
|
|
29
|
+
e.captainMessage = message;
|
|
30
|
+
return e;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
ErrorFactory.STATUS_ERROR_PRO_API_KEY_INVALIDATED = 1115;
|
|
34
|
+
const errorFactory = new ErrorFactory();
|
|
35
|
+
exports.default = errorFactory;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class HttpClient {
|
|
2
|
+
private baseUrl;
|
|
3
|
+
private onAuthFailure;
|
|
4
|
+
readonly GET = "GET";
|
|
5
|
+
readonly POST = "POST";
|
|
6
|
+
isDestroyed: boolean;
|
|
7
|
+
private authToken;
|
|
8
|
+
constructor(baseUrl: string, onAuthFailure: () => Promise<string>);
|
|
9
|
+
createHeaders(): any;
|
|
10
|
+
setAuthToken(authToken: string): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
fetch(method: 'GET' | 'POST', endpoint: string, variables: any): () => Promise<any>;
|
|
13
|
+
fetchInternal(method: 'GET' | 'POST', endpoint: string, variables: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
14
|
+
getReq(endpoint: string, variables: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
+
postReq(endpoint: string, variables: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
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 ErrorFactory_1 = __importDefault(require("./ErrorFactory"));
|
|
8
|
+
let TOKEN_HEADER = 'x-captain-auth';
|
|
9
|
+
let NAMESPACE = 'x-namespace';
|
|
10
|
+
let CAPTAIN = 'captain';
|
|
11
|
+
class HttpClient {
|
|
12
|
+
constructor(baseUrl, onAuthFailure) {
|
|
13
|
+
this.baseUrl = baseUrl;
|
|
14
|
+
this.onAuthFailure = onAuthFailure;
|
|
15
|
+
this.GET = 'GET';
|
|
16
|
+
this.POST = 'POST';
|
|
17
|
+
this.isDestroyed = false;
|
|
18
|
+
this.authToken = '';
|
|
19
|
+
//
|
|
20
|
+
}
|
|
21
|
+
createHeaders() {
|
|
22
|
+
let headers = {};
|
|
23
|
+
if (this.authToken)
|
|
24
|
+
headers[TOKEN_HEADER] = this.authToken;
|
|
25
|
+
headers[NAMESPACE] = CAPTAIN;
|
|
26
|
+
// check user/appData or apiManager.uploadAppData before changing this signature.
|
|
27
|
+
return headers;
|
|
28
|
+
}
|
|
29
|
+
setAuthToken(authToken) {
|
|
30
|
+
this.authToken = authToken;
|
|
31
|
+
}
|
|
32
|
+
destroy() {
|
|
33
|
+
this.isDestroyed = true;
|
|
34
|
+
}
|
|
35
|
+
fetch(method, endpoint, variables) {
|
|
36
|
+
const self = this;
|
|
37
|
+
return function () {
|
|
38
|
+
return Promise.resolve() //
|
|
39
|
+
.then(function () {
|
|
40
|
+
return self.fetchInternal(method, endpoint, variables); //
|
|
41
|
+
})
|
|
42
|
+
.then(function (axiosResponse) {
|
|
43
|
+
const data = axiosResponse.data; // this is an axios thing!
|
|
44
|
+
if (data.status === ErrorFactory_1.default.STATUS_AUTH_TOKEN_INVALID) {
|
|
45
|
+
return self
|
|
46
|
+
.onAuthFailure() //
|
|
47
|
+
.then(function (authToken) {
|
|
48
|
+
self.setAuthToken(authToken);
|
|
49
|
+
return self
|
|
50
|
+
.fetchInternal(method, endpoint, variables)
|
|
51
|
+
.then(function (newAxiosResponse) {
|
|
52
|
+
return newAxiosResponse.data;
|
|
53
|
+
});
|
|
54
|
+
})
|
|
55
|
+
.catch(function (error) {
|
|
56
|
+
// Upon wrong password or back-off error, we force logout the user
|
|
57
|
+
// to avoid getting stuck with wrong password loop
|
|
58
|
+
if (error.captainStatus + '' ===
|
|
59
|
+
ErrorFactory_1.default.STATUS_PASSWORD_BACK_OFF +
|
|
60
|
+
'' ||
|
|
61
|
+
error.captainStatus + '' ===
|
|
62
|
+
ErrorFactory_1.default.STATUS_WRONG_PASSWORD + '') {
|
|
63
|
+
self.setAuthToken('');
|
|
64
|
+
}
|
|
65
|
+
return Promise.reject(error);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
.then(function (data) {
|
|
73
|
+
if (data.status !== ErrorFactory_1.default.OKAY &&
|
|
74
|
+
data.status !== ErrorFactory_1.default.OK_PARTIALLY &&
|
|
75
|
+
data.status !== ErrorFactory_1.default.OKAY_BUILD_STARTED) {
|
|
76
|
+
throw ErrorFactory_1.default.createError(data.status || ErrorFactory_1.default.UNKNOWN_ERROR, data.description || '');
|
|
77
|
+
}
|
|
78
|
+
return data;
|
|
79
|
+
})
|
|
80
|
+
.then(function (data) {
|
|
81
|
+
// These two blocks are clearly memory leaks! But I don't have time to fix them now... I need to CANCEL the promise, but since I don't
|
|
82
|
+
// have CANCEL method on the native Promise, I return a promise that will never RETURN if the HttpClient is destroyed.
|
|
83
|
+
// Will fix them later... but it shouldn't be a big deal anyways as it's only a problem when user navigates away from a page before the
|
|
84
|
+
// network request returns back.
|
|
85
|
+
return new Promise(function (resolve, reject) {
|
|
86
|
+
// data.data here is the "data" field inside the API response! {status: 100, description: "Login succeeded", data: {…}}
|
|
87
|
+
if (!self.isDestroyed)
|
|
88
|
+
return resolve(data.data);
|
|
89
|
+
});
|
|
90
|
+
})
|
|
91
|
+
.catch(function (error) {
|
|
92
|
+
return new Promise(function (resolve, reject) {
|
|
93
|
+
if (!self.isDestroyed)
|
|
94
|
+
return reject(error);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
fetchInternal(method, endpoint, variables) {
|
|
100
|
+
if (method === this.GET)
|
|
101
|
+
return this.getReq(endpoint, variables);
|
|
102
|
+
if (method === this.POST)
|
|
103
|
+
return this.postReq(endpoint, variables);
|
|
104
|
+
throw new Error(`Unknown method: ${method}`);
|
|
105
|
+
}
|
|
106
|
+
getReq(endpoint, variables) {
|
|
107
|
+
const self = this;
|
|
108
|
+
return axios_1.default
|
|
109
|
+
.get(this.baseUrl + endpoint, {
|
|
110
|
+
params: variables,
|
|
111
|
+
headers: self.createHeaders(),
|
|
112
|
+
}) //
|
|
113
|
+
.then(function (data) {
|
|
114
|
+
// console.log(data);
|
|
115
|
+
return data;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
postReq(endpoint, variables) {
|
|
119
|
+
const self = this;
|
|
120
|
+
return axios_1.default
|
|
121
|
+
.post(this.baseUrl + endpoint, variables, {
|
|
122
|
+
headers: self.createHeaders(),
|
|
123
|
+
}) //
|
|
124
|
+
.then(function (data) {
|
|
125
|
+
// console.log(data);
|
|
126
|
+
return data;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.default = HttpClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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 index_1 = __importDefault(require("./index"));
|
|
7
|
+
const caprover = new index_1.default('https://captain.server.demo.caprover.com', () => {
|
|
8
|
+
// get password and otp from user
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
password: 'captain42',
|
|
11
|
+
otpToken: undefined,
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
console.log('===============================================');
|
|
15
|
+
Promise.resolve()
|
|
16
|
+
.then(() => {
|
|
17
|
+
return caprover.getAllNodes();
|
|
18
|
+
})
|
|
19
|
+
.then((response) => {
|
|
20
|
+
console.log('=============================================== getAllNodes:');
|
|
21
|
+
console.log(response);
|
|
22
|
+
return caprover.getDockerRegistries();
|
|
23
|
+
})
|
|
24
|
+
.then((response) => {
|
|
25
|
+
console.log('=============================================== getDockerRegistries:');
|
|
26
|
+
console.log(response);
|
|
27
|
+
})
|
|
28
|
+
.catch((error) => {
|
|
29
|
+
console.log(error);
|
|
30
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.CapRoverModels = void 0;
|
|
40
|
+
const ApiManager_1 = __importDefault(require("./api/ApiManager"));
|
|
41
|
+
const CapRoverModels = __importStar(require("./models"));
|
|
42
|
+
exports.CapRoverModels = CapRoverModels;
|
|
43
|
+
exports.default = ApiManager_1.default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IHashMapGeneric } from './IHashMapGeneric';
|
|
2
|
+
export type IAllAppDefinitions = IHashMapGeneric<IAppDef>;
|
|
3
|
+
export interface IAppEnvVar {
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const enum VolumesTypes {
|
|
8
|
+
BIND = "bind",
|
|
9
|
+
VOLUME = "volume"
|
|
10
|
+
}
|
|
11
|
+
export interface IAppVolume {
|
|
12
|
+
containerPath: string;
|
|
13
|
+
volumeName?: string;
|
|
14
|
+
hostPath?: string;
|
|
15
|
+
mode?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IAppPort {
|
|
18
|
+
containerPort: number;
|
|
19
|
+
hostPort: number;
|
|
20
|
+
protocol?: 'udp' | 'tcp';
|
|
21
|
+
publishMode?: 'ingress' | 'host';
|
|
22
|
+
}
|
|
23
|
+
export interface RepoInfo {
|
|
24
|
+
repo: string;
|
|
25
|
+
branch: string;
|
|
26
|
+
user: string;
|
|
27
|
+
sshKey?: string;
|
|
28
|
+
password: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RepoInfoEncrypted {
|
|
31
|
+
repo: string;
|
|
32
|
+
branch: string;
|
|
33
|
+
user: string;
|
|
34
|
+
sshKeyEncrypted?: string;
|
|
35
|
+
passwordEncrypted: string;
|
|
36
|
+
}
|
|
37
|
+
export interface IAppVersion {
|
|
38
|
+
version: number;
|
|
39
|
+
deployedImageName?: string;
|
|
40
|
+
timeStamp: string;
|
|
41
|
+
gitHash: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface IAppCustomDomain {
|
|
44
|
+
publicDomain: string;
|
|
45
|
+
hasSsl: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface IAppTag {
|
|
48
|
+
tagName: string;
|
|
49
|
+
}
|
|
50
|
+
export interface IAppDefinitionBase {
|
|
51
|
+
projectId?: string | undefined;
|
|
52
|
+
description: string;
|
|
53
|
+
deployedVersion: number;
|
|
54
|
+
notExposeAsWebApp: boolean;
|
|
55
|
+
hasPersistentData: boolean;
|
|
56
|
+
hasDefaultSubDomainSsl: boolean;
|
|
57
|
+
containerHttpPort?: number;
|
|
58
|
+
captainDefinitionRelativeFilePath: string;
|
|
59
|
+
forceSsl: boolean;
|
|
60
|
+
websocketSupport: boolean;
|
|
61
|
+
nodeId?: string;
|
|
62
|
+
instanceCount: number;
|
|
63
|
+
preDeployFunction?: string;
|
|
64
|
+
serviceUpdateOverride?: string;
|
|
65
|
+
customNginxConfig?: string;
|
|
66
|
+
redirectDomain?: string;
|
|
67
|
+
networks: string[];
|
|
68
|
+
customDomain: IAppCustomDomain[];
|
|
69
|
+
tags?: IAppTag[];
|
|
70
|
+
ports: IAppPort[];
|
|
71
|
+
volumes: IAppVolume[];
|
|
72
|
+
envVars: IAppEnvVar[];
|
|
73
|
+
versions: IAppVersion[];
|
|
74
|
+
appDeployTokenConfig?: AppDeployTokenConfig;
|
|
75
|
+
}
|
|
76
|
+
export interface IHttpAuth {
|
|
77
|
+
user: string;
|
|
78
|
+
password?: string;
|
|
79
|
+
passwordHashed?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface AppDeployTokenConfig {
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
appDeployToken?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface IAppDef extends IAppDefinitionBase {
|
|
86
|
+
appPushWebhook?: {
|
|
87
|
+
tokenVersion: string;
|
|
88
|
+
repoInfo: RepoInfo;
|
|
89
|
+
pushWebhookToken: string;
|
|
90
|
+
};
|
|
91
|
+
httpAuth?: IHttpAuth;
|
|
92
|
+
appName?: string;
|
|
93
|
+
isAppBuilding?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface IAppDefSaved extends IAppDefinitionBase {
|
|
96
|
+
appPushWebhook: {
|
|
97
|
+
tokenVersion: string;
|
|
98
|
+
repoInfo: RepoInfoEncrypted;
|
|
99
|
+
pushWebhookToken: string;
|
|
100
|
+
} | undefined;
|
|
101
|
+
httpAuth?: {
|
|
102
|
+
user: string;
|
|
103
|
+
passwordHashed: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IAutomatedCleanupConfigs {
|
|
2
|
+
mostRecentLimit: number;
|
|
3
|
+
cronSchedule: string;
|
|
4
|
+
timezone: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class AutomatedCleanupConfigsCleaner {
|
|
7
|
+
static sanitizeInput(instance: IAutomatedCleanupConfigs): {
|
|
8
|
+
mostRecentLimit: number;
|
|
9
|
+
cronSchedule: string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutomatedCleanupConfigsCleaner = void 0;
|
|
4
|
+
class AutomatedCleanupConfigsCleaner {
|
|
5
|
+
static sanitizeInput(instance) {
|
|
6
|
+
return {
|
|
7
|
+
mostRecentLimit: Number(instance.mostRecentLimit) > 0
|
|
8
|
+
? Number(instance.mostRecentLimit)
|
|
9
|
+
: 1,
|
|
10
|
+
cronSchedule: `${instance.cronSchedule || ''}`.trim(),
|
|
11
|
+
timezone: `${instance.timezone || ''}`.trim() || 'UTC',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AutomatedCleanupConfigsCleaner = AutomatedCleanupConfigsCleaner;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ServerDockerInfo } from './ServerDockerInfo';
|
|
2
|
+
export interface RestoringNode {
|
|
3
|
+
oldIp: string;
|
|
4
|
+
newIp: string;
|
|
5
|
+
user: string;
|
|
6
|
+
privateKeyPath: string;
|
|
7
|
+
}
|
|
8
|
+
export interface OldNodesForReference {
|
|
9
|
+
appsLockOnThisNode: string[];
|
|
10
|
+
nodeData: ServerDockerInfo;
|
|
11
|
+
}
|
|
12
|
+
export interface RestoringInfo {
|
|
13
|
+
nodesMapping: RestoringNode[];
|
|
14
|
+
oldNodesForReference: OldNodesForReference[];
|
|
15
|
+
}
|
|
16
|
+
export interface BackupMeta {
|
|
17
|
+
salt: string;
|
|
18
|
+
nodes: ServerDockerInfo[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface Version {
|
|
2
|
+
Index: number;
|
|
3
|
+
}
|
|
4
|
+
export interface Labels {
|
|
5
|
+
[id: string]: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Mount {
|
|
8
|
+
Type: string;
|
|
9
|
+
Source: string;
|
|
10
|
+
Target: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ContainerSpecType {
|
|
13
|
+
Image: string;
|
|
14
|
+
Env: string[];
|
|
15
|
+
Mounts: Mount[];
|
|
16
|
+
Isolation: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Resources {
|
|
19
|
+
Limits: {
|
|
20
|
+
MemoryBytes: number;
|
|
21
|
+
NanoCPUs: number;
|
|
22
|
+
};
|
|
23
|
+
Reservations: {
|
|
24
|
+
MemoryBytes: number;
|
|
25
|
+
NanoCPUs: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface Placement {
|
|
29
|
+
Constraints: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface Options {
|
|
32
|
+
'max-size': string;
|
|
33
|
+
}
|
|
34
|
+
export interface LogDriver {
|
|
35
|
+
Name: string;
|
|
36
|
+
Options: Options;
|
|
37
|
+
}
|
|
38
|
+
export interface TaskTemplate {
|
|
39
|
+
ContainerSpec: ContainerSpecType;
|
|
40
|
+
Resources: Resources;
|
|
41
|
+
Placement: Placement;
|
|
42
|
+
LogDriver: LogDriver;
|
|
43
|
+
ForceUpdate: number;
|
|
44
|
+
Runtime: string;
|
|
45
|
+
}
|
|
46
|
+
export interface Replicated {
|
|
47
|
+
Replicas: number;
|
|
48
|
+
}
|
|
49
|
+
export interface Mode {
|
|
50
|
+
Replicated: Replicated;
|
|
51
|
+
}
|
|
52
|
+
export interface Port {
|
|
53
|
+
Protocol: string;
|
|
54
|
+
TargetPort: number;
|
|
55
|
+
PublishedPort: number;
|
|
56
|
+
PublishMode: string;
|
|
57
|
+
}
|
|
58
|
+
export interface EndpointSpec {
|
|
59
|
+
Mode: string;
|
|
60
|
+
Ports: Port[];
|
|
61
|
+
}
|
|
62
|
+
export interface Spec {
|
|
63
|
+
Name: string;
|
|
64
|
+
Labels: Labels;
|
|
65
|
+
TaskTemplate: TaskTemplate;
|
|
66
|
+
Mode: Mode;
|
|
67
|
+
EndpointSpec: EndpointSpec;
|
|
68
|
+
}
|
|
69
|
+
export interface PreviousSpec {
|
|
70
|
+
Name: string;
|
|
71
|
+
Labels: Labels;
|
|
72
|
+
TaskTemplate: TaskTemplate;
|
|
73
|
+
Mode: Mode;
|
|
74
|
+
EndpointSpec: EndpointSpec;
|
|
75
|
+
}
|
|
76
|
+
export interface VirtualIP {
|
|
77
|
+
NetworkID: string;
|
|
78
|
+
Addr: string;
|
|
79
|
+
}
|
|
80
|
+
export interface Endpoint {
|
|
81
|
+
Spec: Spec;
|
|
82
|
+
Ports: Port[];
|
|
83
|
+
VirtualIPs: VirtualIP[];
|
|
84
|
+
}
|
|
85
|
+
export interface UpdateStatus {
|
|
86
|
+
State: string;
|
|
87
|
+
StartedAt: string;
|
|
88
|
+
Message: string;
|
|
89
|
+
}
|
|
90
|
+
export default interface DockerService {
|
|
91
|
+
ID: string;
|
|
92
|
+
Version: Version;
|
|
93
|
+
CreatedAt: string;
|
|
94
|
+
UpdatedAt: string;
|
|
95
|
+
Spec: Spec;
|
|
96
|
+
PreviousSpec: PreviousSpec;
|
|
97
|
+
Endpoint: Endpoint;
|
|
98
|
+
UpdateStatus: UpdateStatus;
|
|
99
|
+
}
|