@brimble/models 3.8.38 → 3.8.41
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 +6 -27
- package/dist/app-message.d.ts +6 -27
- package/dist/auto-scaling.d.ts +6 -27
- package/dist/card.d.ts +6 -27
- package/dist/cashier_subscription.d.ts +6 -27
- package/dist/cashier_subscription_item.d.ts +6 -27
- package/dist/collab-annotation.d.ts +6 -27
- package/dist/collab-comment.d.ts +6 -27
- package/dist/collab-integration.d.ts +6 -27
- package/dist/collab-push-subscription.d.ts +6 -27
- package/dist/collab-settings.d.ts +6 -27
- package/dist/collab-share-token.d.ts +6 -27
- package/dist/compute.d.ts +6 -27
- package/dist/db-image.d.ts +6 -27
- package/dist/domain/dns.d.ts +6 -27
- package/dist/domain/index.d.ts +6 -27
- package/dist/domain/renewal.d.ts +6 -27
- package/dist/domain/transfer.d.ts +6 -27
- package/dist/enum/index.d.ts +15 -0
- package/dist/enum/index.js +59 -41
- package/dist/env.d.ts +6 -27
- package/dist/environment-variable.d.ts +6 -27
- package/dist/follower.d.ts +6 -27
- package/dist/following.d.ts +6 -27
- package/dist/framework.d.ts +6 -27
- package/dist/idempotency.d.ts +9 -0
- package/dist/idempotency.js +17 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +14 -3
- package/dist/integration.d.ts +6 -27
- package/dist/intention.d.ts +6 -27
- package/dist/invoice.d.ts +6 -27
- package/dist/job.d.ts +6 -2
- package/dist/job.js +17 -7
- package/dist/license.d.ts +6 -27
- package/dist/load-balancer-port.d.ts +6 -27
- package/dist/logs.d.ts +6 -27
- package/dist/logs.js +0 -2
- package/dist/member-permission.d.ts +6 -27
- package/dist/member.d.ts +6 -27
- package/dist/ownership-transfer.d.ts +6 -27
- package/dist/permission.d.ts +6 -27
- package/dist/plan_configuration.d.ts +6 -2
- package/dist/plan_configuration.js +1 -0
- package/dist/project/connection.d.ts +6 -27
- package/dist/project/index.d.ts +12 -29
- package/dist/project/preview.d.ts +6 -27
- package/dist/project-environment.d.ts +6 -27
- package/dist/project-tag-assignment.d.ts +6 -27
- package/dist/project_analytics.d.ts +6 -27
- package/dist/provider.d.ts +6 -27
- package/dist/region.d.ts +6 -26
- package/dist/role.d.ts +6 -27
- package/dist/sandbox-activity.d.ts +6 -27
- package/dist/sandbox-image.d.ts +6 -27
- package/dist/sandbox-snapshot-usage-segment.d.ts +6 -27
- package/dist/sandbox-snapshot.d.ts +6 -27
- package/dist/sandbox-snapshot.js +0 -2
- package/dist/sandbox-usage-segment.d.ts +6 -27
- package/dist/sandbox.d.ts +6 -27
- package/dist/server.d.ts +6 -27
- package/dist/settings.d.ts +6 -27
- package/dist/storage.d.ts +29 -0
- package/dist/storage.js +65 -0
- package/dist/subscription.d.ts +6 -27
- package/dist/tag.d.ts +6 -27
- package/dist/team.d.ts +6 -27
- package/dist/token.d.ts +6 -27
- 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 +2 -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/dist/user.d.ts +6 -27
- package/dist/volume-usage-segment.d.ts +6 -27
- package/dist/volume.d.ts +6 -27
- package/dist/wallet.d.ts +6 -27
- package/dist/webhook-category.d.ts +6 -27
- package/dist/webhook-event.d.ts +6 -27
- package/dist/webhook-setting.d.ts +6 -27
- package/enum/index.ts +18 -0
- package/idempotency.ts +22 -0
- package/index.ts +12 -1
- package/logs.ts +0 -3
- package/package.json +3 -4
- package/plan_configuration.ts +1 -0
- package/sandbox-snapshot.ts +0 -3
- package/storage.ts +83 -0
- package/types/idempotency.ts +12 -0
- package/types/index.ts +8 -0
- package/types/plan_configuration.ts +2 -1
- package/types/project/index.ts +1 -1
- package/types/storage.ts +67 -0
package/dist/webhook-event.d.ts
CHANGED
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose" />
|
|
25
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
26
1
|
import { IWebhookEvent } from "./types/webhook-event";
|
|
27
|
-
declare const _default: import("mongoose").Model<IWebhookEvent, {}, {}, {}, import("mongoose").Document<unknown, {}, IWebhookEvent> & IWebhookEvent & {
|
|
2
|
+
declare const _default: import("mongoose").Model<IWebhookEvent, {}, {}, {}, import("mongoose").Document<unknown, {}, IWebhookEvent, {}, import("mongoose").DefaultSchemaOptions> & IWebhookEvent & Required<{
|
|
28
3
|
_id: import("mongoose").Types.ObjectId;
|
|
29
|
-
}
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, IWebhookEvent>;
|
|
30
9
|
export default _default;
|
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose" />
|
|
25
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
26
1
|
import { IWebhookSetting } from "./types/webhook-setting";
|
|
27
|
-
declare const _default: import("mongoose").Model<IWebhookSetting, {}, {}, {}, import("mongoose").Document<unknown, {}, IWebhookSetting> & IWebhookSetting & {
|
|
2
|
+
declare const _default: import("mongoose").Model<IWebhookSetting, {}, {}, {}, import("mongoose").Document<unknown, {}, IWebhookSetting, {}, import("mongoose").DefaultSchemaOptions> & IWebhookSetting & Required<{
|
|
28
3
|
_id: import("mongoose").Types.ObjectId;
|
|
29
|
-
}
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, IWebhookSetting>;
|
|
30
9
|
export default _default;
|
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";
|
|
@@ -213,7 +224,7 @@ export const healthCheckMongo = async (): Promise<boolean> => {
|
|
|
213
224
|
if (mongoose.connection.readyState !== 1) {
|
|
214
225
|
return false;
|
|
215
226
|
}
|
|
216
|
-
await mongoose.connection.db
|
|
227
|
+
await mongoose.connection.db?.admin().ping();
|
|
217
228
|
return true;
|
|
218
229
|
} catch (error) {
|
|
219
230
|
log.error(`MongoDB health check failed`, error);
|
package/logs.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { model, Schema } from "mongoose";
|
|
2
2
|
import { ENVIRONMENT, PROJECT_STATUS } from "./enum";
|
|
3
3
|
import { ILog } from "./types";
|
|
4
|
-
import { softDeletePlugin } from "soft-delete-plugin-mongoose";
|
|
5
4
|
|
|
6
5
|
const LogSchema = new Schema(
|
|
7
6
|
{
|
|
@@ -42,6 +41,4 @@ const LogSchema = new Schema(
|
|
|
42
41
|
{ timestamps: true },
|
|
43
42
|
);
|
|
44
43
|
|
|
45
|
-
LogSchema.plugin(softDeletePlugin);
|
|
46
|
-
|
|
47
44
|
export default model<ILog>("Log", LogSchema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brimble/models",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.41",
|
|
4
4
|
"description": "Brimble models",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"@brimble/models": "^3.8.21",
|
|
13
13
|
"@brimble/utils": "^1.5.23",
|
|
14
14
|
"dotenv": "^8.2.0",
|
|
15
|
-
"mongoose": "^
|
|
16
|
-
"soft-delete-plugin-mongoose": "^1.0.17",
|
|
15
|
+
"mongoose": "^9.6.2",
|
|
17
16
|
"uuid": "^8.3.2"
|
|
18
17
|
},
|
|
19
18
|
"devDependencies": {
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
"@types/uuid": "^8.3.0",
|
|
22
21
|
"nodemon": "^2.0.2",
|
|
23
22
|
"ts-node": "^8.10.2",
|
|
24
|
-
"typescript": "^
|
|
23
|
+
"typescript": "^5.9.3"
|
|
25
24
|
},
|
|
26
25
|
"gitHead": "54989906c229a84ccecc57c28ebd8e8dccffd363"
|
|
27
26
|
}
|
package/plan_configuration.ts
CHANGED
|
@@ -23,6 +23,7 @@ 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 },
|
|
26
27
|
plan_type: {
|
|
27
28
|
type: String,
|
|
28
29
|
enum: Object.values(SUBSCRIPTION_PLAN_TYPE),
|
package/sandbox-snapshot.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { model, Schema } from "mongoose";
|
|
2
|
-
import { softDeletePlugin } from "soft-delete-plugin-mongoose";
|
|
3
2
|
import { ISandboxSnapshot } from "./types/sandbox-snapshot";
|
|
4
3
|
import { SANDBOX_SNAPSHOT_STATUS } from "./enum";
|
|
5
4
|
|
|
@@ -53,6 +52,4 @@ const sandboxSnapshotSchema: Schema = new Schema(
|
|
|
53
52
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } },
|
|
54
53
|
);
|
|
55
54
|
|
|
56
|
-
sandboxSnapshotSchema.plugin(softDeletePlugin);
|
|
57
|
-
|
|
58
55
|
export default model<ISandboxSnapshot>("SandboxSnapshot", sandboxSnapshotSchema);
|
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,7 @@ 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;
|
|
39
40
|
sandbox_max_count: number;
|
|
40
41
|
sanxbox_hours_max: number;
|
|
41
42
|
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
|
+
}
|