@brimble/models 3.8.13 → 3.8.14
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/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/dist/sandbox-snapshot-usage-segment.d.ts +30 -0
- package/dist/sandbox-snapshot-usage-segment.js +49 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/sandbox-snapshot-usage-segment.d.ts +16 -0
- package/dist/types/sandbox-snapshot-usage-segment.js +2 -0
- package/index.ts +3 -0
- package/package.json +1 -1
- package/sandbox-snapshot-usage-segment.ts +61 -0
- package/types/index.ts +4 -0
- package/types/sandbox-snapshot-usage-segment.ts +18 -0
package/dist/index.d.ts
CHANGED
|
@@ -56,8 +56,9 @@ export { default as OwnershipTransfer } from "./ownership-transfer";
|
|
|
56
56
|
export { default as Sandbox } from "./sandbox";
|
|
57
57
|
export { default as SandboxImage } from "./sandbox-image";
|
|
58
58
|
export { default as SandboxSnapshot } from "./sandbox-snapshot";
|
|
59
|
+
export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
|
|
59
60
|
export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
|
|
60
|
-
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, ISandboxImage, ISandboxSnapshot, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./types";
|
|
61
|
+
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, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./types";
|
|
61
62
|
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, } from "./enum";
|
|
62
63
|
import mongoose from "mongoose";
|
|
63
64
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
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 = void 0;
|
|
16
|
+
exports.connectToMongo = 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.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.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.Sandbox = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = void 0;
|
|
17
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = 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");
|
|
@@ -132,6 +132,8 @@ var sandbox_image_1 = require("./sandbox-image");
|
|
|
132
132
|
Object.defineProperty(exports, "SandboxImage", { enumerable: true, get: function () { return __importDefault(sandbox_image_1).default; } });
|
|
133
133
|
var sandbox_snapshot_1 = require("./sandbox-snapshot");
|
|
134
134
|
Object.defineProperty(exports, "SandboxSnapshot", { enumerable: true, get: function () { return __importDefault(sandbox_snapshot_1).default; } });
|
|
135
|
+
var sandbox_snapshot_usage_segment_1 = require("./sandbox-snapshot-usage-segment");
|
|
136
|
+
Object.defineProperty(exports, "SandboxSnapshotUsageSegment", { enumerable: true, get: function () { return __importDefault(sandbox_snapshot_usage_segment_1).default; } });
|
|
135
137
|
var sandbox_usage_segment_1 = require("./sandbox-usage-segment");
|
|
136
138
|
Object.defineProperty(exports, "SandboxUsageSegment", { enumerable: true, get: function () { return __importDefault(sandbox_usage_segment_1).default; } });
|
|
137
139
|
var enum_1 = require("./enum");
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import { ISandboxSnapshotUsageSegment } from "./types/sandbox-snapshot-usage-segment";
|
|
27
|
+
declare const _default: import("mongoose").Model<ISandboxSnapshotUsageSegment, {}, {}, {}, import("mongoose").Document<unknown, {}, ISandboxSnapshotUsageSegment> & ISandboxSnapshotUsageSegment & Required<{
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}>, any>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const sandboxSnapshotUsageSegmentSchema = new mongoose_1.Schema({
|
|
5
|
+
snapshot_id: {
|
|
6
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
7
|
+
ref: "SandboxSnapshot",
|
|
8
|
+
required: true,
|
|
9
|
+
index: true,
|
|
10
|
+
},
|
|
11
|
+
user_id: {
|
|
12
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
13
|
+
ref: "User",
|
|
14
|
+
required: true,
|
|
15
|
+
index: true,
|
|
16
|
+
},
|
|
17
|
+
team_id: {
|
|
18
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
19
|
+
ref: "Team",
|
|
20
|
+
required: false,
|
|
21
|
+
default: null,
|
|
22
|
+
index: true,
|
|
23
|
+
},
|
|
24
|
+
size_gb: {
|
|
25
|
+
type: Number,
|
|
26
|
+
required: true,
|
|
27
|
+
default: 0,
|
|
28
|
+
},
|
|
29
|
+
costs: {
|
|
30
|
+
startDate: { type: Date, required: true },
|
|
31
|
+
endDate: { type: Date, default: null },
|
|
32
|
+
},
|
|
33
|
+
billed: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
index: true,
|
|
37
|
+
},
|
|
38
|
+
}, {
|
|
39
|
+
timestamps: true,
|
|
40
|
+
});
|
|
41
|
+
sandboxSnapshotUsageSegmentSchema.index({ user_id: 1, billed: 1, "costs.endDate": 1 });
|
|
42
|
+
sandboxSnapshotUsageSegmentSchema.index({ team_id: 1, billed: 1, "costs.endDate": 1 });
|
|
43
|
+
sandboxSnapshotUsageSegmentSchema.index({ snapshot_id: 1, "costs.endDate": 1 });
|
|
44
|
+
sandboxSnapshotUsageSegmentSchema.index({ snapshot_id: 1 }, {
|
|
45
|
+
unique: true,
|
|
46
|
+
partialFilterExpression: { "costs.endDate": null },
|
|
47
|
+
name: "unique_open_segment_per_snapshot",
|
|
48
|
+
});
|
|
49
|
+
exports.default = (0, mongoose_1.model)("SandboxSnapshotUsageSegment", sandboxSnapshotUsageSegmentSchema, "sandbox_snapshot_usage_segments");
|
package/dist/types/index.d.ts
CHANGED
|
@@ -57,4 +57,5 @@ export type { IOwnershipTransfer } from "./ownership-transfer";
|
|
|
57
57
|
export type { ISandbox, ISandboxSpecs } from "./sandbox";
|
|
58
58
|
export type { ISandboxImage } from "./sandbox-image";
|
|
59
59
|
export type { ISandboxSnapshot } from "./sandbox-snapshot";
|
|
60
|
+
export type { ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, } from "./sandbox-snapshot-usage-segment";
|
|
60
61
|
export type { ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./sandbox-usage-segment";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
export interface ISandboxSnapshotUsageSegmentCosts {
|
|
3
|
+
startDate: Date;
|
|
4
|
+
endDate: Date | null;
|
|
5
|
+
}
|
|
6
|
+
export interface ISandboxSnapshotUsageSegment extends Document {
|
|
7
|
+
_id: Types.ObjectId;
|
|
8
|
+
snapshot_id: Types.ObjectId;
|
|
9
|
+
user_id: Types.ObjectId;
|
|
10
|
+
team_id: Types.ObjectId | null;
|
|
11
|
+
size_gb: number;
|
|
12
|
+
costs: ISandboxSnapshotUsageSegmentCosts;
|
|
13
|
+
billed: boolean;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
}
|
package/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { default as OwnershipTransfer } from "./ownership-transfer";
|
|
|
56
56
|
export { default as Sandbox } from "./sandbox";
|
|
57
57
|
export { default as SandboxImage } from "./sandbox-image";
|
|
58
58
|
export { default as SandboxSnapshot } from "./sandbox-snapshot";
|
|
59
|
+
export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
|
|
59
60
|
export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
|
|
60
61
|
|
|
61
62
|
export {
|
|
@@ -122,6 +123,8 @@ export {
|
|
|
122
123
|
ISandboxSpecs,
|
|
123
124
|
ISandboxImage,
|
|
124
125
|
ISandboxSnapshot,
|
|
126
|
+
ISandboxSnapshotUsageSegment,
|
|
127
|
+
ISandboxSnapshotUsageSegmentCosts,
|
|
125
128
|
ISandboxUsageSegment,
|
|
126
129
|
ISandboxUsageSegmentCurrent,
|
|
127
130
|
ISandboxUsageSegmentCosts,
|
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
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/types/index.ts
CHANGED
|
@@ -57,6 +57,10 @@ export type { IOwnershipTransfer } from "./ownership-transfer";
|
|
|
57
57
|
export type { ISandbox, ISandboxSpecs } from "./sandbox";
|
|
58
58
|
export type { ISandboxImage } from "./sandbox-image";
|
|
59
59
|
export type { ISandboxSnapshot } from "./sandbox-snapshot";
|
|
60
|
+
export type {
|
|
61
|
+
ISandboxSnapshotUsageSegment,
|
|
62
|
+
ISandboxSnapshotUsageSegmentCosts,
|
|
63
|
+
} from "./sandbox-snapshot-usage-segment";
|
|
60
64
|
export type {
|
|
61
65
|
ISandboxUsageSegment,
|
|
62
66
|
ISandboxUsageSegmentCurrent,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface ISandboxSnapshotUsageSegmentCosts {
|
|
4
|
+
startDate: Date;
|
|
5
|
+
endDate: Date | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ISandboxSnapshotUsageSegment extends Document {
|
|
9
|
+
_id: Types.ObjectId;
|
|
10
|
+
snapshot_id: Types.ObjectId;
|
|
11
|
+
user_id: Types.ObjectId;
|
|
12
|
+
team_id: Types.ObjectId | null;
|
|
13
|
+
size_gb: number;
|
|
14
|
+
costs: ISandboxSnapshotUsageSegmentCosts;
|
|
15
|
+
billed: boolean;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|