@brimble/models 3.8.0 → 3.8.3

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.
@@ -0,0 +1,31 @@
1
+ import { model, Schema } from "mongoose";
2
+
3
+ import { ICashierSubscription } from "./types";
4
+
5
+ const cashierSubscriptionSchema: Schema = new Schema(
6
+ {
7
+ user_id: { type: String, required: true },
8
+ type: { type: String, default: "default" },
9
+ stripe_id: { type: String, required: true },
10
+ stripe_status: { type: String, required: true },
11
+ stripe_price: { type: String, default: null },
12
+ quantity: { type: Number, default: null },
13
+ trial_ends_at: { type: Date, default: null },
14
+ ends_at: { type: Date, default: null },
15
+ team_id: { type: String, default: null },
16
+ plan_type: { type: String, default: null },
17
+ domain_id: { type: String, default: null },
18
+ },
19
+ {
20
+ timestamps: {
21
+ createdAt: "created_at",
22
+ updatedAt: "updated_at",
23
+ },
24
+ collection: "cashier_subscriptions",
25
+ },
26
+ );
27
+
28
+ export default model<ICashierSubscription>(
29
+ "CashierSubscription",
30
+ cashierSubscriptionSchema,
31
+ );
@@ -0,0 +1,25 @@
1
+ import { model, Schema } from "mongoose";
2
+
3
+ import { ICashierSubscriptionItem } from "./types";
4
+
5
+ const cashierSubscriptionItemSchema: Schema = new Schema(
6
+ {
7
+ subscription_id: { type: String, required: true },
8
+ stripe_id: { type: String, required: true },
9
+ stripe_product: { type: String, default: null },
10
+ stripe_price: { type: String, required: true },
11
+ quantity: { type: Number, default: null },
12
+ },
13
+ {
14
+ timestamps: {
15
+ createdAt: "created_at",
16
+ updatedAt: "updated_at",
17
+ },
18
+ collection: "cashier_subscription_items",
19
+ },
20
+ );
21
+
22
+ export default model<ICashierSubscriptionItem>(
23
+ "CashierSubscriptionItem",
24
+ cashierSubscriptionItemSchema,
25
+ );
@@ -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 { ICashierSubscription } from "./types";
27
+ declare const _default: import("mongoose").Model<ICashierSubscription, {}, {}, {}, import("mongoose").Document<unknown, {}, ICashierSubscription> & ICashierSubscription & {
28
+ _id: import("mongoose").Types.ObjectId;
29
+ }, any>;
30
+ export default _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const cashierSubscriptionSchema = new mongoose_1.Schema({
5
+ user_id: { type: String, required: true },
6
+ type: { type: String, default: "default" },
7
+ stripe_id: { type: String, required: true },
8
+ stripe_status: { type: String, required: true },
9
+ stripe_price: { type: String, default: null },
10
+ quantity: { type: Number, default: null },
11
+ trial_ends_at: { type: Date, default: null },
12
+ ends_at: { type: Date, default: null },
13
+ team_id: { type: String, default: null },
14
+ plan_type: { type: String, default: null },
15
+ domain_id: { type: String, default: null },
16
+ }, {
17
+ timestamps: {
18
+ createdAt: "created_at",
19
+ updatedAt: "updated_at",
20
+ },
21
+ collection: "cashier_subscriptions",
22
+ });
23
+ exports.default = (0, mongoose_1.model)("CashierSubscription", cashierSubscriptionSchema);
@@ -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 { ICashierSubscriptionItem } from "./types";
27
+ declare const _default: import("mongoose").Model<ICashierSubscriptionItem, {}, {}, {}, import("mongoose").Document<unknown, {}, ICashierSubscriptionItem> & ICashierSubscriptionItem & {
28
+ _id: import("mongoose").Types.ObjectId;
29
+ }, any>;
30
+ 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 cashierSubscriptionItemSchema = new mongoose_1.Schema({
5
+ subscription_id: { type: String, required: true },
6
+ stripe_id: { type: String, required: true },
7
+ stripe_product: { type: String, default: null },
8
+ stripe_price: { type: String, required: true },
9
+ quantity: { type: Number, default: null },
10
+ }, {
11
+ timestamps: {
12
+ createdAt: "created_at",
13
+ updatedAt: "updated_at",
14
+ },
15
+ collection: "cashier_subscription_items",
16
+ });
17
+ exports.default = (0, mongoose_1.model)("CashierSubscriptionItem", cashierSubscriptionItemSchema);
@@ -62,6 +62,10 @@ const domainSchema = new mongoose_1.Schema({
62
62
  ref: "Subscription",
63
63
  type: mongoose_1.Schema.Types.ObjectId,
64
64
  },
65
+ cashier_subscription_id: {
66
+ type: String,
67
+ default: null,
68
+ },
65
69
  nameservers: {
66
70
  type: Array,
67
71
  required: false,
@@ -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 { IDomainTransfer } from "../types";
27
+ declare const _default: import("mongoose").Model<IDomainTransfer, {}, {}, {}, import("mongoose").Document<unknown, {}, IDomainTransfer> & IDomainTransfer & {
28
+ _id: import("mongoose").Types.ObjectId;
29
+ }, any>;
30
+ export default _default;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("../enum");
5
+ const domainTransferSchema = new mongoose_1.Schema({
6
+ domain_id: {
7
+ ref: "Domain",
8
+ type: mongoose_1.Schema.Types.ObjectId,
9
+ required: true,
10
+ },
11
+ domain_name: {
12
+ type: String,
13
+ required: true,
14
+ trim: true,
15
+ },
16
+ user_id: {
17
+ ref: "User",
18
+ type: mongoose_1.Schema.Types.ObjectId,
19
+ required: true,
20
+ },
21
+ team_id: {
22
+ ref: "Team",
23
+ type: mongoose_1.Schema.Types.ObjectId,
24
+ required: false,
25
+ },
26
+ provider: {
27
+ type: String,
28
+ required: true,
29
+ enum: Object.values(enum_1.DomainTransferProvider),
30
+ },
31
+ direction: {
32
+ type: String,
33
+ required: true,
34
+ enum: Object.values(enum_1.DomainTransferDirection),
35
+ },
36
+ status: {
37
+ type: String,
38
+ required: true,
39
+ enum: Object.values(enum_1.DomainTransferStatus),
40
+ },
41
+ provider_transfer_id: {
42
+ type: String,
43
+ required: false,
44
+ },
45
+ payment_reference: {
46
+ type: String,
47
+ required: false,
48
+ },
49
+ payment_token: {
50
+ type: String,
51
+ required: false,
52
+ },
53
+ payment_amount: {
54
+ type: Number,
55
+ required: false,
56
+ },
57
+ renewal_price: {
58
+ type: Number,
59
+ required: false,
60
+ },
61
+ auto_renewal: {
62
+ type: Boolean,
63
+ required: false,
64
+ },
65
+ privacy_enabled: {
66
+ type: Boolean,
67
+ required: false,
68
+ },
69
+ renewal_duration: {
70
+ type: Number,
71
+ required: false,
72
+ },
73
+ project_id: {
74
+ ref: "Project",
75
+ type: mongoose_1.Schema.Types.ObjectId,
76
+ required: false,
77
+ },
78
+ last_polled_at: {
79
+ type: Date,
80
+ required: false,
81
+ },
82
+ poll_count: {
83
+ type: Number,
84
+ required: true,
85
+ default: 0,
86
+ min: 0,
87
+ },
88
+ last_provider_status: {
89
+ type: String,
90
+ required: false,
91
+ },
92
+ failure_reason: {
93
+ type: String,
94
+ required: false,
95
+ },
96
+ }, { timestamps: true });
97
+ domainTransferSchema.index({ status: 1, direction: 1 });
98
+ domainTransferSchema.index({ domain_id: 1 });
99
+ exports.default = (0, mongoose_1.model)("DomainTransfer", domainTransferSchema, "domain_transfers");
@@ -163,6 +163,21 @@ export declare enum DomainRenewalStatus {
163
163
  Completed = "completed",
164
164
  Failed = "failed"
165
165
  }
166
+ export declare enum DomainTransferProvider {
167
+ Dynadot = "dynadot",
168
+ NameDotCom = "name-dot-com",
169
+ NameCheap = "name-cheap"
170
+ }
171
+ export declare enum DomainTransferDirection {
172
+ TransferIn = "transfer_in",
173
+ TransferOut = "transfer_out"
174
+ }
175
+ export declare enum DomainTransferStatus {
176
+ Pending = "pending",
177
+ Completed = "completed",
178
+ Failed = "failed",
179
+ Cancelled = "cancelled"
180
+ }
166
181
  export declare enum NomadDeploymentStatus {
167
182
  NOMAD_SETUP = "nomad_setup",
168
183
  NOMAD_READY = "nomad_ready",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.BRANCH_TYPE = exports.NomadDeploymentStatus = 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.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.BRANCH_TYPE = 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";
@@ -191,6 +191,24 @@ var DomainRenewalStatus;
191
191
  DomainRenewalStatus["Completed"] = "completed";
192
192
  DomainRenewalStatus["Failed"] = "failed";
193
193
  })(DomainRenewalStatus = exports.DomainRenewalStatus || (exports.DomainRenewalStatus = {}));
194
+ var DomainTransferProvider;
195
+ (function (DomainTransferProvider) {
196
+ DomainTransferProvider["Dynadot"] = "dynadot";
197
+ DomainTransferProvider["NameDotCom"] = "name-dot-com";
198
+ DomainTransferProvider["NameCheap"] = "name-cheap";
199
+ })(DomainTransferProvider = exports.DomainTransferProvider || (exports.DomainTransferProvider = {}));
200
+ var DomainTransferDirection;
201
+ (function (DomainTransferDirection) {
202
+ DomainTransferDirection["TransferIn"] = "transfer_in";
203
+ DomainTransferDirection["TransferOut"] = "transfer_out";
204
+ })(DomainTransferDirection = exports.DomainTransferDirection || (exports.DomainTransferDirection = {}));
205
+ var DomainTransferStatus;
206
+ (function (DomainTransferStatus) {
207
+ DomainTransferStatus["Pending"] = "pending";
208
+ DomainTransferStatus["Completed"] = "completed";
209
+ DomainTransferStatus["Failed"] = "failed";
210
+ DomainTransferStatus["Cancelled"] = "cancelled";
211
+ })(DomainTransferStatus = exports.DomainTransferStatus || (exports.DomainTransferStatus = {}));
194
212
  var NomadDeploymentStatus;
195
213
  (function (NomadDeploymentStatus) {
196
214
  NomadDeploymentStatus["NOMAD_SETUP"] = "nomad_setup";
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export { default as Framework } from "./framework";
30
30
  export { default as Settings } from "./settings";
31
31
  export { default as LoadBalancerPort } from "./load-balancer-port";
32
32
  export { default as DomainRenewal } from "./domain/renewal";
33
+ export { default as DomainTransfer } from "./domain/transfer";
33
34
  export { default as WebhookCategory } from "./webhook-category";
34
35
  export { default as WebhookEvent } from "./webhook-event";
35
36
  export { default as WebhookSetting } from "./webhook-setting";
@@ -46,8 +47,10 @@ export { default as AppMessage } from "./app-message";
46
47
  export { default as Invoice } from "./invoice";
47
48
  export { default as Tag } from "./tag";
48
49
  export { default as ProjectTagAssignment } from "./project-tag-assignment";
49
- export { IUser, IGit, IProject, 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, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, IBranch, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, } from "./types";
50
- 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, NomadDeploymentStatus, BRANCH_TYPE, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE } from "./enum";
50
+ export { default as CashierSubscription } from "./cashier_subscription";
51
+ export { default as CashierSubscriptionItem } from "./cashier_subscription_item";
52
+ export { IUser, IGit, IProject, 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, IBranch, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, } from "./types";
53
+ 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, BRANCH_TYPE, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE } from "./enum";
51
54
  import mongoose from "mongoose";
52
55
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
53
56
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -12,8 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GIT_TYPE = exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Branch = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = 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.DeletedProject = exports.Project = exports.User = void 0;
16
- exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = 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.BRANCH_TYPE = exports.NomadDeploymentStatus = 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 = void 0;
15
+ exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Branch = 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.DeletedProject = exports.Project = exports.User = void 0;
16
+ exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = 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.BRANCH_TYPE = 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.CashierSubscriptionItem = exports.CashierSubscription = void 0;
17
17
  var user_1 = require("./user");
18
18
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
19
19
  var project_1 = require("./project");
@@ -79,6 +79,8 @@ var load_balancer_port_1 = require("./load-balancer-port");
79
79
  Object.defineProperty(exports, "LoadBalancerPort", { enumerable: true, get: function () { return __importDefault(load_balancer_port_1).default; } });
80
80
  var renewal_1 = require("./domain/renewal");
81
81
  Object.defineProperty(exports, "DomainRenewal", { enumerable: true, get: function () { return __importDefault(renewal_1).default; } });
82
+ var transfer_1 = require("./domain/transfer");
83
+ Object.defineProperty(exports, "DomainTransfer", { enumerable: true, get: function () { return __importDefault(transfer_1).default; } });
82
84
  var webhook_category_1 = require("./webhook-category");
83
85
  Object.defineProperty(exports, "WebhookCategory", { enumerable: true, get: function () { return __importDefault(webhook_category_1).default; } });
84
86
  var webhook_event_1 = require("./webhook-event");
@@ -111,6 +113,10 @@ var tag_1 = require("./tag");
111
113
  Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return __importDefault(tag_1).default; } });
112
114
  var project_tag_assignment_1 = require("./project-tag-assignment");
113
115
  Object.defineProperty(exports, "ProjectTagAssignment", { enumerable: true, get: function () { return __importDefault(project_tag_assignment_1).default; } });
116
+ var cashier_subscription_1 = require("./cashier_subscription");
117
+ Object.defineProperty(exports, "CashierSubscription", { enumerable: true, get: function () { return __importDefault(cashier_subscription_1).default; } });
118
+ var cashier_subscription_item_1 = require("./cashier_subscription_item");
119
+ Object.defineProperty(exports, "CashierSubscriptionItem", { enumerable: true, get: function () { return __importDefault(cashier_subscription_item_1).default; } });
114
120
  var enum_1 = require("./enum");
115
121
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
116
122
  Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
@@ -135,6 +141,9 @@ Object.defineProperty(exports, "BUILD_DISABLED_BY", { enumerable: true, get: fun
135
141
  Object.defineProperty(exports, "SERVER_PROTOCOL", { enumerable: true, get: function () { return enum_1.SERVER_PROTOCOL; } });
136
142
  Object.defineProperty(exports, "FrameworkApplicationType", { enumerable: true, get: function () { return enum_1.FrameworkApplicationType; } });
137
143
  Object.defineProperty(exports, "DomainRenewalStatus", { enumerable: true, get: function () { return enum_1.DomainRenewalStatus; } });
144
+ Object.defineProperty(exports, "DomainTransferProvider", { enumerable: true, get: function () { return enum_1.DomainTransferProvider; } });
145
+ Object.defineProperty(exports, "DomainTransferDirection", { enumerable: true, get: function () { return enum_1.DomainTransferDirection; } });
146
+ Object.defineProperty(exports, "DomainTransferStatus", { enumerable: true, get: function () { return enum_1.DomainTransferStatus; } });
138
147
  Object.defineProperty(exports, "NomadDeploymentStatus", { enumerable: true, get: function () { return enum_1.NomadDeploymentStatus; } });
139
148
  Object.defineProperty(exports, "BRANCH_TYPE", { enumerable: true, get: function () { return enum_1.BRANCH_TYPE; } });
140
149
  Object.defineProperty(exports, "COLLAB_ANNOTATION_STATUS", { enumerable: true, get: function () { return enum_1.COLLAB_ANNOTATION_STATUS; } });
@@ -0,0 +1,25 @@
1
+ import { Document } from "mongoose";
2
+ export interface ICashierSubscription extends Document {
3
+ user_id: string;
4
+ type: string;
5
+ stripe_id: string;
6
+ stripe_status: string;
7
+ stripe_price: string | null;
8
+ quantity: number | null;
9
+ trial_ends_at: Date | null;
10
+ ends_at: Date | null;
11
+ team_id: string | null;
12
+ plan_type: string | null;
13
+ domain_id: string | null;
14
+ created_at: Date;
15
+ updated_at: Date;
16
+ }
17
+ export interface ICashierSubscriptionItem extends Document {
18
+ subscription_id: string;
19
+ stripe_id: string;
20
+ stripe_product: string | null;
21
+ stripe_price: string;
22
+ quantity: number | null;
23
+ created_at: Date;
24
+ updated_at: Date;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,6 +10,7 @@ export interface IDomain extends Document {
10
10
  preview: IPreview;
11
11
  provider: string;
12
12
  subscription: ISubscription;
13
+ cashier_subscription_id: string | null;
13
14
  auto_renewal: boolean;
14
15
  renewal_duration: number;
15
16
  is_discounted: boolean;
@@ -0,0 +1,27 @@
1
+ import { Document } from "mongoose";
2
+ import { IDomain, IProject, ITeam, IUser } from "../";
3
+ import { DomainTransferDirection, DomainTransferProvider, DomainTransferStatus } from "../../enum";
4
+ export interface IDomainTransfer extends Document {
5
+ domain_id: IDomain;
6
+ domain_name: string;
7
+ user_id: IUser;
8
+ team_id?: ITeam;
9
+ provider: DomainTransferProvider;
10
+ direction: DomainTransferDirection;
11
+ status: DomainTransferStatus;
12
+ provider_transfer_id?: string;
13
+ payment_reference?: string;
14
+ payment_token?: string;
15
+ payment_amount?: number;
16
+ renewal_price?: number;
17
+ auto_renewal?: boolean;
18
+ privacy_enabled?: boolean;
19
+ renewal_duration?: number;
20
+ project_id?: IProject;
21
+ last_polled_at?: Date;
22
+ poll_count: number;
23
+ last_provider_status?: string;
24
+ failure_reason?: string;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ export type { IDbImage } from "./db-image";
6
6
  export type { IDomain } from "./domain";
7
7
  export type { IDns } from "./domain/dns";
8
8
  export type { IDomainRenewal } from "./domain/renewal";
9
+ export type { IDomainTransfer } from "./domain/transfer";
9
10
  export type { IEnv } from "./env";
10
11
  export type { IFollowing } from "./following";
11
12
  export type { BrimbleFrameworkType, IFramework } from "./framework";
@@ -48,3 +49,4 @@ export type { IAppMessage } from "./app-message";
48
49
  export type { IInvoice } from "./invoice";
49
50
  export type { IProjectTagAssignment } from "./project-tag-assignment";
50
51
  export type { ITag } from "./tag";
52
+ export type { ICashierSubscription, ICashierSubscriptionItem } from "./cashier_subscription";
@@ -27,6 +27,7 @@ export interface IUser extends Document {
27
27
  build_disabled: boolean;
28
28
  build_disabled_by: BUILD_DISABLED_BY;
29
29
  spending_limit: number;
30
+ build_minutes: number;
30
31
  disabled: boolean;
31
32
  disabled_at: Date;
32
33
  notifications: {
package/dist/user.js CHANGED
@@ -42,6 +42,7 @@ const userSchema = new mongoose_1.Schema({
42
42
  tenant: { type: mongoose_1.Schema.Types.ObjectId, ref: "Tenancy", required: false },
43
43
  is_waitlist: { type: Boolean, default: true },
44
44
  spending_limit: { type: Number },
45
+ build_minutes: { type: Number, default: 0 },
45
46
  notifications: Object,
46
47
  disabled: Boolean,
47
48
  disabled_at: Date,
package/domain/index.ts CHANGED
@@ -63,6 +63,10 @@ const domainSchema = new Schema(
63
63
  ref: "Subscription",
64
64
  type: Schema.Types.ObjectId,
65
65
  },
66
+ cashier_subscription_id: {
67
+ type: String,
68
+ default: null,
69
+ },
66
70
  nameservers: {
67
71
  type: Array,
68
72
  required: false,
@@ -0,0 +1,112 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { IDomainTransfer } from "../types";
3
+ import {
4
+ DomainTransferDirection,
5
+ DomainTransferProvider,
6
+ DomainTransferStatus,
7
+ } from "../enum";
8
+
9
+ const domainTransferSchema = new Schema(
10
+ {
11
+ domain_id: {
12
+ ref: "Domain",
13
+ type: Schema.Types.ObjectId,
14
+ required: true,
15
+ },
16
+ domain_name: {
17
+ type: String,
18
+ required: true,
19
+ trim: true,
20
+ },
21
+ user_id: {
22
+ ref: "User",
23
+ type: Schema.Types.ObjectId,
24
+ required: true,
25
+ },
26
+ team_id: {
27
+ ref: "Team",
28
+ type: Schema.Types.ObjectId,
29
+ required: false,
30
+ },
31
+ provider: {
32
+ type: String,
33
+ required: true,
34
+ enum: Object.values(DomainTransferProvider),
35
+ },
36
+ direction: {
37
+ type: String,
38
+ required: true,
39
+ enum: Object.values(DomainTransferDirection),
40
+ },
41
+ status: {
42
+ type: String,
43
+ required: true,
44
+ enum: Object.values(DomainTransferStatus),
45
+ },
46
+ provider_transfer_id: {
47
+ type: String,
48
+ required: false,
49
+ },
50
+ payment_reference: {
51
+ type: String,
52
+ required: false,
53
+ },
54
+ payment_token: {
55
+ type: String,
56
+ required: false,
57
+ },
58
+ payment_amount: {
59
+ type: Number,
60
+ required: false,
61
+ },
62
+ renewal_price: {
63
+ type: Number,
64
+ required: false,
65
+ },
66
+ auto_renewal: {
67
+ type: Boolean,
68
+ required: false,
69
+ },
70
+ privacy_enabled: {
71
+ type: Boolean,
72
+ required: false,
73
+ },
74
+ renewal_duration: {
75
+ type: Number,
76
+ required: false,
77
+ },
78
+ project_id: {
79
+ ref: "Project",
80
+ type: Schema.Types.ObjectId,
81
+ required: false,
82
+ },
83
+ last_polled_at: {
84
+ type: Date,
85
+ required: false,
86
+ },
87
+ poll_count: {
88
+ type: Number,
89
+ required: true,
90
+ default: 0,
91
+ min: 0,
92
+ },
93
+ last_provider_status: {
94
+ type: String,
95
+ required: false,
96
+ },
97
+ failure_reason: {
98
+ type: String,
99
+ required: false,
100
+ },
101
+ },
102
+ { timestamps: true },
103
+ );
104
+
105
+ domainTransferSchema.index({ status: 1, direction: 1 });
106
+ domainTransferSchema.index({ domain_id: 1 });
107
+
108
+ export default model<IDomainTransfer>(
109
+ "DomainTransfer",
110
+ domainTransferSchema,
111
+ "domain_transfers",
112
+ );
package/enum/index.ts CHANGED
@@ -188,6 +188,24 @@ export enum DomainRenewalStatus {
188
188
  Failed = "failed",
189
189
  }
190
190
 
191
+ export enum DomainTransferProvider {
192
+ Dynadot = "dynadot",
193
+ NameDotCom = "name-dot-com",
194
+ NameCheap = "name-cheap",
195
+ }
196
+
197
+ export enum DomainTransferDirection {
198
+ TransferIn = "transfer_in",
199
+ TransferOut = "transfer_out",
200
+ }
201
+
202
+ export enum DomainTransferStatus {
203
+ Pending = "pending",
204
+ Completed = "completed",
205
+ Failed = "failed",
206
+ Cancelled = "cancelled",
207
+ }
208
+
191
209
  export enum NomadDeploymentStatus {
192
210
  NOMAD_SETUP = 'nomad_setup',
193
211
  NOMAD_READY = 'nomad_ready',
@@ -239,4 +257,4 @@ export enum INVOICE_PAYMENT_STATUS {
239
257
  export enum INVOICE_TYPE {
240
258
  INVOICE = "invoice",
241
259
  RECEIPT = "receipt",
242
- }
260
+ }
package/index.ts CHANGED
@@ -30,6 +30,7 @@ export { default as Framework } from "./framework";
30
30
  export { default as Settings } from "./settings";
31
31
  export { default as LoadBalancerPort } from "./load-balancer-port";
32
32
  export { default as DomainRenewal } from "./domain/renewal";
33
+ export { default as DomainTransfer } from "./domain/transfer";
33
34
  export { default as WebhookCategory } from "./webhook-category";
34
35
  export { default as WebhookEvent } from "./webhook-event";
35
36
  export { default as WebhookSetting } from "./webhook-setting";
@@ -46,6 +47,8 @@ export { default as AppMessage } from "./app-message";
46
47
  export { default as Invoice } from "./invoice";
47
48
  export { default as Tag } from "./tag";
48
49
  export { default as ProjectTagAssignment } from "./project-tag-assignment";
50
+ export { default as CashierSubscription } from "./cashier_subscription";
51
+ export { default as CashierSubscriptionItem } from "./cashier_subscription_item";
49
52
 
50
53
  export {
51
54
  IUser,
@@ -83,6 +86,7 @@ export {
83
86
  ISettings,
84
87
  ILoadBalancerPort,
85
88
  IDomainRenewal,
89
+ IDomainTransfer,
86
90
  IWebhookCategory,
87
91
  IWebhookEvent,
88
92
  IWebhookSetting,
@@ -100,6 +104,8 @@ export {
100
104
  IInvoice,
101
105
  ITag,
102
106
  IProjectTagAssignment,
107
+ ICashierSubscription,
108
+ ICashierSubscriptionItem,
103
109
  } from "./types";
104
110
  export {
105
111
  GIT_TYPE,
@@ -125,6 +131,9 @@ export {
125
131
  SERVER_PROTOCOL,
126
132
  FrameworkApplicationType,
127
133
  DomainRenewalStatus,
134
+ DomainTransferProvider,
135
+ DomainTransferDirection,
136
+ DomainTransferStatus,
128
137
  NomadDeploymentStatus,
129
138
  BRANCH_TYPE,
130
139
  COLLAB_ANNOTATION_STATUS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.0",
3
+ "version": "3.8.3",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,27 @@
1
+ import { Document } from "mongoose";
2
+
3
+ export interface ICashierSubscription extends Document {
4
+ user_id: string;
5
+ type: string;
6
+ stripe_id: string;
7
+ stripe_status: string;
8
+ stripe_price: string | null;
9
+ quantity: number | null;
10
+ trial_ends_at: Date | null;
11
+ ends_at: Date | null;
12
+ team_id: string | null;
13
+ plan_type: string | null;
14
+ domain_id: string | null;
15
+ created_at: Date;
16
+ updated_at: Date;
17
+ }
18
+
19
+ export interface ICashierSubscriptionItem extends Document {
20
+ subscription_id: string;
21
+ stripe_id: string;
22
+ stripe_product: string | null;
23
+ stripe_price: string;
24
+ quantity: number | null;
25
+ created_at: Date;
26
+ updated_at: Date;
27
+ }
@@ -11,6 +11,7 @@ export interface IDomain extends Document {
11
11
  preview: IPreview;
12
12
  provider: string;
13
13
  subscription: ISubscription;
14
+ cashier_subscription_id: string | null;
14
15
  auto_renewal: boolean;
15
16
  renewal_duration: number;
16
17
  is_discounted: boolean;
@@ -0,0 +1,32 @@
1
+ import { Document } from "mongoose";
2
+ import { IDomain, IProject, ITeam, IUser } from "../";
3
+ import {
4
+ DomainTransferDirection,
5
+ DomainTransferProvider,
6
+ DomainTransferStatus,
7
+ } from "../../enum";
8
+
9
+ export interface IDomainTransfer extends Document {
10
+ domain_id: IDomain;
11
+ domain_name: string;
12
+ user_id: IUser;
13
+ team_id?: ITeam;
14
+ provider: DomainTransferProvider;
15
+ direction: DomainTransferDirection;
16
+ status: DomainTransferStatus;
17
+ provider_transfer_id?: string;
18
+ payment_reference?: string;
19
+ payment_token?: string;
20
+ payment_amount?: number;
21
+ renewal_price?: number;
22
+ auto_renewal?: boolean;
23
+ privacy_enabled?: boolean;
24
+ renewal_duration?: number;
25
+ project_id?: IProject;
26
+ last_polled_at?: Date;
27
+ poll_count: number;
28
+ last_provider_status?: string;
29
+ failure_reason?: string;
30
+ createdAt: Date;
31
+ updatedAt: Date;
32
+ }
package/types/index.ts CHANGED
@@ -6,6 +6,7 @@ export type { IDbImage } from "./db-image";
6
6
  export type { IDomain } from "./domain";
7
7
  export type { IDns } from "./domain/dns";
8
8
  export type { IDomainRenewal } from "./domain/renewal";
9
+ export type { IDomainTransfer } from "./domain/transfer";
9
10
  export type { IEnv } from "./env";
10
11
  export type { IFollowing } from "./following";
11
12
  export type { BrimbleFrameworkType, IFramework } from "./framework";
@@ -48,3 +49,4 @@ export type { IAppMessage } from "./app-message";
48
49
  export type { IInvoice } from "./invoice";
49
50
  export type { IProjectTagAssignment } from "./project-tag-assignment";
50
51
  export type { ITag } from "./tag";
52
+ export type { ICashierSubscription, ICashierSubscriptionItem } from "./cashier_subscription";
package/types/user.ts CHANGED
@@ -28,6 +28,7 @@ export interface IUser extends Document {
28
28
  build_disabled: boolean;
29
29
  build_disabled_by: BUILD_DISABLED_BY;
30
30
  spending_limit: number;
31
+ build_minutes: number;
31
32
  disabled: boolean;
32
33
  disabled_at: Date;
33
34
  notifications: {
package/user.ts CHANGED
@@ -44,6 +44,7 @@ const userSchema: Schema = new Schema(
44
44
  tenant: { type: Schema.Types.ObjectId, ref: "Tenancy", required: false },
45
45
  is_waitlist: { type: Boolean, default: true },
46
46
  spending_limit: { type: Number },
47
+ build_minutes: { type: Number, default: 0 },
47
48
  notifications: Object,
48
49
  disabled: Boolean,
49
50
  disabled_at: Date,