@brimble/models 3.8.106 → 3.8.108

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.
@@ -43,9 +43,27 @@ const backupHistorySchema = new mongoose_1.Schema({
43
43
  type: String,
44
44
  default: null,
45
45
  },
46
+ completed_at: {
47
+ type: Date,
48
+ default: null,
49
+ },
50
+ deleted_at: {
51
+ type: Date,
52
+ default: null,
53
+ },
54
+ billed_through: {
55
+ type: Date,
56
+ default: null,
57
+ },
58
+ pending_rebaseline_gb_hours: {
59
+ type: Number,
60
+ default: 0,
61
+ },
46
62
  }, {
47
63
  timestamps: { createdAt: "created_at", updatedAt: "updated_at" },
48
64
  collection: "backup_histories",
49
65
  });
50
66
  backupHistorySchema.index({ project_id: 1, created_at: -1 });
67
+ backupHistorySchema.index({ project_id: 1, status: 1, completed_at: 1 });
68
+ backupHistorySchema.index({ project_id: 1, status: 1, deleted_at: 1 });
51
69
  exports.default = (0, mongoose_1.model)("BackupHistory", backupHistorySchema);
package/dist/db-image.js CHANGED
@@ -32,6 +32,10 @@ const dbImageSchema = new mongoose_1.Schema({
32
32
  type: Boolean,
33
33
  default: false,
34
34
  },
35
+ backup_supported: {
36
+ type: Boolean,
37
+ default: true,
38
+ },
35
39
  has_port: {
36
40
  type: Boolean,
37
41
  default: true,
@@ -333,6 +333,12 @@ export declare enum BACKUP_STATUS {
333
333
  FAILED = "failed",
334
334
  DELETED = "deleted"
335
335
  }
336
+ export declare enum RESTORE_STATUS {
337
+ PENDING = "pending",
338
+ RUNNING = "running",
339
+ COMPLETED = "completed",
340
+ FAILED = "failed"
341
+ }
336
342
  export declare enum StorageBucketStatus {
337
343
  Active = "active",
338
344
  Deleting = "deleting",
@@ -348,6 +354,10 @@ export declare enum StorageTokenStatus {
348
354
  Active = "active",
349
355
  Revoked = "revoked"
350
356
  }
357
+ export declare enum PlatformApiKeyStatus {
358
+ Active = "active",
359
+ Revoked = "revoked"
360
+ }
351
361
  export declare enum StorageCredentialRole {
352
362
  ReadOnly = "ReadOnly",
353
363
  Editor = "Editor"
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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_SOURCE = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.CONFIG_FILE_VISIBILITY = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
4
- exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = 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 = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.BACKUP_STATUS = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = void 0;
4
+ exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = 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 = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.PlatformApiKeyStatus = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.RESTORE_STATUS = exports.BACKUP_STATUS = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = void 0;
5
5
  var GIT_TYPE;
6
6
  (function (GIT_TYPE) {
7
7
  GIT_TYPE["GITHUB"] = "GITHUB";
@@ -393,6 +393,13 @@ var BACKUP_STATUS;
393
393
  BACKUP_STATUS["FAILED"] = "failed";
394
394
  BACKUP_STATUS["DELETED"] = "deleted";
395
395
  })(BACKUP_STATUS || (exports.BACKUP_STATUS = BACKUP_STATUS = {}));
396
+ var RESTORE_STATUS;
397
+ (function (RESTORE_STATUS) {
398
+ RESTORE_STATUS["PENDING"] = "pending";
399
+ RESTORE_STATUS["RUNNING"] = "running";
400
+ RESTORE_STATUS["COMPLETED"] = "completed";
401
+ RESTORE_STATUS["FAILED"] = "failed";
402
+ })(RESTORE_STATUS || (exports.RESTORE_STATUS = RESTORE_STATUS = {}));
396
403
  var StorageBucketStatus;
397
404
  (function (StorageBucketStatus) {
398
405
  StorageBucketStatus["Active"] = "active";
@@ -411,6 +418,11 @@ var StorageTokenStatus;
411
418
  StorageTokenStatus["Active"] = "active";
412
419
  StorageTokenStatus["Revoked"] = "revoked";
413
420
  })(StorageTokenStatus || (exports.StorageTokenStatus = StorageTokenStatus = {}));
421
+ var PlatformApiKeyStatus;
422
+ (function (PlatformApiKeyStatus) {
423
+ PlatformApiKeyStatus["Active"] = "active";
424
+ PlatformApiKeyStatus["Revoked"] = "revoked";
425
+ })(PlatformApiKeyStatus || (exports.PlatformApiKeyStatus = PlatformApiKeyStatus = {}));
414
426
  var StorageCredentialRole;
415
427
  (function (StorageCredentialRole) {
416
428
  StorageCredentialRole["ReadOnly"] = "ReadOnly";
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { default as Dns } from "./domain/dns";
12
12
  export { default as DnsChangeLog } from "./domain/dns-changelog";
13
13
  export { default as Env } from "./env";
14
14
  export { default as Token } from "./token";
15
+ export { default as PlatformApiKey } from "./platform-api-key";
15
16
  export { default as Team } from "./team";
16
17
  export { default as Member } from "./member";
17
18
  export { default as Permission } from "./permission";
@@ -68,6 +69,7 @@ export { default as SandboxActivity } from "./sandbox-activity";
68
69
  export { default as SandboxImage } from "./sandbox-image";
69
70
  export { default as SandboxSnapshot } from "./sandbox-snapshot";
70
71
  export { default as BackupHistory } from "./backup-history";
72
+ export { default as RestoreHistory } from "./restore-history";
71
73
  export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
72
74
  export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
73
75
  export { default as VolumeUsageSegment } from "./volume-usage-segment";
@@ -84,8 +86,8 @@ export { default as QuestParticipation } from "./quest-participation";
84
86
  export { default as QuestRewardIssuance } from "./quest-reward-issuance";
85
87
  export { default as Coupon } from "./coupon";
86
88
  export { default as CouponRedemption } from "./coupon-redemption";
87
- 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, IPaymentMethod, IDns, IDnsChangeLog, 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, IProjectConfigFile, IActivityLog, IAlertRule, IAlertRuleState, IAlertEvent, IAlertNotificationResult, IDrain, IProjectDrainSubscription, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, IBackupHistory, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IPgBouncerUsageSegment, IPgBouncerUsageSegmentCosts, 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, ICoupon, ICouponRedemption, } from "./types";
88
- export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, AlertMetric, AlertCondition, AlertRuleState, AlertChannelMode, AlertEventStatus, DrainType, DrainStatus, LogSource, DrainEventType, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, DNS_CHANGE_TYPE, DNS_CHANGE_SOURCE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, SCALING_SOURCE, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, PROJECT_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_EGRESS_MODE, SANDBOX_SNAPSHOT_STATUS, BACKUP_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, CouponDiscountType, CouponScope, CouponRedemptionStatus, CONFIG_FILE_VISIBILITY, } from "./enum";
89
+ export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IProjectNetworkSettings, IRatelimit, RatelimitConfig, RateLimitZone, RateLimitMatcher, DistributedRateLimitConfig, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IPlatformApiKey, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IPaymentMethod, IDns, IDnsChangeLog, 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, IProjectConfigFile, IActivityLog, IAlertRule, IAlertRuleState, IAlertEvent, IAlertNotificationResult, IDrain, IProjectDrainSubscription, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, IBackupHistory, IRestoreHistory, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IPgBouncerUsageSegment, IPgBouncerUsageSegmentCosts, 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, ICoupon, ICouponRedemption, } from "./types";
90
+ export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, AlertMetric, AlertCondition, AlertRuleState, AlertChannelMode, AlertEventStatus, DrainType, DrainStatus, LogSource, DrainEventType, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, DNS_CHANGE_TYPE, DNS_CHANGE_SOURCE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, SCALING_SOURCE, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, PROJECT_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_EGRESS_MODE, SANDBOX_SNAPSHOT_STATUS, BACKUP_STATUS, RESTORE_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, PlatformApiKeyStatus, 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, CouponDiscountType, CouponScope, CouponRedemptionStatus, CONFIG_FILE_VISIBILITY, } from "./enum";
89
91
  import mongoose from "mongoose";
90
92
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
91
93
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -12,10 +12,10 @@ 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.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.PaymentMethod = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.DnsChangeLog = 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.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.CouponRedemption = exports.Coupon = 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.PgBouncerUsageSegment = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.BackupHistory = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.ProjectDrainSubscription = exports.Drain = exports.AlertEvent = exports.AlertRuleStateModel = exports.AlertRule = exports.ActivityLog = exports.ProjectConfigFile = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = void 0;
17
- exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.BACKUP_STATUS = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = 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.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.SCALING_SOURCE = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = exports.PROJECT_STATUS = void 0;
18
- exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.CONFIG_FILE_VISIBILITY = exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = 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 = void 0;
15
+ 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.PaymentMethod = exports.Permission = exports.Member = exports.Team = exports.PlatformApiKey = exports.Token = exports.Env = exports.DnsChangeLog = 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.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.CouponRedemption = exports.Coupon = 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.PgBouncerUsageSegment = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.RestoreHistory = exports.BackupHistory = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.ProjectDrainSubscription = exports.Drain = exports.AlertEvent = exports.AlertRuleStateModel = exports.AlertRule = exports.ActivityLog = exports.ProjectConfigFile = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = void 0;
17
+ exports.StorageUploadStatus = exports.StorageBucketStatus = exports.RESTORE_STATUS = exports.BACKUP_STATUS = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = 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.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.SCALING_SOURCE = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = void 0;
18
+ exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.CONFIG_FILE_VISIBILITY = exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = 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.PlatformApiKeyStatus = exports.StorageTokenStatus = void 0;
19
19
  var user_1 = require("./user");
20
20
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
21
21
  var project_1 = require("./project");
@@ -45,6 +45,8 @@ var env_1 = require("./env");
45
45
  Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return __importDefault(env_1).default; } });
46
46
  var token_1 = require("./token");
47
47
  Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return __importDefault(token_1).default; } });
48
+ var platform_api_key_1 = require("./platform-api-key");
49
+ Object.defineProperty(exports, "PlatformApiKey", { enumerable: true, get: function () { return __importDefault(platform_api_key_1).default; } });
48
50
  var team_1 = require("./team");
49
51
  Object.defineProperty(exports, "Team", { enumerable: true, get: function () { return __importDefault(team_1).default; } });
50
52
  var member_1 = require("./member");
@@ -157,6 +159,8 @@ var sandbox_snapshot_1 = require("./sandbox-snapshot");
157
159
  Object.defineProperty(exports, "SandboxSnapshot", { enumerable: true, get: function () { return __importDefault(sandbox_snapshot_1).default; } });
158
160
  var backup_history_1 = require("./backup-history");
159
161
  Object.defineProperty(exports, "BackupHistory", { enumerable: true, get: function () { return __importDefault(backup_history_1).default; } });
162
+ var restore_history_1 = require("./restore-history");
163
+ Object.defineProperty(exports, "RestoreHistory", { enumerable: true, get: function () { return __importDefault(restore_history_1).default; } });
160
164
  var sandbox_snapshot_usage_segment_1 = require("./sandbox-snapshot-usage-segment");
161
165
  Object.defineProperty(exports, "SandboxSnapshotUsageSegment", { enumerable: true, get: function () { return __importDefault(sandbox_snapshot_usage_segment_1).default; } });
162
166
  var sandbox_usage_segment_1 = require("./sandbox-usage-segment");
@@ -248,9 +252,11 @@ Object.defineProperty(exports, "SANDBOX_DESTROY_REASON", { enumerable: true, get
248
252
  Object.defineProperty(exports, "SANDBOX_EGRESS_MODE", { enumerable: true, get: function () { return enum_1.SANDBOX_EGRESS_MODE; } });
249
253
  Object.defineProperty(exports, "SANDBOX_SNAPSHOT_STATUS", { enumerable: true, get: function () { return enum_1.SANDBOX_SNAPSHOT_STATUS; } });
250
254
  Object.defineProperty(exports, "BACKUP_STATUS", { enumerable: true, get: function () { return enum_1.BACKUP_STATUS; } });
255
+ Object.defineProperty(exports, "RESTORE_STATUS", { enumerable: true, get: function () { return enum_1.RESTORE_STATUS; } });
251
256
  Object.defineProperty(exports, "StorageBucketStatus", { enumerable: true, get: function () { return enum_1.StorageBucketStatus; } });
252
257
  Object.defineProperty(exports, "StorageUploadStatus", { enumerable: true, get: function () { return enum_1.StorageUploadStatus; } });
253
258
  Object.defineProperty(exports, "StorageTokenStatus", { enumerable: true, get: function () { return enum_1.StorageTokenStatus; } });
259
+ Object.defineProperty(exports, "PlatformApiKeyStatus", { enumerable: true, get: function () { return enum_1.PlatformApiKeyStatus; } });
254
260
  Object.defineProperty(exports, "StorageCredentialRole", { enumerable: true, get: function () { return enum_1.StorageCredentialRole; } });
255
261
  Object.defineProperty(exports, "StorageCredentialStatus", { enumerable: true, get: function () { return enum_1.StorageCredentialStatus; } });
256
262
  Object.defineProperty(exports, "StorageMigrationStatus", { enumerable: true, get: function () { return enum_1.StorageMigrationStatus; } });
@@ -60,6 +60,8 @@ const PlanConfigurationSchema = new mongoose_1.Schema({
60
60
  sandbox_snapshot_storage_price: { type: Number, default: 0 },
61
61
  sandbox_snapshot_gb_months_included: { type: Number, default: 0 },
62
62
  sandbox_max_volume_size_gb: { type: Number, default: 0 },
63
- sandbox_max_volumes: { type: Number, default: 0 }
63
+ sandbox_max_volumes: { type: Number, default: 0 },
64
+ backup_storage_gb_threshold: { type: Number, default: 10 },
65
+ backup_retention_days: { type: Number, default: 30 }
64
66
  }, { timestamps: true });
65
67
  exports.default = (0, mongoose_1.model)("PlanConfigurations", PlanConfigurationSchema, "plan_configurations");
@@ -0,0 +1,9 @@
1
+ import { IPlatformApiKey } from "./types/platform-api-key";
2
+ declare const _default: import("mongoose").Model<IPlatformApiKey, {}, {}, {}, import("mongoose").Document<unknown, {}, IPlatformApiKey, {}, import("mongoose").DefaultSchemaOptions> & IPlatformApiKey & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IPlatformApiKey>;
9
+ export default _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const platformApiKeySchema = new mongoose_1.Schema({
6
+ name: { type: String, required: true, trim: true, maxlength: 100 },
7
+ key_id: { type: String, required: true, unique: true, index: true },
8
+ key_prefix: { type: String, required: true },
9
+ owner_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
10
+ team_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", default: null, index: true },
11
+ subscription_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Subscription", default: null },
12
+ permissions: { type: [String], required: true },
13
+ status: {
14
+ type: String,
15
+ enum: Object.values(enum_1.PlatformApiKeyStatus),
16
+ default: enum_1.PlatformApiKeyStatus.Active,
17
+ index: true,
18
+ },
19
+ expires_at: { type: Date, default: null },
20
+ last_used_at: { type: Date, default: null },
21
+ }, { timestamps: true, collection: "platform_api_keys" });
22
+ platformApiKeySchema.index({ owner_id: 1, team_id: 1, status: 1 });
23
+ exports.default = (0, mongoose_1.model)("PlatformApiKey", platformApiKeySchema);
@@ -0,0 +1,9 @@
1
+ import { IRestoreHistory } from "./types/restore-history";
2
+ declare const _default: import("mongoose").Model<IRestoreHistory, {}, {}, {}, import("mongoose").Document<unknown, {}, IRestoreHistory, {}, import("mongoose").DefaultSchemaOptions> & IRestoreHistory & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IRestoreHistory>;
9
+ export default _default;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const restoreHistorySchema = new mongoose_1.Schema({
6
+ project_id: {
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ ref: "Project",
9
+ required: true,
10
+ index: true,
11
+ },
12
+ backup_history_id: {
13
+ type: mongoose_1.Schema.Types.ObjectId,
14
+ ref: "BackupHistory",
15
+ required: true,
16
+ index: true,
17
+ },
18
+ user_id: {
19
+ type: mongoose_1.Schema.Types.ObjectId,
20
+ ref: "User",
21
+ required: true,
22
+ index: true,
23
+ },
24
+ team: {
25
+ type: mongoose_1.Schema.Types.ObjectId,
26
+ ref: "Team",
27
+ default: null,
28
+ index: true,
29
+ },
30
+ status: {
31
+ type: String,
32
+ enum: Object.values(enum_1.RESTORE_STATUS),
33
+ default: enum_1.RESTORE_STATUS.PENDING,
34
+ index: true,
35
+ },
36
+ object_key: {
37
+ type: String,
38
+ required: true,
39
+ },
40
+ engine: {
41
+ type: String,
42
+ default: null,
43
+ },
44
+ failure_reason: {
45
+ type: String,
46
+ default: null,
47
+ },
48
+ started_at: {
49
+ type: Date,
50
+ default: null,
51
+ },
52
+ completed_at: {
53
+ type: Date,
54
+ default: null,
55
+ },
56
+ }, {
57
+ timestamps: { createdAt: "created_at", updatedAt: "updated_at" },
58
+ collection: "restore_histories",
59
+ });
60
+ restoreHistorySchema.index({ project_id: 1, created_at: -1 });
61
+ restoreHistorySchema.index({ project_id: 1, status: 1 });
62
+ restoreHistorySchema.index({ project_id: 1 }, {
63
+ unique: true,
64
+ partialFilterExpression: {
65
+ status: { $in: [enum_1.RESTORE_STATUS.PENDING, enum_1.RESTORE_STATUS.RUNNING] },
66
+ },
67
+ });
68
+ exports.default = (0, mongoose_1.model)("RestoreHistory", restoreHistorySchema);
@@ -9,6 +9,10 @@ export interface IBackupHistory extends Document {
9
9
  object_key: string | null;
10
10
  size_bytes: number | null;
11
11
  failure_reason: string | null;
12
+ completed_at: Date | null;
13
+ deleted_at: Date | null;
14
+ billed_through: Date | null;
15
+ pending_rebaseline_gb_hours: number;
12
16
  created_at: Date;
13
17
  updated_at: Date;
14
18
  }
@@ -10,6 +10,7 @@ export interface IDbImage extends Document {
10
10
  }>;
11
11
  is_available: boolean;
12
12
  is_default: boolean;
13
+ backup_supported: boolean;
13
14
  image: string;
14
15
  free: boolean;
15
16
  analytics: boolean;
@@ -37,6 +37,7 @@ export type { ISettings } from "./settings";
37
37
  export type { ISubscription } from "./subscription";
38
38
  export type { ITeam } from "./team";
39
39
  export type { IToken } from "./token";
40
+ export type { IPlatformApiKey } from "./platform-api-key";
40
41
  export type { IUser } from "./user";
41
42
  export type { IVolume } from "./volume";
42
43
  export type { IWallet } from "./wallet";
@@ -69,6 +70,7 @@ export type { ISandboxActivity } from "./sandbox-activity";
69
70
  export type { ISandboxImage } from "./sandbox-image";
70
71
  export type { ISandboxSnapshot } from "./sandbox-snapshot";
71
72
  export type { IBackupHistory } from "./backup-history";
73
+ export type { IRestoreHistory } from "./restore-history";
72
74
  export type { ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, } from "./sandbox-snapshot-usage-segment";
73
75
  export type { ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./sandbox-usage-segment";
74
76
  export type { IVolumeUsageSegment, IVolumeUsageSegmentCosts, } from "./volume-usage-segment";
@@ -56,4 +56,6 @@ export interface IPlanConfiguration extends Document {
56
56
  sandbox_snapshot_gb_months_included: number;
57
57
  sandbox_max_volume_size_gb: number;
58
58
  sandbox_max_volumes: number;
59
+ backup_storage_gb_threshold: number;
60
+ backup_retention_days: number;
59
61
  }
@@ -0,0 +1,18 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { PlatformApiKeyStatus } from "../enum";
3
+ import { ITeam } from "./team";
4
+ import { IUser } from "./user";
5
+ export interface IPlatformApiKey extends Document {
6
+ name: string;
7
+ key_id: string;
8
+ key_prefix: string;
9
+ owner_id: Types.ObjectId | IUser;
10
+ team_id?: Types.ObjectId | ITeam | null;
11
+ subscription_id?: Types.ObjectId | null;
12
+ permissions: string[];
13
+ status: PlatformApiKeyStatus;
14
+ expires_at?: Date | null;
15
+ last_used_at?: Date | null;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { RESTORE_STATUS } from "../enum";
3
+ export interface IRestoreHistory extends Document {
4
+ project_id: Types.ObjectId;
5
+ backup_history_id: Types.ObjectId;
6
+ user_id: Types.ObjectId;
7
+ team: Types.ObjectId | null;
8
+ status: RESTORE_STATUS;
9
+ object_key: string;
10
+ engine: string | null;
11
+ failure_reason: string | null;
12
+ started_at: Date | null;
13
+ completed_at: Date | null;
14
+ created_at: Date;
15
+ updated_at: Date;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.106",
3
+ "version": "3.8.108",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",