@brimble/models 3.8.156 → 4.0.0

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 (63) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/types/activity-log.d.ts +3 -2
  3. package/dist/types/agent-chat-file.d.ts +5 -4
  4. package/dist/types/agent-chat-message.d.ts +4 -3
  5. package/dist/types/agent-chat.d.ts +4 -3
  6. package/dist/types/agent-design-skill-revision.d.ts +3 -2
  7. package/dist/types/agent-design-skill.d.ts +3 -2
  8. package/dist/types/agent-website-file-overlay.d.ts +3 -2
  9. package/dist/types/agent-website-snapshot.d.ts +4 -3
  10. package/dist/types/agent-website.d.ts +5 -4
  11. package/dist/types/alert-event.d.ts +4 -3
  12. package/dist/types/alert-rule-state.d.ts +3 -2
  13. package/dist/types/alert-rule.d.ts +4 -3
  14. package/dist/types/app-message.d.ts +3 -2
  15. package/dist/types/auto-scaling-group.d.ts +4 -3
  16. package/dist/types/cashier_subscription.d.ts +3 -2
  17. package/dist/types/collab-annotation.d.ts +5 -4
  18. package/dist/types/collab-comment.d.ts +3 -2
  19. package/dist/types/collab-integration.d.ts +3 -2
  20. package/dist/types/collab-push-subscription.d.ts +2 -1
  21. package/dist/types/collab-settings.d.ts +3 -2
  22. package/dist/types/collab-share-token.d.ts +3 -2
  23. package/dist/types/compute.d.ts +7 -6
  24. package/dist/types/domain/dns.d.ts +2 -1
  25. package/dist/types/domain/index.d.ts +8 -7
  26. package/dist/types/domain/renewal.d.ts +2 -1
  27. package/dist/types/domain/transfer.d.ts +5 -4
  28. package/dist/types/env.d.ts +3 -2
  29. package/dist/types/environment-variable.d.ts +4 -3
  30. package/dist/types/index.d.ts +1 -0
  31. package/dist/types/intention.d.ts +2 -1
  32. package/dist/types/load-balancer-port.d.ts +4 -3
  33. package/dist/types/logs.d.ts +6 -4
  34. package/dist/types/member-permission.d.ts +3 -2
  35. package/dist/types/member.d.ts +9 -7
  36. package/dist/types/ownership-transfer.d.ts +4 -3
  37. package/dist/types/permission.d.ts +2 -1
  38. package/dist/types/plan_configuration.d.ts +2 -1
  39. package/dist/types/platform-api-key.d.ts +3 -2
  40. package/dist/types/project/connection.d.ts +3 -2
  41. package/dist/types/project/index.d.ts +14 -13
  42. package/dist/types/project/preview.d.ts +4 -3
  43. package/dist/types/project-config-file.d.ts +3 -2
  44. package/dist/types/project-environment.d.ts +4 -3
  45. package/dist/types/project-network-settings.d.ts +2 -1
  46. package/dist/types/project-tag-assignment.d.ts +5 -4
  47. package/dist/types/ref.d.ts +16 -0
  48. package/dist/types/ref.js +2 -0
  49. package/dist/types/role.d.ts +2 -1
  50. package/dist/types/sandbox-usage-segment.d.ts +5 -4
  51. package/dist/types/sandbox.d.ts +5 -4
  52. package/dist/types/server.d.ts +2 -1
  53. package/dist/types/storage.d.ts +6 -5
  54. package/dist/types/subscription.d.ts +5 -4
  55. package/dist/types/tag.d.ts +3 -2
  56. package/dist/types/team.d.ts +8 -5
  57. package/dist/types/ticket.d.ts +3 -2
  58. package/dist/types/token.d.ts +3 -2
  59. package/dist/types/user.d.ts +4 -3
  60. package/dist/types/volume.d.ts +4 -3
  61. package/dist/types/webhook-event.d.ts +2 -1
  62. package/dist/types/webhook-setting.d.ts +4 -3
  63. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ITeam } from "./team";
3
3
  import { IUser } from "./user";
4
+ import { Ref } from "./ref";
4
5
  export interface IOwnershipTransfer extends Document {
5
- team: ITeam;
6
- from_user: IUser;
7
- to_user: IUser;
6
+ team: Ref<ITeam>;
7
+ from_user: Ref<IUser>;
8
+ to_user: Ref<IUser>;
8
9
  status: "pending" | "accepted" | "denied" | "expired";
9
10
  expires_at: Date;
10
11
  created_at: Date;
@@ -1,9 +1,10 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IRole } from "./role";
3
3
  import { PERMISSION_TYPE, REQUEST_TYPE } from "../enum";
4
+ import { Ref } from "./ref";
4
5
  export interface IPermission extends Document {
5
6
  title: string;
6
- role: IRole[];
7
+ role: Ref<IRole>[];
7
8
  type: PERMISSION_TYPE;
8
9
  request: {
9
10
  route: string;
@@ -1,10 +1,11 @@
1
1
  import { Document } from "mongoose";
2
2
  import { SUBSCRIPTION_PLAN_TYPE } from "../enum";
3
3
  import { IRegion } from "./region";
4
+ import { Ref } from "./ref";
4
5
  export interface IPlanConfiguration extends Document {
5
6
  tag: string;
6
7
  price: number;
7
- region: IRegion;
8
+ region: Ref<IRegion>;
8
9
  alerting: boolean;
9
10
  drain: boolean;
10
11
  slack_support: boolean;
@@ -2,12 +2,13 @@ import { Document, Types } from "mongoose";
2
2
  import { PlatformApiKeyStatus } from "../enum";
3
3
  import { ITeam } from "./team";
4
4
  import { IUser } from "./user";
5
+ import { Ref } from "./ref";
5
6
  export interface IPlatformApiKey extends Document {
6
7
  name: string;
7
8
  key_id: string;
8
9
  key_prefix: string;
9
- owner_id: Types.ObjectId | IUser;
10
- team_id?: Types.ObjectId | ITeam | null;
10
+ owner_id: Ref<IUser>;
11
+ team_id?: Ref<ITeam> | null;
11
12
  subscription_id?: Types.ObjectId | null;
12
13
  permissions: string[];
13
14
  status: PlatformApiKeyStatus;
@@ -1,6 +1,7 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IProject } from ".";
3
+ import { Ref } from "../ref";
3
4
  export interface IProjectConnection extends Document {
4
- service: IProject;
5
- project: IProject;
5
+ service: Ref<IProject>;
6
+ project: Ref<IProject>;
6
7
  }
@@ -12,6 +12,7 @@ import { IAutoScalingGroup } from "../auto-scaling-group";
12
12
  import { IProjectEnvironment } from "../project-environment";
13
13
  import { IRegion } from "../region";
14
14
  import { IVolume } from "../volume";
15
+ import { Ref } from "../ref";
15
16
  export type RuntimeVersions = Record<string, string>;
16
17
  export interface IPgBouncerConfig {
17
18
  defaultPoolSize: number;
@@ -36,8 +37,8 @@ export interface IProject extends Document {
36
37
  buildCacheEnabled?: boolean;
37
38
  alerting_enabled: boolean;
38
39
  logDrainsEnabled: boolean;
39
- domains: Array<IDomain>;
40
- environments: Array<IEnv>;
40
+ domains: Array<Ref<IDomain>>;
41
+ environments: Array<Ref<IEnv>>;
41
42
  uuid: number;
42
43
  pid: number;
43
44
  port: number;
@@ -53,7 +54,7 @@ export interface IProject extends Document {
53
54
  tlsHost?: string | null;
54
55
  tlsPort?: number | null;
55
56
  tlsSslModeHint?: string | null;
56
- dbImage: IDbImage;
57
+ dbImage: Ref<IDbImage>;
57
58
  public: boolean;
58
59
  installCommand: string;
59
60
  buildCommand: string;
@@ -61,7 +62,7 @@ export interface IProject extends Document {
61
62
  outputDirectory: string;
62
63
  runtimeVersions?: RuntimeVersions | null;
63
64
  workBenchEnabled: boolean;
64
- user_id: IUser;
65
+ user_id: Ref<IUser>;
65
66
  monitor_id: string;
66
67
  nomadJobId: string;
67
68
  watchPaths: string[];
@@ -75,14 +76,14 @@ export interface IProject extends Document {
75
76
  } | null;
76
77
  rootDir?: string;
77
78
  dockerfile?: string;
78
- team: ITeam;
79
- server: IServer;
79
+ team: Ref<ITeam>;
80
+ server: Ref<IServer>;
80
81
  isPrivate: boolean;
81
82
  status: PROJECT_STATUS;
82
83
  framework: string;
83
84
  description: string;
84
- logs: Array<ILog>;
85
- log: ILog;
85
+ logs: Array<Ref<ILog>>;
86
+ log: Ref<ILog>;
86
87
  maintenance: boolean;
87
88
  starred: boolean;
88
89
  passwordEnabled: boolean;
@@ -104,8 +105,8 @@ export interface IProject extends Document {
104
105
  lastProcessed: number;
105
106
  tracking_token: string;
106
107
  from: string;
107
- previews: IPreview[];
108
- project_environment?: IProjectEnvironment;
108
+ previews: Ref<IPreview>[];
109
+ project_environment?: Ref<IProjectEnvironment>;
109
110
  inherit_environment_vars: boolean;
110
111
  replicas: number;
111
112
  vaultPath: string | null;
@@ -114,7 +115,7 @@ export interface IProject extends Document {
114
115
  memory: number;
115
116
  cpu: number;
116
117
  storage: number;
117
- region: IRegion;
118
+ region: Ref<IRegion>;
118
119
  };
119
120
  last_requested: Date;
120
121
  isPaused: boolean;
@@ -128,12 +129,12 @@ export interface IProject extends Document {
128
129
  last_backup_url?: string;
129
130
  last_backup_at?: Date;
130
131
  replica_ready: boolean;
131
- autoscaling_group?: IAutoScalingGroup;
132
+ autoscaling_group?: Ref<IAutoScalingGroup>;
132
133
  isPaid: boolean;
133
134
  hasUpdates?: boolean;
134
135
  whiteListedIps?: string[];
135
136
  diskSize?: number;
136
137
  persistent_mount_path?: string;
137
138
  volumeMount: string;
138
- volume: IVolume | null;
139
+ volume: Ref<IVolume> | null;
139
140
  }
@@ -3,6 +3,7 @@ import { IServer } from "../server";
3
3
  import { IProject } from ".";
4
4
  import { PROJECT_STATUS } from "../../enum";
5
5
  import { ILog } from "../logs";
6
+ import { Ref } from "../ref";
6
7
  export interface IPreview extends Document {
7
8
  name: string;
8
9
  healthCheckPath?: string;
@@ -12,11 +13,11 @@ export interface IPreview extends Document {
12
13
  http2: boolean;
13
14
  dir: string;
14
15
  branch: string;
15
- server: IServer;
16
- project: IProject;
16
+ server: Ref<IServer>;
17
+ project: Ref<IProject>;
17
18
  issue_comment_id: number;
18
19
  status: PROJECT_STATUS;
19
- log: ILog;
20
+ log: Ref<ILog>;
20
21
  last_requested: Date;
21
22
  isPaused: boolean;
22
23
  }
@@ -1,13 +1,14 @@
1
1
  import { Document } from "mongoose";
2
2
  import { CONFIG_FILE_VISIBILITY } from "../enum";
3
3
  import { IProject, IUser } from "./";
4
+ import { Ref } from "./ref";
4
5
  export interface IProjectConfigFile extends Document {
5
- project: IProject | string;
6
+ project: Ref<IProject>;
6
7
  name: string;
7
8
  mount_path: string;
8
9
  visibility: CONFIG_FILE_VISIBILITY | "public" | "secret";
9
10
  size: number;
10
- user: IUser | string;
11
+ user: Ref<IUser>;
11
12
  createdAt: Date;
12
13
  updatedAt: Date;
13
14
  }
@@ -1,12 +1,13 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ITeam } from "./team";
3
3
  import { IUser } from "./user";
4
+ import { Ref } from "./ref";
4
5
  export interface IProjectEnvironment extends Document {
5
6
  name: string;
6
7
  slug: string;
7
- owner: IUser;
8
- team?: ITeam;
9
- inherit_from?: IProjectEnvironment;
8
+ owner: Ref<IUser>;
9
+ team?: Ref<ITeam>;
10
+ inherit_from?: Ref<IProjectEnvironment>;
10
11
  isDefault: boolean;
11
12
  createdAt: Date;
12
13
  updatedAt: Date;
@@ -1,8 +1,9 @@
1
1
  import { Document } from "mongoose";
2
2
  import { XContentTypeOptions, XFrameOptions, XRobotsTag } from "../enum";
3
3
  import { IProject } from "./project";
4
+ import { Ref } from "./ref";
4
5
  export interface IProjectNetworkSettings extends Document {
5
- project: IProject;
6
+ project: Ref<IProject>;
6
7
  cache: {
7
8
  purgeOnDeploy: boolean;
8
9
  bypassCache: boolean;
@@ -3,11 +3,12 @@ import { ITag } from "./tag";
3
3
  import { IProject } from "./project";
4
4
  import { ITeam } from "./team";
5
5
  import { IUser } from "./user";
6
+ import { Ref } from "./ref";
6
7
  export interface IProjectTagAssignment extends Document {
7
- tagId: ITag;
8
- projectId: IProject;
9
- teamId: ITeam;
10
- assignedBy: IUser;
8
+ tagId: Ref<ITag>;
9
+ projectId: Ref<IProject>;
10
+ teamId: Ref<ITeam>;
11
+ assignedBy: Ref<IUser>;
11
12
  createdAt: Date;
12
13
  updatedAt: Date;
13
14
  }
@@ -0,0 +1,16 @@
1
+ import { Types } from "mongoose";
2
+ /**
3
+ * A Mongoose reference field. Holds an `ObjectId` unless the query populated it,
4
+ * so consumers must narrow before reading the referenced document.
5
+ */
6
+ export type Ref<T> = T | Types.ObjectId;
7
+ type PopulatedField<V> = V extends (infer E)[] ? Exclude<E, Types.ObjectId>[] : Exclude<V, Types.ObjectId>;
8
+ /**
9
+ * Narrows the named reference fields of `T` to their populated documents. Use it
10
+ * on query return types so the populate contract lives with the query that
11
+ * performs it rather than at every call site.
12
+ */
13
+ export type Populated<T, K extends keyof T> = Omit<T, K> & {
14
+ [P in K]: PopulatedField<T[P]>;
15
+ };
16
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,10 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ROLES } from "../enum";
3
3
  import { IPermission } from "./permission";
4
+ import { Ref } from "./ref";
4
5
  export interface IRole extends Document {
5
6
  type: ROLES;
6
7
  description?: string;
7
8
  is_custom?: boolean;
8
- permissions: IPermission[];
9
+ permissions: Ref<IPermission>[];
9
10
  }
@@ -1,7 +1,8 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { ISandbox } from "./sandbox";
3
3
  import { IUser } from "./user";
4
4
  import { ITeam } from "./team";
5
+ import { Ref } from "./ref";
5
6
  export interface ISandboxUsageSegmentCurrent {
6
7
  cpu: number;
7
8
  memory: number;
@@ -12,9 +13,9 @@ export interface ISandboxUsageSegmentCosts {
12
13
  endDate: Date | null;
13
14
  }
14
15
  export interface ISandboxUsageSegment extends Document {
15
- sandbox_id: ISandbox | Types.ObjectId;
16
- user_id: IUser | Types.ObjectId;
17
- team_id: ITeam | Types.ObjectId | null;
16
+ sandbox_id: Ref<ISandbox>;
17
+ user_id: Ref<IUser>;
18
+ team_id: Ref<ITeam> | null;
18
19
  current: ISandboxUsageSegmentCurrent;
19
20
  costs: ISandboxUsageSegmentCosts;
20
21
  billed: boolean;
@@ -4,6 +4,7 @@ import { ITeam } from "./team";
4
4
  import { IProjectEnvironment } from "./project-environment";
5
5
  import { SANDBOX_STATUS, SANDBOX_DESTROY_REASON, SANDBOX_EGRESS_MODE } from "../enum";
6
6
  import { IRegion } from "./region";
7
+ import { Ref } from "./ref";
7
8
  export interface ISandboxSpecs {
8
9
  cpu: number;
9
10
  memory: number;
@@ -15,14 +16,14 @@ export interface ISandboxEgress {
15
16
  }
16
17
  export interface ISandbox extends Document {
17
18
  name: string;
18
- user_id: IUser | Types.ObjectId;
19
- team: ITeam | Types.ObjectId | null;
20
- project_environment: IProjectEnvironment | Types.ObjectId | null;
19
+ user_id: Ref<IUser>;
20
+ team: Ref<ITeam> | null;
21
+ project_environment: Ref<IProjectEnvironment> | null;
21
22
  template: string;
22
23
  status: SANDBOX_STATUS;
23
24
  nomad_job_id: string;
24
25
  nomad_alloc_id: string | null;
25
- region: IRegion;
26
+ region: Ref<IRegion>;
26
27
  specs: ISandboxSpecs;
27
28
  size: string | null;
28
29
  created_at: Date;
@@ -1,6 +1,7 @@
1
1
  import mongoose, { Document } from "mongoose";
2
2
  import { SERVER_STATUS, SERVER_PROTOCOL } from "../enum";
3
3
  import { IRegion } from "./region";
4
+ import { Ref } from "./ref";
4
5
  export interface IServer extends Document {
5
6
  name: string;
6
7
  url: string;
@@ -19,7 +20,7 @@ export interface IServer extends Document {
19
20
  status: SERVER_STATUS;
20
21
  default: boolean;
21
22
  tag: string;
22
- region: IRegion;
23
+ region: Ref<IRegion>;
23
24
  webhook_url?: string;
24
25
  is_custom_provision: boolean;
25
26
  firewall_id?: string;
@@ -1,5 +1,6 @@
1
1
  import { Document, Types } from "mongoose";
2
2
  import { IProjectEnvironment } from "./project-environment";
3
+ import { Ref } from "./ref";
3
4
  import { StorageBucketStatus, StorageCredentialRole, StorageCredentialStatus, StorageMigrationStatus, StorageTokenStatus, StorageUploadStatus } from "../enum";
4
5
  export type StorageTokenPermission = "read" | "write" | "delete" | "list" | "admin";
5
6
  export type StorageCorsRule = {
@@ -23,7 +24,7 @@ export type StorageLifecycleRuleTransition = {
23
24
  export interface IStorageBucket extends Document {
24
25
  name: string;
25
26
  project?: Types.ObjectId;
26
- project_environment?: IProjectEnvironment | Types.ObjectId;
27
+ project_environment?: Ref<IProjectEnvironment>;
27
28
  user_id?: Types.ObjectId;
28
29
  team?: Types.ObjectId;
29
30
  bucket_name: string;
@@ -46,7 +47,7 @@ export interface IStorageBucket extends Document {
46
47
  export interface IStorageObject extends Document {
47
48
  bucket: Types.ObjectId;
48
49
  project?: Types.ObjectId;
49
- project_environment?: IProjectEnvironment | Types.ObjectId;
50
+ project_environment?: Ref<IProjectEnvironment>;
50
51
  key: string;
51
52
  path: string;
52
53
  content_type?: string;
@@ -60,7 +61,7 @@ export interface IStorageObject extends Document {
60
61
  export interface IStorageUpload extends Document {
61
62
  bucket: Types.ObjectId;
62
63
  project?: Types.ObjectId;
63
- project_environment?: IProjectEnvironment | Types.ObjectId;
64
+ project_environment?: Ref<IProjectEnvironment>;
64
65
  key: string;
65
66
  path: string;
66
67
  upload_id?: string;
@@ -91,7 +92,7 @@ export interface IStorageCredential extends Document {
91
92
  name: string;
92
93
  bucket: Types.ObjectId;
93
94
  project?: Types.ObjectId;
94
- project_environment?: IProjectEnvironment | Types.ObjectId;
95
+ project_environment?: Ref<IProjectEnvironment>;
95
96
  user_id?: Types.ObjectId;
96
97
  team?: Types.ObjectId;
97
98
  provider: string;
@@ -108,7 +109,7 @@ export interface IStorageCredential extends Document {
108
109
  export interface IStorageMigration extends Document {
109
110
  bucket: Types.ObjectId;
110
111
  project?: Types.ObjectId;
111
- project_environment?: IProjectEnvironment | Types.ObjectId;
112
+ project_environment?: Ref<IProjectEnvironment>;
112
113
  user_id?: Types.ObjectId;
113
114
  team?: Types.ObjectId;
114
115
  source_bucket: string;
@@ -3,14 +3,15 @@ import { SUBSCRIPTION_PLAN_TYPE, SUBSCRIPTION_STATUS } from "../enum";
3
3
  import { IUser } from "./user";
4
4
  import { ITeam } from "./team";
5
5
  import { IProject } from "./project";
6
+ import { Ref } from "./ref";
6
7
  export interface ISubscription extends Document {
7
8
  initial_start_date: string;
8
- team_id: ITeam;
9
+ team_id: Ref<ITeam>;
9
10
  due_amount: number;
10
- admin_id: IUser;
11
+ admin_id: Ref<IUser>;
11
12
  downgraded: boolean;
12
- billable_id: IUser;
13
- project_id?: IProject;
13
+ billable_id: Ref<IUser>;
14
+ project_id?: Ref<IProject>;
14
15
  plan_type: SUBSCRIPTION_PLAN_TYPE;
15
16
  status: SUBSCRIPTION_STATUS;
16
17
  amount: number;
@@ -1,11 +1,12 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ITeam } from "./team";
3
3
  import { IUser } from "./user";
4
+ import { Ref } from "./ref";
4
5
  export interface ITag extends Document {
5
6
  name: string;
6
7
  color: string;
7
- teamId: ITeam;
8
- createdBy: IUser;
8
+ teamId: Ref<ITeam>;
9
+ createdBy: Ref<IUser>;
9
10
  createdAt: Date;
10
11
  updatedAt: Date;
11
12
  }
@@ -1,13 +1,14 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { IMember, IProject, ISubscription, IUser } from "./";
3
3
  import { BUILD_DISABLED_BY, SPENDING_LIMIT_ACTION } from "../enum";
4
+ import { Ref } from "./ref";
4
5
  export interface ITeam extends Document {
5
6
  name: string;
6
7
  slug: string;
7
8
  description: string;
8
9
  size: number;
9
- members: IMember[];
10
- projects: IProject[];
10
+ members: Ref<IMember>[];
11
+ projects: Ref<IProject>[];
11
12
  ai_usage_count: number;
12
13
  image: string;
13
14
  isCreator: boolean;
@@ -21,8 +22,10 @@ export interface ITeam extends Document {
21
22
  build_disabled_by: BUILD_DISABLED_BY;
22
23
  sandbox_disabled: boolean;
23
24
  sandbox_disabled_by: "system" | "payment_failure" | null;
24
- subscription: ISubscription;
25
+ subscription: Ref<ISubscription>;
25
26
  enforce_2fa: boolean;
26
27
  enforce_2fa_at: Date | null;
27
- enforce_2fa_by: IUser | Types.ObjectId | null;
28
+ enforce_2fa_by: Ref<IUser> | null;
29
+ createdAt: Date;
30
+ updatedAt: Date;
28
31
  }
@@ -1,8 +1,9 @@
1
- import { Document, Types } from "mongoose";
1
+ import { Document } from "mongoose";
2
2
  import { IUser } from "./user";
3
+ import { Ref } from "./ref";
3
4
  export interface ITicket extends Document {
4
5
  airtable_id: string;
5
- user_id: IUser | Types.ObjectId;
6
+ user_id: Ref<IUser>;
6
7
  email: string;
7
8
  subject: string;
8
9
  message: string;
@@ -1,9 +1,10 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ISubscription } from "./subscription";
3
3
  import { IUser } from "./user";
4
+ import { Ref } from "./ref";
4
5
  export interface IToken extends Document {
5
- subscription_id: ISubscription;
6
- owner_id: IUser;
6
+ subscription_id: Ref<ISubscription>;
7
+ owner_id: Ref<IUser>;
7
8
  key_id: string;
8
9
  key: string;
9
10
  tokens_remaining: number;
@@ -2,6 +2,7 @@ import { Document } from "mongoose";
2
2
  import { IFollowing, IProject, ITeam } from "./";
3
3
  import { IGit, IOrigin } from "./git";
4
4
  import { BUILD_DISABLED_BY, SPENDING_LIMIT_ACTION } from "../enum";
5
+ import { Ref } from "./ref";
5
6
  export interface IUser extends Document {
6
7
  first_name: string;
7
8
  last_name: string;
@@ -19,9 +20,9 @@ export interface IUser extends Document {
19
20
  interests: Array<string>;
20
21
  bitbucket: IGit;
21
22
  origin?: IOrigin;
22
- following: IFollowing[];
23
- projects: IProject[];
24
- teams: ITeam[];
23
+ following: Ref<IFollowing>[];
24
+ projects: Ref<IProject>[];
25
+ teams: Ref<ITeam>[];
25
26
  avatar: string;
26
27
  freeTrialActive: boolean;
27
28
  activated: boolean;
@@ -2,16 +2,17 @@ import { Document, Types } from "mongoose";
2
2
  import { IUser } from "./user";
3
3
  import { ITeam } from "./team";
4
4
  import { IRegion } from "./region";
5
+ import { Ref } from "./ref";
5
6
  export interface IVolume extends Document {
6
7
  name: string;
7
- user?: IUser;
8
- team?: ITeam;
8
+ user?: Ref<IUser>;
9
+ team?: Ref<ITeam>;
9
10
  namespace: string;
10
11
  size: number;
11
12
  type: string;
12
13
  mount_path?: string;
13
14
  csi_volume_id: string | null;
14
- region: IRegion | null;
15
+ region: Ref<IRegion> | null;
15
16
  attached_sandbox_id: Types.ObjectId | null;
16
17
  attached_project_id: Types.ObjectId | null;
17
18
  last_attached_at: Date | null;
@@ -1,7 +1,8 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IWebhookCategory } from "./webhook-category";
3
+ import { Ref } from "./ref";
3
4
  export interface IWebhookEvent extends Document {
4
5
  name: string;
5
- category: IWebhookCategory;
6
+ category: Ref<IWebhookCategory>;
6
7
  description: string;
7
8
  }
@@ -3,10 +3,11 @@ import { IWebhookEvent } from "./webhook-event";
3
3
  import { ISubscription } from "./subscription";
4
4
  import { IUser } from "./user";
5
5
  import { ITeam } from "./team";
6
+ import { Ref } from "./ref";
6
7
  export interface IWebhookSetting extends Document {
7
- user_id: IUser;
8
- team_id?: ITeam;
9
- subscription_id: ISubscription;
8
+ user_id: Ref<IUser>;
9
+ team_id?: Ref<ITeam>;
10
+ subscription_id: Ref<ISubscription>;
10
11
  webhook_id: string;
11
12
  external_webhook_url?: string;
12
13
  webhookUrl: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.156",
3
+ "version": "4.0.0",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",