@brimble/models 2.4.76 → 2.4.78

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/auto-scaling.ts CHANGED
@@ -10,7 +10,7 @@ const autoScalingGroupSchema = new Schema(
10
10
  replicas: {
11
11
  type: Number,
12
12
  required: false,
13
- default: 1
13
+ default: 1,
14
14
  },
15
15
  user_id: {
16
16
  type: Schema.Types.ObjectId,
@@ -9,7 +9,7 @@ const autoScalingGroupSchema = new mongoose_1.Schema({
9
9
  replicas: {
10
10
  type: Number,
11
11
  required: false,
12
- default: 1
12
+ default: 1,
13
13
  },
14
14
  user_id: {
15
15
  type: mongoose_1.Schema.Types.ObjectId,
@@ -89,6 +89,12 @@ export declare enum PERMISSION_TYPE {
89
89
  INTEGRATION = "INTEGRATION",
90
90
  USERS = "USERS"
91
91
  }
92
+ export declare enum REGION_CONTINENT {
93
+ AFRICA = "Africa",
94
+ EUROPE = "Europe",
95
+ AMERICA = "America",
96
+ ASIA = "Asia"
97
+ }
92
98
  export declare enum ServiceType {
93
99
  Database = "database",
94
100
  WebService = "web-service",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = 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.GIT_TYPE = void 0;
3
+ 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.GIT_TYPE = void 0;
4
4
  var GIT_TYPE;
5
5
  (function (GIT_TYPE) {
6
6
  GIT_TYPE["GITHUB"] = "GITHUB";
@@ -106,6 +106,13 @@ var PERMISSION_TYPE;
106
106
  PERMISSION_TYPE["INTEGRATION"] = "INTEGRATION";
107
107
  PERMISSION_TYPE["USERS"] = "USERS";
108
108
  })(PERMISSION_TYPE = exports.PERMISSION_TYPE || (exports.PERMISSION_TYPE = {}));
109
+ var REGION_CONTINENT;
110
+ (function (REGION_CONTINENT) {
111
+ REGION_CONTINENT["AFRICA"] = "Africa";
112
+ REGION_CONTINENT["EUROPE"] = "Europe";
113
+ REGION_CONTINENT["AMERICA"] = "America";
114
+ REGION_CONTINENT["ASIA"] = "Asia";
115
+ })(REGION_CONTINENT = exports.REGION_CONTINENT || (exports.REGION_CONTINENT = {}));
109
116
  var ServiceType;
110
117
  (function (ServiceType) {
111
118
  ServiceType["Database"] = "database";
package/dist/env.js CHANGED
@@ -13,7 +13,7 @@ const envSchema = new mongoose_1.Schema({
13
13
  },
14
14
  value: {
15
15
  type: String,
16
- required: true,
16
+ required: false,
17
17
  },
18
18
  user: {
19
19
  type: mongoose_1.Schema.Types.ObjectId,
package/dist/index.d.ts CHANGED
@@ -23,8 +23,9 @@ export { default as Liscense } from "./license";
23
23
  export { default as PlanConfiguration } from "./plan_configuration";
24
24
  export { default as AutoScalingGroup } from "./auto-scaling";
25
25
  export { default as ComputeChange } from "./compute";
26
- export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, } from "./types";
27
- 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, } from "./enum";
26
+ export { default as Region } from "./region";
27
+ export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion } from "./types";
28
+ 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 } from "./enum";
28
29
  import mongoose from "mongoose";
29
30
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
30
31
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.closeMongo = exports.db = exports.connectToMongo = 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.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.Preview = exports.DeletedProject = exports.Project = exports.User = void 0;
15
+ exports.closeMongo = exports.db = exports.connectToMongo = 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.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.Preview = exports.DeletedProject = exports.Project = exports.User = void 0;
16
16
  var user_1 = require("./user");
17
17
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
18
18
  var project_1 = require("./project");
@@ -64,6 +64,8 @@ var auto_scaling_1 = require("./auto-scaling");
64
64
  Object.defineProperty(exports, "AutoScalingGroup", { enumerable: true, get: function () { return __importDefault(auto_scaling_1).default; } });
65
65
  var compute_1 = require("./compute");
66
66
  Object.defineProperty(exports, "ComputeChange", { enumerable: true, get: function () { return __importDefault(compute_1).default; } });
67
+ var region_1 = require("./region");
68
+ Object.defineProperty(exports, "Region", { enumerable: true, get: function () { return __importDefault(region_1).default; } });
67
69
  var enum_1 = require("./enum");
68
70
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
69
71
  Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
@@ -83,6 +85,7 @@ Object.defineProperty(exports, "ServiceType", { enumerable: true, get: function
83
85
  Object.defineProperty(exports, "DatabaseEngine", { enumerable: true, get: function () { return enum_1.DatabaseEngine; } });
84
86
  Object.defineProperty(exports, "JobStatus", { enumerable: true, get: function () { return enum_1.JobStatus; } });
85
87
  Object.defineProperty(exports, "LicenseStatus", { enumerable: true, get: function () { return enum_1.LicenseStatus; } });
88
+ Object.defineProperty(exports, "REGION_CONTINENT", { enumerable: true, get: function () { return enum_1.REGION_CONTINENT; } });
86
89
  const mongoose_1 = __importDefault(require("mongoose"));
87
90
  const utils_1 = require("@brimble/utils");
88
91
  const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -152,8 +152,8 @@ const projectSchema = new mongoose_1.Schema({
152
152
  },
153
153
  whiteListedIps: {
154
154
  type: Array,
155
- required: false
156
- }
155
+ required: false,
156
+ },
157
157
  }, { timestamps: true });
158
158
  exports.default = (0, mongoose_1.model)("Project", projectSchema);
159
159
  exports.DeletedProject = (0, mongoose_1.model)("DeletedProject", projectSchema);
@@ -0,0 +1,56 @@
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-delete/node_modules/mongoose/types/aggregate" />
26
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/callback" />
27
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/collection" />
28
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/connection" />
29
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/cursor" />
30
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/document" />
31
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/error" />
32
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/expressions" />
33
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/helpers" />
34
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/middlewares" />
35
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/indexes" />
36
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/models" />
37
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/mongooseoptions" />
38
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/pipelinestage" />
39
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/populate" />
40
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/query" />
41
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/schemaoptions" />
42
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/schematypes" />
43
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/session" />
44
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/types" />
45
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/utility" />
46
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/validation" />
47
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/virtuals" />
48
+ /// <reference types="mongoose-delete/node_modules/mongoose" />
49
+ /// <reference types="mongoose/types/inferschematype" />
50
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/inferschematype" />
51
+ /// <reference types="mongoose-delete/node_modules/mongoose/types/inferrawdoctype" />
52
+ import { IRegion } from "./types/region";
53
+ declare const _default: import("mongoose").Model<IRegion, {}, {}, {}, import("mongoose").Document<unknown, {}, IRegion> & IRegion & {
54
+ _id: import("mongoose").Types.ObjectId;
55
+ }, any>;
56
+ export default _default;
package/dist/region.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const regionSchema = new mongoose_1.Schema({
6
+ name: { type: String, required: true },
7
+ country: { type: String, required: true },
8
+ continent: { type: String, enum: Object.values(enum_1.REGION_CONTINENT) },
9
+ enabled: { type: Boolean, default: false, select: true },
10
+ });
11
+ exports.default = (0, mongoose_1.model)("Region", regionSchema, "regions");
package/dist/server.js CHANGED
@@ -44,7 +44,11 @@ const serverSchema = new mongoose_1.Schema({
44
44
  type: Boolean,
45
45
  default: true,
46
46
  },
47
- region: String,
47
+ region: {
48
+ type: mongoose_1.Schema.Types.ObjectId,
49
+ ref: "Region",
50
+ required: true,
51
+ },
48
52
  tag: String,
49
53
  specifications: {
50
54
  type: Object,
@@ -25,3 +25,4 @@ export { ILicense } from "./license";
25
25
  export { IPlanConfiguration } from "./plan_configuration";
26
26
  export { IAutoScalingGroup } from "./auto-scaling-group";
27
27
  export { IComputeChange } from "./compute";
28
+ export { IRegion } from "./region";
@@ -0,0 +1,7 @@
1
+ import { REGION_CONTINENT } from "../enum";
2
+ export interface IRegion extends Document {
3
+ name: string;
4
+ country: string;
5
+ continent?: REGION_CONTINENT;
6
+ enabled?: boolean;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
@@ -1,5 +1,6 @@
1
1
  import mongoose, { Document } from "mongoose";
2
2
  import { SERVER_STATUS } from "../enum";
3
+ import { IRegion } from "./region";
3
4
  export interface IServer extends Document {
4
5
  name: string;
5
6
  url: string;
@@ -14,7 +15,7 @@ export interface IServer extends Document {
14
15
  status: SERVER_STATUS;
15
16
  default: boolean;
16
17
  tag: string;
17
- region: string;
18
+ region: IRegion;
18
19
  webhook_url?: string;
19
20
  is_custom_provision: boolean;
20
21
  specifications: Record<any, any>;
package/enum/index.ts CHANGED
@@ -103,6 +103,13 @@ export enum PERMISSION_TYPE {
103
103
  USERS = "USERS",
104
104
  }
105
105
 
106
+ export enum REGION_CONTINENT {
107
+ AFRICA = "Africa",
108
+ EUROPE = "Europe",
109
+ AMERICA = "America",
110
+ ASIA = "Asia",
111
+ }
112
+
106
113
  export enum ServiceType {
107
114
  Database = "database",
108
115
  WebService = "web-service",
package/env.ts CHANGED
@@ -14,7 +14,7 @@ const envSchema = new Schema(
14
14
  },
15
15
  value: {
16
16
  type: String,
17
- required: true,
17
+ required: false,
18
18
  },
19
19
  user: {
20
20
  type: Schema.Types.ObjectId,
package/index.ts CHANGED
@@ -23,6 +23,7 @@ export { default as Liscense } from "./license";
23
23
  export { default as PlanConfiguration } from "./plan_configuration";
24
24
  export { default as AutoScalingGroup } from "./auto-scaling";
25
25
  export { default as ComputeChange } from "./compute";
26
+ export { default as Region } from "./region";
26
27
 
27
28
  export {
28
29
  IUser,
@@ -52,6 +53,7 @@ export {
52
53
  IPlanConfiguration,
53
54
  IAutoScalingGroup,
54
55
  IComputeChange,
56
+ IRegion
55
57
  } from "./types";
56
58
  export {
57
59
  GIT_TYPE,
@@ -72,6 +74,7 @@ export {
72
74
  DatabaseEngine,
73
75
  JobStatus,
74
76
  LicenseStatus,
77
+ REGION_CONTINENT
75
78
  } from "./enum";
76
79
 
77
80
  import mongoose from "mongoose";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "2.4.76",
3
+ "version": "2.4.78",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/project/index.ts CHANGED
@@ -152,8 +152,8 @@ const projectSchema = new Schema(
152
152
  },
153
153
  whiteListedIps: {
154
154
  type: Array,
155
- required: false
156
- }
155
+ required: false,
156
+ },
157
157
  },
158
158
  { timestamps: true },
159
159
  );
package/region.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { Schema, model } from "mongoose";
2
+ import { IRegion } from "./types/region";
3
+ import { REGION_CONTINENT } from "./enum";
4
+
5
+ const regionSchema = new Schema({
6
+ name: { type: String, required: true },
7
+ country: { type: String, required: true },
8
+ continent: { type: String, enum: Object.values(REGION_CONTINENT) },
9
+ enabled: { type: Boolean, default: false, select: true },
10
+ });
11
+
12
+ export default model<IRegion>("Region", regionSchema, "regions");
package/server.ts CHANGED
@@ -45,7 +45,11 @@ const serverSchema = new Schema(
45
45
  type: Boolean,
46
46
  default: true,
47
47
  },
48
- region: String,
48
+ region: {
49
+ type: Schema.Types.ObjectId,
50
+ ref: "Region",
51
+ required: true,
52
+ },
49
53
  tag: String,
50
54
  specifications: {
51
55
  type: Object,
package/types/index.ts CHANGED
@@ -24,4 +24,5 @@ export { IJob } from "./job";
24
24
  export { ILicense } from "./license";
25
25
  export { IPlanConfiguration } from "./plan_configuration";
26
26
  export { IAutoScalingGroup } from "./auto-scaling-group";
27
- export { IComputeChange } from "./compute";
27
+ export { IComputeChange } from "./compute";
28
+ export { IRegion } from "./region";
@@ -76,5 +76,5 @@ export interface IProject extends Document {
76
76
  replica_ready: boolean;
77
77
  autoscaling_group?: IAutoScalingGroup;
78
78
  isPaid: boolean;
79
- whiteListedIps?: string[];
79
+ whiteListedIps?: string[];
80
80
  }
@@ -0,0 +1,8 @@
1
+ import { REGION_CONTINENT } from "../enum";
2
+
3
+ export interface IRegion extends Document {
4
+ name: string;
5
+ country: string;
6
+ continent?: REGION_CONTINENT;
7
+ enabled?: boolean;
8
+ };
package/types/server.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import mongoose, { Document } from "mongoose";
2
2
  import { SERVER_STATUS } from "../enum";
3
+ import { IRegion } from "./region";
3
4
 
4
5
  export interface IServer extends Document {
5
6
  name: string;
@@ -28,7 +29,7 @@ export interface IServer extends Document {
28
29
 
29
30
  tag: string;
30
31
 
31
- region: string;
32
+ region: IRegion;
32
33
 
33
34
  webhook_url?: string;
34
35