@brimble/models 3.8.46 → 3.8.47
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/dist/activity-log.d.ts +9 -0
- package/dist/activity-log.js +61 -0
- package/dist/app-message.d.ts +9 -0
- package/dist/app-message.js +14 -0
- package/dist/auto-scaling.d.ts +9 -0
- package/dist/auto-scaling.js +63 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.js +41 -0
- package/dist/cashier_subscription.d.ts +9 -0
- package/dist/cashier_subscription.js +27 -0
- package/dist/cashier_subscription_item.d.ts +9 -0
- package/dist/cashier_subscription_item.js +17 -0
- package/dist/collab-annotation.d.ts +9 -0
- package/dist/collab-annotation.js +31 -0
- package/dist/collab-comment.d.ts +9 -0
- package/dist/collab-comment.js +19 -0
- package/dist/collab-integration.d.ts +9 -0
- package/dist/collab-integration.js +17 -0
- package/dist/collab-push-subscription.d.ts +9 -0
- package/dist/collab-push-subscription.js +14 -0
- package/dist/collab-settings.d.ts +9 -0
- package/dist/collab-settings.js +24 -0
- package/dist/collab-share-token.d.ts +9 -0
- package/dist/collab-share-token.js +11 -0
- package/dist/compute.d.ts +9 -0
- package/dist/compute.js +82 -0
- package/dist/db-image.d.ts +9 -0
- package/dist/db-image.js +67 -0
- package/dist/domain/dns.d.ts +9 -0
- package/dist/domain/dns.js +33 -0
- package/dist/domain/index.d.ts +9 -0
- package/dist/domain/index.js +109 -0
- package/dist/domain/renewal.d.ts +9 -0
- package/dist/domain/renewal.js +21 -0
- package/dist/domain/transfer.d.ts +9 -0
- package/dist/domain/transfer.js +99 -0
- package/dist/enum/index.d.ts +271 -0
- package/dist/enum/index.js +319 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.js +34 -0
- package/dist/environment-variable.d.ts +9 -0
- package/dist/environment-variable.js +16 -0
- package/dist/follower.d.ts +9 -0
- package/dist/follower.js +15 -0
- package/dist/following.d.ts +9 -0
- package/dist/following.js +15 -0
- package/dist/framework.d.ts +9 -0
- package/dist/framework.js +84 -0
- package/dist/idempotency.d.ts +9 -0
- package/{idempotency.ts → dist/idempotency.js} +8 -13
- package/{index.ts → dist/index.d.ts} +6 -174
- package/dist/index.js +232 -0
- package/dist/integration.d.ts +9 -0
- package/dist/integration.js +35 -0
- package/dist/intention.d.ts +9 -0
- package/dist/intention.js +36 -0
- package/dist/invoice.d.ts +9 -0
- package/dist/invoice.js +28 -0
- package/dist/job.d.ts +10 -0
- package/dist/job.js +62 -0
- package/dist/license.d.ts +9 -0
- package/dist/license.js +75 -0
- package/dist/load-balancer-port.d.ts +9 -0
- package/dist/load-balancer-port.js +27 -0
- package/dist/logs.d.ts +9 -0
- package/dist/logs.js +40 -0
- package/dist/member-permission.d.ts +9 -0
- package/dist/member-permission.js +9 -0
- package/dist/member.d.ts +9 -0
- package/dist/member.js +40 -0
- package/dist/object-storage-usage-segment.d.ts +9 -0
- package/dist/object-storage-usage-segment.js +46 -0
- package/dist/ownership-transfer.d.ts +9 -0
- package/dist/ownership-transfer.js +35 -0
- package/dist/permission.d.ts +9 -0
- package/dist/permission.js +12 -0
- package/dist/plan_configuration.d.ts +10 -0
- package/{plan_configuration.ts → dist/plan_configuration.js} +13 -21
- package/dist/project/connection.d.ts +9 -0
- package/dist/project/connection.js +14 -0
- package/dist/project/index.d.ts +16 -0
- package/dist/project/index.js +256 -0
- package/dist/project/preview.d.ts +9 -0
- package/dist/project/preview.js +37 -0
- package/dist/project-environment.d.ts +9 -0
- package/dist/project-environment.js +13 -0
- package/dist/project-tag-assignment.d.ts +9 -0
- package/dist/project-tag-assignment.js +32 -0
- package/dist/project_analytics.d.ts +9 -0
- package/dist/project_analytics.js +18 -0
- package/dist/provider.d.ts +9 -0
- package/dist/provider.js +10 -0
- package/dist/region.d.ts +9 -0
- package/dist/region.js +17 -0
- package/dist/role.d.ts +9 -0
- package/dist/role.js +11 -0
- package/dist/sandbox-activity.d.ts +9 -0
- package/dist/sandbox-activity.js +49 -0
- package/dist/sandbox-image.d.ts +9 -0
- package/dist/sandbox-image.js +31 -0
- package/dist/sandbox-snapshot-usage-segment.d.ts +9 -0
- package/dist/sandbox-snapshot-usage-segment.js +49 -0
- package/dist/sandbox-snapshot.d.ts +9 -0
- package/dist/sandbox-snapshot.js +51 -0
- package/dist/sandbox-usage-segment.d.ts +9 -0
- package/dist/sandbox-usage-segment.js +57 -0
- package/dist/sandbox.d.ts +9 -0
- package/dist/sandbox.js +132 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +101 -0
- package/dist/settings.d.ts +9 -0
- package/dist/settings.js +49 -0
- package/dist/storage.d.ts +36 -0
- package/dist/storage.js +82 -0
- package/dist/subscription.d.ts +9 -0
- package/dist/subscription.js +82 -0
- package/dist/tag.d.ts +9 -0
- package/dist/tag.js +29 -0
- package/dist/team.d.ts +9 -0
- package/dist/team.js +82 -0
- package/dist/token.d.ts +9 -0
- package/dist/token.js +36 -0
- package/dist/types/activity-log.d.ts +18 -0
- package/dist/types/activity-log.js +2 -0
- package/dist/types/app-message.d.ts +15 -0
- package/dist/types/app-message.js +2 -0
- package/dist/types/auto-scaling-group.d.ts +20 -0
- package/dist/types/auto-scaling-group.js +2 -0
- package/dist/types/card.d.ts +12 -0
- package/dist/types/card.js +2 -0
- package/dist/types/cashier_subscription.d.ts +27 -0
- package/dist/types/cashier_subscription.js +2 -0
- package/dist/types/collab-annotation.d.ts +27 -0
- package/dist/types/collab-annotation.js +2 -0
- package/dist/types/collab-comment.d.ts +20 -0
- package/dist/types/collab-comment.js +2 -0
- package/{types/collab-integration.ts → dist/types/collab-integration.d.ts} +7 -8
- package/dist/types/collab-integration.js +2 -0
- package/dist/types/collab-push-subscription.d.ts +12 -0
- package/dist/types/collab-push-subscription.js +2 -0
- package/dist/types/collab-settings.d.ts +16 -0
- package/dist/types/collab-settings.js +2 -0
- package/{types/collab-share-token.ts → dist/types/collab-share-token.d.ts} +7 -8
- package/dist/types/collab-share-token.js +2 -0
- package/dist/types/compute.d.ts +48 -0
- package/dist/types/compute.js +2 -0
- package/dist/types/db-image.d.ts +25 -0
- package/dist/types/db-image.js +2 -0
- package/dist/types/domain/dns.d.ts +12 -0
- package/dist/types/domain/dns.js +2 -0
- package/dist/types/domain/index.d.ts +35 -0
- package/dist/types/domain/index.js +2 -0
- package/{types/domain/renewal.ts → dist/types/domain/renewal.d.ts} +0 -1
- package/dist/types/domain/renewal.js +2 -0
- package/dist/types/domain/transfer.d.ts +27 -0
- package/dist/types/domain/transfer.js +2 -0
- package/dist/types/env.d.ts +13 -0
- package/dist/types/env.js +2 -0
- package/{types/environment-variable.ts → dist/types/environment-variable.d.ts} +7 -8
- package/dist/types/environment-variable.js +2 -0
- package/{types/following.ts → dist/types/following.d.ts} +2 -3
- package/dist/types/following.js +2 -0
- package/dist/types/framework.d.ts +39 -0
- package/dist/types/framework.js +2 -0
- package/dist/types/git.d.ts +14 -0
- package/dist/types/git.js +2 -0
- package/dist/types/idempotency.d.ts +10 -0
- package/dist/types/idempotency.js +2 -0
- package/{types/index.ts → dist/types/index.d.ts} +5 -26
- package/dist/types/index.js +2 -0
- package/{types/installed_integration.ts → dist/types/installed_integration.d.ts} +3 -6
- package/dist/types/installed_integration.js +2 -0
- package/dist/types/integration.d.ts +14 -0
- package/dist/types/integration.js +2 -0
- package/dist/types/intention.d.ts +13 -0
- package/dist/types/intention.js +2 -0
- package/dist/types/invoice.d.ts +15 -0
- package/dist/types/invoice.js +2 -0
- package/dist/types/job.d.ts +19 -0
- package/dist/types/job.js +2 -0
- package/dist/types/license.d.ts +18 -0
- package/dist/types/license.js +2 -0
- package/{types/load-balancer-port.ts → dist/types/load-balancer-port.d.ts} +7 -8
- package/dist/types/load-balancer-port.js +2 -0
- package/dist/types/logs.d.ts +35 -0
- package/dist/types/logs.js +2 -0
- package/{types/member-permission.ts → dist/types/member-permission.d.ts} +3 -6
- package/dist/types/member-permission.js +2 -0
- package/dist/types/member.d.ts +18 -0
- package/dist/types/member.js +2 -0
- package/dist/types/object-storage-usage-segment.d.ts +23 -0
- package/dist/types/object-storage-usage-segment.js +2 -0
- package/dist/types/ownership-transfer.d.ts +12 -0
- package/dist/types/ownership-transfer.js +2 -0
- package/{types/permission.ts → dist/types/permission.d.ts} +8 -14
- package/dist/types/permission.js +2 -0
- package/dist/types/plan_configuration.d.ts +55 -0
- package/dist/types/plan_configuration.js +2 -0
- package/{types/project/connection.ts → dist/types/project/connection.d.ts} +2 -3
- package/dist/types/project/connection.js +2 -0
- package/dist/types/project/index.d.ts +100 -0
- package/dist/types/project/index.js +2 -0
- package/dist/types/project/preview.d.ts +21 -0
- package/dist/types/project/preview.js +2 -0
- package/dist/types/project-environment.d.ts +13 -0
- package/dist/types/project-environment.js +2 -0
- package/{types/project-tag-assignment.ts → dist/types/project-tag-assignment.d.ts} +6 -7
- package/dist/types/project-tag-assignment.js +2 -0
- package/dist/types/project_analytics.d.ts +11 -0
- package/dist/types/project_analytics.js +2 -0
- package/{types/provider.ts → dist/types/provider.d.ts} +4 -5
- package/dist/types/provider.js +2 -0
- package/dist/types/region.d.ts +15 -0
- package/dist/types/region.js +2 -0
- package/{types/role.ts → dist/types/role.d.ts} +4 -8
- package/dist/types/role.js +2 -0
- package/dist/types/sandbox-activity.d.ts +14 -0
- package/dist/types/sandbox-activity.js +2 -0
- package/dist/types/sandbox-image.d.ts +9 -0
- package/dist/types/sandbox-image.js +2 -0
- package/dist/types/sandbox-snapshot-usage-segment.d.ts +16 -0
- package/dist/types/sandbox-snapshot-usage-segment.js +2 -0
- package/dist/types/sandbox-snapshot.d.ts +16 -0
- package/dist/types/sandbox-snapshot.js +2 -0
- package/dist/types/sandbox-usage-segment.d.ts +25 -0
- package/dist/types/sandbox-usage-segment.js +2 -0
- package/dist/types/sandbox.d.ts +41 -0
- package/dist/types/sandbox.js +2 -0
- package/dist/types/server.d.ts +32 -0
- package/dist/types/server.js +2 -0
- package/dist/types/settings.d.ts +11 -0
- package/dist/types/settings.js +2 -0
- package/dist/types/storage.d.ts +79 -0
- package/dist/types/storage.js +2 -0
- package/dist/types/subscription.d.ts +33 -0
- package/dist/types/subscription.js +2 -0
- package/{types/tag.ts → dist/types/tag.d.ts} +6 -7
- package/dist/types/tag.js +2 -0
- package/dist/types/team.d.ts +24 -0
- package/dist/types/team.js +2 -0
- package/{types/token.ts → dist/types/token.d.ts} +6 -7
- package/dist/types/token.js +2 -0
- package/dist/types/user.d.ts +44 -0
- package/dist/types/user.js +2 -0
- package/dist/types/volume-usage-segment.d.ts +16 -0
- package/dist/types/volume-usage-segment.js +2 -0
- package/dist/types/volume.d.ts +20 -0
- package/dist/types/volume.js +2 -0
- package/dist/types/wallet.d.ts +8 -0
- package/dist/types/wallet.js +2 -0
- package/{types/webhook-category.ts → dist/types/webhook-category.d.ts} +1 -2
- package/dist/types/webhook-category.js +2 -0
- package/{types/webhook-event.ts → dist/types/webhook-event.d.ts} +1 -2
- package/dist/types/webhook-event.js +2 -0
- package/{types/webhook-setting.ts → dist/types/webhook-setting.d.ts} +1 -2
- package/dist/types/webhook-setting.js +2 -0
- package/dist/user.d.ts +9 -0
- package/dist/user.js +70 -0
- package/dist/volume-usage-segment.d.ts +9 -0
- package/dist/volume-usage-segment.js +46 -0
- package/dist/volume.d.ts +9 -0
- package/dist/volume.js +48 -0
- package/dist/wallet.d.ts +9 -0
- package/dist/wallet.js +26 -0
- package/dist/webhook-category.d.ts +9 -0
- package/dist/webhook-category.js +10 -0
- package/dist/webhook-event.d.ts +9 -0
- package/dist/webhook-event.js +19 -0
- package/dist/webhook-setting.d.ts +9 -0
- package/dist/webhook-setting.js +50 -0
- package/package.json +6 -2
- package/.claude/settings.local.json +0 -7
- package/.eslintrc.js +0 -26
- package/.prettierrc +0 -4
- package/activity-log.ts +0 -66
- package/app-message.ts +0 -18
- package/auto-scaling.ts +0 -72
- package/card.ts +0 -45
- package/cashier_subscription.ts +0 -35
- package/cashier_subscription_item.ts +0 -25
- package/collab-annotation.ts +0 -36
- package/collab-comment.ts +0 -27
- package/collab-integration.ts +0 -21
- package/collab-push-subscription.ts +0 -19
- package/collab-settings.ts +0 -29
- package/collab-share-token.ts +0 -15
- package/compute.ts +0 -88
- package/db-image.ts +0 -71
- package/domain/dns.ts +0 -34
- package/domain/index.ts +0 -113
- package/domain/renewal.ts +0 -25
- package/domain/transfer.ts +0 -112
- package/enum/index.ts +0 -315
- package/env.ts +0 -38
- package/environment-variable.ts +0 -21
- package/follower.ts +0 -19
- package/following.ts +0 -19
- package/framework.ts +0 -88
- package/integration.ts +0 -39
- package/intention.ts +0 -40
- package/invoice.ts +0 -36
- package/job.ts +0 -30
- package/load-balancer-port.ts +0 -31
- package/logs.ts +0 -44
- package/member-permission.ts +0 -13
- package/member.ts +0 -44
- package/object-storage-usage-segment.ts +0 -59
- package/ownership-transfer.ts +0 -42
- package/permission.ts +0 -13
- package/project/connection.ts +0 -21
- package/project/index.ts +0 -264
- package/project/preview.ts +0 -41
- package/project-environment.ts +0 -18
- package/project-tag-assignment.ts +0 -40
- package/project_analytics.ts +0 -26
- package/provider.ts +0 -11
- package/region.ts +0 -18
- package/role.ts +0 -12
- package/sandbox-activity.ts +0 -53
- package/sandbox-image.ts +0 -35
- package/sandbox-snapshot-usage-segment.ts +0 -61
- package/sandbox-snapshot.ts +0 -55
- package/sandbox-usage-segment.ts +0 -69
- package/sandbox.ts +0 -134
- package/server.ts +0 -105
- package/settings.ts +0 -53
- package/storage.ts +0 -117
- package/subscription.ts +0 -86
- package/tag.ts +0 -34
- package/team.ts +0 -86
- package/token.ts +0 -40
- package/tsconfig.json +0 -14
- package/types/activity-log.ts +0 -19
- package/types/app-message.ts +0 -16
- package/types/auto-scaling-group.ts +0 -21
- package/types/card.ts +0 -20
- package/types/cashier_subscription.ts +0 -29
- package/types/collab-annotation.ts +0 -28
- package/types/collab-comment.ts +0 -22
- package/types/collab-push-subscription.ts +0 -10
- package/types/collab-settings.ts +0 -17
- package/types/compute.ts +0 -51
- package/types/db-image.ts +0 -19
- package/types/domain/dns.ts +0 -13
- package/types/domain/index.ts +0 -36
- package/types/domain/transfer.ts +0 -32
- package/types/env.ts +0 -14
- package/types/framework.ts +0 -41
- package/types/git.ts +0 -15
- package/types/idempotency.ts +0 -12
- package/types/integration.ts +0 -24
- package/types/intention.ts +0 -14
- package/types/invoice.ts +0 -16
- package/types/job.ts +0 -20
- package/types/license.ts +0 -19
- package/types/logs.ts +0 -36
- package/types/member.ts +0 -19
- package/types/object-storage-usage-segment.ts +0 -26
- package/types/ownership-transfer.ts +0 -13
- package/types/plan_configuration.ts +0 -56
- package/types/project/index.ts +0 -101
- package/types/project/preview.ts +0 -22
- package/types/project-environment.ts +0 -14
- package/types/project_analytics.ts +0 -12
- package/types/region.ts +0 -16
- package/types/sandbox-activity.ts +0 -15
- package/types/sandbox-image.ts +0 -10
- package/types/sandbox-snapshot-usage-segment.ts +0 -18
- package/types/sandbox-snapshot.ts +0 -17
- package/types/sandbox-usage-segment.ts +0 -28
- package/types/sandbox.ts +0 -43
- package/types/server.ts +0 -59
- package/types/settings.ts +0 -19
- package/types/storage.ts +0 -91
- package/types/subscription.ts +0 -34
- package/types/team.ts +0 -25
- package/types/user.ts +0 -45
- package/types/volume-usage-segment.ts +0 -18
- package/types/volume.ts +0 -21
- package/types/wallet.ts +0 -9
- package/user.ts +0 -75
- package/volume-usage-segment.ts +0 -59
- package/volume.ts +0 -53
- package/wallet.ts +0 -27
- package/webhook-category.ts +0 -11
- package/webhook-event.ts +0 -20
- package/webhook-setting.ts +0 -48
package/sandbox-activity.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { ISandboxActivity } from "./types/sandbox-activity";
|
|
3
|
-
|
|
4
|
-
const sandboxActivitySchema: Schema = new Schema(
|
|
5
|
-
{
|
|
6
|
-
sandbox_id: {
|
|
7
|
-
type: Schema.Types.ObjectId,
|
|
8
|
-
ref: "Sandbox",
|
|
9
|
-
required: true,
|
|
10
|
-
index: true,
|
|
11
|
-
},
|
|
12
|
-
user_id: {
|
|
13
|
-
type: Schema.Types.ObjectId,
|
|
14
|
-
ref: "User",
|
|
15
|
-
required: true,
|
|
16
|
-
index: true,
|
|
17
|
-
},
|
|
18
|
-
team: {
|
|
19
|
-
type: Schema.Types.ObjectId,
|
|
20
|
-
ref: "Team",
|
|
21
|
-
default: null,
|
|
22
|
-
index: true,
|
|
23
|
-
},
|
|
24
|
-
command: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
|
-
started_at: {
|
|
29
|
-
type: Date,
|
|
30
|
-
required: true,
|
|
31
|
-
index: true,
|
|
32
|
-
},
|
|
33
|
-
ended_at: {
|
|
34
|
-
type: Date,
|
|
35
|
-
default: null,
|
|
36
|
-
},
|
|
37
|
-
exit_code: {
|
|
38
|
-
type: Number,
|
|
39
|
-
default: null,
|
|
40
|
-
},
|
|
41
|
-
duration_ms: {
|
|
42
|
-
type: Number,
|
|
43
|
-
default: null,
|
|
44
|
-
},
|
|
45
|
-
error: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: null,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } },
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
export default model<ISandboxActivity>("SandboxActivity", sandboxActivitySchema);
|
package/sandbox-image.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { ISandboxSnapshotUsageSegment } from "./types/sandbox-snapshot-usage-segment";
|
|
3
|
-
|
|
4
|
-
const sandboxSnapshotUsageSegmentSchema = new Schema<ISandboxSnapshotUsageSegment>(
|
|
5
|
-
{
|
|
6
|
-
snapshot_id: {
|
|
7
|
-
type: Schema.Types.ObjectId,
|
|
8
|
-
ref: "SandboxSnapshot",
|
|
9
|
-
required: true,
|
|
10
|
-
index: true,
|
|
11
|
-
},
|
|
12
|
-
user_id: {
|
|
13
|
-
type: Schema.Types.ObjectId,
|
|
14
|
-
ref: "User",
|
|
15
|
-
required: true,
|
|
16
|
-
index: true,
|
|
17
|
-
},
|
|
18
|
-
team_id: {
|
|
19
|
-
type: Schema.Types.ObjectId,
|
|
20
|
-
ref: "Team",
|
|
21
|
-
required: false,
|
|
22
|
-
default: null,
|
|
23
|
-
index: true,
|
|
24
|
-
},
|
|
25
|
-
size_gb: {
|
|
26
|
-
type: Number,
|
|
27
|
-
required: true,
|
|
28
|
-
default: 0,
|
|
29
|
-
},
|
|
30
|
-
costs: {
|
|
31
|
-
startDate: { type: Date, required: true },
|
|
32
|
-
endDate: { type: Date, default: null },
|
|
33
|
-
},
|
|
34
|
-
billed: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false,
|
|
37
|
-
index: true,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
timestamps: true,
|
|
42
|
-
},
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
sandboxSnapshotUsageSegmentSchema.index({ user_id: 1, billed: 1, "costs.endDate": 1 });
|
|
46
|
-
sandboxSnapshotUsageSegmentSchema.index({ team_id: 1, billed: 1, "costs.endDate": 1 });
|
|
47
|
-
sandboxSnapshotUsageSegmentSchema.index({ snapshot_id: 1, "costs.endDate": 1 });
|
|
48
|
-
sandboxSnapshotUsageSegmentSchema.index(
|
|
49
|
-
{ snapshot_id: 1 },
|
|
50
|
-
{
|
|
51
|
-
unique: true,
|
|
52
|
-
partialFilterExpression: { "costs.endDate": null },
|
|
53
|
-
name: "unique_open_segment_per_snapshot",
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
export default model<ISandboxSnapshotUsageSegment>(
|
|
58
|
-
"SandboxSnapshotUsageSegment",
|
|
59
|
-
sandboxSnapshotUsageSegmentSchema,
|
|
60
|
-
"sandbox_snapshot_usage_segments",
|
|
61
|
-
);
|
package/sandbox-snapshot.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { ISandboxSnapshot } from "./types/sandbox-snapshot";
|
|
3
|
-
import { SANDBOX_SNAPSHOT_STATUS } from "./enum";
|
|
4
|
-
|
|
5
|
-
const sandboxSnapshotSchema: Schema = new Schema(
|
|
6
|
-
{
|
|
7
|
-
user_id: {
|
|
8
|
-
type: Schema.Types.ObjectId,
|
|
9
|
-
ref: "User",
|
|
10
|
-
required: true,
|
|
11
|
-
index: true,
|
|
12
|
-
},
|
|
13
|
-
team: {
|
|
14
|
-
type: Schema.Types.ObjectId,
|
|
15
|
-
ref: "Team",
|
|
16
|
-
default: null,
|
|
17
|
-
index: true,
|
|
18
|
-
},
|
|
19
|
-
sandbox_id: {
|
|
20
|
-
type: Schema.Types.ObjectId,
|
|
21
|
-
ref: "Sandbox",
|
|
22
|
-
required: true,
|
|
23
|
-
index: true,
|
|
24
|
-
},
|
|
25
|
-
name: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: true,
|
|
28
|
-
match: /^[a-z0-9-]{1,40}$/,
|
|
29
|
-
},
|
|
30
|
-
image_tag: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
source_template: {
|
|
35
|
-
type: String,
|
|
36
|
-
required: true,
|
|
37
|
-
},
|
|
38
|
-
status: {
|
|
39
|
-
type: String,
|
|
40
|
-
enum: Object.values(SANDBOX_SNAPSHOT_STATUS),
|
|
41
|
-
default: SANDBOX_SNAPSHOT_STATUS.CREATING,
|
|
42
|
-
},
|
|
43
|
-
failure_reason: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: null,
|
|
46
|
-
},
|
|
47
|
-
size_bytes: {
|
|
48
|
-
type: Number,
|
|
49
|
-
default: null,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } },
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
export default model<ISandboxSnapshot>("SandboxSnapshot", sandboxSnapshotSchema);
|
package/sandbox-usage-segment.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { ISandboxUsageSegment } from "./types/sandbox-usage-segment";
|
|
3
|
-
|
|
4
|
-
const sandboxUsageSegmentSchema = new Schema<ISandboxUsageSegment>(
|
|
5
|
-
{
|
|
6
|
-
sandbox_id: {
|
|
7
|
-
type: Schema.Types.ObjectId,
|
|
8
|
-
ref: "Sandbox",
|
|
9
|
-
required: true,
|
|
10
|
-
index: true,
|
|
11
|
-
},
|
|
12
|
-
user_id: {
|
|
13
|
-
type: Schema.Types.ObjectId,
|
|
14
|
-
ref: "User",
|
|
15
|
-
required: true,
|
|
16
|
-
index: true,
|
|
17
|
-
},
|
|
18
|
-
team_id: {
|
|
19
|
-
type: Schema.Types.ObjectId,
|
|
20
|
-
ref: "Team",
|
|
21
|
-
required: false,
|
|
22
|
-
index: true,
|
|
23
|
-
default: null,
|
|
24
|
-
},
|
|
25
|
-
current: {
|
|
26
|
-
cpu: { type: Number, required: true },
|
|
27
|
-
memory: { type: Number, required: true },
|
|
28
|
-
storage: { type: Number, required: true },
|
|
29
|
-
},
|
|
30
|
-
costs: {
|
|
31
|
-
startDate: { type: Date, required: true },
|
|
32
|
-
endDate: { type: Date, default: null },
|
|
33
|
-
},
|
|
34
|
-
billed: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false,
|
|
37
|
-
index: true,
|
|
38
|
-
},
|
|
39
|
-
region: {
|
|
40
|
-
type: String,
|
|
41
|
-
required: false,
|
|
42
|
-
},
|
|
43
|
-
template: {
|
|
44
|
-
type: String,
|
|
45
|
-
required: false,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
timestamps: true,
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
sandboxUsageSegmentSchema.index({ user_id: 1, billed: 1, "costs.endDate": 1 });
|
|
54
|
-
sandboxUsageSegmentSchema.index({ team_id: 1, billed: 1, "costs.endDate": 1 });
|
|
55
|
-
sandboxUsageSegmentSchema.index({ sandbox_id: 1, "costs.endDate": 1 });
|
|
56
|
-
sandboxUsageSegmentSchema.index(
|
|
57
|
-
{ sandbox_id: 1 },
|
|
58
|
-
{
|
|
59
|
-
unique: true,
|
|
60
|
-
partialFilterExpression: { "costs.endDate": null },
|
|
61
|
-
name: "uniq_open_sandbox_usage_segment_per_sandbox",
|
|
62
|
-
},
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
export default model<ISandboxUsageSegment>(
|
|
66
|
-
"SandboxUsageSegment",
|
|
67
|
-
sandboxUsageSegmentSchema,
|
|
68
|
-
"sandbox_usage_segments",
|
|
69
|
-
);
|
package/sandbox.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { ISandbox } from "./types/sandbox";
|
|
3
|
-
import { SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "./enum";
|
|
4
|
-
|
|
5
|
-
const sandboxSchema: Schema = new Schema({
|
|
6
|
-
name: {
|
|
7
|
-
type: String,
|
|
8
|
-
required: true
|
|
9
|
-
},
|
|
10
|
-
user_id: {
|
|
11
|
-
type: Schema.Types.ObjectId,
|
|
12
|
-
ref: "User",
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
team: {
|
|
16
|
-
type: Schema.Types.ObjectId,
|
|
17
|
-
ref: "Team",
|
|
18
|
-
default: null,
|
|
19
|
-
},
|
|
20
|
-
project_environment: {
|
|
21
|
-
type: Schema.Types.ObjectId,
|
|
22
|
-
ref: "ProjectEnvironment",
|
|
23
|
-
default: null,
|
|
24
|
-
},
|
|
25
|
-
template: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
status: {
|
|
30
|
-
type: String,
|
|
31
|
-
enum: Object.values(SANDBOX_STATUS),
|
|
32
|
-
required: true,
|
|
33
|
-
default: SANDBOX_STATUS.STARTING,
|
|
34
|
-
},
|
|
35
|
-
nomad_job_id: {
|
|
36
|
-
type: String,
|
|
37
|
-
required: true,
|
|
38
|
-
},
|
|
39
|
-
nomad_alloc_id: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: null,
|
|
42
|
-
},
|
|
43
|
-
region: {
|
|
44
|
-
type: Schema.Types.ObjectId,
|
|
45
|
-
ref: "Region",
|
|
46
|
-
required: true,
|
|
47
|
-
},
|
|
48
|
-
specs: {
|
|
49
|
-
cpu: { type: Number, default: 500 },
|
|
50
|
-
memory: { type: Number, default: 512 },
|
|
51
|
-
disk: { type: Number, default: 2 },
|
|
52
|
-
},
|
|
53
|
-
created_at: {
|
|
54
|
-
type: Date,
|
|
55
|
-
default: Date.now,
|
|
56
|
-
},
|
|
57
|
-
last_activity_at: {
|
|
58
|
-
type: Date,
|
|
59
|
-
default: Date.now,
|
|
60
|
-
},
|
|
61
|
-
expires_at: {
|
|
62
|
-
type: Date,
|
|
63
|
-
required: true,
|
|
64
|
-
},
|
|
65
|
-
destroyed_at: {
|
|
66
|
-
type: Date,
|
|
67
|
-
default: null,
|
|
68
|
-
},
|
|
69
|
-
destroy_reason: {
|
|
70
|
-
type: String,
|
|
71
|
-
enum: Object.values(SANDBOX_DESTROY_REASON),
|
|
72
|
-
default: null,
|
|
73
|
-
},
|
|
74
|
-
auto_destroy: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: false,
|
|
77
|
-
},
|
|
78
|
-
destroy_timeout: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: null,
|
|
81
|
-
},
|
|
82
|
-
one_shot: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false,
|
|
85
|
-
},
|
|
86
|
-
block_outbound: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: false,
|
|
89
|
-
},
|
|
90
|
-
persistent: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: false,
|
|
93
|
-
},
|
|
94
|
-
persistent_disk_gb: {
|
|
95
|
-
type: Number,
|
|
96
|
-
default: null,
|
|
97
|
-
},
|
|
98
|
-
csi_volume_id: {
|
|
99
|
-
type: String,
|
|
100
|
-
default: null,
|
|
101
|
-
},
|
|
102
|
-
paused_at: {
|
|
103
|
-
type: Date,
|
|
104
|
-
default: null,
|
|
105
|
-
},
|
|
106
|
-
image_override: {
|
|
107
|
-
type: String,
|
|
108
|
-
default: null,
|
|
109
|
-
},
|
|
110
|
-
from_snapshot: {
|
|
111
|
-
type: Schema.Types.ObjectId,
|
|
112
|
-
ref: "SandboxSnapshot",
|
|
113
|
-
default: null,
|
|
114
|
-
},
|
|
115
|
-
snapshot_mode: {
|
|
116
|
-
type: String,
|
|
117
|
-
enum: ["automatic", "manual"],
|
|
118
|
-
default: "manual",
|
|
119
|
-
},
|
|
120
|
-
snapshot_frequency: {
|
|
121
|
-
type: String,
|
|
122
|
-
default: null,
|
|
123
|
-
},
|
|
124
|
-
isDeleted: {
|
|
125
|
-
type: Boolean,
|
|
126
|
-
default: false,
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
sandboxSchema.index({ user_id: 1, status: 1, isDeleted: 1 });
|
|
131
|
-
sandboxSchema.index({ expires_at: 1 });
|
|
132
|
-
sandboxSchema.index({ last_activity_at: 1, status: 1 });
|
|
133
|
-
|
|
134
|
-
export default model<ISandbox>("Sandbox", sandboxSchema);
|
package/server.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { IServer } from "./types";
|
|
3
|
-
import { SERVER_STATUS, SERVER_PROTOCOL } from "./enum";
|
|
4
|
-
|
|
5
|
-
const serverSchema = new Schema(
|
|
6
|
-
{
|
|
7
|
-
name: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true,
|
|
10
|
-
},
|
|
11
|
-
url: String,
|
|
12
|
-
grpc_address: String,
|
|
13
|
-
userId: {
|
|
14
|
-
type: Schema.Types.ObjectId,
|
|
15
|
-
ref: "User",
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
teamId: {
|
|
19
|
-
type: Schema.Types.ObjectId,
|
|
20
|
-
ref: "Team",
|
|
21
|
-
required: false,
|
|
22
|
-
},
|
|
23
|
-
domain: {
|
|
24
|
-
required: false,
|
|
25
|
-
type: String,
|
|
26
|
-
},
|
|
27
|
-
webhook_url: String,
|
|
28
|
-
ip_address: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
ipv6: String,
|
|
33
|
-
private_ip_address: {
|
|
34
|
-
type: String,
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
tunnel_token: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: false,
|
|
40
|
-
},
|
|
41
|
-
type: String,
|
|
42
|
-
status: {
|
|
43
|
-
type: String,
|
|
44
|
-
enum: Object.values(SERVER_STATUS),
|
|
45
|
-
default: SERVER_STATUS.Active,
|
|
46
|
-
},
|
|
47
|
-
protocol: {
|
|
48
|
-
type: String,
|
|
49
|
-
enum: Object.values(SERVER_PROTOCOL),
|
|
50
|
-
default: SERVER_PROTOCOL.TCP,
|
|
51
|
-
},
|
|
52
|
-
default: Boolean,
|
|
53
|
-
is_custom_provision: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: true,
|
|
56
|
-
},
|
|
57
|
-
region: {
|
|
58
|
-
type: Schema.Types.ObjectId,
|
|
59
|
-
ref: "Region",
|
|
60
|
-
required: true,
|
|
61
|
-
},
|
|
62
|
-
tag: String,
|
|
63
|
-
plugin_id: {
|
|
64
|
-
type: String,
|
|
65
|
-
required: false,
|
|
66
|
-
},
|
|
67
|
-
firewall_id: {
|
|
68
|
-
required: false,
|
|
69
|
-
type: String,
|
|
70
|
-
},
|
|
71
|
-
provider: {
|
|
72
|
-
type: String,
|
|
73
|
-
required: true,
|
|
74
|
-
},
|
|
75
|
-
provider_location: {
|
|
76
|
-
type: String,
|
|
77
|
-
required: false,
|
|
78
|
-
},
|
|
79
|
-
provider_identifier: {
|
|
80
|
-
type: String,
|
|
81
|
-
required: false,
|
|
82
|
-
},
|
|
83
|
-
topology_path: {
|
|
84
|
-
type: String,
|
|
85
|
-
required: false,
|
|
86
|
-
},
|
|
87
|
-
specifications: {
|
|
88
|
-
type: Object,
|
|
89
|
-
default: {},
|
|
90
|
-
select: true,
|
|
91
|
-
},
|
|
92
|
-
cert_storage_path: {
|
|
93
|
-
type: String,
|
|
94
|
-
required: false,
|
|
95
|
-
},
|
|
96
|
-
meta: {
|
|
97
|
-
type: Object,
|
|
98
|
-
default: {},
|
|
99
|
-
select: true,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
{ timestamps: true },
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export default model<IServer>("Server", serverSchema);
|
package/settings.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import { ISettings } from "./types";
|
|
3
|
-
|
|
4
|
-
const settingsSchema: Schema = new Schema(
|
|
5
|
-
{
|
|
6
|
-
vaultEnabled: {
|
|
7
|
-
type: Boolean,
|
|
8
|
-
default: false,
|
|
9
|
-
},
|
|
10
|
-
maintenanceMode: {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
default: false,
|
|
13
|
-
},
|
|
14
|
-
enableSecretRotation: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: false,
|
|
17
|
-
},
|
|
18
|
-
domainPromoEnabled: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false,
|
|
21
|
-
},
|
|
22
|
-
buildsEnabled: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false,
|
|
25
|
-
},
|
|
26
|
-
minimumBuildMinutes: {
|
|
27
|
-
type: Number,
|
|
28
|
-
required: false,
|
|
29
|
-
},
|
|
30
|
-
enableLogging: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: false,
|
|
33
|
-
},
|
|
34
|
-
postHogEnabled: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
webhookEnabled: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
metaSettings: {
|
|
43
|
-
type: Object,
|
|
44
|
-
required: false,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
timestamps: true,
|
|
49
|
-
collection: "app_settings",
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
export default model<ISettings>("Settings", settingsSchema, "app_settings");
|
package/storage.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { model, Schema } from "mongoose";
|
|
2
|
-
import {
|
|
3
|
-
StorageBucketStatus,
|
|
4
|
-
StorageCredentialRole,
|
|
5
|
-
StorageCredentialStatus,
|
|
6
|
-
StorageTokenStatus,
|
|
7
|
-
StorageUploadStatus,
|
|
8
|
-
} from "./enum";
|
|
9
|
-
import {
|
|
10
|
-
IStorageBucket,
|
|
11
|
-
IStorageCredential,
|
|
12
|
-
IStorageObject,
|
|
13
|
-
IStorageToken,
|
|
14
|
-
IStorageUpload,
|
|
15
|
-
} from "./types/storage";
|
|
16
|
-
|
|
17
|
-
const storageBucketSchema = new Schema(
|
|
18
|
-
{
|
|
19
|
-
name: { type: String, required: true, trim: true },
|
|
20
|
-
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
21
|
-
user_id: { type: Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
22
|
-
team: { type: Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
23
|
-
bucket_name: { type: String, required: true, unique: true },
|
|
24
|
-
is_public: { type: Boolean, default: false },
|
|
25
|
-
versioning: { type: Boolean, default: false },
|
|
26
|
-
provider: { type: String, default: "tigris" },
|
|
27
|
-
region: { type: String, default: "auto" },
|
|
28
|
-
storage_used: { type: Number, default: 0 },
|
|
29
|
-
reserved_bytes: { type: Number, default: 0 },
|
|
30
|
-
quota: { type: Number, required: true },
|
|
31
|
-
status: { type: String, enum: Object.values(StorageBucketStatus), default: StorageBucketStatus.Active },
|
|
32
|
-
},
|
|
33
|
-
{ timestamps: true },
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
storageBucketSchema.index({ user_id: 1, team: 1, name: 1 }, { unique: true, name: "uniq_storage_bucket_owner_name" });
|
|
37
|
-
storageBucketSchema.index({ user_id: 1, updatedAt: -1 }, { name: "idx_storage_bucket_user_updated_at" });
|
|
38
|
-
storageBucketSchema.index({ team: 1, updatedAt: -1 }, { name: "idx_storage_bucket_team_updated_at" });
|
|
39
|
-
|
|
40
|
-
const storageObjectSchema = new Schema(
|
|
41
|
-
{
|
|
42
|
-
bucket: { type: Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
43
|
-
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
44
|
-
key: { type: String, required: true },
|
|
45
|
-
path: { type: String, required: true },
|
|
46
|
-
content_type: { type: String },
|
|
47
|
-
size: { type: Number, default: 0 },
|
|
48
|
-
etag: { type: String },
|
|
49
|
-
public_url: { type: String },
|
|
50
|
-
last_modified: { type: Date },
|
|
51
|
-
},
|
|
52
|
-
{ timestamps: true },
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
storageObjectSchema.index({ bucket: 1, key: 1 }, { unique: true, name: "uniq_storage_object_bucket_key" });
|
|
56
|
-
|
|
57
|
-
const storageUploadSchema = new Schema(
|
|
58
|
-
{
|
|
59
|
-
bucket: { type: Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
60
|
-
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
61
|
-
key: { type: String, required: true },
|
|
62
|
-
path: { type: String, required: true },
|
|
63
|
-
upload_id: { type: String, index: true },
|
|
64
|
-
content_type: { type: String },
|
|
65
|
-
size: { type: Number, required: true },
|
|
66
|
-
status: { type: String, enum: Object.values(StorageUploadStatus), default: StorageUploadStatus.Pending, index: true },
|
|
67
|
-
expires_at: { type: Date, required: true, index: true },
|
|
68
|
-
completed_at: { type: Date },
|
|
69
|
-
},
|
|
70
|
-
{ timestamps: true },
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const storageTokenSchema = new Schema(
|
|
74
|
-
{
|
|
75
|
-
name: { type: String, required: true, trim: true },
|
|
76
|
-
token_hash: { type: String, required: true, unique: true },
|
|
77
|
-
prefix: { type: String, required: true },
|
|
78
|
-
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
79
|
-
buckets: [{ type: Schema.Types.ObjectId, ref: "StorageBucket" }],
|
|
80
|
-
user_id: { type: Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
81
|
-
team: { type: Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
82
|
-
permissions: [{ type: String, enum: ["read", "write", "delete", "list", "admin"], required: true }],
|
|
83
|
-
status: { type: String, enum: Object.values(StorageTokenStatus), default: StorageTokenStatus.Active },
|
|
84
|
-
last_used_at: { type: Date },
|
|
85
|
-
expires_at: { type: Date },
|
|
86
|
-
},
|
|
87
|
-
{ timestamps: true },
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
storageTokenSchema.index({ project: 1, status: 1 }, { name: "idx_storage_token_project_status" });
|
|
91
|
-
|
|
92
|
-
const storageCredentialSchema = new Schema(
|
|
93
|
-
{
|
|
94
|
-
name: { type: String, required: true, trim: true },
|
|
95
|
-
bucket: { type: Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
96
|
-
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
97
|
-
user_id: { type: Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
98
|
-
team: { type: Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
99
|
-
provider: { type: String, default: "tigris" },
|
|
100
|
-
provider_org_id: { type: String, required: true },
|
|
101
|
-
access_key_id: { type: String, required: true, unique: true },
|
|
102
|
-
policy_names: [{ type: String }],
|
|
103
|
-
role: { type: String, enum: Object.values(StorageCredentialRole), required: true },
|
|
104
|
-
status: { type: String, enum: Object.values(StorageCredentialStatus), default: StorageCredentialStatus.Active, index: true },
|
|
105
|
-
last_rotated_at: { type: Date },
|
|
106
|
-
revoked_at: { type: Date },
|
|
107
|
-
},
|
|
108
|
-
{ timestamps: true },
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
storageCredentialSchema.index({ bucket: 1, status: 1, updatedAt: -1 }, { name: "idx_storage_credential_bucket_status_updated_at" });
|
|
112
|
-
|
|
113
|
-
export const StorageBucket = model<IStorageBucket>("StorageBucket", storageBucketSchema);
|
|
114
|
-
export const StorageObject = model<IStorageObject>("StorageObject", storageObjectSchema);
|
|
115
|
-
export const StorageUpload = model<IStorageUpload>("StorageUpload", storageUploadSchema);
|
|
116
|
-
export const StorageToken = model<IStorageToken>("StorageToken", storageTokenSchema);
|
|
117
|
-
export const StorageCredential = model<IStorageCredential>("StorageCredential", storageCredentialSchema);
|