@brimble/models 4.0.1 → 4.0.3

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.
Files changed (70) hide show
  1. package/dist/types/activity-log.d.ts +8 -8
  2. package/dist/types/agent-design-skill-revision.d.ts +1 -1
  3. package/dist/types/alert-rule.d.ts +1 -1
  4. package/dist/types/app-message.d.ts +4 -4
  5. package/dist/types/auto-scaling-group.d.ts +3 -4
  6. package/dist/types/backup-history.d.ts +8 -4
  7. package/dist/types/cashier_subscription.d.ts +1 -1
  8. package/dist/types/collab-annotation.d.ts +13 -13
  9. package/dist/types/collab-comment.d.ts +6 -6
  10. package/dist/types/collab-integration.d.ts +1 -1
  11. package/dist/types/collab-settings.d.ts +2 -2
  12. package/dist/types/collab-share-token.d.ts +1 -1
  13. package/dist/types/compute.d.ts +11 -11
  14. package/dist/types/coupon-redemption.d.ts +16 -12
  15. package/dist/types/coupon.d.ts +15 -13
  16. package/dist/types/db-image.d.ts +3 -3
  17. package/dist/types/domain/dns-changelog.d.ts +16 -10
  18. package/dist/types/domain/dns.d.ts +1 -1
  19. package/dist/types/domain/index.d.ts +6 -6
  20. package/dist/types/domain/transfer.d.ts +13 -13
  21. package/dist/types/drain.d.ts +18 -15
  22. package/dist/types/email-dead-letter.d.ts +3 -3
  23. package/dist/types/env.d.ts +1 -1
  24. package/dist/types/environment-variable.d.ts +1 -1
  25. package/dist/types/following.d.ts +2 -2
  26. package/dist/types/framework.d.ts +9 -9
  27. package/dist/types/git.d.ts +12 -12
  28. package/dist/types/integration.d.ts +7 -7
  29. package/dist/types/intention.d.ts +1 -1
  30. package/dist/types/job.d.ts +9 -9
  31. package/dist/types/license.d.ts +8 -4
  32. package/dist/types/logs.d.ts +3 -3
  33. package/dist/types/member.d.ts +2 -2
  34. package/dist/types/object-storage-usage-segment.d.ts +8 -4
  35. package/dist/types/pgbouncer-usage-segment.d.ts +8 -5
  36. package/dist/types/plan_configuration.d.ts +1 -1
  37. package/dist/types/platform-api-key.d.ts +6 -5
  38. package/dist/types/project/index.d.ts +31 -31
  39. package/dist/types/project/preview.d.ts +1 -1
  40. package/dist/types/project-drain-subscription.d.ts +7 -5
  41. package/dist/types/project-environment.d.ts +2 -2
  42. package/dist/types/project-network-settings.d.ts +2 -2
  43. package/dist/types/project_analytics.d.ts +5 -3
  44. package/dist/types/quest-campaign.d.ts +2 -2
  45. package/dist/types/quest-participation.d.ts +8 -5
  46. package/dist/types/quest-reward-issuance.d.ts +10 -6
  47. package/dist/types/ratelimit.d.ts +20 -18
  48. package/dist/types/ref.d.ts +3 -2
  49. package/dist/types/region.d.ts +15 -15
  50. package/dist/types/restore-history.d.ts +10 -5
  51. package/dist/types/role.d.ts +2 -2
  52. package/dist/types/sandbox-activity.d.ts +10 -6
  53. package/dist/types/sandbox-snapshot-usage-segment.d.ts +8 -5
  54. package/dist/types/sandbox-snapshot.d.ts +8 -4
  55. package/dist/types/sandbox-usage-segment.d.ts +2 -2
  56. package/dist/types/sandbox.d.ts +4 -3
  57. package/dist/types/server.d.ts +15 -13
  58. package/dist/types/storage.d.ts +59 -56
  59. package/dist/types/streak-day.d.ts +6 -4
  60. package/dist/types/streak-event.d.ts +7 -4
  61. package/dist/types/streak-milestone.d.ts +6 -4
  62. package/dist/types/streak.d.ts +6 -4
  63. package/dist/types/subscription.d.ts +1 -1
  64. package/dist/types/ticket.d.ts +5 -5
  65. package/dist/types/user.d.ts +4 -4
  66. package/dist/types/volume-usage-segment.d.ts +12 -8
  67. package/dist/types/volume.d.ts +13 -11
  68. package/dist/types/webhook-setting.d.ts +2 -2
  69. package/dist/types/worker-run.d.ts +8 -4
  70. package/package.json +1 -1
@@ -2,13 +2,13 @@ import { Document } from "mongoose";
2
2
  import { INTEGRATION_PROVIDERS, INTEGRATION_TYPES } from "../enum";
3
3
  export interface IIntegration extends Document {
4
4
  user_id: string;
5
- team_id?: string;
6
- app_id?: string;
5
+ team_id: string;
6
+ app_id: string;
7
7
  name: INTEGRATION_PROVIDERS;
8
- scope_description?: string[];
9
- hook?: string;
10
- reference?: string;
11
- token?: string;
8
+ scope_description: string[];
9
+ hook: string;
10
+ reference: string;
11
+ token: string;
12
12
  type: INTEGRATION_TYPES;
13
- extra?: any;
13
+ extra: any;
14
14
  }
@@ -8,7 +8,7 @@ export interface IIntention extends Document {
8
8
  sourceNamespace: string;
9
9
  destinationNamespace: string;
10
10
  action: "allow" | "deny";
11
- description?: string;
11
+ description: string;
12
12
  createdAt: Date;
13
13
  updatedAt: Date;
14
14
  }
@@ -6,14 +6,14 @@ export interface IJob extends Document {
6
6
  url: string;
7
7
  method: string;
8
8
  schedule: string;
9
- headers?: Map<string, string>;
10
- maxAttempts?: number;
11
- attempts?: number;
9
+ headers: Map<string, string>;
10
+ maxAttempts: number;
11
+ attempts: number;
12
12
  isRecurring: boolean;
13
- lastRun?: Date;
14
- nextRun?: Date;
15
- body?: any;
16
- status?: JobStatus;
17
- createdAt?: Date;
18
- updatedAt?: Date;
13
+ lastRun: Date;
14
+ nextRun: Date;
15
+ body: any;
16
+ status: JobStatus;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
19
  }
@@ -1,13 +1,17 @@
1
- import mongoose, { Document } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { LicenseStatus } from "../enum";
3
+ import { ISubscription } from "./subscription";
4
+ import { ITeam } from "./team";
5
+ import { IUser } from "./user";
6
+ import { Ref } from "./ref";
3
7
  export interface ILicense extends Document {
4
8
  licenseKey: string;
5
9
  infisicalIdentity: string;
6
- userId: mongoose.Types.ObjectId;
7
- teamId: mongoose.Types.ObjectId;
10
+ userId: Ref<IUser>;
11
+ teamId: Ref<ITeam>;
8
12
  status: LicenseStatus;
9
13
  tag: string;
10
- subscriptionId: mongoose.Types.ObjectId;
14
+ subscriptionId: Ref<ISubscription>;
11
15
  devices: Array<{
12
16
  deviceId: string;
13
17
  hostname: string;
@@ -16,14 +16,14 @@ export interface ILog extends Document {
16
16
  name: string;
17
17
  email: string;
18
18
  username: string;
19
- avatar_url?: string;
19
+ avatar_url: string;
20
20
  };
21
21
  };
22
22
  source: string;
23
23
  status: PROJECT_STATUS;
24
24
  project: Ref<IProject>;
25
- user?: Ref<IUser>;
26
- team?: Ref<ITeam>;
25
+ user: Ref<IUser>;
26
+ team: Ref<ITeam>;
27
27
  jobs: {
28
28
  id: number;
29
29
  name: string;
@@ -6,11 +6,11 @@ import { IProjectEnvironment } from "./project-environment";
6
6
  import { Ref } from "./ref";
7
7
  export interface IMember extends Document {
8
8
  /** Absent until an invited member registers; `email` identifies them until then. */
9
- user?: Ref<IUser>;
9
+ user: Ref<IUser>;
10
10
  team: Ref<ITeam>;
11
11
  role: ROLES;
12
12
  accepted: boolean;
13
- invitedBy?: Ref<IUser>;
13
+ invitedBy: Ref<IUser>;
14
14
  email: string;
15
15
  featureOnboarded: boolean;
16
16
  permissions: Ref<IMemberPermission>[];
@@ -1,12 +1,16 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { IStorageBucket } from "./storage";
3
+ import { ITeam } from "./team";
4
+ import { IUser } from "./user";
5
+ import { Ref } from "./ref";
2
6
  export interface IObjectStorageUsageSegmentCosts {
3
7
  startDate: Date;
4
8
  endDate: Date | null;
5
9
  }
6
10
  export interface IObjectStorageUsageSegment extends Document {
7
- bucket_id: Types.ObjectId;
8
- user_id: Types.ObjectId;
9
- team_id: Types.ObjectId | null;
11
+ bucket_id: Ref<IStorageBucket>;
12
+ user_id: Ref<IUser>;
13
+ team_id: Ref<ITeam> | null;
10
14
  size_gb: number;
11
15
  costs: IObjectStorageUsageSegmentCosts;
12
16
  billed: boolean;
@@ -1,13 +1,16 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { IProject } from "./project";
3
+ import { ITeam } from "./team";
4
+ import { IUser } from "./user";
5
+ import { Ref } from "./ref";
2
6
  export interface IPgBouncerUsageSegmentCosts {
3
7
  startDate: Date;
4
8
  endDate: Date | null;
5
9
  }
6
10
  export interface IPgBouncerUsageSegment extends Document {
7
- _id: Types.ObjectId;
8
- project_id: Types.ObjectId;
9
- user_id: Types.ObjectId;
10
- team_id: Types.ObjectId | null;
11
+ project_id: Ref<IProject>;
12
+ user_id: Ref<IUser>;
13
+ team_id: Ref<ITeam> | null;
11
14
  costs: IPgBouncerUsageSegmentCosts;
12
15
  billed: boolean;
13
16
  createdAt: Date;
@@ -39,7 +39,7 @@ export interface IPlanConfiguration extends Document {
39
39
  unlimited_projects: boolean;
40
40
  webhook_enabled: boolean;
41
41
  can_deploy_all_applications: boolean;
42
- stripe_prices?: Record<string, string>;
42
+ stripe_prices: Record<string, string>;
43
43
  storage_bucket_enabled: boolean;
44
44
  storage_bucket_quota_gb: number;
45
45
  sandbox_max_count: number;
@@ -1,5 +1,6 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { PlatformApiKeyStatus } from "../enum";
3
+ import { ISubscription } from "./subscription";
3
4
  import { ITeam } from "./team";
4
5
  import { IUser } from "./user";
5
6
  import { Ref } from "./ref";
@@ -8,12 +9,12 @@ export interface IPlatformApiKey extends Document {
8
9
  key_id: string;
9
10
  key_prefix: string;
10
11
  owner_id: Ref<IUser>;
11
- team_id?: Ref<ITeam> | null;
12
- subscription_id?: Types.ObjectId | null;
12
+ team_id: Ref<ITeam> | null;
13
+ subscription_id: Ref<ISubscription> | null;
13
14
  permissions: string[];
14
15
  status: PlatformApiKeyStatus;
15
- expires_at?: Date | null;
16
- last_used_at?: Date | null;
16
+ expires_at: Date | null;
17
+ last_used_at: Date | null;
17
18
  createdAt: Date;
18
19
  updatedAt: Date;
19
20
  }
@@ -26,15 +26,15 @@ export interface IPgBouncerConfig {
26
26
  }
27
27
  export interface IProject extends Document {
28
28
  name: string;
29
- healthCheckPath?: string;
30
- preStartCommand?: string;
29
+ healthCheckPath: string;
30
+ preStartCommand: string;
31
31
  backupEnabled: boolean;
32
32
  backup_mode: "automatic" | "manual";
33
33
  backup_schedule: string;
34
34
  http2: boolean;
35
- free_tier_expires_at?: Date | null;
36
- free_tier_expiry_notified_at?: Date | null;
37
- buildCacheEnabled?: boolean;
35
+ free_tier_expires_at: Date | null;
36
+ free_tier_expiry_notified_at: Date | null;
37
+ buildCacheEnabled: boolean;
38
38
  alerting_enabled: boolean;
39
39
  logDrainsEnabled: boolean;
40
40
  domains: Array<Ref<IDomain>>;
@@ -47,20 +47,20 @@ export interface IProject extends Document {
47
47
  tlsEnabled: boolean;
48
48
  sendReport: boolean;
49
49
  pgbouncerEnabled: boolean;
50
- pgbouncerConfig?: IPgBouncerConfig | null;
51
- tlsEnabledAt?: Date | null;
52
- tlsCaObjectKey?: string | null;
53
- tlsServerCertExpiresAt?: Date | null;
54
- tlsHost?: string | null;
55
- tlsPort?: number | null;
56
- tlsSslModeHint?: string | null;
50
+ pgbouncerConfig: IPgBouncerConfig | null;
51
+ tlsEnabledAt: Date | null;
52
+ tlsCaObjectKey: string | null;
53
+ tlsServerCertExpiresAt: Date | null;
54
+ tlsHost: string | null;
55
+ tlsPort: number | null;
56
+ tlsSslModeHint: string | null;
57
57
  dbImage: Ref<IDbImage>;
58
58
  public: boolean;
59
59
  installCommand: string;
60
60
  buildCommand: string;
61
61
  startCommand: string;
62
62
  outputDirectory: string;
63
- runtimeVersions?: RuntimeVersions | null;
63
+ runtimeVersions: RuntimeVersions | null;
64
64
  workBenchEnabled: boolean;
65
65
  user_id: Ref<IUser>;
66
66
  monitor_id: string;
@@ -74,8 +74,8 @@ export interface IProject extends Document {
74
74
  installationId: string | number;
75
75
  git: GIT_TYPE;
76
76
  } | null;
77
- rootDir?: string;
78
- dockerfile?: string;
77
+ rootDir: string;
78
+ dockerfile: string;
79
79
  team: Ref<ITeam>;
80
80
  server: Ref<IServer>;
81
81
  isPrivate: boolean;
@@ -88,10 +88,10 @@ export interface IProject extends Document {
88
88
  starred: boolean;
89
89
  passwordEnabled: boolean;
90
90
  disabled: boolean;
91
- disabled_at?: Date | null;
92
- disabled_by?: PROJECT_DISABLED_BY | null;
91
+ disabled_at: Date | null;
92
+ disabled_by: PROJECT_DISABLED_BY | null;
93
93
  isDeleted: boolean;
94
- deletedAt?: Date | null;
94
+ deletedAt: Date | null;
95
95
  authEnabled: boolean;
96
96
  password: string | null;
97
97
  deployedInCluster: boolean;
@@ -106,7 +106,7 @@ export interface IProject extends Document {
106
106
  tracking_token: string;
107
107
  from: string;
108
108
  previews: Ref<IPreview>[];
109
- project_environment?: Ref<IProjectEnvironment>;
109
+ project_environment: Ref<IProjectEnvironment>;
110
110
  inherit_environment_vars: boolean;
111
111
  replicas: number;
112
112
  vaultPath: string | null;
@@ -121,20 +121,20 @@ export interface IProject extends Document {
121
121
  isPaused: boolean;
122
122
  paused_by: string | null;
123
123
  billable: boolean;
124
- serviceType?: ServiceType;
125
- cronEnabled?: boolean;
126
- cronExpression?: string | null;
127
- cronTimezone?: string | null;
128
- cronCommand?: string | null;
129
- last_backup_url?: string;
130
- last_backup_at?: Date;
124
+ serviceType: ServiceType;
125
+ cronEnabled: boolean;
126
+ cronExpression: string | null;
127
+ cronTimezone: string | null;
128
+ cronCommand: string | null;
129
+ last_backup_url: string;
130
+ last_backup_at: Date;
131
131
  replica_ready: boolean;
132
- autoscaling_group?: Ref<IAutoScalingGroup>;
132
+ autoscaling_group: Ref<IAutoScalingGroup>;
133
133
  isPaid: boolean;
134
- hasUpdates?: boolean;
135
- whiteListedIps?: string[];
136
- diskSize?: number;
137
- persistent_mount_path?: string;
134
+ hasUpdates: boolean;
135
+ whiteListedIps: string[];
136
+ diskSize: number;
137
+ persistent_mount_path: string;
138
138
  volumeMount: string;
139
139
  volume: Ref<IVolume> | null;
140
140
  }
@@ -6,7 +6,7 @@ import { ILog } from "../logs";
6
6
  import { Ref } from "../ref";
7
7
  export interface IPreview extends Document {
8
8
  name: string;
9
- healthCheckPath?: string;
9
+ healthCheckPath: string;
10
10
  pid: number;
11
11
  port: number;
12
12
  ip: string;
@@ -1,10 +1,12 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { IDrain } from "./drain";
3
+ import { IProject } from "./project";
4
+ import { Ref } from "./ref";
2
5
  export interface IProjectDrainSubscription extends Document {
3
- _id: Types.ObjectId;
4
- drain: Types.ObjectId;
5
- project: Types.ObjectId;
6
+ drain: Ref<IDrain>;
7
+ project: Ref<IProject>;
6
8
  enabled: boolean;
7
- disabledAt?: Date | null;
9
+ disabledAt: Date | null;
8
10
  createdAt: Date;
9
11
  updatedAt: Date;
10
12
  }
@@ -6,8 +6,8 @@ export interface IProjectEnvironment extends Document {
6
6
  name: string;
7
7
  slug: string;
8
8
  owner: Ref<IUser>;
9
- team?: Ref<ITeam>;
10
- inherit_from?: Ref<IProjectEnvironment>;
9
+ team: Ref<ITeam>;
10
+ inherit_from: Ref<IProjectEnvironment>;
11
11
  isDefault: boolean;
12
12
  createdAt: Date;
13
13
  updatedAt: Date;
@@ -22,8 +22,8 @@ export interface IProjectNetworkSettings extends Document {
22
22
  wordpressProtection: boolean;
23
23
  };
24
24
  cloudflare: {
25
- lastSyncedAt?: Date;
26
- syncError?: string;
25
+ lastSyncedAt: Date;
26
+ syncError: string;
27
27
  };
28
28
  createdAt: Date;
29
29
  updatedAt: Date;
@@ -1,9 +1,11 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { IProject } from "./project";
3
+ import { Ref } from "./ref";
2
4
  export interface IProjectAnalytics extends Document {
3
- project: Types.ObjectId;
5
+ project: Ref<IProject>;
4
6
  provider: "umami";
5
7
  websiteId: string;
6
- shareId?: string | null;
8
+ shareId: string | null;
7
9
  domain: string;
8
10
  enabled: boolean;
9
11
  createdAt: Date;
@@ -33,6 +33,6 @@ export interface IQuestCampaign extends Document {
33
33
  rewards: IQuestReward[];
34
34
  active: boolean;
35
35
  auto_expire: boolean;
36
- created_at?: Date;
37
- updated_at?: Date;
36
+ created_at: Date;
37
+ updated_at: Date;
38
38
  }
@@ -1,4 +1,7 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { IQuestCampaign } from "./quest-campaign";
3
+ import { IUser } from "./user";
4
+ import { Ref } from "./ref";
2
5
  export interface IQuestCriterionProgress {
3
6
  key: string;
4
7
  current: number;
@@ -6,14 +9,14 @@ export interface IQuestCriterionProgress {
6
9
  met: boolean;
7
10
  }
8
11
  export interface IQuestParticipation extends Document {
9
- campaign_id: Types.ObjectId;
10
- user_id: Types.ObjectId;
12
+ campaign_id: Ref<IQuestCampaign>;
13
+ user_id: Ref<IUser>;
11
14
  joined_at: Date;
12
15
  slot_number: number;
13
16
  streak_deducted: number;
14
17
  criteria_progress: IQuestCriterionProgress[];
15
18
  qualifier_met: boolean;
16
19
  claimed_at: Date | null;
17
- created_at?: Date;
18
- updated_at?: Date;
20
+ created_at: Date;
21
+ updated_at: Date;
19
22
  }
@@ -1,17 +1,21 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { QuestRewardStatus, RewardType } from "../enum";
3
+ import { IQuestCampaign } from "./quest-campaign";
4
+ import { IQuestParticipation } from "./quest-participation";
5
+ import { IUser } from "./user";
6
+ import { Ref } from "./ref";
3
7
  export interface IQuestIssuedReward {
4
8
  type: RewardType;
5
9
  metadata: Record<string, unknown>;
6
10
  }
7
11
  export interface IQuestRewardIssuance extends Document {
8
- participation_id: Types.ObjectId;
9
- campaign_id: Types.ObjectId;
10
- user_id: Types.ObjectId;
12
+ participation_id: Ref<IQuestParticipation>;
13
+ campaign_id: Ref<IQuestCampaign>;
14
+ user_id: Ref<IUser>;
11
15
  rewards: IQuestIssuedReward[];
12
16
  status: QuestRewardStatus;
13
17
  claimed_at: Date;
14
18
  fulfilled_at: Date | null;
15
- created_at?: Date;
16
- updated_at?: Date;
19
+ created_at: Date;
20
+ updated_at: Date;
17
21
  }
@@ -1,41 +1,43 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { IProject } from "./project";
3
+ import { Ref } from "./ref";
2
4
  export type RateLimitMatcher = {
3
- methods?: string[];
4
- paths?: string[];
5
+ methods: string[];
6
+ paths: string[];
5
7
  };
6
8
  export type RateLimitZone = {
7
9
  name: string;
8
10
  key: string;
9
11
  window: string;
10
12
  events: number;
11
- matcher?: RateLimitMatcher;
12
- ipv4Prefix?: number;
13
- ipv6Prefix?: number;
13
+ matcher: RateLimitMatcher;
14
+ ipv4Prefix: number;
15
+ ipv6Prefix: number;
14
16
  };
15
17
  export type DistributedRateLimitConfig = {
16
18
  enabled: boolean;
17
- readInterval?: string;
18
- writeInterval?: string;
19
- purgeAge?: string;
19
+ readInterval: string;
20
+ writeInterval: string;
21
+ purgeAge: string;
20
22
  };
21
23
  export type RatelimitConfig = {
22
24
  enabled: boolean;
23
25
  zones: RateLimitZone[];
24
- distributed?: DistributedRateLimitConfig;
25
- logKey?: boolean;
26
- disableMetrics?: boolean;
27
- jitter?: number;
28
- sweepInterval?: string;
26
+ distributed: DistributedRateLimitConfig;
27
+ logKey: boolean;
28
+ disableMetrics: boolean;
29
+ jitter: number;
30
+ sweepInterval: string;
29
31
  };
30
32
  export interface IRatelimit extends Document {
31
- project: Types.ObjectId;
33
+ project: Ref<IProject>;
32
34
  enabled: boolean;
33
35
  zones: RateLimitZone[];
34
- distributed?: DistributedRateLimitConfig;
36
+ distributed: DistributedRateLimitConfig;
35
37
  logKey: boolean;
36
38
  disableMetrics: boolean;
37
- jitter?: number;
38
- sweepInterval?: string;
39
+ jitter: number;
40
+ sweepInterval: string;
39
41
  createdAt: Date;
40
42
  updatedAt: Date;
41
43
  }
@@ -1,7 +1,8 @@
1
1
  import { Types } from "mongoose";
2
2
  /**
3
- * A Mongoose reference field. Holds an `ObjectId` unless the query populated it,
4
- * so consumers must narrow before reading the referenced document.
3
+ * A Mongoose reference field. Holds an `ObjectId` unless the query that loaded
4
+ * the document populated it. Type that query's result as `Populated<T, K>`
5
+ * (or a named alias of it) so callers already know which refs are documents.
5
6
  */
6
7
  export type Ref<T> = T | Types.ObjectId;
7
8
  type PopulatedField<V> = V extends (infer E)[] ? Exclude<E, Types.ObjectId>[] : Exclude<V, Types.ObjectId>;
@@ -2,31 +2,31 @@ import { Types, Document } from "mongoose";
2
2
  import { REGION_CONTINENT, VOLUME_BACKEND } from "../enum";
3
3
  export type RegionType = "web" | "database" | "sandbox";
4
4
  export interface IRegionCsiConfig {
5
- plugin_id?: string;
6
- topology_path?: string;
7
- require_topology?: boolean;
8
- availability_zone?: string;
9
- parameters?: Record<string, string>;
10
- parameters_env?: Record<string, string>;
11
- fs_type?: string;
12
- attachment_modes?: string[];
5
+ plugin_id: string;
6
+ topology_path: string;
7
+ require_topology: boolean;
8
+ availability_zone: string;
9
+ parameters: Record<string, string>;
10
+ parameters_env: Record<string, string>;
11
+ fs_type: string;
12
+ attachment_modes: string[];
13
13
  }
14
14
  export interface IRegion extends Document {
15
15
  _id: Types.ObjectId;
16
16
  name: string;
17
17
  country: string;
18
18
  cname: string;
19
- continent?: REGION_CONTINENT;
20
- enabled?: boolean;
19
+ continent: REGION_CONTINENT;
20
+ enabled: boolean;
21
21
  dbVolumePath: string;
22
22
  is_paid: boolean;
23
23
  logo: string;
24
24
  provider: string;
25
25
  provider_identifier: string;
26
26
  storage_pricing_factor: number;
27
- floating_ip?: string;
28
- type?: RegionType;
29
- ceph_cluster_id?: string;
30
- volume_backend?: VOLUME_BACKEND;
31
- csi?: IRegionCsiConfig;
27
+ floating_ip: string;
28
+ type: RegionType;
29
+ ceph_cluster_id: string;
30
+ volume_backend: VOLUME_BACKEND;
31
+ csi: IRegionCsiConfig;
32
32
  }
@@ -1,10 +1,15 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { RESTORE_STATUS } from "../enum";
3
+ import { IBackupHistory } from "./backup-history";
4
+ import { IProject } from "./project";
5
+ import { ITeam } from "./team";
6
+ import { IUser } from "./user";
7
+ import { Ref } from "./ref";
3
8
  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;
9
+ project_id: Ref<IProject>;
10
+ backup_history_id: Ref<IBackupHistory>;
11
+ user_id: Ref<IUser>;
12
+ team: Ref<ITeam> | null;
8
13
  status: RESTORE_STATUS;
9
14
  object_key: string;
10
15
  engine: string | null;
@@ -4,7 +4,7 @@ import { IPermission } from "./permission";
4
4
  import { Ref } from "./ref";
5
5
  export interface IRole extends Document {
6
6
  type: ROLES;
7
- description?: string;
8
- is_custom?: boolean;
7
+ description: string;
8
+ is_custom: boolean;
9
9
  permissions: Ref<IPermission>[];
10
10
  }
@@ -1,14 +1,18 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { ISandbox } from "./sandbox";
3
+ import { ITeam } from "./team";
4
+ import { IUser } from "./user";
5
+ import { Ref } from "./ref";
2
6
  export interface ISandboxActivity extends Document {
3
- sandbox_id: Types.ObjectId;
4
- user_id: Types.ObjectId;
5
- team: Types.ObjectId | null;
7
+ sandbox_id: Ref<ISandbox>;
8
+ user_id: Ref<IUser>;
9
+ team: Ref<ITeam> | null;
6
10
  command: string;
7
11
  started_at: Date;
8
12
  ended_at: Date | null;
9
13
  exit_code: number | null;
10
14
  duration_ms: number | null;
11
15
  error: string | null;
12
- created_at?: Date;
13
- updated_at?: Date;
16
+ created_at: Date;
17
+ updated_at: Date;
14
18
  }
@@ -1,13 +1,16 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
+ import { ISandboxSnapshot } from "./sandbox-snapshot";
3
+ import { ITeam } from "./team";
4
+ import { IUser } from "./user";
5
+ import { Ref } from "./ref";
2
6
  export interface ISandboxSnapshotUsageSegmentCosts {
3
7
  startDate: Date;
4
8
  endDate: Date | null;
5
9
  }
6
10
  export interface ISandboxSnapshotUsageSegment extends Document {
7
- _id: Types.ObjectId;
8
- snapshot_id: Types.ObjectId;
9
- user_id: Types.ObjectId;
10
- team_id: Types.ObjectId | null;
11
+ snapshot_id: Ref<ISandboxSnapshot>;
12
+ user_id: Ref<IUser>;
13
+ team_id: Ref<ITeam> | null;
11
14
  size_gb: number;
12
15
  costs: ISandboxSnapshotUsageSegmentCosts;
13
16
  billed: boolean;