@brimble/models 3.8.53 → 3.8.55

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.
Files changed (38) hide show
  1. package/dist/db-image.js +14 -0
  2. package/dist/enum/index.d.ts +67 -0
  3. package/dist/enum/index.js +98 -1
  4. package/dist/index.d.ts +9 -2
  5. package/dist/index.js +29 -2
  6. package/dist/project/index.js +4 -0
  7. package/dist/quest-campaign.d.ts +9 -0
  8. package/dist/quest-campaign.js +39 -0
  9. package/dist/quest-participation.d.ts +9 -0
  10. package/dist/quest-participation.js +21 -0
  11. package/dist/quest-reward-issuance.d.ts +9 -0
  12. package/dist/quest-reward-issuance.js +19 -0
  13. package/dist/streak-day.d.ts +9 -0
  14. package/dist/streak-day.js +11 -0
  15. package/dist/streak-event.d.ts +9 -0
  16. package/dist/streak-event.js +18 -0
  17. package/dist/streak-milestone.d.ts +9 -0
  18. package/dist/streak-milestone.js +11 -0
  19. package/dist/streak.d.ts +9 -0
  20. package/dist/streak.js +17 -0
  21. package/dist/types/db-image.d.ts +4 -1
  22. package/dist/types/index.d.ts +7 -0
  23. package/dist/types/project/index.d.ts +1 -0
  24. package/dist/types/quest-campaign.d.ts +38 -0
  25. package/dist/types/quest-campaign.js +2 -0
  26. package/dist/types/quest-participation.d.ts +19 -0
  27. package/dist/types/quest-participation.js +2 -0
  28. package/dist/types/quest-reward-issuance.d.ts +17 -0
  29. package/dist/types/quest-reward-issuance.js +2 -0
  30. package/dist/types/streak-day.d.ts +9 -0
  31. package/dist/types/streak-day.js +2 -0
  32. package/dist/types/streak-event.d.ts +13 -0
  33. package/dist/types/streak-event.js +2 -0
  34. package/dist/types/streak-milestone.d.ts +10 -0
  35. package/dist/types/streak-milestone.js +2 -0
  36. package/dist/types/streak.d.ts +17 -0
  37. package/dist/types/streak.js +2 -0
  38. package/package.json +1 -1
package/dist/db-image.js CHANGED
@@ -40,6 +40,20 @@ const dbImageSchema = new mongoose_1.Schema({
40
40
  type: Number,
41
41
  required: true,
42
42
  },
43
+ ha: {
44
+ type: Boolean,
45
+ required: false,
46
+ default: false
47
+ },
48
+ workbench: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ workbench_mode: {
53
+ type: String,
54
+ enum: Object.values(enum_1.WorkbenchMode),
55
+ required: false,
56
+ },
43
57
  volumePath: {
44
58
  type: String,
45
59
  required: true,
@@ -292,3 +292,70 @@ export declare enum XRobotsTag {
292
292
  IndexNoFollow = "index, nofollow",
293
293
  Disabled = "disabled"
294
294
  }
295
+ export declare enum QualifyingActionType {
296
+ Deployment = "deployment",
297
+ DomainPurchase = "domain_purchase",
298
+ DomainConnect = "domain_connect",
299
+ DatabaseProvision = "database_provision",
300
+ BucketProvision = "bucket_provision",
301
+ SandboxCreate = "sandbox_create",
302
+ AutoscalingCreate = "autoscaling_create",
303
+ AutoscalingApply = "autoscaling_apply"
304
+ }
305
+ export declare enum MilestoneType {
306
+ LiveDeploy = "live_deploy",
307
+ DomainPurchase = "domain_purchase",
308
+ DomainConnect = "domain_connect",
309
+ DatabaseProvision = "database_provision",
310
+ BucketProvision = "bucket_provision",
311
+ SandboxCreate = "sandbox_create",
312
+ AutoscalingCreate = "autoscaling_create",
313
+ AutoscalingApply = "autoscaling_apply"
314
+ }
315
+ export declare const QUEST_COUNTABLE_MILESTONES: MilestoneType[];
316
+ export declare const ACTION_TO_MILESTONE: Record<QualifyingActionType, MilestoneType>;
317
+ export declare enum EligibilityType {
318
+ Streak = "streak",
319
+ Paid = "paid"
320
+ }
321
+ export declare enum RewardType {
322
+ Merch = "merch",
323
+ SubscriptionPass = "subscription_pass",
324
+ FreeDomain = "free_domain",
325
+ DiscountedDomain = "discounted_domain",
326
+ BuildMinutes = "build_minutes",
327
+ FreeCompute = "free_compute",
328
+ CashPrize = "cash_prize"
329
+ }
330
+ export declare enum QuestRewardStatus {
331
+ Claimed = "claimed",
332
+ Fulfilled = "fulfilled"
333
+ }
334
+ export declare enum QuestCriterionType {
335
+ StreakThreshold = "streak_threshold",
336
+ DistinctMilestones = "distinct_milestones",
337
+ EntityCount = "entity_count",
338
+ ActionCount = "action_count",
339
+ BuildMinutes = "build_minutes"
340
+ }
341
+ export declare enum QuestEntity {
342
+ Project = "project",
343
+ Sandbox = "sandbox",
344
+ Bucket = "bucket",
345
+ Domain = "domain",
346
+ Database = "database"
347
+ }
348
+ export declare enum QuestRequirementType {
349
+ AccountAgeDays = "account_age_days",
350
+ PaidPlan = "paid_plan",
351
+ PaymentMethod = "payment_method",
352
+ DeploymentAgeMinutes = "deployment_age_minutes",
353
+ RewardCooldownDays = "reward_cooldown_days"
354
+ }
355
+ export declare enum WorkbenchMode {
356
+ SQL = "sql",
357
+ Kv = "kv",
358
+ Document = "document"
359
+ }
360
+ export declare const QUEST_CLAIM_REQUIREMENTS: QuestRequirementType[];
361
+ export declare const QUEST_TARGETLESS_REQUIREMENTS: QuestRequirementType[];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
3
+ 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_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
4
+ 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 = void 0;
4
5
  var GIT_TYPE;
5
6
  (function (GIT_TYPE) {
6
7
  GIT_TYPE["GITHUB"] = "GITHUB";
@@ -344,3 +345,99 @@ var XRobotsTag;
344
345
  XRobotsTag["IndexNoFollow"] = "index, nofollow";
345
346
  XRobotsTag["Disabled"] = "disabled";
346
347
  })(XRobotsTag || (exports.XRobotsTag = XRobotsTag = {}));
348
+ var QualifyingActionType;
349
+ (function (QualifyingActionType) {
350
+ QualifyingActionType["Deployment"] = "deployment";
351
+ QualifyingActionType["DomainPurchase"] = "domain_purchase";
352
+ QualifyingActionType["DomainConnect"] = "domain_connect";
353
+ QualifyingActionType["DatabaseProvision"] = "database_provision";
354
+ QualifyingActionType["BucketProvision"] = "bucket_provision";
355
+ QualifyingActionType["SandboxCreate"] = "sandbox_create";
356
+ QualifyingActionType["AutoscalingCreate"] = "autoscaling_create";
357
+ QualifyingActionType["AutoscalingApply"] = "autoscaling_apply";
358
+ })(QualifyingActionType || (exports.QualifyingActionType = QualifyingActionType = {}));
359
+ var MilestoneType;
360
+ (function (MilestoneType) {
361
+ MilestoneType["LiveDeploy"] = "live_deploy";
362
+ MilestoneType["DomainPurchase"] = "domain_purchase";
363
+ MilestoneType["DomainConnect"] = "domain_connect";
364
+ MilestoneType["DatabaseProvision"] = "database_provision";
365
+ MilestoneType["BucketProvision"] = "bucket_provision";
366
+ MilestoneType["SandboxCreate"] = "sandbox_create";
367
+ MilestoneType["AutoscalingCreate"] = "autoscaling_create";
368
+ MilestoneType["AutoscalingApply"] = "autoscaling_apply";
369
+ })(MilestoneType || (exports.MilestoneType = MilestoneType = {}));
370
+ exports.QUEST_COUNTABLE_MILESTONES = [
371
+ MilestoneType.LiveDeploy,
372
+ MilestoneType.DomainPurchase,
373
+ MilestoneType.DomainConnect,
374
+ MilestoneType.DatabaseProvision,
375
+ MilestoneType.BucketProvision,
376
+ ];
377
+ exports.ACTION_TO_MILESTONE = {
378
+ [QualifyingActionType.Deployment]: MilestoneType.LiveDeploy,
379
+ [QualifyingActionType.DomainPurchase]: MilestoneType.DomainPurchase,
380
+ [QualifyingActionType.DomainConnect]: MilestoneType.DomainConnect,
381
+ [QualifyingActionType.DatabaseProvision]: MilestoneType.DatabaseProvision,
382
+ [QualifyingActionType.BucketProvision]: MilestoneType.BucketProvision,
383
+ [QualifyingActionType.SandboxCreate]: MilestoneType.SandboxCreate,
384
+ [QualifyingActionType.AutoscalingCreate]: MilestoneType.AutoscalingCreate,
385
+ [QualifyingActionType.AutoscalingApply]: MilestoneType.AutoscalingApply,
386
+ };
387
+ var EligibilityType;
388
+ (function (EligibilityType) {
389
+ EligibilityType["Streak"] = "streak";
390
+ EligibilityType["Paid"] = "paid";
391
+ })(EligibilityType || (exports.EligibilityType = EligibilityType = {}));
392
+ var RewardType;
393
+ (function (RewardType) {
394
+ RewardType["Merch"] = "merch";
395
+ RewardType["SubscriptionPass"] = "subscription_pass";
396
+ RewardType["FreeDomain"] = "free_domain";
397
+ RewardType["DiscountedDomain"] = "discounted_domain";
398
+ RewardType["BuildMinutes"] = "build_minutes";
399
+ RewardType["FreeCompute"] = "free_compute";
400
+ RewardType["CashPrize"] = "cash_prize";
401
+ })(RewardType || (exports.RewardType = RewardType = {}));
402
+ var QuestRewardStatus;
403
+ (function (QuestRewardStatus) {
404
+ QuestRewardStatus["Claimed"] = "claimed";
405
+ QuestRewardStatus["Fulfilled"] = "fulfilled";
406
+ })(QuestRewardStatus || (exports.QuestRewardStatus = QuestRewardStatus = {}));
407
+ var QuestCriterionType;
408
+ (function (QuestCriterionType) {
409
+ QuestCriterionType["StreakThreshold"] = "streak_threshold";
410
+ QuestCriterionType["DistinctMilestones"] = "distinct_milestones";
411
+ QuestCriterionType["EntityCount"] = "entity_count";
412
+ QuestCriterionType["ActionCount"] = "action_count";
413
+ QuestCriterionType["BuildMinutes"] = "build_minutes";
414
+ })(QuestCriterionType || (exports.QuestCriterionType = QuestCriterionType = {}));
415
+ var QuestEntity;
416
+ (function (QuestEntity) {
417
+ QuestEntity["Project"] = "project";
418
+ QuestEntity["Sandbox"] = "sandbox";
419
+ QuestEntity["Bucket"] = "bucket";
420
+ QuestEntity["Domain"] = "domain";
421
+ QuestEntity["Database"] = "database";
422
+ })(QuestEntity || (exports.QuestEntity = QuestEntity = {}));
423
+ var QuestRequirementType;
424
+ (function (QuestRequirementType) {
425
+ QuestRequirementType["AccountAgeDays"] = "account_age_days";
426
+ QuestRequirementType["PaidPlan"] = "paid_plan";
427
+ QuestRequirementType["PaymentMethod"] = "payment_method";
428
+ QuestRequirementType["DeploymentAgeMinutes"] = "deployment_age_minutes";
429
+ QuestRequirementType["RewardCooldownDays"] = "reward_cooldown_days";
430
+ })(QuestRequirementType || (exports.QuestRequirementType = QuestRequirementType = {}));
431
+ var WorkbenchMode;
432
+ (function (WorkbenchMode) {
433
+ WorkbenchMode["SQL"] = "sql";
434
+ WorkbenchMode["Kv"] = "kv";
435
+ WorkbenchMode["Document"] = "document";
436
+ })(WorkbenchMode || (exports.WorkbenchMode = WorkbenchMode = {}));
437
+ exports.QUEST_CLAIM_REQUIREMENTS = [
438
+ QuestRequirementType.RewardCooldownDays,
439
+ ];
440
+ exports.QUEST_TARGETLESS_REQUIREMENTS = [
441
+ QuestRequirementType.PaidPlan,
442
+ QuestRequirementType.PaymentMethod,
443
+ ];
package/dist/index.d.ts CHANGED
@@ -65,8 +65,15 @@ export { default as VolumeUsageSegment } from "./volume-usage-segment";
65
65
  export { default as ObjectStorageUsageSegment } from "./object-storage-usage-segment";
66
66
  export { default as IdempotencyRecord } from "./idempotency";
67
67
  export { StorageBucket, StorageObject, StorageUpload, StorageToken, StorageCredential, StorageMigration } from "./storage";
68
- 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, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, IIdempotencyRecord, IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition } from "./types";
69
- export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, DomainTransferProvider, DomainTransferDirection, DomainTransferStatus, NomadDeploymentStatus, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE, SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, StorageCredentialRole, StorageCredentialStatus, StorageMigrationStatus, XFrameOptions, XContentTypeOptions, XRobotsTag, } from "./enum";
68
+ export { default as Streak } from "./streak";
69
+ export { default as StreakEvent } from "./streak-event";
70
+ export { default as StreakDay } from "./streak-day";
71
+ export { default as StreakMilestone } from "./streak-milestone";
72
+ export { default as QuestCampaign } from "./quest-campaign";
73
+ export { default as QuestParticipation } from "./quest-participation";
74
+ export { default as QuestRewardIssuance } from "./quest-reward-issuance";
75
+ 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, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, 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, } from "./types";
76
+ export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, DomainTransferProvider, DomainTransferDirection, DomainTransferStatus, NomadDeploymentStatus, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE, SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, 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 } from "./enum";
70
77
  import mongoose from "mongoose";
71
78
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
72
79
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -13,8 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.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.Ratelimit = exports.ProjectNetworkSettings = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
16
- 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.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.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = void 0;
17
- exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = void 0;
16
+ 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.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.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = void 0;
17
+ 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 = 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_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 = 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");
@@ -155,6 +155,20 @@ Object.defineProperty(exports, "StorageUpload", { enumerable: true, get: functio
155
155
  Object.defineProperty(exports, "StorageToken", { enumerable: true, get: function () { return storage_1.StorageToken; } });
156
156
  Object.defineProperty(exports, "StorageCredential", { enumerable: true, get: function () { return storage_1.StorageCredential; } });
157
157
  Object.defineProperty(exports, "StorageMigration", { enumerable: true, get: function () { return storage_1.StorageMigration; } });
158
+ var streak_1 = require("./streak");
159
+ Object.defineProperty(exports, "Streak", { enumerable: true, get: function () { return __importDefault(streak_1).default; } });
160
+ var streak_event_1 = require("./streak-event");
161
+ Object.defineProperty(exports, "StreakEvent", { enumerable: true, get: function () { return __importDefault(streak_event_1).default; } });
162
+ var streak_day_1 = require("./streak-day");
163
+ Object.defineProperty(exports, "StreakDay", { enumerable: true, get: function () { return __importDefault(streak_day_1).default; } });
164
+ var streak_milestone_1 = require("./streak-milestone");
165
+ Object.defineProperty(exports, "StreakMilestone", { enumerable: true, get: function () { return __importDefault(streak_milestone_1).default; } });
166
+ var quest_campaign_1 = require("./quest-campaign");
167
+ Object.defineProperty(exports, "QuestCampaign", { enumerable: true, get: function () { return __importDefault(quest_campaign_1).default; } });
168
+ var quest_participation_1 = require("./quest-participation");
169
+ Object.defineProperty(exports, "QuestParticipation", { enumerable: true, get: function () { return __importDefault(quest_participation_1).default; } });
170
+ var quest_reward_issuance_1 = require("./quest-reward-issuance");
171
+ Object.defineProperty(exports, "QuestRewardIssuance", { enumerable: true, get: function () { return __importDefault(quest_reward_issuance_1).default; } });
158
172
  var enum_1 = require("./enum");
159
173
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
160
174
  Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
@@ -203,6 +217,19 @@ Object.defineProperty(exports, "StorageMigrationStatus", { enumerable: true, get
203
217
  Object.defineProperty(exports, "XFrameOptions", { enumerable: true, get: function () { return enum_1.XFrameOptions; } });
204
218
  Object.defineProperty(exports, "XContentTypeOptions", { enumerable: true, get: function () { return enum_1.XContentTypeOptions; } });
205
219
  Object.defineProperty(exports, "XRobotsTag", { enumerable: true, get: function () { return enum_1.XRobotsTag; } });
220
+ Object.defineProperty(exports, "QualifyingActionType", { enumerable: true, get: function () { return enum_1.QualifyingActionType; } });
221
+ Object.defineProperty(exports, "MilestoneType", { enumerable: true, get: function () { return enum_1.MilestoneType; } });
222
+ Object.defineProperty(exports, "QUEST_COUNTABLE_MILESTONES", { enumerable: true, get: function () { return enum_1.QUEST_COUNTABLE_MILESTONES; } });
223
+ Object.defineProperty(exports, "ACTION_TO_MILESTONE", { enumerable: true, get: function () { return enum_1.ACTION_TO_MILESTONE; } });
224
+ Object.defineProperty(exports, "EligibilityType", { enumerable: true, get: function () { return enum_1.EligibilityType; } });
225
+ Object.defineProperty(exports, "RewardType", { enumerable: true, get: function () { return enum_1.RewardType; } });
226
+ Object.defineProperty(exports, "QuestRewardStatus", { enumerable: true, get: function () { return enum_1.QuestRewardStatus; } });
227
+ Object.defineProperty(exports, "QuestCriterionType", { enumerable: true, get: function () { return enum_1.QuestCriterionType; } });
228
+ Object.defineProperty(exports, "QuestEntity", { enumerable: true, get: function () { return enum_1.QuestEntity; } });
229
+ Object.defineProperty(exports, "QuestRequirementType", { enumerable: true, get: function () { return enum_1.QuestRequirementType; } });
230
+ Object.defineProperty(exports, "QUEST_CLAIM_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_CLAIM_REQUIREMENTS; } });
231
+ Object.defineProperty(exports, "QUEST_TARGETLESS_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_TARGETLESS_REQUIREMENTS; } });
232
+ Object.defineProperty(exports, "WorkbenchMode", { enumerable: true, get: function () { return enum_1.WorkbenchMode; } });
206
233
  const mongoose_1 = __importDefault(require("mongoose"));
207
234
  const utils_1 = require("@brimble/utils");
208
235
  const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -31,6 +31,10 @@ const projectSchema = new mongoose_1.Schema({
31
31
  type: Boolean,
32
32
  default: true,
33
33
  },
34
+ workBenchEnabled: {
35
+ type: Boolean,
36
+ default: false
37
+ },
34
38
  domains: [
35
39
  {
36
40
  ref: "Domain",
@@ -0,0 +1,9 @@
1
+ import { IQuestCampaign } from "./types";
2
+ declare const _default: import("mongoose").Model<IQuestCampaign, {}, {}, {}, import("mongoose").Document<unknown, {}, IQuestCampaign, {}, import("mongoose").DefaultSchemaOptions> & IQuestCampaign & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IQuestCampaign>;
9
+ export default _default;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const questCriterionSchema = new mongoose_1.Schema({
5
+ type: { type: String, required: true },
6
+ label: { type: String, required: true },
7
+ target: { type: Number, required: true },
8
+ entity: { type: String, default: null },
9
+ action: { type: String, default: null },
10
+ service_type: { type: String, default: null },
11
+ distinct: { type: Boolean, default: false },
12
+ milestones: { type: [String], default: [] },
13
+ }, { _id: false });
14
+ const questRequirementSchema = new mongoose_1.Schema({
15
+ type: { type: String, required: true },
16
+ target: { type: Number, default: 0 },
17
+ message: { type: String, default: null },
18
+ }, { _id: false });
19
+ const questRewardSchema = new mongoose_1.Schema({
20
+ type: { type: String, required: true },
21
+ metadata: { type: mongoose_1.Schema.Types.Mixed, default: {} },
22
+ }, { _id: false });
23
+ const questCampaignSchema = new mongoose_1.Schema({
24
+ name: { type: String, required: true },
25
+ slug: { type: String, required: true, unique: true },
26
+ start_at: { type: Date, required: true },
27
+ end_at: { type: Date, required: true },
28
+ eligibility_type: { type: String, required: true },
29
+ min_streak_to_join: { type: Number, default: 0 },
30
+ slots_total: { type: Number, required: true },
31
+ slots_remaining: { type: Number, required: true },
32
+ criteria: { type: [questCriterionSchema], default: [] },
33
+ requirements: { type: [questRequirementSchema], default: [] },
34
+ rewards: { type: [questRewardSchema], default: [] },
35
+ active: { type: Boolean, default: true, index: true },
36
+ auto_expire: { type: Boolean, default: true },
37
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "quest_campaigns" });
38
+ questCampaignSchema.index({ active: 1, start_at: 1, end_at: 1 });
39
+ exports.default = (0, mongoose_1.model)("QuestCampaign", questCampaignSchema);
@@ -0,0 +1,9 @@
1
+ import { IQuestParticipation } from "./types";
2
+ declare const _default: import("mongoose").Model<IQuestParticipation, {}, {}, {}, import("mongoose").Document<unknown, {}, IQuestParticipation, {}, import("mongoose").DefaultSchemaOptions> & IQuestParticipation & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IQuestParticipation>;
9
+ export default _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const questCriterionProgressSchema = new mongoose_1.Schema({
5
+ key: { type: String, required: true },
6
+ current: { type: Number, default: 0 },
7
+ target: { type: Number, required: true },
8
+ met: { type: Boolean, default: false },
9
+ }, { _id: false });
10
+ const questParticipationSchema = new mongoose_1.Schema({
11
+ campaign_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "QuestCampaign", required: true, index: true },
12
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
13
+ joined_at: { type: Date, required: true },
14
+ slot_number: { type: Number, required: true },
15
+ streak_deducted: { type: Number, default: 0 },
16
+ criteria_progress: { type: [questCriterionProgressSchema], default: [] },
17
+ qualifier_met: { type: Boolean, default: false },
18
+ claimed_at: { type: Date, default: null },
19
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "quest_participations" });
20
+ questParticipationSchema.index({ campaign_id: 1, user_id: 1 }, { unique: true });
21
+ exports.default = (0, mongoose_1.model)("QuestParticipation", questParticipationSchema);
@@ -0,0 +1,9 @@
1
+ import { IQuestRewardIssuance } from "./types";
2
+ declare const _default: import("mongoose").Model<IQuestRewardIssuance, {}, {}, {}, import("mongoose").Document<unknown, {}, IQuestRewardIssuance, {}, import("mongoose").DefaultSchemaOptions> & IQuestRewardIssuance & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IQuestRewardIssuance>;
9
+ export default _default;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const questIssuedRewardSchema = new mongoose_1.Schema({
6
+ type: { type: String, required: true },
7
+ metadata: { type: mongoose_1.Schema.Types.Mixed, default: {} },
8
+ }, { _id: false });
9
+ const questRewardIssuanceSchema = new mongoose_1.Schema({
10
+ participation_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "QuestParticipation", required: true, index: true },
11
+ campaign_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "QuestCampaign", required: true, index: true },
12
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
13
+ rewards: { type: [questIssuedRewardSchema], default: [] },
14
+ status: { type: String, required: true, default: enum_1.QuestRewardStatus.Claimed },
15
+ claimed_at: { type: Date, required: true },
16
+ fulfilled_at: { type: Date, default: null },
17
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "quest_reward_issuances" });
18
+ questRewardIssuanceSchema.index({ campaign_id: 1, user_id: 1 }, { unique: true });
19
+ exports.default = (0, mongoose_1.model)("QuestRewardIssuance", questRewardIssuanceSchema);
@@ -0,0 +1,9 @@
1
+ import { IStreakDay } from "./types";
2
+ declare const _default: import("mongoose").Model<IStreakDay, {}, {}, {}, import("mongoose").Document<unknown, {}, IStreakDay, {}, import("mongoose").DefaultSchemaOptions> & IStreakDay & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IStreakDay>;
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 streakDaySchema = new mongoose_1.Schema({
5
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
6
+ day: { type: Date, required: true },
7
+ action_types: { type: [String], default: [] },
8
+ is_milestone_day: { type: Boolean, default: false },
9
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "streak_days" });
10
+ streakDaySchema.index({ user_id: 1, day: 1 }, { unique: true });
11
+ exports.default = (0, mongoose_1.model)("StreakDay", streakDaySchema);
@@ -0,0 +1,9 @@
1
+ import { IStreakEvent } from "./types";
2
+ declare const _default: import("mongoose").Model<IStreakEvent, {}, {}, {}, import("mongoose").Document<unknown, {}, IStreakEvent, {}, import("mongoose").DefaultSchemaOptions> & IStreakEvent & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IStreakEvent>;
9
+ export default _default;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const streakEventSchema = new mongoose_1.Schema({
5
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
6
+ action_type: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ project_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", default: null },
11
+ resource_id: { type: mongoose_1.Schema.Types.ObjectId, default: null },
12
+ service_type: { type: String, default: null },
13
+ system_day: { type: Date, required: true, index: true },
14
+ dedupe_key: { type: String, required: true, unique: true },
15
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "streak_events" });
16
+ streakEventSchema.index({ user_id: 1, system_day: 1 });
17
+ streakEventSchema.index({ user_id: 1, action_type: 1, created_at: 1 });
18
+ exports.default = (0, mongoose_1.model)("StreakEvent", streakEventSchema);
@@ -0,0 +1,9 @@
1
+ import { IStreakMilestone } from "./types";
2
+ declare const _default: import("mongoose").Model<IStreakMilestone, {}, {}, {}, import("mongoose").Document<unknown, {}, IStreakMilestone, {}, import("mongoose").DefaultSchemaOptions> & IStreakMilestone & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IStreakMilestone>;
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 streakMilestoneSchema = new mongoose_1.Schema({
5
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
6
+ type: { type: String, required: true },
7
+ action: { type: String, required: true },
8
+ date: { type: Date, required: true },
9
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "streak_milestones" });
10
+ streakMilestoneSchema.index({ user_id: 1, type: 1, date: 1 }, { unique: true });
11
+ exports.default = (0, mongoose_1.model)("StreakMilestone", streakMilestoneSchema);
@@ -0,0 +1,9 @@
1
+ import { IStreak } from "./types";
2
+ declare const _default: import("mongoose").Model<IStreak, {}, {}, {}, import("mongoose").Document<unknown, {}, IStreak, {}, import("mongoose").DefaultSchemaOptions> & IStreak & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IStreak>;
9
+ export default _default;
package/dist/streak.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const streakMilestoneRefSchema = new mongoose_1.Schema({
5
+ type: { type: String, required: true },
6
+ date: { type: Date, required: true },
7
+ }, { _id: false });
8
+ const streakSchema = new mongoose_1.Schema({
9
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, unique: true, index: true },
10
+ current_count: { type: Number, default: 0 },
11
+ longest_count: { type: Number, default: 0 },
12
+ last_active_day: { type: Date, default: null },
13
+ last_processed_day: { type: Date, default: null },
14
+ last_milestone: { type: streakMilestoneRefSchema, default: null },
15
+ last_streak_email_day: { type: Date, default: null },
16
+ }, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "streaks" });
17
+ exports.default = (0, mongoose_1.model)("Streak", streakSchema);
@@ -1,5 +1,5 @@
1
1
  import { Document } from "mongoose";
2
- import { DatabaseEngine } from "../enum";
2
+ import { DatabaseEngine, WorkbenchMode } from "../enum";
3
3
  export interface IDbImage extends Document {
4
4
  name: DatabaseEngine;
5
5
  image_url: string;
@@ -16,6 +16,9 @@ export interface IDbImage extends Document {
16
16
  port: number;
17
17
  volumePath: string;
18
18
  protocol: string;
19
+ ha: boolean;
20
+ workbench: boolean;
21
+ workbench_mode: WorkbenchMode;
19
22
  params: Record<any, any>;
20
23
  recommendations?: Array<{
21
24
  cpu: string;
@@ -65,4 +65,11 @@ export type { ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSe
65
65
  export type { IVolumeUsageSegment, IVolumeUsageSegmentCosts, } from "./volume-usage-segment";
66
66
  export type { IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, } from "./object-storage-usage-segment";
67
67
  export type { IIdempotencyRecord } from "./idempotency";
68
+ export type { IStreak, IStreakMilestoneRef } from "./streak";
69
+ export type { IStreakEvent } from "./streak-event";
70
+ export type { IStreakDay } from "./streak-day";
71
+ export type { IStreakMilestone } from "./streak-milestone";
72
+ export type { IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward, } from "./quest-campaign";
73
+ export type { IQuestParticipation, IQuestCriterionProgress, } from "./quest-participation";
74
+ export type { IQuestRewardIssuance, IQuestIssuedReward, } from "./quest-reward-issuance";
68
75
  export type { IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition } from "./storage";
@@ -33,6 +33,7 @@ export interface IProject extends Document {
33
33
  buildCommand: string;
34
34
  startCommand: string;
35
35
  outputDirectory: string;
36
+ workBenchEnabled: boolean;
36
37
  user_id: IUser;
37
38
  monitor_id: string;
38
39
  nomadJobId: string;
@@ -0,0 +1,38 @@
1
+ import { Document } from "mongoose";
2
+ import { EligibilityType, MilestoneType, QualifyingActionType, QuestCriterionType, QuestEntity, QuestRequirementType, RewardType } from "../enum";
3
+ export interface IQuestCriterion {
4
+ type: QuestCriterionType;
5
+ label: string;
6
+ target: number;
7
+ entity: QuestEntity | null;
8
+ action: QualifyingActionType | null;
9
+ service_type: string | null;
10
+ distinct: boolean;
11
+ milestones: MilestoneType[];
12
+ }
13
+ export interface IQuestRequirement {
14
+ type: QuestRequirementType;
15
+ target: number;
16
+ message: string | null;
17
+ }
18
+ export interface IQuestReward {
19
+ type: RewardType;
20
+ metadata: Record<string, unknown>;
21
+ }
22
+ export interface IQuestCampaign extends Document {
23
+ name: string;
24
+ slug: string;
25
+ start_at: Date;
26
+ end_at: Date;
27
+ eligibility_type: EligibilityType;
28
+ min_streak_to_join: number;
29
+ slots_total: number;
30
+ slots_remaining: number;
31
+ criteria: IQuestCriterion[];
32
+ requirements: IQuestRequirement[];
33
+ rewards: IQuestReward[];
34
+ active: boolean;
35
+ auto_expire: boolean;
36
+ created_at?: Date;
37
+ updated_at?: Date;
38
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { Document, Types } from "mongoose";
2
+ export interface IQuestCriterionProgress {
3
+ key: string;
4
+ current: number;
5
+ target: number;
6
+ met: boolean;
7
+ }
8
+ export interface IQuestParticipation extends Document {
9
+ campaign_id: Types.ObjectId;
10
+ user_id: Types.ObjectId;
11
+ joined_at: Date;
12
+ slot_number: number;
13
+ streak_deducted: number;
14
+ criteria_progress: IQuestCriterionProgress[];
15
+ qualifier_met: boolean;
16
+ claimed_at: Date | null;
17
+ created_at?: Date;
18
+ updated_at?: Date;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { QuestRewardStatus, RewardType } from "../enum";
3
+ export interface IQuestIssuedReward {
4
+ type: RewardType;
5
+ metadata: Record<string, unknown>;
6
+ }
7
+ export interface IQuestRewardIssuance extends Document {
8
+ participation_id: Types.ObjectId;
9
+ campaign_id: Types.ObjectId;
10
+ user_id: Types.ObjectId;
11
+ rewards: IQuestIssuedReward[];
12
+ status: QuestRewardStatus;
13
+ claimed_at: Date;
14
+ fulfilled_at: Date | null;
15
+ created_at?: Date;
16
+ updated_at?: Date;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { Document, Types } from "mongoose";
2
+ export interface IStreakDay extends Document {
3
+ user_id: Types.ObjectId;
4
+ day: Date;
5
+ action_types: string[];
6
+ is_milestone_day: boolean;
7
+ created_at?: Date;
8
+ updated_at?: Date;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { QualifyingActionType } from "../enum";
3
+ export interface IStreakEvent extends Document {
4
+ user_id: Types.ObjectId;
5
+ action_type: QualifyingActionType;
6
+ project_id: Types.ObjectId | null;
7
+ resource_id: Types.ObjectId | null;
8
+ service_type: string | null;
9
+ system_day: Date;
10
+ dedupe_key: string;
11
+ created_at?: Date;
12
+ updated_at?: Date;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { MilestoneType } from "../enum";
3
+ export interface IStreakMilestone extends Document {
4
+ user_id: Types.ObjectId;
5
+ type: MilestoneType;
6
+ action: string;
7
+ date: Date;
8
+ created_at?: Date;
9
+ updated_at?: Date;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { MilestoneType } from "../enum";
3
+ export interface IStreakMilestoneRef {
4
+ type: MilestoneType;
5
+ date: Date;
6
+ }
7
+ export interface IStreak extends Document {
8
+ user_id: Types.ObjectId;
9
+ current_count: number;
10
+ longest_count: number;
11
+ last_active_day: Date | null;
12
+ last_processed_day: Date | null;
13
+ last_milestone: IStreakMilestoneRef | null;
14
+ last_streak_email_day: Date | null;
15
+ created_at?: Date;
16
+ updated_at?: Date;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.53",
3
+ "version": "3.8.55",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",