@brimble/models 3.8.65 → 3.8.66

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.
@@ -183,10 +183,6 @@ export declare enum NomadDeploymentStatus {
183
183
  NOMAD_READY = "nomad_ready",
184
184
  NOMAD_FAILED = "nomad_failed"
185
185
  }
186
- export declare enum BRANCH_TYPE {
187
- USER_CREATED = "USER_CREATED",
188
- PREVIEW = "PREVIEW"
189
- }
190
186
  export declare enum COLLAB_ANNOTATION_STATUS {
191
187
  OPEN = "open",
192
188
  RESOLVED = "resolved"
@@ -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.BRANCH_TYPE = 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.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";
@@ -215,11 +215,6 @@ var NomadDeploymentStatus;
215
215
  NomadDeploymentStatus["NOMAD_READY"] = "nomad_ready";
216
216
  NomadDeploymentStatus["NOMAD_FAILED"] = "nomad_failed";
217
217
  })(NomadDeploymentStatus = exports.NomadDeploymentStatus || (exports.NomadDeploymentStatus = {}));
218
- var BRANCH_TYPE;
219
- (function (BRANCH_TYPE) {
220
- BRANCH_TYPE["USER_CREATED"] = "USER_CREATED";
221
- BRANCH_TYPE["PREVIEW"] = "PREVIEW";
222
- })(BRANCH_TYPE = exports.BRANCH_TYPE || (exports.BRANCH_TYPE = {}));
223
218
  var COLLAB_ANNOTATION_STATUS;
224
219
  (function (COLLAB_ANNOTATION_STATUS) {
225
220
  COLLAB_ANNOTATION_STATUS["OPEN"] = "open";
package/dist/env.js CHANGED
@@ -25,14 +25,6 @@ const envSchema = new mongoose_1.Schema({
25
25
  default: enum_1.ENVIRONMENT.PRODUCTION,
26
26
  required: true,
27
27
  },
28
- branch: {
29
- ref: "Branch",
30
- type: mongoose_1.Schema.Types.ObjectId,
31
- },
32
- inheritable: {
33
- type: Boolean,
34
- default: true,
35
- },
36
28
  is_system: {
37
29
  type: Boolean,
38
30
  default: false,
@@ -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 { IEnvironmentVariable } from "./types";
27
+ declare const _default: import("mongoose").Model<IEnvironmentVariable, {}, {}, {}, import("mongoose").Document<unknown, {}, IEnvironmentVariable> & IEnvironmentVariable & {
28
+ _id: import("mongoose").Types.ObjectId;
29
+ }, any>;
30
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const environmentVariableSchema = new mongoose_1.Schema({
5
+ name: { type: String, required: true },
6
+ value: { type: String, required: true },
7
+ project_environment: {
8
+ ref: "ProjectEnvironment",
9
+ type: mongoose_1.Schema.Types.ObjectId,
10
+ required: true,
11
+ },
12
+ user: { ref: "User", type: mongoose_1.Schema.Types.ObjectId, required: true },
13
+ inheritable: { type: Boolean, default: true },
14
+ }, { timestamps: true });
15
+ environmentVariableSchema.index({ name: 1, project_environment: 1 }, { unique: true });
16
+ exports.default = (0, mongoose_1.model)("EnvironmentVariable", environmentVariableSchema);
package/dist/index.d.ts CHANGED
@@ -36,7 +36,6 @@ export { default as WebhookEvent } from "./webhook-event";
36
36
  export { default as WebhookSetting } from "./webhook-setting";
37
37
  export { default as Intention } from "./intention";
38
38
  export { default as Provider } from "./provider";
39
- export { default as Branch } from "./branch";
40
39
  export { default as CollabAnnotation } from "./collab-annotation";
41
40
  export { default as CollabComment } from "./collab-comment";
42
41
  export { default as CollabIntegration } from "./collab-integration";
@@ -49,8 +48,10 @@ export { default as Tag } from "./tag";
49
48
  export { default as ProjectTagAssignment } from "./project-tag-assignment";
50
49
  export { default as CashierSubscription } from "./cashier_subscription";
51
50
  export { default as CashierSubscriptionItem } from "./cashier_subscription_item";
52
- export { IUser, IGit, IProject, 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, IBranch, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, } from "./types";
53
- 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, BRANCH_TYPE, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE } from "./enum";
51
+ export { default as ProjectEnvironment } from "./project-environment";
52
+ export { default as EnvironmentVariable } from "./environment-variable";
53
+ export { IUser, IGit, IProject, 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, } from "./types";
54
+ 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 } from "./enum";
54
55
  import mongoose from "mongoose";
55
56
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
56
57
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -12,8 +12,8 @@ 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.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Branch = 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.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.BRANCH_TYPE = 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.CashierSubscriptionItem = exports.CashierSubscription = void 0;
15
+ exports.CashierSubscription = 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.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.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = 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");
@@ -91,8 +91,6 @@ var intention_1 = require("./intention");
91
91
  Object.defineProperty(exports, "Intention", { enumerable: true, get: function () { return __importDefault(intention_1).default; } });
92
92
  var provider_1 = require("./provider");
93
93
  Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return __importDefault(provider_1).default; } });
94
- var branch_1 = require("./branch");
95
- Object.defineProperty(exports, "Branch", { enumerable: true, get: function () { return __importDefault(branch_1).default; } });
96
94
  var collab_annotation_1 = require("./collab-annotation");
97
95
  Object.defineProperty(exports, "CollabAnnotation", { enumerable: true, get: function () { return __importDefault(collab_annotation_1).default; } });
98
96
  var collab_comment_1 = require("./collab-comment");
@@ -117,6 +115,10 @@ var cashier_subscription_1 = require("./cashier_subscription");
117
115
  Object.defineProperty(exports, "CashierSubscription", { enumerable: true, get: function () { return __importDefault(cashier_subscription_1).default; } });
118
116
  var cashier_subscription_item_1 = require("./cashier_subscription_item");
119
117
  Object.defineProperty(exports, "CashierSubscriptionItem", { enumerable: true, get: function () { return __importDefault(cashier_subscription_item_1).default; } });
118
+ var project_environment_1 = require("./project-environment");
119
+ Object.defineProperty(exports, "ProjectEnvironment", { enumerable: true, get: function () { return __importDefault(project_environment_1).default; } });
120
+ var environment_variable_1 = require("./environment-variable");
121
+ Object.defineProperty(exports, "EnvironmentVariable", { enumerable: true, get: function () { return __importDefault(environment_variable_1).default; } });
120
122
  var enum_1 = require("./enum");
121
123
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
122
124
  Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
@@ -145,7 +147,6 @@ Object.defineProperty(exports, "DomainTransferProvider", { enumerable: true, get
145
147
  Object.defineProperty(exports, "DomainTransferDirection", { enumerable: true, get: function () { return enum_1.DomainTransferDirection; } });
146
148
  Object.defineProperty(exports, "DomainTransferStatus", { enumerable: true, get: function () { return enum_1.DomainTransferStatus; } });
147
149
  Object.defineProperty(exports, "NomadDeploymentStatus", { enumerable: true, get: function () { return enum_1.NomadDeploymentStatus; } });
148
- Object.defineProperty(exports, "BRANCH_TYPE", { enumerable: true, get: function () { return enum_1.BRANCH_TYPE; } });
149
150
  Object.defineProperty(exports, "COLLAB_ANNOTATION_STATUS", { enumerable: true, get: function () { return enum_1.COLLAB_ANNOTATION_STATUS; } });
150
151
  Object.defineProperty(exports, "COLLAB_INTEGRATION_TYPE", { enumerable: true, get: function () { return enum_1.COLLAB_INTEGRATION_TYPE; } });
151
152
  Object.defineProperty(exports, "COLLAB_THEME", { enumerable: true, get: function () { return enum_1.COLLAB_THEME; } });
@@ -131,12 +131,15 @@ const projectSchema = new mongoose_1.Schema({
131
131
  type: mongoose_1.Schema.Types.ObjectId,
132
132
  },
133
133
  ],
134
- branches: [
135
- {
136
- ref: "Branch",
137
- type: mongoose_1.Schema.Types.ObjectId,
138
- },
139
- ],
134
+ project_environment: {
135
+ ref: "ProjectEnvironment",
136
+ type: mongoose_1.Schema.Types.ObjectId,
137
+ index: true,
138
+ },
139
+ inherit_environment_vars: {
140
+ type: Boolean,
141
+ default: true,
142
+ },
140
143
  replicas: {
141
144
  type: Number,
142
145
  default: 3,
@@ -23,8 +23,8 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
- import { IBranch } from "./types";
27
- declare const _default: import("mongoose").Model<IBranch, {}, {}, {}, import("mongoose").Document<unknown, {}, IBranch> & IBranch & {
26
+ import { IProjectEnvironment } from "./types";
27
+ declare const _default: import("mongoose").Model<IProjectEnvironment, {}, {}, {}, import("mongoose").Document<unknown, {}, IProjectEnvironment> & IProjectEnvironment & {
28
28
  _id: import("mongoose").Types.ObjectId;
29
29
  }, any>;
30
30
  export default _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const projectEnvironmentSchema = new mongoose_1.Schema({
5
+ name: { type: String, required: true },
6
+ slug: { type: String, required: true },
7
+ owner: { ref: "User", type: mongoose_1.Schema.Types.ObjectId, required: true },
8
+ team: { ref: "Team", type: mongoose_1.Schema.Types.ObjectId },
9
+ inherit_from: { ref: "ProjectEnvironment", type: mongoose_1.Schema.Types.ObjectId },
10
+ isDefault: { type: Boolean, default: false },
11
+ }, { timestamps: true });
12
+ projectEnvironmentSchema.index({ slug: 1, owner: 1, team: 1 }, { unique: true });
13
+ exports.default = (0, mongoose_1.model)("ProjectEnvironment", projectEnvironmentSchema);
@@ -1,6 +1,5 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ENVIRONMENT } from "../enum";
3
- import { IBranch } from "./branch";
4
3
  import { IProject, IUser } from "./";
5
4
  export interface IEnv extends Document {
6
5
  name: string;
@@ -8,8 +7,6 @@ export interface IEnv extends Document {
8
7
  project: IProject;
9
8
  user: IUser;
10
9
  environment: ENVIRONMENT | string;
11
- branch?: IBranch;
12
- inheritable?: boolean;
13
10
  is_system?: boolean;
14
11
  createdAt: Date;
15
12
  updatedAt: Date;
@@ -0,0 +1,12 @@
1
+ import { Document } from "mongoose";
2
+ import { IProjectEnvironment } from "./project-environment";
3
+ import { IUser } from "./user";
4
+ export interface IEnvironmentVariable extends Document {
5
+ name: string;
6
+ value: string;
7
+ project_environment: IProjectEnvironment;
8
+ user: IUser;
9
+ inheritable: boolean;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
@@ -1,5 +1,4 @@
1
1
  export type { IAutoScalingGroup } from "./auto-scaling-group";
2
- export type { IBranch } from "./branch";
3
2
  export type { ICard } from "./card";
4
3
  export type { IComputeChange } from "./compute";
5
4
  export type { IDbImage } from "./db-image";
@@ -50,3 +49,5 @@ export type { IInvoice } from "./invoice";
50
49
  export type { IProjectTagAssignment } from "./project-tag-assignment";
51
50
  export type { ITag } from "./tag";
52
51
  export type { ICashierSubscription, ICashierSubscriptionItem } from "./cashier_subscription";
52
+ export type { IProjectEnvironment } from "./project-environment";
53
+ export type { IEnvironmentVariable } from "./environment-variable";
@@ -6,10 +6,10 @@ import { ILog } from "../logs";
6
6
  import { ITeam } from "../team";
7
7
  import { IUser } from "../user";
8
8
  import { IServer } from "../server";
9
- import { IBranch } from "../branch";
10
9
  import { IPreview } from "./preview";
11
10
  import { IDbImage } from "../db-image";
12
11
  import { IAutoScalingGroup } from "../auto-scaling-group";
12
+ import { IProjectEnvironment } from "../project-environment";
13
13
  import { IRegion } from "../region";
14
14
  export interface IProject extends Document {
15
15
  name: string;
@@ -67,7 +67,8 @@ export interface IProject extends Document {
67
67
  tracking_token: string;
68
68
  from: string;
69
69
  previews: IPreview[];
70
- branches: IBranch[];
70
+ project_environment?: IProjectEnvironment;
71
+ inherit_environment_vars: boolean;
71
72
  replicas: number;
72
73
  vaultPath: string | null;
73
74
  vaultToken: string | null;
@@ -0,0 +1,13 @@
1
+ import { Document } from "mongoose";
2
+ import { ITeam } from "./team";
3
+ import { IUser } from "./user";
4
+ export interface IProjectEnvironment extends Document {
5
+ name: string;
6
+ slug: string;
7
+ owner: IUser;
8
+ team?: ITeam;
9
+ inherit_from?: IProjectEnvironment;
10
+ isDefault: boolean;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/enum/index.ts CHANGED
@@ -212,11 +212,6 @@ export enum NomadDeploymentStatus {
212
212
  NOMAD_FAILED = 'nomad_failed',
213
213
  }
214
214
 
215
- export enum BRANCH_TYPE {
216
- USER_CREATED = "USER_CREATED",
217
- PREVIEW = "PREVIEW",
218
- }
219
-
220
215
  export enum COLLAB_ANNOTATION_STATUS {
221
216
  OPEN = "open",
222
217
  RESOLVED = "resolved",
package/env.ts CHANGED
@@ -26,14 +26,6 @@ const envSchema = new Schema(
26
26
  default: ENVIRONMENT.PRODUCTION,
27
27
  required: true,
28
28
  },
29
- branch: {
30
- ref: "Branch",
31
- type: Schema.Types.ObjectId,
32
- },
33
- inheritable: {
34
- type: Boolean,
35
- default: true,
36
- },
37
29
  is_system: {
38
30
  type: Boolean,
39
31
  default: false,
@@ -0,0 +1,21 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { IEnvironmentVariable } from "./types";
3
+
4
+ const environmentVariableSchema = new Schema(
5
+ {
6
+ name: { type: String, required: true },
7
+ value: { type: String, required: true },
8
+ project_environment: {
9
+ ref: "ProjectEnvironment",
10
+ type: Schema.Types.ObjectId,
11
+ required: true,
12
+ },
13
+ user: { ref: "User", type: Schema.Types.ObjectId, required: true },
14
+ inheritable: { type: Boolean, default: true },
15
+ },
16
+ { timestamps: true },
17
+ );
18
+
19
+ environmentVariableSchema.index({ name: 1, project_environment: 1 }, { unique: true });
20
+
21
+ export default model<IEnvironmentVariable>("EnvironmentVariable", environmentVariableSchema);
package/index.ts CHANGED
@@ -36,7 +36,6 @@ export { default as WebhookEvent } from "./webhook-event";
36
36
  export { default as WebhookSetting } from "./webhook-setting";
37
37
  export { default as Intention } from "./intention";
38
38
  export { default as Provider } from "./provider";
39
- export { default as Branch } from "./branch";
40
39
  export { default as CollabAnnotation } from "./collab-annotation";
41
40
  export { default as CollabComment } from "./collab-comment";
42
41
  export { default as CollabIntegration } from "./collab-integration";
@@ -49,6 +48,8 @@ export { default as Tag } from "./tag";
49
48
  export { default as ProjectTagAssignment } from "./project-tag-assignment";
50
49
  export { default as CashierSubscription } from "./cashier_subscription";
51
50
  export { default as CashierSubscriptionItem } from "./cashier_subscription_item";
51
+ export { default as ProjectEnvironment } from "./project-environment";
52
+ export { default as EnvironmentVariable } from "./environment-variable";
52
53
 
53
54
  export {
54
55
  IUser,
@@ -92,7 +93,6 @@ export {
92
93
  IWebhookSetting,
93
94
  IIntention,
94
95
  IProvider,
95
- IBranch,
96
96
  ICollabAnnotation,
97
97
  ICollabComment,
98
98
  ICollabAttachment,
@@ -106,6 +106,8 @@ export {
106
106
  IProjectTagAssignment,
107
107
  ICashierSubscription,
108
108
  ICashierSubscriptionItem,
109
+ IProjectEnvironment,
110
+ IEnvironmentVariable,
109
111
  } from "./types";
110
112
  export {
111
113
  GIT_TYPE,
@@ -135,7 +137,6 @@ export {
135
137
  DomainTransferDirection,
136
138
  DomainTransferStatus,
137
139
  NomadDeploymentStatus,
138
- BRANCH_TYPE,
139
140
  COLLAB_ANNOTATION_STATUS,
140
141
  COLLAB_INTEGRATION_TYPE,
141
142
  COLLAB_THEME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.65",
3
+ "version": "3.8.66",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/project/index.ts CHANGED
@@ -131,12 +131,15 @@ const projectSchema = new Schema(
131
131
  type: Schema.Types.ObjectId,
132
132
  },
133
133
  ],
134
- branches: [
135
- {
136
- ref: "Branch",
137
- type: Schema.Types.ObjectId,
138
- },
139
- ],
134
+ project_environment: {
135
+ ref: "ProjectEnvironment",
136
+ type: Schema.Types.ObjectId,
137
+ index: true,
138
+ },
139
+ inherit_environment_vars: {
140
+ type: Boolean,
141
+ default: true,
142
+ },
140
143
  replicas: {
141
144
  type: Number,
142
145
  default: 3,
@@ -0,0 +1,18 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { IProjectEnvironment } from "./types";
3
+
4
+ const projectEnvironmentSchema = new Schema(
5
+ {
6
+ name: { type: String, required: true },
7
+ slug: { type: String, required: true },
8
+ owner: { ref: "User", type: Schema.Types.ObjectId, required: true },
9
+ team: { ref: "Team", type: Schema.Types.ObjectId },
10
+ inherit_from: { ref: "ProjectEnvironment", type: Schema.Types.ObjectId },
11
+ isDefault: { type: Boolean, default: false },
12
+ },
13
+ { timestamps: true },
14
+ );
15
+
16
+ projectEnvironmentSchema.index({ slug: 1, owner: 1, team: 1 }, { unique: true });
17
+
18
+ export default model<IProjectEnvironment>("ProjectEnvironment", projectEnvironmentSchema);
package/types/env.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ENVIRONMENT } from "../enum";
3
- import { IBranch } from "./branch";
4
3
  import { IProject, IUser } from "./";
5
4
 
6
5
  export interface IEnv extends Document {
@@ -9,8 +8,6 @@ export interface IEnv extends Document {
9
8
  project: IProject;
10
9
  user: IUser;
11
10
  environment: ENVIRONMENT | string;
12
- branch?: IBranch;
13
- inheritable?: boolean;
14
11
  is_system?: boolean;
15
12
  createdAt: Date;
16
13
  updatedAt: Date;
@@ -0,0 +1,13 @@
1
+ import { Document } from "mongoose";
2
+ import { IProjectEnvironment } from "./project-environment";
3
+ import { IUser } from "./user";
4
+
5
+ export interface IEnvironmentVariable extends Document {
6
+ name: string;
7
+ value: string;
8
+ project_environment: IProjectEnvironment;
9
+ user: IUser;
10
+ inheritable: boolean;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
package/types/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export type { IAutoScalingGroup } from "./auto-scaling-group";
2
- export type { IBranch } from "./branch";
3
2
  export type { ICard } from "./card";
4
3
  export type { IComputeChange } from "./compute";
5
4
  export type { IDbImage } from "./db-image";
@@ -50,3 +49,5 @@ export type { IInvoice } from "./invoice";
50
49
  export type { IProjectTagAssignment } from "./project-tag-assignment";
51
50
  export type { ITag } from "./tag";
52
51
  export type { ICashierSubscription, ICashierSubscriptionItem } from "./cashier_subscription";
52
+ export type { IProjectEnvironment } from "./project-environment";
53
+ export type { IEnvironmentVariable } from "./environment-variable";
@@ -6,10 +6,10 @@ import { ILog } from "../logs";
6
6
  import { ITeam } from "../team";
7
7
  import { IUser } from "../user";
8
8
  import { IServer } from "../server";
9
- import { IBranch } from "../branch";
10
9
  import { IPreview } from "./preview";
11
10
  import { IDbImage } from "../db-image";
12
11
  import { IAutoScalingGroup } from "../auto-scaling-group";
12
+ import { IProjectEnvironment } from "../project-environment";
13
13
  import { IRegion } from "../region";
14
14
 
15
15
  export interface IProject extends Document {
@@ -68,7 +68,8 @@ export interface IProject extends Document {
68
68
  tracking_token: string;
69
69
  from: string;
70
70
  previews: IPreview[];
71
- branches: IBranch[];
71
+ project_environment?: IProjectEnvironment;
72
+ inherit_environment_vars: boolean;
72
73
  replicas: number;
73
74
  vaultPath: string | null;
74
75
  vaultToken: string | null;
@@ -0,0 +1,14 @@
1
+ import { Document } from "mongoose";
2
+ import { ITeam } from "./team";
3
+ import { IUser } from "./user";
4
+
5
+ export interface IProjectEnvironment extends Document {
6
+ name: string;
7
+ slug: string;
8
+ owner: IUser;
9
+ team?: ITeam;
10
+ inherit_from?: IProjectEnvironment;
11
+ isDefault: boolean;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
package/branch.ts DELETED
@@ -1,22 +0,0 @@
1
- import { Schema, model } from "mongoose";
2
- import { IBranch } from "./types";
3
- import { BRANCH_TYPE } from "./enum";
4
-
5
- const branchSchema = new Schema(
6
- {
7
- name: { type: String, required: true },
8
- type: { type: String, enum: Object.values(BRANCH_TYPE), required: true },
9
- gitRef: { type: String, required: true },
10
- project: { ref: "Project", type: Schema.Types.ObjectId, required: true },
11
- inherit_from: { ref: "Branch", type: Schema.Types.ObjectId },
12
- ancestors: [{ ref: "Branch", type: Schema.Types.ObjectId }],
13
- created_by: { ref: "User", type: Schema.Types.ObjectId, required: true },
14
- issue_comment_id: Number,
15
- pr_number: Number,
16
- },
17
- { timestamps: true },
18
- );
19
-
20
- branchSchema.index({ project: 1, name: 1 }, { unique: true });
21
-
22
- export default model<IBranch>("Branch", branchSchema);
package/dist/branch.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const mongoose_1 = require("mongoose");
4
- const enum_1 = require("./enum");
5
- const branchSchema = new mongoose_1.Schema({
6
- name: { type: String, required: true },
7
- type: { type: String, enum: Object.values(enum_1.BRANCH_TYPE), required: true },
8
- gitRef: { type: String, required: true },
9
- project: { ref: "Project", type: mongoose_1.Schema.Types.ObjectId, required: true },
10
- inherit_from: { ref: "Branch", type: mongoose_1.Schema.Types.ObjectId },
11
- ancestors: [{ ref: "Branch", type: mongoose_1.Schema.Types.ObjectId }],
12
- created_by: { ref: "User", type: mongoose_1.Schema.Types.ObjectId, required: true },
13
- issue_comment_id: Number,
14
- pr_number: Number,
15
- }, { timestamps: true });
16
- branchSchema.index({ project: 1, name: 1 }, { unique: true });
17
- exports.default = (0, mongoose_1.model)("Branch", branchSchema);
@@ -1,17 +0,0 @@
1
- import { Document } from "mongoose";
2
- import { BRANCH_TYPE } from "../enum";
3
- import { IProject } from "./project";
4
- import { IUser } from "./user";
5
- export interface IBranch extends Document {
6
- name: string;
7
- type: BRANCH_TYPE;
8
- gitRef: string;
9
- project: IProject;
10
- inherit_from?: IBranch;
11
- ancestors: IBranch[];
12
- created_by: IUser;
13
- pr_number?: number;
14
- issue_comment_id?: number;
15
- createdAt: Date;
16
- updatedAt: Date;
17
- }
package/types/branch.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Document } from "mongoose";
2
- import { BRANCH_TYPE } from "../enum";
3
- import { IProject } from "./project";
4
- import { IUser } from "./user";
5
-
6
- export interface IBranch extends Document {
7
- name: string;
8
- type: BRANCH_TYPE;
9
- gitRef: string;
10
- project: IProject;
11
- inherit_from?: IBranch;
12
- ancestors: IBranch[];
13
- created_by: IUser;
14
- pr_number?: number;
15
- issue_comment_id?: number;
16
- createdAt: Date;
17
- updatedAt: Date;
18
- }