@brimble/models 3.8.40 → 3.8.42
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/enum/index.d.ts +15 -0
- package/dist/enum/index.js +19 -1
- package/dist/idempotency.d.ts +9 -0
- package/dist/idempotency.js +17 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +12 -2
- package/dist/plan_configuration.js +2 -0
- package/dist/storage.d.ts +29 -0
- package/dist/storage.js +65 -0
- package/dist/types/idempotency.d.ts +10 -0
- package/dist/types/idempotency.js +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/plan_configuration.d.ts +3 -1
- package/dist/types/project/index.d.ts +1 -1
- package/dist/types/storage.d.ts +62 -0
- package/dist/types/storage.js +2 -0
- package/enum/index.ts +18 -0
- package/idempotency.ts +22 -0
- package/index.ts +11 -0
- package/package.json +1 -1
- package/plan_configuration.ts +2 -0
- package/storage.ts +83 -0
- package/types/idempotency.ts +12 -0
- package/types/index.ts +8 -0
- package/types/plan_configuration.ts +3 -1
- package/types/project/index.ts +1 -1
- package/types/storage.ts +67 -0
package/dist/enum/index.d.ts
CHANGED
|
@@ -246,3 +246,18 @@ export declare enum SANDBOX_SNAPSHOT_STATUS {
|
|
|
246
246
|
READY = "ready",
|
|
247
247
|
FAILED = "failed"
|
|
248
248
|
}
|
|
249
|
+
export declare enum StorageBucketStatus {
|
|
250
|
+
Active = "active",
|
|
251
|
+
Deleting = "deleting",
|
|
252
|
+
Deleted = "deleted"
|
|
253
|
+
}
|
|
254
|
+
export declare enum StorageUploadStatus {
|
|
255
|
+
Pending = "pending",
|
|
256
|
+
Completed = "completed",
|
|
257
|
+
Aborted = "aborted",
|
|
258
|
+
Expired = "expired"
|
|
259
|
+
}
|
|
260
|
+
export declare enum StorageTokenStatus {
|
|
261
|
+
Active = "active",
|
|
262
|
+
Revoked = "revoked"
|
|
263
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
3
|
+
exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
4
4
|
var GIT_TYPE;
|
|
5
5
|
(function (GIT_TYPE) {
|
|
6
6
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -289,3 +289,21 @@ var SANDBOX_SNAPSHOT_STATUS;
|
|
|
289
289
|
SANDBOX_SNAPSHOT_STATUS["READY"] = "ready";
|
|
290
290
|
SANDBOX_SNAPSHOT_STATUS["FAILED"] = "failed";
|
|
291
291
|
})(SANDBOX_SNAPSHOT_STATUS || (exports.SANDBOX_SNAPSHOT_STATUS = SANDBOX_SNAPSHOT_STATUS = {}));
|
|
292
|
+
var StorageBucketStatus;
|
|
293
|
+
(function (StorageBucketStatus) {
|
|
294
|
+
StorageBucketStatus["Active"] = "active";
|
|
295
|
+
StorageBucketStatus["Deleting"] = "deleting";
|
|
296
|
+
StorageBucketStatus["Deleted"] = "deleted";
|
|
297
|
+
})(StorageBucketStatus || (exports.StorageBucketStatus = StorageBucketStatus = {}));
|
|
298
|
+
var StorageUploadStatus;
|
|
299
|
+
(function (StorageUploadStatus) {
|
|
300
|
+
StorageUploadStatus["Pending"] = "pending";
|
|
301
|
+
StorageUploadStatus["Completed"] = "completed";
|
|
302
|
+
StorageUploadStatus["Aborted"] = "aborted";
|
|
303
|
+
StorageUploadStatus["Expired"] = "expired";
|
|
304
|
+
})(StorageUploadStatus || (exports.StorageUploadStatus = StorageUploadStatus = {}));
|
|
305
|
+
var StorageTokenStatus;
|
|
306
|
+
(function (StorageTokenStatus) {
|
|
307
|
+
StorageTokenStatus["Active"] = "active";
|
|
308
|
+
StorageTokenStatus["Revoked"] = "revoked";
|
|
309
|
+
})(StorageTokenStatus || (exports.StorageTokenStatus = StorageTokenStatus = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IIdempotencyRecord } from "./types/idempotency";
|
|
2
|
+
declare const _default: import("mongoose").Model<IIdempotencyRecord, {}, {}, {}, import("mongoose").Document<unknown, {}, IIdempotencyRecord, {}, import("mongoose").DefaultSchemaOptions> & IIdempotencyRecord & Required<{
|
|
3
|
+
_id: string;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, IIdempotencyRecord>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const IdempotencyRecordSchema = new mongoose_1.Schema({
|
|
5
|
+
_id: { type: String, required: true },
|
|
6
|
+
endpoint: { type: String, required: true },
|
|
7
|
+
requestHash: { type: String, required: true },
|
|
8
|
+
responseStatus: { type: Number, required: true },
|
|
9
|
+
responseBody: { type: mongoose_1.Schema.Types.Mixed, required: true },
|
|
10
|
+
createdAt: { type: Date, default: Date.now },
|
|
11
|
+
expiresAt: { type: Date, required: true },
|
|
12
|
+
}, {
|
|
13
|
+
timestamps: false, // We manage createdAt manually for simplicity
|
|
14
|
+
});
|
|
15
|
+
// TTL index on expiresAt (0 seconds means it expires exactly at expiresAt)
|
|
16
|
+
IdempotencyRecordSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
17
|
+
exports.default = (0, mongoose_1.model)("IdempotencyRecord", IdempotencyRecordSchema);
|
package/dist/index.d.ts
CHANGED
|
@@ -60,8 +60,10 @@ export { default as SandboxSnapshot } from "./sandbox-snapshot";
|
|
|
60
60
|
export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
|
|
61
61
|
export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
|
|
62
62
|
export { default as VolumeUsageSegment } from "./volume-usage-segment";
|
|
63
|
-
export {
|
|
64
|
-
export {
|
|
63
|
+
export { default as IdempotencyRecord } from "./idempotency";
|
|
64
|
+
export { StorageBucket, StorageObject, StorageUpload, StorageToken } from "./storage";
|
|
65
|
+
export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IIdempotencyRecord, IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, StorageTokenPermission, } from "./types";
|
|
66
|
+
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, DomainTransferProvider, DomainTransferDirection, DomainTransferStatus, NomadDeploymentStatus, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE, SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, } from "./enum";
|
|
65
67
|
import mongoose from "mongoose";
|
|
66
68
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
67
69
|
export declare const db: mongoose.Connection;
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainTransfer = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
|
-
exports.
|
|
17
|
-
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.SANDBOX_SNAPSHOT_STATUS = void 0;
|
|
16
|
+
exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.StorageToken = exports.StorageUpload = exports.StorageObject = exports.StorageBucket = exports.IdempotencyRecord = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = void 0;
|
|
17
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = void 0;
|
|
18
18
|
var user_1 = require("./user");
|
|
19
19
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
20
20
|
var project_1 = require("./project");
|
|
@@ -140,6 +140,13 @@ var sandbox_usage_segment_1 = require("./sandbox-usage-segment");
|
|
|
140
140
|
Object.defineProperty(exports, "SandboxUsageSegment", { enumerable: true, get: function () { return __importDefault(sandbox_usage_segment_1).default; } });
|
|
141
141
|
var volume_usage_segment_1 = require("./volume-usage-segment");
|
|
142
142
|
Object.defineProperty(exports, "VolumeUsageSegment", { enumerable: true, get: function () { return __importDefault(volume_usage_segment_1).default; } });
|
|
143
|
+
var idempotency_1 = require("./idempotency");
|
|
144
|
+
Object.defineProperty(exports, "IdempotencyRecord", { enumerable: true, get: function () { return __importDefault(idempotency_1).default; } });
|
|
145
|
+
var storage_1 = require("./storage");
|
|
146
|
+
Object.defineProperty(exports, "StorageBucket", { enumerable: true, get: function () { return storage_1.StorageBucket; } });
|
|
147
|
+
Object.defineProperty(exports, "StorageObject", { enumerable: true, get: function () { return storage_1.StorageObject; } });
|
|
148
|
+
Object.defineProperty(exports, "StorageUpload", { enumerable: true, get: function () { return storage_1.StorageUpload; } });
|
|
149
|
+
Object.defineProperty(exports, "StorageToken", { enumerable: true, get: function () { return storage_1.StorageToken; } });
|
|
143
150
|
var enum_1 = require("./enum");
|
|
144
151
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
145
152
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -179,6 +186,9 @@ Object.defineProperty(exports, "SANDBOX_TEMPLATE", { enumerable: true, get: func
|
|
|
179
186
|
Object.defineProperty(exports, "SANDBOX_STATUS", { enumerable: true, get: function () { return enum_1.SANDBOX_STATUS; } });
|
|
180
187
|
Object.defineProperty(exports, "SANDBOX_DESTROY_REASON", { enumerable: true, get: function () { return enum_1.SANDBOX_DESTROY_REASON; } });
|
|
181
188
|
Object.defineProperty(exports, "SANDBOX_SNAPSHOT_STATUS", { enumerable: true, get: function () { return enum_1.SANDBOX_SNAPSHOT_STATUS; } });
|
|
189
|
+
Object.defineProperty(exports, "StorageBucketStatus", { enumerable: true, get: function () { return enum_1.StorageBucketStatus; } });
|
|
190
|
+
Object.defineProperty(exports, "StorageUploadStatus", { enumerable: true, get: function () { return enum_1.StorageUploadStatus; } });
|
|
191
|
+
Object.defineProperty(exports, "StorageTokenStatus", { enumerable: true, get: function () { return enum_1.StorageTokenStatus; } });
|
|
182
192
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
183
193
|
const utils_1 = require("@brimble/utils");
|
|
184
194
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -22,6 +22,8 @@ const PlanConfigurationSchema = new mongoose_1.Schema({
|
|
|
22
22
|
unlimited_projects: { type: Boolean, default: false },
|
|
23
23
|
ai_debug_enabled: { type: Boolean, default: false, required: false },
|
|
24
24
|
ai_debug_limit: { type: Number, default: 0, required: false },
|
|
25
|
+
storage_bucket_enabled: { type: Boolean, default: false },
|
|
26
|
+
storage_bucket_quota_gb: { type: Number, default: 5 },
|
|
25
27
|
plan_type: {
|
|
26
28
|
type: String,
|
|
27
29
|
enum: Object.values(enum_1.SUBSCRIPTION_PLAN_TYPE),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IStorageBucket, IStorageObject, IStorageToken, IStorageUpload } from "./types/storage";
|
|
2
|
+
export declare const StorageBucket: import("mongoose").Model<IStorageBucket, {}, {}, {}, import("mongoose").Document<unknown, {}, IStorageBucket, {}, import("mongoose").DefaultSchemaOptions> & IStorageBucket & Required<{
|
|
3
|
+
_id: import("mongoose").Types.ObjectId;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, IStorageBucket>;
|
|
9
|
+
export declare const StorageObject: import("mongoose").Model<IStorageObject, {}, {}, {}, import("mongoose").Document<unknown, {}, IStorageObject, {}, import("mongoose").DefaultSchemaOptions> & IStorageObject & Required<{
|
|
10
|
+
_id: import("mongoose").Types.ObjectId;
|
|
11
|
+
}> & {
|
|
12
|
+
__v: number;
|
|
13
|
+
} & {
|
|
14
|
+
id: string;
|
|
15
|
+
}, any, IStorageObject>;
|
|
16
|
+
export declare const StorageUpload: import("mongoose").Model<IStorageUpload, {}, {}, {}, import("mongoose").Document<unknown, {}, IStorageUpload, {}, import("mongoose").DefaultSchemaOptions> & IStorageUpload & Required<{
|
|
17
|
+
_id: import("mongoose").Types.ObjectId;
|
|
18
|
+
}> & {
|
|
19
|
+
__v: number;
|
|
20
|
+
} & {
|
|
21
|
+
id: string;
|
|
22
|
+
}, any, IStorageUpload>;
|
|
23
|
+
export declare const StorageToken: import("mongoose").Model<IStorageToken, {}, {}, {}, import("mongoose").Document<unknown, {}, IStorageToken, {}, import("mongoose").DefaultSchemaOptions> & IStorageToken & Required<{
|
|
24
|
+
_id: import("mongoose").Types.ObjectId;
|
|
25
|
+
}> & {
|
|
26
|
+
__v: number;
|
|
27
|
+
} & {
|
|
28
|
+
id: string;
|
|
29
|
+
}, any, IStorageToken>;
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageToken = exports.StorageUpload = exports.StorageObject = exports.StorageBucket = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const enum_1 = require("./enum");
|
|
6
|
+
const storageBucketSchema = new mongoose_1.Schema({
|
|
7
|
+
name: { type: String, required: true, trim: true },
|
|
8
|
+
project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
9
|
+
user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
10
|
+
team: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
11
|
+
bucket_name: { type: String, required: true, unique: true },
|
|
12
|
+
is_public: { type: Boolean, default: false },
|
|
13
|
+
versioning: { type: Boolean, default: false },
|
|
14
|
+
provider: { type: String, default: "tigris" },
|
|
15
|
+
region: { type: String, default: "auto" },
|
|
16
|
+
storage_used: { type: Number, default: 0 },
|
|
17
|
+
reserved_bytes: { type: Number, default: 0 },
|
|
18
|
+
quota: { type: Number, required: true },
|
|
19
|
+
status: { type: String, enum: Object.values(enum_1.StorageBucketStatus), default: enum_1.StorageBucketStatus.Active },
|
|
20
|
+
}, { timestamps: true });
|
|
21
|
+
storageBucketSchema.index({ user_id: 1, team: 1, name: 1 }, { unique: true, name: "uniq_storage_bucket_owner_name" });
|
|
22
|
+
storageBucketSchema.index({ user_id: 1, updatedAt: -1 }, { name: "idx_storage_bucket_user_updated_at" });
|
|
23
|
+
storageBucketSchema.index({ team: 1, updatedAt: -1 }, { name: "idx_storage_bucket_team_updated_at" });
|
|
24
|
+
const storageObjectSchema = new mongoose_1.Schema({
|
|
25
|
+
bucket: { type: mongoose_1.Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
26
|
+
project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
27
|
+
key: { type: String, required: true },
|
|
28
|
+
path: { type: String, required: true },
|
|
29
|
+
content_type: { type: String },
|
|
30
|
+
size: { type: Number, default: 0 },
|
|
31
|
+
etag: { type: String },
|
|
32
|
+
public_url: { type: String },
|
|
33
|
+
last_modified: { type: Date },
|
|
34
|
+
}, { timestamps: true });
|
|
35
|
+
storageObjectSchema.index({ bucket: 1, key: 1 }, { unique: true, name: "uniq_storage_object_bucket_key" });
|
|
36
|
+
const storageUploadSchema = new mongoose_1.Schema({
|
|
37
|
+
bucket: { type: mongoose_1.Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
38
|
+
project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
39
|
+
key: { type: String, required: true },
|
|
40
|
+
path: { type: String, required: true },
|
|
41
|
+
upload_id: { type: String, index: true },
|
|
42
|
+
content_type: { type: String },
|
|
43
|
+
size: { type: Number, required: true },
|
|
44
|
+
status: { type: String, enum: Object.values(enum_1.StorageUploadStatus), default: enum_1.StorageUploadStatus.Pending, index: true },
|
|
45
|
+
expires_at: { type: Date, required: true, index: true },
|
|
46
|
+
completed_at: { type: Date },
|
|
47
|
+
}, { timestamps: true });
|
|
48
|
+
const storageTokenSchema = new mongoose_1.Schema({
|
|
49
|
+
name: { type: String, required: true, trim: true },
|
|
50
|
+
token_hash: { type: String, required: true, unique: true },
|
|
51
|
+
prefix: { type: String, required: true },
|
|
52
|
+
project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
53
|
+
buckets: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "StorageBucket" }],
|
|
54
|
+
user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
55
|
+
team: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
56
|
+
permissions: [{ type: String, enum: ["read", "write", "delete", "list", "admin"], required: true }],
|
|
57
|
+
status: { type: String, enum: Object.values(enum_1.StorageTokenStatus), default: enum_1.StorageTokenStatus.Active },
|
|
58
|
+
last_used_at: { type: Date },
|
|
59
|
+
expires_at: { type: Date },
|
|
60
|
+
}, { timestamps: true });
|
|
61
|
+
storageTokenSchema.index({ project: 1, status: 1 }, { name: "idx_storage_token_project_status" });
|
|
62
|
+
exports.StorageBucket = (0, mongoose_1.model)("StorageBucket", storageBucketSchema);
|
|
63
|
+
exports.StorageObject = (0, mongoose_1.model)("StorageObject", storageObjectSchema);
|
|
64
|
+
exports.StorageUpload = (0, mongoose_1.model)("StorageUpload", storageUploadSchema);
|
|
65
|
+
exports.StorageToken = (0, mongoose_1.model)("StorageToken", storageTokenSchema);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -61,3 +61,5 @@ export type { ISandboxSnapshot } from "./sandbox-snapshot";
|
|
|
61
61
|
export type { ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, } from "./sandbox-snapshot-usage-segment";
|
|
62
62
|
export type { ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./sandbox-usage-segment";
|
|
63
63
|
export type { IVolumeUsageSegment, IVolumeUsageSegmentCosts, } from "./volume-usage-segment";
|
|
64
|
+
export type { IIdempotencyRecord } from "./idempotency";
|
|
65
|
+
export type { IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, StorageTokenPermission, } from "./storage";
|
|
@@ -9,7 +9,6 @@ export interface IPlanConfiguration extends Document {
|
|
|
9
9
|
autoscaling_enabled: boolean;
|
|
10
10
|
concurrent_builds: number;
|
|
11
11
|
project_limit: number;
|
|
12
|
-
volumes_enabled: boolean;
|
|
13
12
|
deploy_private_organization: boolean;
|
|
14
13
|
preview_comments: boolean;
|
|
15
14
|
password_enabled: boolean;
|
|
@@ -22,6 +21,7 @@ export interface IPlanConfiguration extends Document {
|
|
|
22
21
|
bandwidth: number;
|
|
23
22
|
pull_request_preview: boolean;
|
|
24
23
|
plan_type: SUBSCRIPTION_PLAN_TYPE;
|
|
24
|
+
volumes_enabled: boolean;
|
|
25
25
|
memory: number;
|
|
26
26
|
build_timeout: number;
|
|
27
27
|
storage: number;
|
|
@@ -35,6 +35,8 @@ export interface IPlanConfiguration extends Document {
|
|
|
35
35
|
webhook_enabled: boolean;
|
|
36
36
|
can_deploy_all_applications: boolean;
|
|
37
37
|
stripe_prices?: Record<string, string>;
|
|
38
|
+
storage_bucket_enabled: boolean;
|
|
39
|
+
storage_bucket_quota_gb: number;
|
|
38
40
|
sandbox_max_count: number;
|
|
39
41
|
sanxbox_hours_max: number;
|
|
40
42
|
sandbox_enabled: boolean;
|
|
@@ -29,7 +29,6 @@ export interface IProject extends Document {
|
|
|
29
29
|
dir: string;
|
|
30
30
|
tlsEnabled: boolean;
|
|
31
31
|
dbImage: IDbImage;
|
|
32
|
-
persistent_mount_path: string;
|
|
33
32
|
installCommand: string;
|
|
34
33
|
buildCommand: string;
|
|
35
34
|
startCommand: string;
|
|
@@ -95,6 +94,7 @@ export interface IProject extends Document {
|
|
|
95
94
|
hasUpdates?: boolean;
|
|
96
95
|
whiteListedIps?: string[];
|
|
97
96
|
diskSize?: number;
|
|
97
|
+
persistent_mount_path?: string;
|
|
98
98
|
volumeMount: string;
|
|
99
99
|
volume: IVolume | null;
|
|
100
100
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { StorageBucketStatus, StorageTokenStatus, StorageUploadStatus } from "../enum";
|
|
3
|
+
export type StorageTokenPermission = "read" | "write" | "delete" | "list" | "admin";
|
|
4
|
+
export interface IStorageBucket extends Document {
|
|
5
|
+
name: string;
|
|
6
|
+
project?: Types.ObjectId;
|
|
7
|
+
user_id?: Types.ObjectId;
|
|
8
|
+
team?: Types.ObjectId;
|
|
9
|
+
bucket_name: string;
|
|
10
|
+
is_public: boolean;
|
|
11
|
+
versioning: boolean;
|
|
12
|
+
provider: string;
|
|
13
|
+
region: string;
|
|
14
|
+
storage_used: number;
|
|
15
|
+
reserved_bytes: number;
|
|
16
|
+
quota: number;
|
|
17
|
+
status: StorageBucketStatus;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
}
|
|
21
|
+
export interface IStorageObject extends Document {
|
|
22
|
+
bucket: Types.ObjectId;
|
|
23
|
+
project?: Types.ObjectId;
|
|
24
|
+
key: string;
|
|
25
|
+
path: string;
|
|
26
|
+
content_type?: string;
|
|
27
|
+
size: number;
|
|
28
|
+
etag?: string;
|
|
29
|
+
public_url?: string;
|
|
30
|
+
last_modified?: Date;
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
updatedAt: Date;
|
|
33
|
+
}
|
|
34
|
+
export interface IStorageUpload extends Document {
|
|
35
|
+
bucket: Types.ObjectId;
|
|
36
|
+
project?: Types.ObjectId;
|
|
37
|
+
key: string;
|
|
38
|
+
path: string;
|
|
39
|
+
upload_id?: string;
|
|
40
|
+
content_type?: string;
|
|
41
|
+
size: number;
|
|
42
|
+
status: StorageUploadStatus;
|
|
43
|
+
expires_at: Date;
|
|
44
|
+
completed_at?: Date;
|
|
45
|
+
createdAt: Date;
|
|
46
|
+
updatedAt: Date;
|
|
47
|
+
}
|
|
48
|
+
export interface IStorageToken extends Document {
|
|
49
|
+
name: string;
|
|
50
|
+
token_hash: string;
|
|
51
|
+
prefix: string;
|
|
52
|
+
project?: Types.ObjectId;
|
|
53
|
+
buckets: Types.ObjectId[];
|
|
54
|
+
user_id?: Types.ObjectId;
|
|
55
|
+
team?: Types.ObjectId;
|
|
56
|
+
permissions: StorageTokenPermission[];
|
|
57
|
+
status: StorageTokenStatus;
|
|
58
|
+
last_used_at?: Date;
|
|
59
|
+
expires_at?: Date;
|
|
60
|
+
createdAt: Date;
|
|
61
|
+
updatedAt: Date;
|
|
62
|
+
}
|
package/enum/index.ts
CHANGED
|
@@ -285,3 +285,21 @@ export enum SANDBOX_SNAPSHOT_STATUS {
|
|
|
285
285
|
READY = "ready",
|
|
286
286
|
FAILED = "failed",
|
|
287
287
|
}
|
|
288
|
+
|
|
289
|
+
export enum StorageBucketStatus {
|
|
290
|
+
Active = "active",
|
|
291
|
+
Deleting = "deleting",
|
|
292
|
+
Deleted = "deleted",
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export enum StorageUploadStatus {
|
|
296
|
+
Pending = "pending",
|
|
297
|
+
Completed = "completed",
|
|
298
|
+
Aborted = "aborted",
|
|
299
|
+
Expired = "expired",
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export enum StorageTokenStatus {
|
|
303
|
+
Active = "active",
|
|
304
|
+
Revoked = "revoked",
|
|
305
|
+
}
|
package/idempotency.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IIdempotencyRecord } from "./types/idempotency";
|
|
3
|
+
|
|
4
|
+
const IdempotencyRecordSchema = new Schema<IIdempotencyRecord>(
|
|
5
|
+
{
|
|
6
|
+
_id: { type: String, required: true },
|
|
7
|
+
endpoint: { type: String, required: true },
|
|
8
|
+
requestHash: { type: String, required: true },
|
|
9
|
+
responseStatus: { type: Number, required: true },
|
|
10
|
+
responseBody: { type: Schema.Types.Mixed, required: true },
|
|
11
|
+
createdAt: { type: Date, default: Date.now },
|
|
12
|
+
expiresAt: { type: Date, required: true },
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
timestamps: false, // We manage createdAt manually for simplicity
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// TTL index on expiresAt (0 seconds means it expires exactly at expiresAt)
|
|
20
|
+
IdempotencyRecordSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
21
|
+
|
|
22
|
+
export default model<IIdempotencyRecord>("IdempotencyRecord", IdempotencyRecordSchema);
|
package/index.ts
CHANGED
|
@@ -60,6 +60,8 @@ export { default as SandboxSnapshot } from "./sandbox-snapshot";
|
|
|
60
60
|
export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
|
|
61
61
|
export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
|
|
62
62
|
export { default as VolumeUsageSegment } from "./volume-usage-segment";
|
|
63
|
+
export { default as IdempotencyRecord } from "./idempotency";
|
|
64
|
+
export { StorageBucket, StorageObject, StorageUpload, StorageToken } from "./storage";
|
|
63
65
|
|
|
64
66
|
export {
|
|
65
67
|
IUser,
|
|
@@ -133,6 +135,12 @@ export {
|
|
|
133
135
|
ISandboxUsageSegmentCosts,
|
|
134
136
|
IVolumeUsageSegment,
|
|
135
137
|
IVolumeUsageSegmentCosts,
|
|
138
|
+
IIdempotencyRecord,
|
|
139
|
+
IStorageBucket,
|
|
140
|
+
IStorageObject,
|
|
141
|
+
IStorageUpload,
|
|
142
|
+
IStorageToken,
|
|
143
|
+
StorageTokenPermission,
|
|
136
144
|
} from "./types";
|
|
137
145
|
export {
|
|
138
146
|
GIT_TYPE,
|
|
@@ -173,6 +181,9 @@ export {
|
|
|
173
181
|
SANDBOX_STATUS,
|
|
174
182
|
SANDBOX_DESTROY_REASON,
|
|
175
183
|
SANDBOX_SNAPSHOT_STATUS,
|
|
184
|
+
StorageBucketStatus,
|
|
185
|
+
StorageUploadStatus,
|
|
186
|
+
StorageTokenStatus,
|
|
176
187
|
} from "./enum";
|
|
177
188
|
|
|
178
189
|
import mongoose from "mongoose";
|
package/package.json
CHANGED
package/plan_configuration.ts
CHANGED
|
@@ -23,6 +23,8 @@ const PlanConfigurationSchema = new Schema<IPlanConfiguration>(
|
|
|
23
23
|
unlimited_projects: { type: Boolean, default: false },
|
|
24
24
|
ai_debug_enabled: { type: Boolean, default: false, required: false },
|
|
25
25
|
ai_debug_limit: { type: Number, default: 0, required: false },
|
|
26
|
+
storage_bucket_enabled: { type: Boolean, default: false },
|
|
27
|
+
storage_bucket_quota_gb: { type: Number, default: 5 },
|
|
26
28
|
plan_type: {
|
|
27
29
|
type: String,
|
|
28
30
|
enum: Object.values(SUBSCRIPTION_PLAN_TYPE),
|
package/storage.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { StorageBucketStatus, StorageTokenStatus, StorageUploadStatus } from "./enum";
|
|
3
|
+
import { IStorageBucket, IStorageObject, IStorageToken, IStorageUpload } from "./types/storage";
|
|
4
|
+
|
|
5
|
+
const storageBucketSchema = new Schema(
|
|
6
|
+
{
|
|
7
|
+
name: { type: String, required: true, trim: true },
|
|
8
|
+
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
9
|
+
user_id: { type: Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
10
|
+
team: { type: Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
11
|
+
bucket_name: { type: String, required: true, unique: true },
|
|
12
|
+
is_public: { type: Boolean, default: false },
|
|
13
|
+
versioning: { type: Boolean, default: false },
|
|
14
|
+
provider: { type: String, default: "tigris" },
|
|
15
|
+
region: { type: String, default: "auto" },
|
|
16
|
+
storage_used: { type: Number, default: 0 },
|
|
17
|
+
reserved_bytes: { type: Number, default: 0 },
|
|
18
|
+
quota: { type: Number, required: true },
|
|
19
|
+
status: { type: String, enum: Object.values(StorageBucketStatus), default: StorageBucketStatus.Active },
|
|
20
|
+
},
|
|
21
|
+
{ timestamps: true },
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
storageBucketSchema.index({ user_id: 1, team: 1, name: 1 }, { unique: true, name: "uniq_storage_bucket_owner_name" });
|
|
25
|
+
storageBucketSchema.index({ user_id: 1, updatedAt: -1 }, { name: "idx_storage_bucket_user_updated_at" });
|
|
26
|
+
storageBucketSchema.index({ team: 1, updatedAt: -1 }, { name: "idx_storage_bucket_team_updated_at" });
|
|
27
|
+
|
|
28
|
+
const storageObjectSchema = new Schema(
|
|
29
|
+
{
|
|
30
|
+
bucket: { type: Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
31
|
+
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
32
|
+
key: { type: String, required: true },
|
|
33
|
+
path: { type: String, required: true },
|
|
34
|
+
content_type: { type: String },
|
|
35
|
+
size: { type: Number, default: 0 },
|
|
36
|
+
etag: { type: String },
|
|
37
|
+
public_url: { type: String },
|
|
38
|
+
last_modified: { type: Date },
|
|
39
|
+
},
|
|
40
|
+
{ timestamps: true },
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
storageObjectSchema.index({ bucket: 1, key: 1 }, { unique: true, name: "uniq_storage_object_bucket_key" });
|
|
44
|
+
|
|
45
|
+
const storageUploadSchema = new Schema(
|
|
46
|
+
{
|
|
47
|
+
bucket: { type: Schema.Types.ObjectId, ref: "StorageBucket", required: true, index: true },
|
|
48
|
+
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
49
|
+
key: { type: String, required: true },
|
|
50
|
+
path: { type: String, required: true },
|
|
51
|
+
upload_id: { type: String, index: true },
|
|
52
|
+
content_type: { type: String },
|
|
53
|
+
size: { type: Number, required: true },
|
|
54
|
+
status: { type: String, enum: Object.values(StorageUploadStatus), default: StorageUploadStatus.Pending, index: true },
|
|
55
|
+
expires_at: { type: Date, required: true, index: true },
|
|
56
|
+
completed_at: { type: Date },
|
|
57
|
+
},
|
|
58
|
+
{ timestamps: true },
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const storageTokenSchema = new Schema(
|
|
62
|
+
{
|
|
63
|
+
name: { type: String, required: true, trim: true },
|
|
64
|
+
token_hash: { type: String, required: true, unique: true },
|
|
65
|
+
prefix: { type: String, required: true },
|
|
66
|
+
project: { type: Schema.Types.ObjectId, ref: "Project", required: false, index: true },
|
|
67
|
+
buckets: [{ type: Schema.Types.ObjectId, ref: "StorageBucket" }],
|
|
68
|
+
user_id: { type: Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
69
|
+
team: { type: Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
70
|
+
permissions: [{ type: String, enum: ["read", "write", "delete", "list", "admin"], required: true }],
|
|
71
|
+
status: { type: String, enum: Object.values(StorageTokenStatus), default: StorageTokenStatus.Active },
|
|
72
|
+
last_used_at: { type: Date },
|
|
73
|
+
expires_at: { type: Date },
|
|
74
|
+
},
|
|
75
|
+
{ timestamps: true },
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
storageTokenSchema.index({ project: 1, status: 1 }, { name: "idx_storage_token_project_status" });
|
|
79
|
+
|
|
80
|
+
export const StorageBucket = model<IStorageBucket>("StorageBucket", storageBucketSchema);
|
|
81
|
+
export const StorageObject = model<IStorageObject>("StorageObject", storageObjectSchema);
|
|
82
|
+
export const StorageUpload = model<IStorageUpload>("StorageUpload", storageUploadSchema);
|
|
83
|
+
export const StorageToken = model<IStorageToken>("StorageToken", storageTokenSchema);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
|
|
3
|
+
// `Document<string>` makes `_id` a string (the idempotency key / UUID) rather than the default ObjectId.
|
|
4
|
+
export interface IIdempotencyRecord extends Document<string> {
|
|
5
|
+
_id: string; // The idempotency key (UUID)
|
|
6
|
+
endpoint: string;
|
|
7
|
+
requestHash: string;
|
|
8
|
+
responseStatus: number;
|
|
9
|
+
responseBody: unknown;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
expiresAt: Date;
|
|
12
|
+
}
|
package/types/index.ts
CHANGED
|
@@ -71,3 +71,11 @@ export type {
|
|
|
71
71
|
IVolumeUsageSegment,
|
|
72
72
|
IVolumeUsageSegmentCosts,
|
|
73
73
|
} from "./volume-usage-segment";
|
|
74
|
+
export type { IIdempotencyRecord } from "./idempotency";
|
|
75
|
+
export type {
|
|
76
|
+
IStorageBucket,
|
|
77
|
+
IStorageObject,
|
|
78
|
+
IStorageUpload,
|
|
79
|
+
IStorageToken,
|
|
80
|
+
StorageTokenPermission,
|
|
81
|
+
} from "./storage";
|
|
@@ -10,7 +10,6 @@ export interface IPlanConfiguration extends Document {
|
|
|
10
10
|
autoscaling_enabled: boolean;
|
|
11
11
|
concurrent_builds: number;
|
|
12
12
|
project_limit: number;
|
|
13
|
-
volumes_enabled: boolean;
|
|
14
13
|
deploy_private_organization: boolean;
|
|
15
14
|
preview_comments: boolean;
|
|
16
15
|
password_enabled: boolean;
|
|
@@ -23,6 +22,7 @@ export interface IPlanConfiguration extends Document {
|
|
|
23
22
|
bandwidth: number;
|
|
24
23
|
pull_request_preview: boolean;
|
|
25
24
|
plan_type: SUBSCRIPTION_PLAN_TYPE;
|
|
25
|
+
volumes_enabled: boolean;
|
|
26
26
|
memory: number;
|
|
27
27
|
build_timeout: number;
|
|
28
28
|
storage: number;
|
|
@@ -36,6 +36,8 @@ export interface IPlanConfiguration extends Document {
|
|
|
36
36
|
webhook_enabled: boolean;
|
|
37
37
|
can_deploy_all_applications: boolean;
|
|
38
38
|
stripe_prices?: Record<string, string>;
|
|
39
|
+
storage_bucket_enabled: boolean;
|
|
40
|
+
storage_bucket_quota_gb: number;
|
|
39
41
|
sandbox_max_count: number;
|
|
40
42
|
sanxbox_hours_max: number;
|
|
41
43
|
sandbox_enabled: boolean;
|
package/types/project/index.ts
CHANGED
|
@@ -30,7 +30,6 @@ export interface IProject extends Document {
|
|
|
30
30
|
dir: string;
|
|
31
31
|
tlsEnabled: boolean;
|
|
32
32
|
dbImage: IDbImage;
|
|
33
|
-
persistent_mount_path: string;
|
|
34
33
|
installCommand: string;
|
|
35
34
|
buildCommand: string;
|
|
36
35
|
startCommand: string;
|
|
@@ -96,6 +95,7 @@ export interface IProject extends Document {
|
|
|
96
95
|
hasUpdates?: boolean;
|
|
97
96
|
whiteListedIps?: string[];
|
|
98
97
|
diskSize?: number;
|
|
98
|
+
persistent_mount_path?: string;
|
|
99
99
|
volumeMount: string;
|
|
100
100
|
volume: IVolume | null;
|
|
101
101
|
}
|
package/types/storage.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { StorageBucketStatus, StorageTokenStatus, StorageUploadStatus } from "../enum";
|
|
3
|
+
|
|
4
|
+
export type StorageTokenPermission = "read" | "write" | "delete" | "list" | "admin";
|
|
5
|
+
|
|
6
|
+
export interface IStorageBucket extends Document {
|
|
7
|
+
name: string;
|
|
8
|
+
project?: Types.ObjectId;
|
|
9
|
+
user_id?: Types.ObjectId;
|
|
10
|
+
team?: Types.ObjectId;
|
|
11
|
+
bucket_name: string;
|
|
12
|
+
is_public: boolean;
|
|
13
|
+
versioning: boolean;
|
|
14
|
+
provider: string;
|
|
15
|
+
region: string;
|
|
16
|
+
storage_used: number;
|
|
17
|
+
reserved_bytes: number;
|
|
18
|
+
quota: number;
|
|
19
|
+
status: StorageBucketStatus;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
updatedAt: Date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IStorageObject extends Document {
|
|
25
|
+
bucket: Types.ObjectId;
|
|
26
|
+
project?: Types.ObjectId;
|
|
27
|
+
key: string;
|
|
28
|
+
path: string;
|
|
29
|
+
content_type?: string;
|
|
30
|
+
size: number;
|
|
31
|
+
etag?: string;
|
|
32
|
+
public_url?: string;
|
|
33
|
+
last_modified?: Date;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
updatedAt: Date;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IStorageUpload extends Document {
|
|
39
|
+
bucket: Types.ObjectId;
|
|
40
|
+
project?: Types.ObjectId;
|
|
41
|
+
key: string;
|
|
42
|
+
path: string;
|
|
43
|
+
upload_id?: string;
|
|
44
|
+
content_type?: string;
|
|
45
|
+
size: number;
|
|
46
|
+
status: StorageUploadStatus;
|
|
47
|
+
expires_at: Date;
|
|
48
|
+
completed_at?: Date;
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
updatedAt: Date;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface IStorageToken extends Document {
|
|
54
|
+
name: string;
|
|
55
|
+
token_hash: string;
|
|
56
|
+
prefix: string;
|
|
57
|
+
project?: Types.ObjectId;
|
|
58
|
+
buckets: Types.ObjectId[];
|
|
59
|
+
user_id?: Types.ObjectId;
|
|
60
|
+
team?: Types.ObjectId;
|
|
61
|
+
permissions: StorageTokenPermission[];
|
|
62
|
+
status: StorageTokenStatus;
|
|
63
|
+
last_used_at?: Date;
|
|
64
|
+
expires_at?: Date;
|
|
65
|
+
createdAt: Date;
|
|
66
|
+
updatedAt: Date;
|
|
67
|
+
}
|