@brimble/models 3.8.54 → 3.8.56

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.
@@ -0,0 +1,9 @@
1
+ import { IAlertEvent } from "./types";
2
+ declare const _default: import("mongoose").Model<IAlertEvent, {}, {}, {}, import("mongoose").Document<unknown, {}, IAlertEvent, {}, import("mongoose").DefaultSchemaOptions> & IAlertEvent & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IAlertEvent>;
9
+ export default _default;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const alertNotificationResultSchema = new mongoose_1.Schema({
6
+ channel_id: {
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ required: true,
9
+ },
10
+ channel_type: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ delivered: {
15
+ type: Boolean,
16
+ required: true,
17
+ },
18
+ error: {
19
+ type: String,
20
+ default: null,
21
+ },
22
+ }, { _id: false });
23
+ const alertEventSchema = new mongoose_1.Schema({
24
+ rule_id: {
25
+ type: mongoose_1.Schema.Types.ObjectId,
26
+ ref: "AlertRule",
27
+ required: true,
28
+ index: true,
29
+ },
30
+ user_id: {
31
+ type: mongoose_1.Schema.Types.ObjectId,
32
+ ref: "User",
33
+ required: true,
34
+ index: true,
35
+ },
36
+ project_id: {
37
+ type: mongoose_1.Schema.Types.ObjectId,
38
+ ref: "Project",
39
+ required: true,
40
+ index: true,
41
+ },
42
+ status: {
43
+ type: String,
44
+ enum: Object.values(enum_1.AlertEventStatus),
45
+ required: true,
46
+ },
47
+ value: {
48
+ type: Number,
49
+ required: true,
50
+ },
51
+ threshold: {
52
+ type: Number,
53
+ required: true,
54
+ },
55
+ metric: {
56
+ type: String,
57
+ enum: Object.values(enum_1.AlertMetric),
58
+ required: true,
59
+ },
60
+ fired_at: {
61
+ type: Date,
62
+ required: true,
63
+ },
64
+ resolved_at: {
65
+ type: Date,
66
+ default: null,
67
+ },
68
+ notification_results: {
69
+ type: [alertNotificationResultSchema],
70
+ default: [],
71
+ },
72
+ }, {
73
+ collection: "alert_events",
74
+ });
75
+ alertEventSchema.index({ project_id: 1, fired_at: -1 });
76
+ alertEventSchema.index({ rule_id: 1, fired_at: -1 });
77
+ alertEventSchema.index({ user_id: 1, fired_at: -1 });
78
+ exports.default = (0, mongoose_1.model)("AlertEvent", alertEventSchema);
@@ -0,0 +1,9 @@
1
+ import { IAlertRuleState } from "./types";
2
+ declare const _default: import("mongoose").Model<IAlertRuleState, {}, {}, {}, import("mongoose").Document<unknown, {}, IAlertRuleState, {}, import("mongoose").DefaultSchemaOptions> & IAlertRuleState & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IAlertRuleState>;
9
+ export default _default;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const alertRuleStateSchema = new mongoose_1.Schema({
6
+ rule_id: {
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ ref: "AlertRule",
9
+ required: true,
10
+ unique: true,
11
+ index: true,
12
+ },
13
+ state: {
14
+ type: String,
15
+ enum: Object.values(enum_1.AlertRuleState),
16
+ required: true,
17
+ default: enum_1.AlertRuleState.Ok,
18
+ index: true,
19
+ },
20
+ pending_since: {
21
+ type: Date,
22
+ default: null,
23
+ },
24
+ last_evaluated_at: {
25
+ type: Date,
26
+ required: true,
27
+ },
28
+ last_fired_at: {
29
+ type: Date,
30
+ default: null,
31
+ },
32
+ last_resolved_at: {
33
+ type: Date,
34
+ default: null,
35
+ },
36
+ last_value: {
37
+ type: Number,
38
+ default: null,
39
+ },
40
+ consecutive_errors: {
41
+ type: Number,
42
+ default: 0,
43
+ },
44
+ }, {
45
+ collection: "alert_rule_states",
46
+ });
47
+ alertRuleStateSchema.index({ last_evaluated_at: 1 });
48
+ alertRuleStateSchema.index({ state: 1 });
49
+ exports.default = (0, mongoose_1.model)("AlertRuleState", alertRuleStateSchema);
@@ -0,0 +1,9 @@
1
+ import { IAlertRule } from "./types";
2
+ declare const _default: import("mongoose").Model<IAlertRule, {}, {}, {}, import("mongoose").Document<unknown, {}, IAlertRule, {}, import("mongoose").DefaultSchemaOptions> & IAlertRule & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IAlertRule>;
9
+ export default _default;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const alertRuleSchema = new mongoose_1.Schema({
6
+ user_id: {
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ ref: "User",
9
+ required: true,
10
+ index: true,
11
+ },
12
+ team_id: {
13
+ type: mongoose_1.Schema.Types.ObjectId,
14
+ ref: "Team",
15
+ default: null,
16
+ index: true,
17
+ },
18
+ project_id: {
19
+ type: mongoose_1.Schema.Types.ObjectId,
20
+ ref: "Project",
21
+ required: true,
22
+ index: true,
23
+ },
24
+ name: {
25
+ type: String,
26
+ required: true,
27
+ },
28
+ metric: {
29
+ type: String,
30
+ enum: Object.values(enum_1.AlertMetric),
31
+ required: true,
32
+ },
33
+ condition: {
34
+ type: String,
35
+ enum: Object.values(enum_1.AlertCondition),
36
+ required: true,
37
+ },
38
+ threshold: {
39
+ type: Number,
40
+ required: true,
41
+ },
42
+ duration_seconds: {
43
+ type: Number,
44
+ required: true,
45
+ },
46
+ cooldown_seconds: {
47
+ type: Number,
48
+ required: true,
49
+ },
50
+ channel_mode: {
51
+ type: String,
52
+ enum: Object.values(enum_1.AlertChannelMode),
53
+ required: true,
54
+ },
55
+ channel_ids: [
56
+ {
57
+ type: mongoose_1.Schema.Types.ObjectId,
58
+ ref: "NotificationChannel",
59
+ },
60
+ ],
61
+ enabled: {
62
+ type: Boolean,
63
+ default: true,
64
+ index: true,
65
+ },
66
+ }, {
67
+ timestamps: {
68
+ createdAt: "created_at",
69
+ updatedAt: "updated_at",
70
+ },
71
+ collection: "alert_rules",
72
+ });
73
+ alertRuleSchema.index({ project_id: 1, enabled: 1 });
74
+ alertRuleSchema.index({ user_id: 1, enabled: 1 });
75
+ alertRuleSchema.index({ team_id: 1, enabled: 1 });
76
+ alertRuleSchema.index({ project_id: 1, created_at: -1 });
77
+ exports.default = (0, mongoose_1.model)("AlertRule", alertRuleSchema);
package/dist/db-image.js CHANGED
@@ -40,6 +40,20 @@ const dbImageSchema = new mongoose_1.Schema({
40
40
  type: Number,
41
41
  required: true,
42
42
  },
43
+ ha: {
44
+ type: Boolean,
45
+ required: false,
46
+ default: false
47
+ },
48
+ workbench: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ workbench_mode: {
53
+ type: String,
54
+ enum: Object.values(enum_1.WorkbenchMode),
55
+ required: false,
56
+ },
43
57
  volumePath: {
44
58
  type: String,
45
59
  required: true,
@@ -64,6 +64,30 @@ export declare enum PROJECT_STATUS {
64
64
  NOMAD_READY = "NOMAD_READY",
65
65
  NOMAD_FAILED = "NOMAD_FAILED"
66
66
  }
67
+ export declare enum AlertMetric {
68
+ CpuUsagePercent = "cpu_usage_percent",
69
+ MemoryUsagePercent = "memory_usage_percent",
70
+ DiskUsagePercent = "disk_usage_percent",
71
+ ContainerRestarts = "container_restarts",
72
+ ResponseTimeP95Ms = "response_time_p95_ms"
73
+ }
74
+ export declare enum AlertCondition {
75
+ Above = "above",
76
+ Below = "below"
77
+ }
78
+ export declare enum AlertRuleState {
79
+ Ok = "ok",
80
+ Pending = "pending",
81
+ Firing = "firing"
82
+ }
83
+ export declare enum AlertChannelMode {
84
+ AllChannels = "all_channels",
85
+ SpecificChannels = "specific_channels"
86
+ }
87
+ export declare enum AlertEventStatus {
88
+ Firing = "firing",
89
+ Resolved = "resolved"
90
+ }
67
91
  export declare enum SUBSCRIPTION_STATUS {
68
92
  ACTIVE = "active",
69
93
  INACTIVE = "in-active"
@@ -352,5 +376,10 @@ export declare enum QuestRequirementType {
352
376
  DeploymentAgeMinutes = "deployment_age_minutes",
353
377
  RewardCooldownDays = "reward_cooldown_days"
354
378
  }
379
+ export declare enum WorkbenchMode {
380
+ SQL = "sql",
381
+ Kv = "kv",
382
+ Document = "document"
383
+ }
355
384
  export declare const QUEST_CLAIM_REQUIREMENTS: QuestRequirementType[];
356
385
  export declare const QUEST_TARGETLESS_REQUIREMENTS: QuestRequirementType[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = 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
- exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = void 0;
3
+ exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = 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.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = 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
+ exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.WorkbenchMode = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = void 0;
5
5
  var GIT_TYPE;
6
6
  (function (GIT_TYPE) {
7
7
  GIT_TYPE["GITHUB"] = "GITHUB";
@@ -77,6 +77,35 @@ var PROJECT_STATUS;
77
77
  PROJECT_STATUS["NOMAD_READY"] = "NOMAD_READY";
78
78
  PROJECT_STATUS["NOMAD_FAILED"] = "NOMAD_FAILED";
79
79
  })(PROJECT_STATUS || (exports.PROJECT_STATUS = PROJECT_STATUS = {}));
80
+ var AlertMetric;
81
+ (function (AlertMetric) {
82
+ AlertMetric["CpuUsagePercent"] = "cpu_usage_percent";
83
+ AlertMetric["MemoryUsagePercent"] = "memory_usage_percent";
84
+ AlertMetric["DiskUsagePercent"] = "disk_usage_percent";
85
+ AlertMetric["ContainerRestarts"] = "container_restarts";
86
+ AlertMetric["ResponseTimeP95Ms"] = "response_time_p95_ms";
87
+ })(AlertMetric || (exports.AlertMetric = AlertMetric = {}));
88
+ var AlertCondition;
89
+ (function (AlertCondition) {
90
+ AlertCondition["Above"] = "above";
91
+ AlertCondition["Below"] = "below";
92
+ })(AlertCondition || (exports.AlertCondition = AlertCondition = {}));
93
+ var AlertRuleState;
94
+ (function (AlertRuleState) {
95
+ AlertRuleState["Ok"] = "ok";
96
+ AlertRuleState["Pending"] = "pending";
97
+ AlertRuleState["Firing"] = "firing";
98
+ })(AlertRuleState || (exports.AlertRuleState = AlertRuleState = {}));
99
+ var AlertChannelMode;
100
+ (function (AlertChannelMode) {
101
+ AlertChannelMode["AllChannels"] = "all_channels";
102
+ AlertChannelMode["SpecificChannels"] = "specific_channels";
103
+ })(AlertChannelMode || (exports.AlertChannelMode = AlertChannelMode = {}));
104
+ var AlertEventStatus;
105
+ (function (AlertEventStatus) {
106
+ AlertEventStatus["Firing"] = "firing";
107
+ AlertEventStatus["Resolved"] = "resolved";
108
+ })(AlertEventStatus || (exports.AlertEventStatus = AlertEventStatus = {}));
80
109
  var SUBSCRIPTION_STATUS;
81
110
  (function (SUBSCRIPTION_STATUS) {
82
111
  SUBSCRIPTION_STATUS["ACTIVE"] = "active";
@@ -428,6 +457,12 @@ var QuestRequirementType;
428
457
  QuestRequirementType["DeploymentAgeMinutes"] = "deployment_age_minutes";
429
458
  QuestRequirementType["RewardCooldownDays"] = "reward_cooldown_days";
430
459
  })(QuestRequirementType || (exports.QuestRequirementType = QuestRequirementType = {}));
460
+ var WorkbenchMode;
461
+ (function (WorkbenchMode) {
462
+ WorkbenchMode["SQL"] = "sql";
463
+ WorkbenchMode["Kv"] = "kv";
464
+ WorkbenchMode["Document"] = "document";
465
+ })(WorkbenchMode || (exports.WorkbenchMode = WorkbenchMode = {}));
431
466
  exports.QUEST_CLAIM_REQUIREMENTS = [
432
467
  QuestRequirementType.RewardCooldownDays,
433
468
  ];
package/dist/index.d.ts CHANGED
@@ -54,6 +54,9 @@ export { default as CashierSubscriptionItem } from "./cashier_subscription_item"
54
54
  export { default as ProjectEnvironment } from "./project-environment";
55
55
  export { default as EnvironmentVariable } from "./environment-variable";
56
56
  export { default as ActivityLog } from "./activity-log";
57
+ export { default as AlertRule } from "./alert-rule";
58
+ export { default as AlertRuleStateModel } from "./alert-rule-state";
59
+ export { default as AlertEvent } from "./alert-event";
57
60
  export { default as OwnershipTransfer } from "./ownership-transfer";
58
61
  export { default as Sandbox } from "./sandbox";
59
62
  export { default as SandboxActivity } from "./sandbox-activity";
@@ -72,8 +75,8 @@ export { default as StreakMilestone } from "./streak-milestone";
72
75
  export { default as QuestCampaign } from "./quest-campaign";
73
76
  export { default as QuestParticipation } from "./quest-participation";
74
77
  export { default as QuestRewardIssuance } from "./quest-reward-issuance";
75
- export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IProjectNetworkSettings, IRatelimit, RatelimitConfig, RateLimitZone, RateLimitMatcher, DistributedRateLimitConfig, 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, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, IIdempotencyRecord, IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition, IStreak, IStreakMilestoneRef, IStreakEvent, IStreakDay, IStreakMilestone, IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward, IQuestParticipation, IQuestCriterionProgress, IQuestRewardIssuance, IQuestIssuedReward, } from "./types";
76
- 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, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, StorageCredentialRole, StorageCredentialStatus, StorageMigrationStatus, XFrameOptions, XContentTypeOptions, XRobotsTag, QualifyingActionType, MilestoneType, QUEST_COUNTABLE_MILESTONES, ACTION_TO_MILESTONE, EligibilityType, RewardType, QuestRewardStatus, QuestCriterionType, QuestEntity, QuestRequirementType, QUEST_CLAIM_REQUIREMENTS, QUEST_TARGETLESS_REQUIREMENTS, } from "./enum";
78
+ export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IProjectNetworkSettings, IRatelimit, RatelimitConfig, RateLimitZone, RateLimitMatcher, DistributedRateLimitConfig, 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, IAlertRule, IAlertRuleState, IAlertEvent, IAlertNotificationResult, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, IIdempotencyRecord, IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition, IStreak, IStreakMilestoneRef, IStreakEvent, IStreakDay, IStreakMilestone, IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward, IQuestParticipation, IQuestCriterionProgress, IQuestRewardIssuance, IQuestIssuedReward, } from "./types";
79
+ export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, AlertMetric, AlertCondition, AlertRuleState, AlertChannelMode, AlertEventStatus, 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, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, StorageCredentialRole, StorageCredentialStatus, StorageMigrationStatus, XFrameOptions, XContentTypeOptions, XRobotsTag, QualifyingActionType, MilestoneType, QUEST_COUNTABLE_MILESTONES, ACTION_TO_MILESTONE, EligibilityType, RewardType, QuestRewardStatus, QuestCriterionType, QuestEntity, QuestRequirementType, QUEST_CLAIM_REQUIREMENTS, QUEST_TARGETLESS_REQUIREMENTS, WorkbenchMode } from "./enum";
77
80
  import mongoose from "mongoose";
78
81
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
79
82
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -13,8 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  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.Ratelimit = exports.ProjectNetworkSettings = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
16
- 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.QuestRewardIssuance = exports.QuestParticipation = exports.QuestCampaign = exports.StreakMilestone = exports.StreakDay = exports.StreakEvent = exports.Streak = exports.StorageMigration = exports.StorageCredential = exports.StorageToken = exports.StorageUpload = exports.StorageObject = exports.StorageBucket = exports.IdempotencyRecord = exports.ObjectStorageUsageSegment = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = void 0;
17
- exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = 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 = void 0;
16
+ exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = 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.QuestRewardIssuance = exports.QuestParticipation = exports.QuestCampaign = exports.StreakMilestone = exports.StreakDay = exports.StreakEvent = exports.Streak = exports.StorageMigration = exports.StorageCredential = exports.StorageToken = exports.StorageUpload = exports.StorageObject = exports.StorageBucket = exports.IdempotencyRecord = exports.ObjectStorageUsageSegment = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.AlertEvent = exports.AlertRuleStateModel = exports.AlertRule = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = void 0;
17
+ exports.db = exports.connectToMongo = exports.WorkbenchMode = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = 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 = void 0;
18
+ exports.healthCheckMongo = exports.closeMongo = void 0;
18
19
  var user_1 = require("./user");
19
20
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
20
21
  var project_1 = require("./project");
@@ -128,6 +129,12 @@ var environment_variable_1 = require("./environment-variable");
128
129
  Object.defineProperty(exports, "EnvironmentVariable", { enumerable: true, get: function () { return __importDefault(environment_variable_1).default; } });
129
130
  var activity_log_1 = require("./activity-log");
130
131
  Object.defineProperty(exports, "ActivityLog", { enumerable: true, get: function () { return __importDefault(activity_log_1).default; } });
132
+ var alert_rule_1 = require("./alert-rule");
133
+ Object.defineProperty(exports, "AlertRule", { enumerable: true, get: function () { return __importDefault(alert_rule_1).default; } });
134
+ var alert_rule_state_1 = require("./alert-rule-state");
135
+ Object.defineProperty(exports, "AlertRuleStateModel", { enumerable: true, get: function () { return __importDefault(alert_rule_state_1).default; } });
136
+ var alert_event_1 = require("./alert-event");
137
+ Object.defineProperty(exports, "AlertEvent", { enumerable: true, get: function () { return __importDefault(alert_event_1).default; } });
131
138
  var ownership_transfer_1 = require("./ownership-transfer");
132
139
  Object.defineProperty(exports, "OwnershipTransfer", { enumerable: true, get: function () { return __importDefault(ownership_transfer_1).default; } });
133
140
  var sandbox_1 = require("./sandbox");
@@ -179,6 +186,11 @@ Object.defineProperty(exports, "SERVER_STATUS", { enumerable: true, get: functio
179
186
  Object.defineProperty(exports, "ROLES", { enumerable: true, get: function () { return enum_1.ROLES; } });
180
187
  Object.defineProperty(exports, "SUBSCRIPTION_PLAN_TYPE", { enumerable: true, get: function () { return enum_1.SUBSCRIPTION_PLAN_TYPE; } });
181
188
  Object.defineProperty(exports, "PROJECT_STATUS", { enumerable: true, get: function () { return enum_1.PROJECT_STATUS; } });
189
+ Object.defineProperty(exports, "AlertMetric", { enumerable: true, get: function () { return enum_1.AlertMetric; } });
190
+ Object.defineProperty(exports, "AlertCondition", { enumerable: true, get: function () { return enum_1.AlertCondition; } });
191
+ Object.defineProperty(exports, "AlertRuleState", { enumerable: true, get: function () { return enum_1.AlertRuleState; } });
192
+ Object.defineProperty(exports, "AlertChannelMode", { enumerable: true, get: function () { return enum_1.AlertChannelMode; } });
193
+ Object.defineProperty(exports, "AlertEventStatus", { enumerable: true, get: function () { return enum_1.AlertEventStatus; } });
182
194
  Object.defineProperty(exports, "SUBSCRIPTION_STATUS", { enumerable: true, get: function () { return enum_1.SUBSCRIPTION_STATUS; } });
183
195
  Object.defineProperty(exports, "CARD_TYPES", { enumerable: true, get: function () { return enum_1.CARD_TYPES; } });
184
196
  Object.defineProperty(exports, "DNS_TYPE", { enumerable: true, get: function () { return enum_1.DNS_TYPE; } });
@@ -229,6 +241,7 @@ Object.defineProperty(exports, "QuestEntity", { enumerable: true, get: function
229
241
  Object.defineProperty(exports, "QuestRequirementType", { enumerable: true, get: function () { return enum_1.QuestRequirementType; } });
230
242
  Object.defineProperty(exports, "QUEST_CLAIM_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_CLAIM_REQUIREMENTS; } });
231
243
  Object.defineProperty(exports, "QUEST_TARGETLESS_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_TARGETLESS_REQUIREMENTS; } });
244
+ Object.defineProperty(exports, "WorkbenchMode", { enumerable: true, get: function () { return enum_1.WorkbenchMode; } });
232
245
  const mongoose_1 = __importDefault(require("mongoose"));
233
246
  const utils_1 = require("@brimble/utils");
234
247
  const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -31,6 +31,14 @@ const projectSchema = new mongoose_1.Schema({
31
31
  type: Boolean,
32
32
  default: true,
33
33
  },
34
+ alerting_enabled: {
35
+ type: Boolean,
36
+ default: true,
37
+ },
38
+ workBenchEnabled: {
39
+ type: Boolean,
40
+ default: false
41
+ },
34
42
  domains: [
35
43
  {
36
44
  ref: "Domain",
@@ -0,0 +1,23 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { AlertEventStatus, AlertMetric } from "../enum";
3
+ import { IAlertRule } from "./alert-rule";
4
+ import { IProject } from "./project";
5
+ import { IUser } from "./user";
6
+ export interface IAlertNotificationResult {
7
+ channel_id: Types.ObjectId;
8
+ channel_type: string;
9
+ delivered: boolean;
10
+ error: string | null;
11
+ }
12
+ export interface IAlertEvent extends Document {
13
+ rule_id: IAlertRule | Types.ObjectId;
14
+ user_id: IUser | Types.ObjectId;
15
+ project_id: IProject | Types.ObjectId;
16
+ status: AlertEventStatus;
17
+ value: number;
18
+ threshold: number;
19
+ metric: AlertMetric;
20
+ fired_at: Date;
21
+ resolved_at: Date | null;
22
+ notification_results: IAlertNotificationResult[];
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { AlertRuleState } from "../enum";
3
+ import { IAlertRule } from "./alert-rule";
4
+ export interface IAlertRuleState extends Document {
5
+ rule_id: IAlertRule | Types.ObjectId;
6
+ state: AlertRuleState;
7
+ pending_since: Date | null;
8
+ last_evaluated_at: Date;
9
+ last_fired_at: Date | null;
10
+ last_resolved_at: Date | null;
11
+ last_value: number | null;
12
+ consecutive_errors: number;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { AlertChannelMode, AlertCondition, AlertMetric } from "../enum";
3
+ import { IProject } from "./project";
4
+ import { ITeam } from "./team";
5
+ import { IUser } from "./user";
6
+ export interface IAlertRule extends Document {
7
+ user_id: IUser | Types.ObjectId;
8
+ team_id?: ITeam | Types.ObjectId | null;
9
+ project_id: IProject | Types.ObjectId;
10
+ name: string;
11
+ metric: AlertMetric;
12
+ condition: AlertCondition;
13
+ threshold: number;
14
+ duration_seconds: number;
15
+ cooldown_seconds: number;
16
+ channel_mode: AlertChannelMode;
17
+ channel_ids: Types.ObjectId[];
18
+ enabled: boolean;
19
+ created_at: Date;
20
+ updated_at: Date;
21
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { Document } from "mongoose";
2
- import { DatabaseEngine } from "../enum";
2
+ import { DatabaseEngine, WorkbenchMode } from "../enum";
3
3
  export interface IDbImage extends Document {
4
4
  name: DatabaseEngine;
5
5
  image_url: string;
@@ -16,6 +16,9 @@ export interface IDbImage extends Document {
16
16
  port: number;
17
17
  volumePath: string;
18
18
  protocol: string;
19
+ ha: boolean;
20
+ workbench: boolean;
21
+ workbench_mode: WorkbenchMode;
19
22
  params: Record<any, any>;
20
23
  recommendations?: Array<{
21
24
  cpu: string;
@@ -55,6 +55,9 @@ export type { ICashierSubscription, ICashierSubscriptionItem } from "./cashier_s
55
55
  export type { IProjectEnvironment } from "./project-environment";
56
56
  export type { IEnvironmentVariable } from "./environment-variable";
57
57
  export type { IActivityLog } from "./activity-log";
58
+ export type { IAlertRule } from "./alert-rule";
59
+ export type { IAlertRuleState } from "./alert-rule-state";
60
+ export type { IAlertEvent, IAlertNotificationResult } from "./alert-event";
58
61
  export type { IOwnershipTransfer } from "./ownership-transfer";
59
62
  export type { ISandbox, ISandboxSpecs } from "./sandbox";
60
63
  export type { ISandboxActivity } from "./sandbox-activity";
@@ -20,6 +20,7 @@ export interface IProject extends Document {
20
20
  free_tier_expires_at?: Date | null;
21
21
  free_tier_expiry_notified_at?: Date | null;
22
22
  buildCacheEnabled?: boolean;
23
+ alerting_enabled: boolean;
23
24
  domains: Array<IDomain>;
24
25
  environments: Array<IEnv>;
25
26
  uuid: number;
@@ -33,6 +34,7 @@ export interface IProject extends Document {
33
34
  buildCommand: string;
34
35
  startCommand: string;
35
36
  outputDirectory: string;
37
+ workBenchEnabled: boolean;
36
38
  user_id: IUser;
37
39
  monitor_id: string;
38
40
  nomadJobId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.54",
3
+ "version": "3.8.56",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",