@brimble/models 3.7.87 → 3.7.89
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/enum/index.d.ts +16 -0
- package/dist/enum/index.js +20 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +8 -1
- package/dist/sandbox-image.d.ts +30 -0
- package/dist/sandbox-image.js +31 -0
- package/dist/sandbox.d.ts +30 -0
- package/dist/sandbox.js +90 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/sandbox-image.d.ts +9 -0
- package/dist/types/sandbox-image.js +2 -0
- package/dist/types/sandbox.d.ts +30 -0
- package/dist/types/sandbox.js +2 -0
- package/enum/index.ts +19 -0
- package/index.ts +9 -1
- package/package.json +1 -1
- package/sandbox-image.ts +35 -0
- package/sandbox.ts +92 -0
- package/types/index.ts +2 -0
- package/types/sandbox-image.ts +10 -0
- package/types/sandbox.ts +32 -0
package/dist/enum/index.d.ts
CHANGED
|
@@ -220,3 +220,19 @@ export declare enum INVOICE_TYPE {
|
|
|
220
220
|
INVOICE = "invoice",
|
|
221
221
|
RECEIPT = "receipt"
|
|
222
222
|
}
|
|
223
|
+
export declare enum SANDBOX_TEMPLATE {
|
|
224
|
+
PYTHON = "python",
|
|
225
|
+
NODE = "node"
|
|
226
|
+
}
|
|
227
|
+
export declare enum SANDBOX_STATUS {
|
|
228
|
+
STARTING = "starting",
|
|
229
|
+
READY = "ready",
|
|
230
|
+
FAILED = "failed",
|
|
231
|
+
DESTROYED = "destroyed"
|
|
232
|
+
}
|
|
233
|
+
export declare enum SANDBOX_DESTROY_REASON {
|
|
234
|
+
USER = "user",
|
|
235
|
+
IDLE_TTL = "idle_ttl",
|
|
236
|
+
MAX_LIFETIME = "max_lifetime",
|
|
237
|
+
FAILED = "failed"
|
|
238
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
3
|
+
exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
4
4
|
var GIT_TYPE;
|
|
5
5
|
(function (GIT_TYPE) {
|
|
6
6
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -259,3 +259,22 @@ var INVOICE_TYPE;
|
|
|
259
259
|
INVOICE_TYPE["INVOICE"] = "invoice";
|
|
260
260
|
INVOICE_TYPE["RECEIPT"] = "receipt";
|
|
261
261
|
})(INVOICE_TYPE = exports.INVOICE_TYPE || (exports.INVOICE_TYPE = {}));
|
|
262
|
+
var SANDBOX_TEMPLATE;
|
|
263
|
+
(function (SANDBOX_TEMPLATE) {
|
|
264
|
+
SANDBOX_TEMPLATE["PYTHON"] = "python";
|
|
265
|
+
SANDBOX_TEMPLATE["NODE"] = "node";
|
|
266
|
+
})(SANDBOX_TEMPLATE = exports.SANDBOX_TEMPLATE || (exports.SANDBOX_TEMPLATE = {}));
|
|
267
|
+
var SANDBOX_STATUS;
|
|
268
|
+
(function (SANDBOX_STATUS) {
|
|
269
|
+
SANDBOX_STATUS["STARTING"] = "starting";
|
|
270
|
+
SANDBOX_STATUS["READY"] = "ready";
|
|
271
|
+
SANDBOX_STATUS["FAILED"] = "failed";
|
|
272
|
+
SANDBOX_STATUS["DESTROYED"] = "destroyed";
|
|
273
|
+
})(SANDBOX_STATUS = exports.SANDBOX_STATUS || (exports.SANDBOX_STATUS = {}));
|
|
274
|
+
var SANDBOX_DESTROY_REASON;
|
|
275
|
+
(function (SANDBOX_DESTROY_REASON) {
|
|
276
|
+
SANDBOX_DESTROY_REASON["USER"] = "user";
|
|
277
|
+
SANDBOX_DESTROY_REASON["IDLE_TTL"] = "idle_ttl";
|
|
278
|
+
SANDBOX_DESTROY_REASON["MAX_LIFETIME"] = "max_lifetime";
|
|
279
|
+
SANDBOX_DESTROY_REASON["FAILED"] = "failed";
|
|
280
|
+
})(SANDBOX_DESTROY_REASON = exports.SANDBOX_DESTROY_REASON || (exports.SANDBOX_DESTROY_REASON = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -53,8 +53,10 @@ export { default as ProjectEnvironment } from "./project-environment";
|
|
|
53
53
|
export { default as EnvironmentVariable } from "./environment-variable";
|
|
54
54
|
export { default as ActivityLog } from "./activity-log";
|
|
55
55
|
export { default as OwnershipTransfer } from "./ownership-transfer";
|
|
56
|
-
export {
|
|
57
|
-
export {
|
|
56
|
+
export { default as Sandbox } from "./sandbox";
|
|
57
|
+
export { default as SandboxImage } from "./sandbox-image";
|
|
58
|
+
export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxImage, } from "./types";
|
|
59
|
+
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, DomainTransferProvider, DomainTransferDirection, DomainTransferStatus, NomadDeploymentStatus, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE, SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON, } from "./enum";
|
|
58
60
|
import mongoose from "mongoose";
|
|
59
61
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
60
62
|
export declare const db: mongoose.Connection;
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainTransfer = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
|
-
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = void 0;
|
|
16
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.SandboxImage = exports.Sandbox = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = void 0;
|
|
17
17
|
var user_1 = require("./user");
|
|
18
18
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
19
19
|
var project_1 = require("./project");
|
|
@@ -125,6 +125,10 @@ var activity_log_1 = require("./activity-log");
|
|
|
125
125
|
Object.defineProperty(exports, "ActivityLog", { enumerable: true, get: function () { return __importDefault(activity_log_1).default; } });
|
|
126
126
|
var ownership_transfer_1 = require("./ownership-transfer");
|
|
127
127
|
Object.defineProperty(exports, "OwnershipTransfer", { enumerable: true, get: function () { return __importDefault(ownership_transfer_1).default; } });
|
|
128
|
+
var sandbox_1 = require("./sandbox");
|
|
129
|
+
Object.defineProperty(exports, "Sandbox", { enumerable: true, get: function () { return __importDefault(sandbox_1).default; } });
|
|
130
|
+
var sandbox_image_1 = require("./sandbox-image");
|
|
131
|
+
Object.defineProperty(exports, "SandboxImage", { enumerable: true, get: function () { return __importDefault(sandbox_image_1).default; } });
|
|
128
132
|
var enum_1 = require("./enum");
|
|
129
133
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
130
134
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -160,6 +164,9 @@ Object.defineProperty(exports, "COLLAB_TOOLBAR_POSITION", { enumerable: true, ge
|
|
|
160
164
|
Object.defineProperty(exports, "INVOICE_STATUS", { enumerable: true, get: function () { return enum_1.INVOICE_STATUS; } });
|
|
161
165
|
Object.defineProperty(exports, "INVOICE_PAYMENT_STATUS", { enumerable: true, get: function () { return enum_1.INVOICE_PAYMENT_STATUS; } });
|
|
162
166
|
Object.defineProperty(exports, "INVOICE_TYPE", { enumerable: true, get: function () { return enum_1.INVOICE_TYPE; } });
|
|
167
|
+
Object.defineProperty(exports, "SANDBOX_TEMPLATE", { enumerable: true, get: function () { return enum_1.SANDBOX_TEMPLATE; } });
|
|
168
|
+
Object.defineProperty(exports, "SANDBOX_STATUS", { enumerable: true, get: function () { return enum_1.SANDBOX_STATUS; } });
|
|
169
|
+
Object.defineProperty(exports, "SANDBOX_DESTROY_REASON", { enumerable: true, get: function () { return enum_1.SANDBOX_DESTROY_REASON; } });
|
|
163
170
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
164
171
|
const utils_1 = require("@brimble/utils");
|
|
165
172
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
+
import { ISandboxImage } from "./types/sandbox-image";
|
|
27
|
+
declare const _default: import("mongoose").Model<ISandboxImage, {}, {}, {}, import("mongoose").Document<unknown, {}, ISandboxImage> & ISandboxImage & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}, any>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const sandboxImageSchema = new mongoose_1.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true,
|
|
9
|
+
},
|
|
10
|
+
display_name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
image: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
is_available: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true,
|
|
25
|
+
},
|
|
26
|
+
is_default: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
}, { timestamps: true });
|
|
31
|
+
exports.default = (0, mongoose_1.model)("SandboxImage", sandboxImageSchema);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
+
import { ISandbox } from "./types/sandbox";
|
|
27
|
+
declare const _default: import("mongoose").Model<ISandbox, {}, {}, {}, import("mongoose").Document<unknown, {}, ISandbox> & ISandbox & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}, any>;
|
|
30
|
+
export default _default;
|
package/dist/sandbox.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const sandboxSchema = new mongoose_1.Schema({
|
|
6
|
+
user_id: {
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
ref: "User",
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
team: {
|
|
12
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
13
|
+
ref: "Team",
|
|
14
|
+
default: null,
|
|
15
|
+
},
|
|
16
|
+
project_environment: {
|
|
17
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
18
|
+
ref: "ProjectEnvironment",
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
template: {
|
|
22
|
+
type: String,
|
|
23
|
+
enum: Object.values(enum_1.SANDBOX_TEMPLATE),
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
status: {
|
|
27
|
+
type: String,
|
|
28
|
+
enum: Object.values(enum_1.SANDBOX_STATUS),
|
|
29
|
+
required: true,
|
|
30
|
+
default: enum_1.SANDBOX_STATUS.STARTING,
|
|
31
|
+
},
|
|
32
|
+
nomad_job_id: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
nomad_alloc_id: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: null,
|
|
39
|
+
},
|
|
40
|
+
host: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: null,
|
|
43
|
+
},
|
|
44
|
+
port: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
agent_token_hash: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: null,
|
|
51
|
+
},
|
|
52
|
+
region: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
specs: {
|
|
57
|
+
cpu: { type: Number, default: 2000 },
|
|
58
|
+
memory: { type: Number, default: 2048 },
|
|
59
|
+
disk: { type: Number, default: 5 },
|
|
60
|
+
},
|
|
61
|
+
created_at: {
|
|
62
|
+
type: Date,
|
|
63
|
+
default: Date.now,
|
|
64
|
+
},
|
|
65
|
+
last_activity_at: {
|
|
66
|
+
type: Date,
|
|
67
|
+
default: Date.now,
|
|
68
|
+
},
|
|
69
|
+
expires_at: {
|
|
70
|
+
type: Date,
|
|
71
|
+
required: true,
|
|
72
|
+
},
|
|
73
|
+
destroyed_at: {
|
|
74
|
+
type: Date,
|
|
75
|
+
default: null,
|
|
76
|
+
},
|
|
77
|
+
destroy_reason: {
|
|
78
|
+
type: String,
|
|
79
|
+
enum: Object.values(enum_1.SANDBOX_DESTROY_REASON),
|
|
80
|
+
default: null,
|
|
81
|
+
},
|
|
82
|
+
isDeleted: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
sandboxSchema.index({ user_id: 1, status: 1, isDeleted: 1 });
|
|
88
|
+
sandboxSchema.index({ expires_at: 1 });
|
|
89
|
+
sandboxSchema.index({ last_activity_at: 1, status: 1 });
|
|
90
|
+
exports.default = (0, mongoose_1.model)("Sandbox", sandboxSchema);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -54,3 +54,5 @@ export type { IProjectEnvironment } from "./project-environment";
|
|
|
54
54
|
export type { IEnvironmentVariable } from "./environment-variable";
|
|
55
55
|
export type { IActivityLog } from "./activity-log";
|
|
56
56
|
export type { IOwnershipTransfer } from "./ownership-transfer";
|
|
57
|
+
export type { ISandbox, ISandboxSpecs } from "./sandbox";
|
|
58
|
+
export type { ISandboxImage } from "./sandbox-image";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { IUser } from "./user";
|
|
3
|
+
import { ITeam } from "./team";
|
|
4
|
+
import { IProjectEnvironment } from "./project-environment";
|
|
5
|
+
import { SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "../enum";
|
|
6
|
+
export interface ISandboxSpecs {
|
|
7
|
+
cpu: number;
|
|
8
|
+
memory: number;
|
|
9
|
+
disk: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ISandbox extends Document {
|
|
12
|
+
user_id: IUser | Types.ObjectId;
|
|
13
|
+
team: ITeam | Types.ObjectId | null;
|
|
14
|
+
project_environment: IProjectEnvironment | Types.ObjectId | null;
|
|
15
|
+
template: SANDBOX_TEMPLATE;
|
|
16
|
+
status: SANDBOX_STATUS;
|
|
17
|
+
nomad_job_id: string;
|
|
18
|
+
nomad_alloc_id: string | null;
|
|
19
|
+
host: string | null;
|
|
20
|
+
port: number | null;
|
|
21
|
+
agent_token_hash: string | null;
|
|
22
|
+
region: string;
|
|
23
|
+
specs: ISandboxSpecs;
|
|
24
|
+
created_at: Date;
|
|
25
|
+
last_activity_at: Date;
|
|
26
|
+
expires_at: Date;
|
|
27
|
+
destroyed_at: Date | null;
|
|
28
|
+
destroy_reason: SANDBOX_DESTROY_REASON | null;
|
|
29
|
+
isDeleted: boolean;
|
|
30
|
+
}
|
package/enum/index.ts
CHANGED
|
@@ -255,3 +255,22 @@ export enum INVOICE_TYPE {
|
|
|
255
255
|
INVOICE = "invoice",
|
|
256
256
|
RECEIPT = "receipt",
|
|
257
257
|
}
|
|
258
|
+
|
|
259
|
+
export enum SANDBOX_TEMPLATE {
|
|
260
|
+
PYTHON = "python",
|
|
261
|
+
NODE = "node",
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export enum SANDBOX_STATUS {
|
|
265
|
+
STARTING = "starting",
|
|
266
|
+
READY = "ready",
|
|
267
|
+
FAILED = "failed",
|
|
268
|
+
DESTROYED = "destroyed",
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export enum SANDBOX_DESTROY_REASON {
|
|
272
|
+
USER = "user",
|
|
273
|
+
IDLE_TTL = "idle_ttl",
|
|
274
|
+
MAX_LIFETIME = "max_lifetime",
|
|
275
|
+
FAILED = "failed",
|
|
276
|
+
}
|
package/index.ts
CHANGED
|
@@ -53,6 +53,8 @@ export { default as ProjectEnvironment } from "./project-environment";
|
|
|
53
53
|
export { default as EnvironmentVariable } from "./environment-variable";
|
|
54
54
|
export { default as ActivityLog } from "./activity-log";
|
|
55
55
|
export { default as OwnershipTransfer } from "./ownership-transfer";
|
|
56
|
+
export { default as Sandbox } from "./sandbox";
|
|
57
|
+
export { default as SandboxImage } from "./sandbox-image";
|
|
56
58
|
|
|
57
59
|
export {
|
|
58
60
|
IUser,
|
|
@@ -114,6 +116,9 @@ export {
|
|
|
114
116
|
IEnvironmentVariable,
|
|
115
117
|
IActivityLog,
|
|
116
118
|
IOwnershipTransfer,
|
|
119
|
+
ISandbox,
|
|
120
|
+
ISandboxSpecs,
|
|
121
|
+
ISandboxImage,
|
|
117
122
|
} from "./types";
|
|
118
123
|
export {
|
|
119
124
|
GIT_TYPE,
|
|
@@ -149,7 +154,10 @@ export {
|
|
|
149
154
|
COLLAB_TOOLBAR_POSITION,
|
|
150
155
|
INVOICE_STATUS,
|
|
151
156
|
INVOICE_PAYMENT_STATUS,
|
|
152
|
-
INVOICE_TYPE
|
|
157
|
+
INVOICE_TYPE,
|
|
158
|
+
SANDBOX_TEMPLATE,
|
|
159
|
+
SANDBOX_STATUS,
|
|
160
|
+
SANDBOX_DESTROY_REASON,
|
|
153
161
|
} from "./enum";
|
|
154
162
|
|
|
155
163
|
import mongoose from "mongoose";
|
package/package.json
CHANGED
package/sandbox-image.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { ISandboxImage } from "./types/sandbox-image";
|
|
3
|
+
|
|
4
|
+
const sandboxImageSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
name: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true,
|
|
10
|
+
},
|
|
11
|
+
display_name: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
image: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
is_available: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true,
|
|
26
|
+
},
|
|
27
|
+
is_default: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{ timestamps: true },
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default model<ISandboxImage>("SandboxImage", sandboxImageSchema);
|
package/sandbox.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { ISandbox } from "./types/sandbox";
|
|
3
|
+
import { SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "./enum";
|
|
4
|
+
|
|
5
|
+
const sandboxSchema: Schema = new Schema({
|
|
6
|
+
user_id: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
ref: "User",
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
team: {
|
|
12
|
+
type: Schema.Types.ObjectId,
|
|
13
|
+
ref: "Team",
|
|
14
|
+
default: null,
|
|
15
|
+
},
|
|
16
|
+
project_environment: {
|
|
17
|
+
type: Schema.Types.ObjectId,
|
|
18
|
+
ref: "ProjectEnvironment",
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
template: {
|
|
22
|
+
type: String,
|
|
23
|
+
enum: Object.values(SANDBOX_TEMPLATE),
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
status: {
|
|
27
|
+
type: String,
|
|
28
|
+
enum: Object.values(SANDBOX_STATUS),
|
|
29
|
+
required: true,
|
|
30
|
+
default: SANDBOX_STATUS.STARTING,
|
|
31
|
+
},
|
|
32
|
+
nomad_job_id: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
nomad_alloc_id: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: null,
|
|
39
|
+
},
|
|
40
|
+
host: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: null,
|
|
43
|
+
},
|
|
44
|
+
port: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
agent_token_hash: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: null,
|
|
51
|
+
},
|
|
52
|
+
region: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
specs: {
|
|
57
|
+
cpu: { type: Number, default: 2000 },
|
|
58
|
+
memory: { type: Number, default: 2048 },
|
|
59
|
+
disk: { type: Number, default: 5 },
|
|
60
|
+
},
|
|
61
|
+
created_at: {
|
|
62
|
+
type: Date,
|
|
63
|
+
default: Date.now,
|
|
64
|
+
},
|
|
65
|
+
last_activity_at: {
|
|
66
|
+
type: Date,
|
|
67
|
+
default: Date.now,
|
|
68
|
+
},
|
|
69
|
+
expires_at: {
|
|
70
|
+
type: Date,
|
|
71
|
+
required: true,
|
|
72
|
+
},
|
|
73
|
+
destroyed_at: {
|
|
74
|
+
type: Date,
|
|
75
|
+
default: null,
|
|
76
|
+
},
|
|
77
|
+
destroy_reason: {
|
|
78
|
+
type: String,
|
|
79
|
+
enum: Object.values(SANDBOX_DESTROY_REASON),
|
|
80
|
+
default: null,
|
|
81
|
+
},
|
|
82
|
+
isDeleted: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
sandboxSchema.index({ user_id: 1, status: 1, isDeleted: 1 });
|
|
89
|
+
sandboxSchema.index({ expires_at: 1 });
|
|
90
|
+
sandboxSchema.index({ last_activity_at: 1, status: 1 });
|
|
91
|
+
|
|
92
|
+
export default model<ISandbox>("Sandbox", sandboxSchema);
|
package/types/index.ts
CHANGED
|
@@ -54,3 +54,5 @@ export type { IProjectEnvironment } from "./project-environment";
|
|
|
54
54
|
export type { IEnvironmentVariable } from "./environment-variable";
|
|
55
55
|
export type { IActivityLog } from "./activity-log";
|
|
56
56
|
export type { IOwnershipTransfer } from "./ownership-transfer";
|
|
57
|
+
export type { ISandbox, ISandboxSpecs } from "./sandbox";
|
|
58
|
+
export type { ISandboxImage } from "./sandbox-image";
|
package/types/sandbox.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { IUser } from "./user";
|
|
3
|
+
import { ITeam } from "./team";
|
|
4
|
+
import { IProjectEnvironment } from "./project-environment";
|
|
5
|
+
import { SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "../enum";
|
|
6
|
+
|
|
7
|
+
export interface ISandboxSpecs {
|
|
8
|
+
cpu: number;
|
|
9
|
+
memory: number;
|
|
10
|
+
disk: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ISandbox extends Document {
|
|
14
|
+
user_id: IUser | Types.ObjectId;
|
|
15
|
+
team: ITeam | Types.ObjectId | null;
|
|
16
|
+
project_environment: IProjectEnvironment | Types.ObjectId | null;
|
|
17
|
+
template: SANDBOX_TEMPLATE;
|
|
18
|
+
status: SANDBOX_STATUS;
|
|
19
|
+
nomad_job_id: string;
|
|
20
|
+
nomad_alloc_id: string | null;
|
|
21
|
+
host: string | null;
|
|
22
|
+
port: number | null;
|
|
23
|
+
agent_token_hash: string | null;
|
|
24
|
+
region: string;
|
|
25
|
+
specs: ISandboxSpecs;
|
|
26
|
+
created_at: Date;
|
|
27
|
+
last_activity_at: Date;
|
|
28
|
+
expires_at: Date;
|
|
29
|
+
destroyed_at: Date | null;
|
|
30
|
+
destroy_reason: SANDBOX_DESTROY_REASON | null;
|
|
31
|
+
isDeleted: boolean;
|
|
32
|
+
}
|