@brimble/models 3.8.83 → 3.8.85
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/coupon-redemption.d.ts +9 -0
- package/dist/coupon-redemption.js +44 -0
- package/dist/coupon.d.ts +9 -0
- package/dist/coupon.js +35 -0
- package/dist/domain/index.js +4 -0
- package/dist/drain.js +5 -3
- package/dist/enum/index.d.ts +12 -0
- package/dist/enum/index.js +16 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12 -3
- package/dist/project-drain-subscription.d.ts +9 -0
- package/dist/project-drain-subscription.js +11 -0
- package/dist/types/coupon-redemption.d.ts +22 -0
- package/dist/types/coupon-redemption.js +2 -0
- package/dist/types/coupon.d.ts +24 -0
- package/dist/types/coupon.js +2 -0
- package/dist/types/domain/index.d.ts +1 -0
- package/dist/types/drain.d.ts +4 -2
- package/dist/types/index.d.ts +3 -0
- package/dist/types/project-drain-subscription.d.ts +10 -0
- package/dist/types/project-drain-subscription.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICouponRedemption } from "./types/coupon-redemption";
|
|
2
|
+
declare const _default: import("mongoose").Model<ICouponRedemption, {}, {}, {}, import("mongoose").Document<unknown, {}, ICouponRedemption, {}, import("mongoose").DefaultSchemaOptions> & ICouponRedemption & Required<{
|
|
3
|
+
_id: import("mongoose").Types.ObjectId;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, ICouponRedemption>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const couponRedemptionSchema = new mongoose_1.Schema({
|
|
6
|
+
coupon_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Coupon", required: true, index: true },
|
|
7
|
+
code: { type: String, required: true },
|
|
8
|
+
user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
|
|
9
|
+
team_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", default: null },
|
|
10
|
+
scope: {
|
|
11
|
+
type: String,
|
|
12
|
+
enum: Object.values(enum_1.CouponScope),
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
domain_name: { type: String, default: null },
|
|
16
|
+
duration_years: { type: Number, default: null },
|
|
17
|
+
idempotency_key: { type: String },
|
|
18
|
+
transaction_reference: { type: String },
|
|
19
|
+
original_amount: { type: Number, required: true },
|
|
20
|
+
discount_amount: { type: Number, required: true },
|
|
21
|
+
final_amount: { type: Number, required: true },
|
|
22
|
+
status: {
|
|
23
|
+
type: String,
|
|
24
|
+
enum: Object.values(enum_1.CouponRedemptionStatus),
|
|
25
|
+
default: enum_1.CouponRedemptionStatus.Reserved,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
reserved_at: { type: Date, required: true },
|
|
29
|
+
applied_at: { type: Date, default: null },
|
|
30
|
+
reversed_at: { type: Date, default: null },
|
|
31
|
+
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "coupon_redemptions" });
|
|
32
|
+
couponRedemptionSchema.index({ coupon_id: 1, user_id: 1, status: 1 });
|
|
33
|
+
couponRedemptionSchema.index({ coupon_id: 1, transaction_reference: 1 }, {
|
|
34
|
+
unique: true,
|
|
35
|
+
partialFilterExpression: {
|
|
36
|
+
transaction_reference: { $exists: true },
|
|
37
|
+
status: enum_1.CouponRedemptionStatus.Applied,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
couponRedemptionSchema.index({ coupon_id: 1, user_id: 1, idempotency_key: 1 }, {
|
|
41
|
+
unique: true,
|
|
42
|
+
partialFilterExpression: { idempotency_key: { $exists: true } },
|
|
43
|
+
});
|
|
44
|
+
exports.default = (0, mongoose_1.model)("CouponRedemption", couponRedemptionSchema);
|
package/dist/coupon.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICoupon } from "./types/coupon";
|
|
2
|
+
declare const _default: import("mongoose").Model<ICoupon, {}, {}, {}, import("mongoose").Document<unknown, {}, ICoupon, {}, import("mongoose").DefaultSchemaOptions> & ICoupon & Required<{
|
|
3
|
+
_id: import("mongoose").Types.ObjectId;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, ICoupon>;
|
|
9
|
+
export default _default;
|
package/dist/coupon.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const couponSchema = new mongoose_1.Schema({
|
|
6
|
+
code: { type: String, required: true, unique: true, uppercase: true, trim: true },
|
|
7
|
+
description: { type: String, default: null },
|
|
8
|
+
scope: {
|
|
9
|
+
type: String,
|
|
10
|
+
enum: Object.values(enum_1.CouponScope),
|
|
11
|
+
default: enum_1.CouponScope.DomainPurchase,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
discount_type: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: Object.values(enum_1.CouponDiscountType),
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
discount_value: { type: Number, required: true, min: 0 },
|
|
20
|
+
currency: { type: String, default: "USD" },
|
|
21
|
+
max_redemptions: { type: Number, default: null },
|
|
22
|
+
max_redemptions_per_user: { type: Number, default: 1 },
|
|
23
|
+
redemption_count: { type: Number, default: 0 },
|
|
24
|
+
min_purchase_amount: { type: Number, default: null },
|
|
25
|
+
allowed_tlds: { type: [String], default: [] },
|
|
26
|
+
max_duration_years: { type: Number, default: null },
|
|
27
|
+
allow_below_cost: { type: Boolean, default: false },
|
|
28
|
+
starts_at: { type: Date, default: null },
|
|
29
|
+
expires_at: { type: Date, default: null },
|
|
30
|
+
enabled: { type: Boolean, default: true },
|
|
31
|
+
created_by: { type: String, default: null },
|
|
32
|
+
disabled_at: { type: Date, default: null },
|
|
33
|
+
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "coupons" });
|
|
34
|
+
couponSchema.index({ enabled: 1, expires_at: 1 });
|
|
35
|
+
exports.default = (0, mongoose_1.model)("Coupon", couponSchema);
|
package/dist/domain/index.js
CHANGED
package/dist/drain.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const mongoose_1 = require("mongoose");
|
|
4
4
|
const enum_1 = require("./enum");
|
|
5
5
|
const DrainSchema = new mongoose_1.Schema({
|
|
6
|
-
|
|
6
|
+
user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: false, index: true },
|
|
7
|
+
team: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", required: false, index: true },
|
|
7
8
|
name: { type: String, required: true, minlength: 1, maxlength: 64 },
|
|
8
9
|
type: { type: String, enum: Object.values(enum_1.DrainType), default: enum_1.DrainType.Https, required: true },
|
|
9
10
|
url: { type: String },
|
|
@@ -13,6 +14,8 @@ const DrainSchema = new mongoose_1.Schema({
|
|
|
13
14
|
region: { type: String },
|
|
14
15
|
endpoint: { type: String },
|
|
15
16
|
keyPrefix: { type: String, default: "" },
|
|
17
|
+
storageBucketId: { type: mongoose_1.Schema.Types.ObjectId, ref: "StorageBucket", default: null },
|
|
18
|
+
storageCredentialId: { type: mongoose_1.Schema.Types.ObjectId, ref: "StorageCredential", default: null },
|
|
16
19
|
},
|
|
17
20
|
secretsRef: { type: String, required: true },
|
|
18
21
|
sources: [{ type: String, enum: Object.values(enum_1.LogSource) }],
|
|
@@ -25,7 +28,6 @@ const DrainSchema = new mongoose_1.Schema({
|
|
|
25
28
|
statusReason: { type: String, default: null },
|
|
26
29
|
failingSince: { type: Date, default: null },
|
|
27
30
|
disabledAt: { type: Date, default: null },
|
|
28
|
-
deletedAt: { type: Date, default: null },
|
|
29
31
|
}, { timestamps: true });
|
|
30
|
-
DrainSchema.index({
|
|
32
|
+
DrainSchema.index({ user_id: 1, team: 1 });
|
|
31
33
|
exports.default = (0, mongoose_1.model)("Drain", DrainSchema);
|
package/dist/enum/index.d.ts
CHANGED
|
@@ -435,3 +435,15 @@ export declare enum WorkbenchMode {
|
|
|
435
435
|
}
|
|
436
436
|
export declare const QUEST_CLAIM_REQUIREMENTS: QuestRequirementType[];
|
|
437
437
|
export declare const QUEST_TARGETLESS_REQUIREMENTS: QuestRequirementType[];
|
|
438
|
+
export declare enum CouponDiscountType {
|
|
439
|
+
Percentage = "percentage",
|
|
440
|
+
Fixed = "fixed"
|
|
441
|
+
}
|
|
442
|
+
export declare enum CouponScope {
|
|
443
|
+
DomainPurchase = "domain_purchase"
|
|
444
|
+
}
|
|
445
|
+
export declare enum CouponRedemptionStatus {
|
|
446
|
+
Reserved = "reserved",
|
|
447
|
+
Applied = "applied",
|
|
448
|
+
Reversed = "reversed"
|
|
449
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
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_SOURCE = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
4
|
-
exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.WorkbenchMode = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = void 0;
|
|
4
|
+
exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.WorkbenchMode = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = void 0;
|
|
5
5
|
var GIT_TYPE;
|
|
6
6
|
(function (GIT_TYPE) {
|
|
7
7
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -531,3 +531,18 @@ exports.QUEST_TARGETLESS_REQUIREMENTS = [
|
|
|
531
531
|
QuestRequirementType.PaidPlan,
|
|
532
532
|
QuestRequirementType.PaymentMethod,
|
|
533
533
|
];
|
|
534
|
+
var CouponDiscountType;
|
|
535
|
+
(function (CouponDiscountType) {
|
|
536
|
+
CouponDiscountType["Percentage"] = "percentage";
|
|
537
|
+
CouponDiscountType["Fixed"] = "fixed";
|
|
538
|
+
})(CouponDiscountType || (exports.CouponDiscountType = CouponDiscountType = {}));
|
|
539
|
+
var CouponScope;
|
|
540
|
+
(function (CouponScope) {
|
|
541
|
+
CouponScope["DomainPurchase"] = "domain_purchase";
|
|
542
|
+
})(CouponScope || (exports.CouponScope = CouponScope = {}));
|
|
543
|
+
var CouponRedemptionStatus;
|
|
544
|
+
(function (CouponRedemptionStatus) {
|
|
545
|
+
CouponRedemptionStatus["Reserved"] = "reserved";
|
|
546
|
+
CouponRedemptionStatus["Applied"] = "applied";
|
|
547
|
+
CouponRedemptionStatus["Reversed"] = "reversed";
|
|
548
|
+
})(CouponRedemptionStatus || (exports.CouponRedemptionStatus = CouponRedemptionStatus = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export { default as AlertRule } from "./alert-rule";
|
|
|
59
59
|
export { default as AlertRuleStateModel } from "./alert-rule-state";
|
|
60
60
|
export { default as AlertEvent } from "./alert-event";
|
|
61
61
|
export { default as Drain } from "./drain";
|
|
62
|
+
export { default as ProjectDrainSubscription } from "./project-drain-subscription";
|
|
62
63
|
export { default as OwnershipTransfer } from "./ownership-transfer";
|
|
63
64
|
export { default as Sandbox } from "./sandbox";
|
|
64
65
|
export { default as SandboxActivity } from "./sandbox-activity";
|
|
@@ -77,8 +78,10 @@ export { default as StreakMilestone } from "./streak-milestone";
|
|
|
77
78
|
export { default as QuestCampaign } from "./quest-campaign";
|
|
78
79
|
export { default as QuestParticipation } from "./quest-participation";
|
|
79
80
|
export { default as QuestRewardIssuance } from "./quest-reward-issuance";
|
|
80
|
-
export {
|
|
81
|
-
export {
|
|
81
|
+
export { default as Coupon } from "./coupon";
|
|
82
|
+
export { default as CouponRedemption } from "./coupon-redemption";
|
|
83
|
+
export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IProjectNetworkSettings, IRatelimit, RatelimitConfig, RateLimitZone, RateLimitMatcher, DistributedRateLimitConfig, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IDnsChangeLog, 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, IAlertRule, IAlertRuleState, IAlertEvent, IAlertNotificationResult, IDrain, IProjectDrainSubscription, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, IIdempotencyRecord, IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition, IStreak, IStreakMilestoneRef, IStreakEvent, IStreakDay, IStreakMilestone, IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward, IQuestParticipation, IQuestCriterionProgress, IQuestRewardIssuance, IQuestIssuedReward, ICoupon, ICouponRedemption, } from "./types";
|
|
84
|
+
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, AlertMetric, AlertCondition, AlertRuleState, AlertChannelMode, AlertEventStatus, DrainType, DrainStatus, LogSource, DrainEventType, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, DNS_CHANGE_TYPE, DNS_CHANGE_SOURCE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, SCALING_SOURCE, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, PROJECT_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_EGRESS_MODE, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, StorageCredentialRole, StorageCredentialStatus, StorageMigrationStatus, XFrameOptions, XContentTypeOptions, XRobotsTag, QualifyingActionType, MilestoneType, QUEST_COUNTABLE_MILESTONES, ACTION_TO_MILESTONE, EligibilityType, RewardType, QuestRewardStatus, QuestCriterionType, QuestEntity, QuestRequirementType, QUEST_CLAIM_REQUIREMENTS, QUEST_TARGETLESS_REQUIREMENTS, WorkbenchMode, CouponDiscountType, CouponScope, CouponRedemptionStatus } from "./enum";
|
|
82
85
|
import mongoose from "mongoose";
|
|
83
86
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
84
87
|
export declare const db: mongoose.Connection;
|
package/dist/index.js
CHANGED
|
@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
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.DnsChangeLog = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.Ratelimit = exports.ProjectNetworkSettings = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.WorkbenchMode = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = void 0;
|
|
16
|
+
exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = 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.CouponRedemption = exports.Coupon = exports.QuestRewardIssuance = exports.QuestParticipation = exports.QuestCampaign = exports.StreakMilestone = exports.StreakDay = exports.StreakEvent = exports.Streak = exports.StorageMigration = exports.StorageCredential = exports.StorageToken = exports.StorageUpload = exports.StorageObject = exports.StorageBucket = exports.IdempotencyRecord = exports.ObjectStorageUsageSegment = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.ProjectDrainSubscription = exports.Drain = exports.AlertEvent = exports.AlertRuleStateModel = exports.AlertRule = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = exports.Invoice = void 0;
|
|
17
|
+
exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = 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.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.SCALING_SOURCE = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = void 0;
|
|
18
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = exports.WorkbenchMode = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = void 0;
|
|
19
19
|
var user_1 = require("./user");
|
|
20
20
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
21
21
|
var project_1 = require("./project");
|
|
@@ -139,6 +139,8 @@ var alert_event_1 = require("./alert-event");
|
|
|
139
139
|
Object.defineProperty(exports, "AlertEvent", { enumerable: true, get: function () { return __importDefault(alert_event_1).default; } });
|
|
140
140
|
var drain_1 = require("./drain");
|
|
141
141
|
Object.defineProperty(exports, "Drain", { enumerable: true, get: function () { return __importDefault(drain_1).default; } });
|
|
142
|
+
var project_drain_subscription_1 = require("./project-drain-subscription");
|
|
143
|
+
Object.defineProperty(exports, "ProjectDrainSubscription", { enumerable: true, get: function () { return __importDefault(project_drain_subscription_1).default; } });
|
|
142
144
|
var ownership_transfer_1 = require("./ownership-transfer");
|
|
143
145
|
Object.defineProperty(exports, "OwnershipTransfer", { enumerable: true, get: function () { return __importDefault(ownership_transfer_1).default; } });
|
|
144
146
|
var sandbox_1 = require("./sandbox");
|
|
@@ -180,6 +182,10 @@ var quest_participation_1 = require("./quest-participation");
|
|
|
180
182
|
Object.defineProperty(exports, "QuestParticipation", { enumerable: true, get: function () { return __importDefault(quest_participation_1).default; } });
|
|
181
183
|
var quest_reward_issuance_1 = require("./quest-reward-issuance");
|
|
182
184
|
Object.defineProperty(exports, "QuestRewardIssuance", { enumerable: true, get: function () { return __importDefault(quest_reward_issuance_1).default; } });
|
|
185
|
+
var coupon_1 = require("./coupon");
|
|
186
|
+
Object.defineProperty(exports, "Coupon", { enumerable: true, get: function () { return __importDefault(coupon_1).default; } });
|
|
187
|
+
var coupon_redemption_1 = require("./coupon-redemption");
|
|
188
|
+
Object.defineProperty(exports, "CouponRedemption", { enumerable: true, get: function () { return __importDefault(coupon_redemption_1).default; } });
|
|
183
189
|
var enum_1 = require("./enum");
|
|
184
190
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
185
191
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -255,6 +261,9 @@ Object.defineProperty(exports, "QuestRequirementType", { enumerable: true, get:
|
|
|
255
261
|
Object.defineProperty(exports, "QUEST_CLAIM_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_CLAIM_REQUIREMENTS; } });
|
|
256
262
|
Object.defineProperty(exports, "QUEST_TARGETLESS_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_TARGETLESS_REQUIREMENTS; } });
|
|
257
263
|
Object.defineProperty(exports, "WorkbenchMode", { enumerable: true, get: function () { return enum_1.WorkbenchMode; } });
|
|
264
|
+
Object.defineProperty(exports, "CouponDiscountType", { enumerable: true, get: function () { return enum_1.CouponDiscountType; } });
|
|
265
|
+
Object.defineProperty(exports, "CouponScope", { enumerable: true, get: function () { return enum_1.CouponScope; } });
|
|
266
|
+
Object.defineProperty(exports, "CouponRedemptionStatus", { enumerable: true, get: function () { return enum_1.CouponRedemptionStatus; } });
|
|
258
267
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
259
268
|
const utils_1 = require("@brimble/utils");
|
|
260
269
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IProjectDrainSubscription } from "./types";
|
|
2
|
+
declare const _default: import("mongoose").Model<IProjectDrainSubscription, {}, {}, {}, import("mongoose").Document<unknown, {}, IProjectDrainSubscription, {}, import("mongoose").DefaultSchemaOptions> & IProjectDrainSubscription & Required<{
|
|
3
|
+
_id: import("mongoose").Types.ObjectId;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, IProjectDrainSubscription>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const ProjectDrainSubscriptionSchema = new mongoose_1.Schema({
|
|
5
|
+
drain: { type: mongoose_1.Schema.Types.ObjectId, ref: "Drain", required: true, index: true },
|
|
6
|
+
project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: true, index: true },
|
|
7
|
+
enabled: { type: Boolean, default: true },
|
|
8
|
+
disabledAt: { type: Date, default: null },
|
|
9
|
+
}, { timestamps: true });
|
|
10
|
+
ProjectDrainSubscriptionSchema.index({ drain: 1, project: 1 }, { unique: true });
|
|
11
|
+
exports.default = (0, mongoose_1.model)("ProjectDrainSubscription", ProjectDrainSubscriptionSchema);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { CouponRedemptionStatus, CouponScope } from "../enum";
|
|
3
|
+
export interface ICouponRedemption extends Document {
|
|
4
|
+
coupon_id: Types.ObjectId;
|
|
5
|
+
code: string;
|
|
6
|
+
user_id: Types.ObjectId;
|
|
7
|
+
team_id?: Types.ObjectId | null;
|
|
8
|
+
scope: CouponScope;
|
|
9
|
+
domain_name?: string | null;
|
|
10
|
+
duration_years?: number | null;
|
|
11
|
+
idempotency_key?: string | null;
|
|
12
|
+
transaction_reference?: string | null;
|
|
13
|
+
original_amount: number;
|
|
14
|
+
discount_amount: number;
|
|
15
|
+
final_amount: number;
|
|
16
|
+
status: CouponRedemptionStatus;
|
|
17
|
+
reserved_at: Date;
|
|
18
|
+
applied_at?: Date | null;
|
|
19
|
+
reversed_at?: Date | null;
|
|
20
|
+
created_at?: Date;
|
|
21
|
+
updated_at?: Date;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { CouponDiscountType, CouponScope } from "../enum";
|
|
3
|
+
export interface ICoupon extends Document {
|
|
4
|
+
code: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
scope: CouponScope;
|
|
7
|
+
discount_type: CouponDiscountType;
|
|
8
|
+
discount_value: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
max_redemptions?: number | null;
|
|
11
|
+
max_redemptions_per_user: number;
|
|
12
|
+
redemption_count: number;
|
|
13
|
+
min_purchase_amount?: number | null;
|
|
14
|
+
allowed_tlds: string[];
|
|
15
|
+
max_duration_years?: number | null;
|
|
16
|
+
allow_below_cost: boolean;
|
|
17
|
+
starts_at?: Date | null;
|
|
18
|
+
expires_at?: Date | null;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
created_by?: string | null;
|
|
21
|
+
disabled_at?: Date | null;
|
|
22
|
+
created_at?: Date;
|
|
23
|
+
updated_at?: Date;
|
|
24
|
+
}
|
package/dist/types/drain.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { Document, Types } from "mongoose";
|
|
|
2
2
|
import { DrainStatus, DrainType, LogSource } from "../enum";
|
|
3
3
|
export interface IDrain extends Document {
|
|
4
4
|
_id: Types.ObjectId;
|
|
5
|
-
|
|
5
|
+
user_id?: Types.ObjectId;
|
|
6
|
+
team?: Types.ObjectId | null;
|
|
6
7
|
name: string;
|
|
7
8
|
type: DrainType;
|
|
8
9
|
url?: string | null;
|
|
@@ -12,6 +13,8 @@ export interface IDrain extends Document {
|
|
|
12
13
|
region?: string;
|
|
13
14
|
endpoint?: string | null;
|
|
14
15
|
keyPrefix?: string;
|
|
16
|
+
storageBucketId?: Types.ObjectId | null;
|
|
17
|
+
storageCredentialId?: Types.ObjectId | null;
|
|
15
18
|
} | null;
|
|
16
19
|
secretsRef: string;
|
|
17
20
|
sources: LogSource[];
|
|
@@ -19,7 +22,6 @@ export interface IDrain extends Document {
|
|
|
19
22
|
statusReason?: string | null;
|
|
20
23
|
failingSince?: Date | null;
|
|
21
24
|
disabledAt?: Date | null;
|
|
22
|
-
deletedAt?: Date | null;
|
|
23
25
|
createdAt: Date;
|
|
24
26
|
updatedAt: Date;
|
|
25
27
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export type { IAlertRule } from "./alert-rule";
|
|
|
60
60
|
export type { IAlertRuleState } from "./alert-rule-state";
|
|
61
61
|
export type { IAlertEvent, IAlertNotificationResult } from "./alert-event";
|
|
62
62
|
export type { IDrain } from "./drain";
|
|
63
|
+
export type { IProjectDrainSubscription } from "./project-drain-subscription";
|
|
63
64
|
export type { IOwnershipTransfer } from "./ownership-transfer";
|
|
64
65
|
export type { ISandbox, ISandboxSpecs, ISandboxEgress } from "./sandbox";
|
|
65
66
|
export type { ISandboxActivity } from "./sandbox-activity";
|
|
@@ -78,3 +79,5 @@ export type { IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward,
|
|
|
78
79
|
export type { IQuestParticipation, IQuestCriterionProgress, } from "./quest-participation";
|
|
79
80
|
export type { IQuestRewardIssuance, IQuestIssuedReward, } from "./quest-reward-issuance";
|
|
80
81
|
export type { IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition } from "./storage";
|
|
82
|
+
export type { ICoupon } from "./coupon";
|
|
83
|
+
export type { ICouponRedemption } from "./coupon-redemption";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
export interface IProjectDrainSubscription extends Document {
|
|
3
|
+
_id: Types.ObjectId;
|
|
4
|
+
drain: Types.ObjectId;
|
|
5
|
+
project: Types.ObjectId;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
disabledAt?: Date | null;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
}
|