@brimble/models 3.8.6 → 3.8.10
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.
- package/.claude/settings.local.json +7 -0
- package/activity-log.ts +66 -0
- package/app-message.ts +3 -2
- package/cashier_subscription.ts +7 -3
- package/db-image.ts +5 -0
- package/dist/activity-log.d.ts +30 -0
- package/dist/activity-log.js +61 -0
- package/dist/app-message.js +3 -2
- package/dist/cashier_subscription.js +7 -3
- package/dist/db-image.js +5 -0
- package/dist/domain/index.js +6 -0
- package/dist/enum/index.d.ts +20 -6
- package/dist/enum/index.js +22 -6
- package/dist/env.js +0 -8
- package/dist/environment-variable.d.ts +30 -0
- package/dist/environment-variable.js +16 -0
- package/dist/framework.js +5 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +19 -5
- package/dist/member.js +1 -0
- package/dist/ownership-transfer.d.ts +30 -0
- package/dist/ownership-transfer.js +35 -0
- package/dist/plan_configuration.js +5 -0
- package/dist/project/index.js +28 -6
- package/dist/project-environment.d.ts +30 -0
- package/dist/project-environment.js +13 -0
- package/dist/project_analytics.d.ts +30 -0
- package/dist/project_analytics.js +18 -0
- package/dist/sandbox-image.d.ts +30 -0
- package/dist/sandbox-image.js +31 -0
- package/dist/{branch.d.ts → sandbox.d.ts} +2 -2
- package/dist/sandbox.js +89 -0
- package/dist/team.js +34 -0
- package/dist/types/activity-log.d.ts +18 -0
- package/dist/types/app-message.d.ts +3 -2
- package/dist/types/cashier_subscription.d.ts +4 -2
- package/dist/types/db-image.d.ts +1 -0
- package/dist/types/domain/index.d.ts +2 -1
- package/dist/types/env.d.ts +0 -3
- package/dist/types/environment-variable.d.ts +12 -0
- package/dist/types/environment-variable.js +2 -0
- package/dist/types/framework.d.ts +1 -0
- package/dist/types/index.d.ts +7 -1
- package/dist/types/member.d.ts +2 -0
- package/dist/types/ownership-transfer.d.ts +12 -0
- package/dist/types/ownership-transfer.js +2 -0
- package/dist/types/plan_configuration.d.ts +5 -0
- package/dist/types/project/index.d.ts +6 -2
- package/dist/types/project-environment.d.ts +13 -0
- package/dist/types/project-environment.js +2 -0
- package/dist/types/project_analytics.d.ts +11 -0
- package/dist/types/project_analytics.js +2 -0
- package/dist/types/sandbox-image.d.ts +9 -0
- package/dist/types/sandbox-image.js +2 -0
- package/dist/types/sandbox.d.ts +30 -0
- package/dist/types/sandbox.js +2 -0
- package/dist/types/team.d.ts +10 -2
- package/dist/types/user.d.ts +3 -0
- package/dist/types/wallet.d.ts +4 -0
- package/dist/user.js +7 -0
- package/dist/wallet.js +16 -0
- package/domain/index.ts +6 -0
- package/enum/index.ts +21 -5
- package/env.ts +0 -8
- package/environment-variable.ts +21 -0
- package/framework.ts +5 -0
- package/index.ts +19 -4
- package/member.ts +1 -0
- package/ownership-transfer.ts +42 -0
- package/package.json +1 -1
- package/plan_configuration.ts +5 -0
- package/project/index.ts +32 -6
- package/project-environment.ts +18 -0
- package/project_analytics.ts +26 -0
- package/sandbox-image.ts +35 -0
- package/sandbox.ts +91 -0
- package/team.ts +34 -0
- package/types/activity-log.ts +19 -0
- package/types/app-message.ts +3 -2
- package/types/cashier_subscription.ts +4 -2
- package/types/db-image.ts +1 -0
- package/types/domain/index.ts +2 -1
- package/types/env.ts +0 -3
- package/types/environment-variable.ts +13 -0
- package/types/framework.ts +3 -2
- package/types/index.ts +7 -1
- package/types/member.ts +2 -0
- package/types/ownership-transfer.ts +13 -0
- package/types/plan_configuration.ts +5 -0
- package/types/project/index.ts +6 -2
- package/types/project-environment.ts +14 -0
- package/types/project_analytics.ts +12 -0
- package/types/sandbox-image.ts +10 -0
- package/types/sandbox.ts +32 -0
- package/types/team.ts +10 -2
- package/types/user.ts +3 -0
- package/types/wallet.ts +4 -0
- package/user.ts +7 -0
- package/wallet.ts +16 -0
- package/branch.ts +0 -22
- package/dist/branch.js +0 -17
- package/dist/types/branch.d.ts +0 -17
- package/types/branch.ts +0 -18
- /package/dist/types/{branch.js → activity-log.js} +0 -0
|
@@ -6,16 +6,18 @@ import { ILog } from "../logs";
|
|
|
6
6
|
import { ITeam } from "../team";
|
|
7
7
|
import { IUser } from "../user";
|
|
8
8
|
import { IServer } from "../server";
|
|
9
|
-
import { IBranch } from "../branch";
|
|
10
9
|
import { IPreview } from "./preview";
|
|
11
10
|
import { IDbImage } from "../db-image";
|
|
12
11
|
import { IAutoScalingGroup } from "../auto-scaling-group";
|
|
12
|
+
import { IProjectEnvironment } from "../project-environment";
|
|
13
13
|
import { IRegion } from "../region";
|
|
14
14
|
export interface IProject extends Document {
|
|
15
15
|
name: string;
|
|
16
16
|
healthCheckPath?: string;
|
|
17
17
|
preStartCommand?: string;
|
|
18
18
|
backupEnabled: boolean;
|
|
19
|
+
free_tier_expires_at?: Date | null;
|
|
20
|
+
free_tier_expiry_notified_at?: Date | null;
|
|
19
21
|
buildCacheEnabled?: boolean;
|
|
20
22
|
domains: Array<IDomain>;
|
|
21
23
|
environments: Array<IEnv>;
|
|
@@ -33,6 +35,7 @@ export interface IProject extends Document {
|
|
|
33
35
|
user_id: IUser;
|
|
34
36
|
monitor_id: string;
|
|
35
37
|
nomadJobId: string;
|
|
38
|
+
watchPaths: string[];
|
|
36
39
|
repo: {
|
|
37
40
|
name: string;
|
|
38
41
|
full_name: string;
|
|
@@ -67,7 +70,8 @@ export interface IProject extends Document {
|
|
|
67
70
|
tracking_token: string;
|
|
68
71
|
from: string;
|
|
69
72
|
previews: IPreview[];
|
|
70
|
-
|
|
73
|
+
project_environment?: IProjectEnvironment;
|
|
74
|
+
inherit_environment_vars: boolean;
|
|
71
75
|
replicas: number;
|
|
72
76
|
vaultPath: string | null;
|
|
73
77
|
vaultToken: string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { ITeam } from "./team";
|
|
3
|
+
import { IUser } from "./user";
|
|
4
|
+
export interface IProjectEnvironment extends Document {
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
owner: IUser;
|
|
8
|
+
team?: ITeam;
|
|
9
|
+
inherit_from?: IProjectEnvironment;
|
|
10
|
+
isDefault: boolean;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
export interface IProjectAnalytics extends Document {
|
|
3
|
+
project: Types.ObjectId;
|
|
4
|
+
provider: "umami";
|
|
5
|
+
websiteId: string;
|
|
6
|
+
shareId?: string | null;
|
|
7
|
+
domain: string;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { IUser } from "./user";
|
|
3
|
+
import { ITeam } from "./team";
|
|
4
|
+
import { IProjectEnvironment } from "./project-environment";
|
|
5
|
+
import { SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "../enum";
|
|
6
|
+
export interface ISandboxSpecs {
|
|
7
|
+
cpu: number;
|
|
8
|
+
memory: number;
|
|
9
|
+
disk: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ISandbox extends Document {
|
|
12
|
+
user_id: IUser | Types.ObjectId;
|
|
13
|
+
team: ITeam | Types.ObjectId | null;
|
|
14
|
+
project_environment: IProjectEnvironment | Types.ObjectId | null;
|
|
15
|
+
template: string;
|
|
16
|
+
status: SANDBOX_STATUS;
|
|
17
|
+
nomad_job_id: string;
|
|
18
|
+
nomad_alloc_id: string | null;
|
|
19
|
+
host: string | null;
|
|
20
|
+
port: number | null;
|
|
21
|
+
agent_token_hash: string | null;
|
|
22
|
+
region: string;
|
|
23
|
+
specs: ISandboxSpecs;
|
|
24
|
+
created_at: Date;
|
|
25
|
+
last_activity_at: Date;
|
|
26
|
+
expires_at: Date;
|
|
27
|
+
destroyed_at: Date | null;
|
|
28
|
+
destroy_reason: SANDBOX_DESTROY_REASON | null;
|
|
29
|
+
isDeleted: boolean;
|
|
30
|
+
}
|
package/dist/types/team.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { Document } from "mongoose";
|
|
2
|
-
import { IMember, IProject, ISubscription } from "./";
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { IMember, IProject, ISubscription, IUser } from "./";
|
|
3
3
|
import { BUILD_DISABLED_BY } from "../enum";
|
|
4
4
|
export interface ITeam extends Document {
|
|
5
5
|
name: string;
|
|
6
6
|
description: string;
|
|
7
|
+
size: number;
|
|
7
8
|
members: IMember[];
|
|
8
9
|
projects: IProject[];
|
|
10
|
+
ai_usage_count: number;
|
|
9
11
|
image: string;
|
|
10
12
|
isCreator: boolean;
|
|
13
|
+
build_minutes: number;
|
|
14
|
+
build_minutes_last_reset_at: Date | null;
|
|
15
|
+
build_minutes_cycle_anchor: Date | null;
|
|
11
16
|
build_disabled: boolean;
|
|
12
17
|
build_disabled_by: BUILD_DISABLED_BY;
|
|
13
18
|
subscription: ISubscription;
|
|
19
|
+
enforce_2fa: boolean;
|
|
20
|
+
enforce_2fa_at: Date | null;
|
|
21
|
+
enforce_2fa_by: IUser | Types.ObjectId | null;
|
|
14
22
|
}
|
package/dist/types/user.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface IUser extends Document {
|
|
|
12
12
|
verification_token: number;
|
|
13
13
|
token?: string;
|
|
14
14
|
company?: string;
|
|
15
|
+
ai_usage_count: number;
|
|
15
16
|
github: IGit;
|
|
16
17
|
gitlab: IGit;
|
|
17
18
|
location: string;
|
|
@@ -30,10 +31,12 @@ export interface IUser extends Document {
|
|
|
30
31
|
build_minutes: number;
|
|
31
32
|
disabled: boolean;
|
|
32
33
|
disabled_at: Date;
|
|
34
|
+
has_payment_method: boolean;
|
|
33
35
|
notifications: {
|
|
34
36
|
email: boolean;
|
|
35
37
|
mute: boolean;
|
|
36
38
|
};
|
|
39
|
+
totp_enabled?: boolean;
|
|
37
40
|
created_at: Date;
|
|
38
41
|
updated_at: Date;
|
|
39
42
|
}
|
package/dist/types/wallet.d.ts
CHANGED
package/dist/user.js
CHANGED
|
@@ -39,6 +39,11 @@ const userSchema = new mongoose_1.Schema({
|
|
|
39
39
|
type: String,
|
|
40
40
|
required: false,
|
|
41
41
|
},
|
|
42
|
+
ai_usage_count: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 0,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
42
47
|
tenant: { type: mongoose_1.Schema.Types.ObjectId, ref: "Tenancy", required: false },
|
|
43
48
|
is_waitlist: { type: Boolean, default: true },
|
|
44
49
|
spending_limit: { type: Number },
|
|
@@ -46,6 +51,8 @@ const userSchema = new mongoose_1.Schema({
|
|
|
46
51
|
notifications: Object,
|
|
47
52
|
disabled: Boolean,
|
|
48
53
|
disabled_at: Date,
|
|
54
|
+
has_payment_method: Boolean,
|
|
55
|
+
totp_enabled: { type: Boolean, default: false },
|
|
49
56
|
}, {
|
|
50
57
|
timestamps: {
|
|
51
58
|
createdAt: "created_at",
|
package/dist/wallet.js
CHANGED
|
@@ -6,5 +6,21 @@ const walletSchema = new mongoose_1.Schema({
|
|
|
6
6
|
type: Number,
|
|
7
7
|
required: true,
|
|
8
8
|
},
|
|
9
|
+
enabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: true,
|
|
12
|
+
},
|
|
13
|
+
slug: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
provider: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
discounted: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
}
|
|
9
25
|
});
|
|
10
26
|
exports.default = (0, mongoose_1.model)("Wallet", walletSchema);
|
package/domain/index.ts
CHANGED
|
@@ -91,6 +91,12 @@ const domainSchema = new Schema(
|
|
|
91
91
|
type: Schema.Types.ObjectId,
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
|
+
project_environment: {
|
|
95
|
+
ref: "ProjectEnvironment",
|
|
96
|
+
type: Schema.Types.ObjectId,
|
|
97
|
+
required: false,
|
|
98
|
+
default: null,
|
|
99
|
+
},
|
|
94
100
|
is_pending_verification: Boolean,
|
|
95
101
|
redirect: {
|
|
96
102
|
url: String,
|
package/enum/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export enum SERVER_PROTOCOL {
|
|
|
16
16
|
export enum BUILD_DISABLED_BY {
|
|
17
17
|
System = "system",
|
|
18
18
|
User = "user",
|
|
19
|
+
Payment = "payment_failure"
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export enum REQUEST_TYPE {
|
|
@@ -111,6 +112,7 @@ export enum ROLES {
|
|
|
111
112
|
CREATOR = "CREATOR",
|
|
112
113
|
ADMINISTRATOR = "ADMINISTRATOR",
|
|
113
114
|
MEMBER = "MEMBER",
|
|
115
|
+
VIEWER = "VIEWER"
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
export enum PERMISSION_TYPE {
|
|
@@ -212,11 +214,6 @@ export enum NomadDeploymentStatus {
|
|
|
212
214
|
NOMAD_FAILED = 'nomad_failed',
|
|
213
215
|
}
|
|
214
216
|
|
|
215
|
-
export enum BRANCH_TYPE {
|
|
216
|
-
USER_CREATED = "USER_CREATED",
|
|
217
|
-
PREVIEW = "PREVIEW",
|
|
218
|
-
}
|
|
219
|
-
|
|
220
217
|
export enum COLLAB_ANNOTATION_STATUS {
|
|
221
218
|
OPEN = "open",
|
|
222
219
|
RESOLVED = "resolved",
|
|
@@ -258,3 +255,22 @@ export enum INVOICE_TYPE {
|
|
|
258
255
|
INVOICE = "invoice",
|
|
259
256
|
RECEIPT = "receipt",
|
|
260
257
|
}
|
|
258
|
+
|
|
259
|
+
export enum SANDBOX_TEMPLATE {
|
|
260
|
+
PYTHON = "python",
|
|
261
|
+
NODE = "node",
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export enum SANDBOX_STATUS {
|
|
265
|
+
STARTING = "starting",
|
|
266
|
+
READY = "ready",
|
|
267
|
+
FAILED = "failed",
|
|
268
|
+
DESTROYED = "destroyed",
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export enum SANDBOX_DESTROY_REASON {
|
|
272
|
+
USER = "user",
|
|
273
|
+
IDLE_TTL = "idle_ttl",
|
|
274
|
+
MAX_LIFETIME = "max_lifetime",
|
|
275
|
+
FAILED = "failed",
|
|
276
|
+
}
|
package/env.ts
CHANGED
|
@@ -26,14 +26,6 @@ const envSchema = new Schema(
|
|
|
26
26
|
default: ENVIRONMENT.PRODUCTION,
|
|
27
27
|
required: true,
|
|
28
28
|
},
|
|
29
|
-
branch: {
|
|
30
|
-
ref: "Branch",
|
|
31
|
-
type: Schema.Types.ObjectId,
|
|
32
|
-
},
|
|
33
|
-
inheritable: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: true,
|
|
36
|
-
},
|
|
37
29
|
is_system: {
|
|
38
30
|
type: Boolean,
|
|
39
31
|
default: false,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IEnvironmentVariable } from "./types";
|
|
3
|
+
|
|
4
|
+
const environmentVariableSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
name: { type: String, required: true },
|
|
7
|
+
value: { type: String, required: true },
|
|
8
|
+
project_environment: {
|
|
9
|
+
ref: "ProjectEnvironment",
|
|
10
|
+
type: Schema.Types.ObjectId,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
user: { ref: "User", type: Schema.Types.ObjectId, required: true },
|
|
14
|
+
inheritable: { type: Boolean, default: true },
|
|
15
|
+
},
|
|
16
|
+
{ timestamps: true },
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
environmentVariableSchema.index({ name: 1, project_environment: 1 }, { unique: true });
|
|
20
|
+
|
|
21
|
+
export default model<IEnvironmentVariable>("EnvironmentVariable", environmentVariableSchema);
|
package/framework.ts
CHANGED
package/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as User } from "./user";
|
|
2
2
|
export { default as Project, DeletedProject } from "./project";
|
|
3
|
+
export { default as ProjectAnalytics } from "./project_analytics";
|
|
3
4
|
export { default as Preview } from "./project/preview";
|
|
4
5
|
export { default as ProjectConnection } from "./project/connection";
|
|
5
6
|
export { default as Following } from "./following";
|
|
@@ -36,7 +37,6 @@ export { default as WebhookEvent } from "./webhook-event";
|
|
|
36
37
|
export { default as WebhookSetting } from "./webhook-setting";
|
|
37
38
|
export { default as Intention } from "./intention";
|
|
38
39
|
export { default as Provider } from "./provider";
|
|
39
|
-
export { default as Branch } from "./branch";
|
|
40
40
|
export { default as CollabAnnotation } from "./collab-annotation";
|
|
41
41
|
export { default as CollabComment } from "./collab-comment";
|
|
42
42
|
export { default as CollabIntegration } from "./collab-integration";
|
|
@@ -49,11 +49,18 @@ export { default as Tag } from "./tag";
|
|
|
49
49
|
export { default as ProjectTagAssignment } from "./project-tag-assignment";
|
|
50
50
|
export { default as CashierSubscription } from "./cashier_subscription";
|
|
51
51
|
export { default as CashierSubscriptionItem } from "./cashier_subscription_item";
|
|
52
|
+
export { default as ProjectEnvironment } from "./project-environment";
|
|
53
|
+
export { default as EnvironmentVariable } from "./environment-variable";
|
|
54
|
+
export { default as ActivityLog } from "./activity-log";
|
|
55
|
+
export { default as OwnershipTransfer } from "./ownership-transfer";
|
|
56
|
+
export { default as Sandbox } from "./sandbox";
|
|
57
|
+
export { default as SandboxImage } from "./sandbox-image";
|
|
52
58
|
|
|
53
59
|
export {
|
|
54
60
|
IUser,
|
|
55
61
|
IGit,
|
|
56
62
|
IProject,
|
|
63
|
+
IProjectAnalytics,
|
|
57
64
|
IPreview,
|
|
58
65
|
IProjectConnection,
|
|
59
66
|
IFollowing,
|
|
@@ -92,7 +99,6 @@ export {
|
|
|
92
99
|
IWebhookSetting,
|
|
93
100
|
IIntention,
|
|
94
101
|
IProvider,
|
|
95
|
-
IBranch,
|
|
96
102
|
ICollabAnnotation,
|
|
97
103
|
ICollabComment,
|
|
98
104
|
ICollabAttachment,
|
|
@@ -106,6 +112,13 @@ export {
|
|
|
106
112
|
IProjectTagAssignment,
|
|
107
113
|
ICashierSubscription,
|
|
108
114
|
ICashierSubscriptionItem,
|
|
115
|
+
IProjectEnvironment,
|
|
116
|
+
IEnvironmentVariable,
|
|
117
|
+
IActivityLog,
|
|
118
|
+
IOwnershipTransfer,
|
|
119
|
+
ISandbox,
|
|
120
|
+
ISandboxSpecs,
|
|
121
|
+
ISandboxImage,
|
|
109
122
|
} from "./types";
|
|
110
123
|
export {
|
|
111
124
|
GIT_TYPE,
|
|
@@ -135,14 +148,16 @@ export {
|
|
|
135
148
|
DomainTransferDirection,
|
|
136
149
|
DomainTransferStatus,
|
|
137
150
|
NomadDeploymentStatus,
|
|
138
|
-
BRANCH_TYPE,
|
|
139
151
|
COLLAB_ANNOTATION_STATUS,
|
|
140
152
|
COLLAB_INTEGRATION_TYPE,
|
|
141
153
|
COLLAB_THEME,
|
|
142
154
|
COLLAB_TOOLBAR_POSITION,
|
|
143
155
|
INVOICE_STATUS,
|
|
144
156
|
INVOICE_PAYMENT_STATUS,
|
|
145
|
-
INVOICE_TYPE
|
|
157
|
+
INVOICE_TYPE,
|
|
158
|
+
SANDBOX_TEMPLATE,
|
|
159
|
+
SANDBOX_STATUS,
|
|
160
|
+
SANDBOX_DESTROY_REASON,
|
|
146
161
|
} from "./enum";
|
|
147
162
|
|
|
148
163
|
import mongoose from "mongoose";
|
package/member.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IOwnershipTransfer } from "./types";
|
|
3
|
+
|
|
4
|
+
const ownershipTransferSchema: Schema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
team: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
ref: "Team",
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
from_user: {
|
|
12
|
+
type: Schema.Types.ObjectId,
|
|
13
|
+
ref: "User",
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
to_user: {
|
|
17
|
+
type: Schema.Types.ObjectId,
|
|
18
|
+
ref: "User",
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
status: {
|
|
22
|
+
type: String,
|
|
23
|
+
enum: ["pending", "accepted", "denied", "expired"],
|
|
24
|
+
default: "pending",
|
|
25
|
+
},
|
|
26
|
+
expires_at: {
|
|
27
|
+
type: Date,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
timestamps: {
|
|
33
|
+
createdAt: "created_at",
|
|
34
|
+
updatedAt: "updated_at",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export default model<IOwnershipTransfer>(
|
|
40
|
+
"OwnershipTransfer",
|
|
41
|
+
ownershipTransferSchema,
|
|
42
|
+
);
|
package/package.json
CHANGED
package/plan_configuration.ts
CHANGED
|
@@ -16,10 +16,13 @@ const PlanConfigurationSchema = new Schema<IPlanConfiguration>(
|
|
|
16
16
|
log_retention: { type: Number, required: true },
|
|
17
17
|
bandwidth: { type: Number, required: true },
|
|
18
18
|
price: { type: Number, required: true },
|
|
19
|
+
password_enabled: { type: Boolean, required: false, default: true },
|
|
19
20
|
autoscaling_enabled: { type: Boolean, default: false, required: false },
|
|
20
21
|
region: { type: Schema.Types.ObjectId, ref: "Region", required: false },
|
|
21
22
|
multi_region: { type: Boolean, default: false },
|
|
22
23
|
unlimited_projects: { type: Boolean, default: false },
|
|
24
|
+
ai_debug_enabled: { type: Boolean, default: false, required: false },
|
|
25
|
+
ai_debug_limit: { type: Number, default: 0, required: false },
|
|
23
26
|
plan_type: {
|
|
24
27
|
type: String,
|
|
25
28
|
enum: Object.values(SUBSCRIPTION_PLAN_TYPE),
|
|
@@ -37,6 +40,8 @@ const PlanConfigurationSchema = new Schema<IPlanConfiguration>(
|
|
|
37
40
|
webhook_enabled: { type: Boolean, required: true, default: false },
|
|
38
41
|
can_deploy_all_applications: { type: Boolean, required: true, default: false },
|
|
39
42
|
stripe_prices: { type: Schema.Types.Mixed, required: false, default: {} },
|
|
43
|
+
sandbox_max_count: { type: Number, required: false, default: 3 },
|
|
44
|
+
sandbox_enabled: { type: Boolean, required: false, default: true }
|
|
40
45
|
},
|
|
41
46
|
{ timestamps: true },
|
|
42
47
|
);
|
package/project/index.ts
CHANGED
|
@@ -47,6 +47,11 @@ const projectSchema = new Schema(
|
|
|
47
47
|
ref: "Team",
|
|
48
48
|
type: Schema.Types.ObjectId,
|
|
49
49
|
},
|
|
50
|
+
watchPaths: {
|
|
51
|
+
type: Array,
|
|
52
|
+
required: false,
|
|
53
|
+
default: [],
|
|
54
|
+
},
|
|
50
55
|
server: {
|
|
51
56
|
ref: "Server",
|
|
52
57
|
type: Schema.Types.ObjectId,
|
|
@@ -102,6 +107,14 @@ const projectSchema = new Schema(
|
|
|
102
107
|
type: Boolean,
|
|
103
108
|
default: false,
|
|
104
109
|
},
|
|
110
|
+
free_tier_expires_at: {
|
|
111
|
+
type: Date,
|
|
112
|
+
default: null,
|
|
113
|
+
},
|
|
114
|
+
free_tier_expiry_notified_at: {
|
|
115
|
+
type: Date,
|
|
116
|
+
default: null,
|
|
117
|
+
},
|
|
105
118
|
disabled: {
|
|
106
119
|
type: Boolean,
|
|
107
120
|
default: false,
|
|
@@ -131,12 +144,15 @@ const projectSchema = new Schema(
|
|
|
131
144
|
type: Schema.Types.ObjectId,
|
|
132
145
|
},
|
|
133
146
|
],
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
project_environment: {
|
|
148
|
+
ref: "ProjectEnvironment",
|
|
149
|
+
type: Schema.Types.ObjectId,
|
|
150
|
+
index: true,
|
|
151
|
+
},
|
|
152
|
+
inherit_environment_vars: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: true,
|
|
155
|
+
},
|
|
140
156
|
replicas: {
|
|
141
157
|
type: Number,
|
|
142
158
|
default: 3,
|
|
@@ -226,5 +242,15 @@ const projectSchema = new Schema(
|
|
|
226
242
|
{ timestamps: true },
|
|
227
243
|
);
|
|
228
244
|
|
|
245
|
+
// Partial index for the free-tier lifecycle crons. Restricts the index to
|
|
246
|
+
// rows that actually carry an expiry, so paid/legacy projects stay out of it.
|
|
247
|
+
projectSchema.index(
|
|
248
|
+
{ free_tier_expires_at: 1, serviceType: 1, status: 1 },
|
|
249
|
+
{
|
|
250
|
+
partialFilterExpression: { free_tier_expires_at: { $type: "date" } },
|
|
251
|
+
name: "free_tier_lifecycle",
|
|
252
|
+
},
|
|
253
|
+
);
|
|
254
|
+
|
|
229
255
|
export default model<IProject>("Project", projectSchema);
|
|
230
256
|
export const DeletedProject = model<IProject>("DeletedProject", projectSchema);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IProjectEnvironment } from "./types";
|
|
3
|
+
|
|
4
|
+
const projectEnvironmentSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
name: { type: String, required: true },
|
|
7
|
+
slug: { type: String, required: true },
|
|
8
|
+
owner: { ref: "User", type: Schema.Types.ObjectId, required: true },
|
|
9
|
+
team: { ref: "Team", type: Schema.Types.ObjectId },
|
|
10
|
+
inherit_from: { ref: "ProjectEnvironment", type: Schema.Types.ObjectId },
|
|
11
|
+
isDefault: { type: Boolean, default: false },
|
|
12
|
+
},
|
|
13
|
+
{ timestamps: true },
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
projectEnvironmentSchema.index({ slug: 1, owner: 1, team: 1 }, { unique: true });
|
|
17
|
+
|
|
18
|
+
export default model<IProjectEnvironment>("ProjectEnvironment", projectEnvironmentSchema);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { IProjectAnalytics } from "./types/project_analytics";
|
|
3
|
+
|
|
4
|
+
const ProjectAnalyticsSchema = new Schema<IProjectAnalytics>(
|
|
5
|
+
{
|
|
6
|
+
project: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
ref: "Project",
|
|
9
|
+
required: true,
|
|
10
|
+
unique: true,
|
|
11
|
+
index: true,
|
|
12
|
+
},
|
|
13
|
+
provider: { type: String, enum: ["umami"], required: true, default: "umami" },
|
|
14
|
+
websiteId: { type: String, required: true, unique: true },
|
|
15
|
+
shareId: { type: String, default: null },
|
|
16
|
+
domain: { type: String, required: true },
|
|
17
|
+
enabled: { type: Boolean, default: true },
|
|
18
|
+
},
|
|
19
|
+
{ timestamps: true },
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default model<IProjectAnalytics>(
|
|
23
|
+
"ProjectAnalytics",
|
|
24
|
+
ProjectAnalyticsSchema,
|
|
25
|
+
"project_analytics",
|
|
26
|
+
);
|
package/sandbox-image.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { ISandboxImage } from "./types/sandbox-image";
|
|
3
|
+
|
|
4
|
+
const sandboxImageSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
name: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true,
|
|
10
|
+
},
|
|
11
|
+
display_name: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
image: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
is_available: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true,
|
|
26
|
+
},
|
|
27
|
+
is_default: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{ timestamps: true },
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default model<ISandboxImage>("SandboxImage", sandboxImageSchema);
|