@brimble/models 3.8.52 → 3.8.54

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 (40) hide show
  1. package/dist/enum/index.d.ts +62 -0
  2. package/dist/enum/index.js +92 -1
  3. package/dist/index.d.ts +10 -2
  4. package/dist/index.js +31 -3
  5. package/dist/plan_configuration.js +1 -0
  6. package/dist/quest-campaign.d.ts +9 -0
  7. package/dist/quest-campaign.js +39 -0
  8. package/dist/quest-participation.d.ts +9 -0
  9. package/dist/quest-participation.js +21 -0
  10. package/dist/quest-reward-issuance.d.ts +9 -0
  11. package/dist/quest-reward-issuance.js +19 -0
  12. package/dist/ratelimit.d.ts +9 -0
  13. package/dist/ratelimit.js +36 -0
  14. package/dist/streak-day.d.ts +9 -0
  15. package/dist/streak-day.js +11 -0
  16. package/dist/streak-event.d.ts +9 -0
  17. package/dist/streak-event.js +18 -0
  18. package/dist/streak-milestone.d.ts +9 -0
  19. package/dist/streak-milestone.js +11 -0
  20. package/dist/streak.d.ts +9 -0
  21. package/dist/streak.js +17 -0
  22. package/dist/types/index.d.ts +8 -0
  23. package/dist/types/plan_configuration.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/ratelimit.d.ts +41 -0
  31. package/dist/types/ratelimit.js +2 -0
  32. package/dist/types/streak-day.d.ts +9 -0
  33. package/dist/types/streak-day.js +2 -0
  34. package/dist/types/streak-event.d.ts +13 -0
  35. package/dist/types/streak-event.js +2 -0
  36. package/dist/types/streak-milestone.d.ts +10 -0
  37. package/dist/types/streak-milestone.js +2 -0
  38. package/dist/types/streak.d.ts +17 -0
  39. package/dist/types/streak.js +2 -0
  40. package/package.json +1 -1
@@ -292,3 +292,65 @@ 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 const QUEST_CLAIM_REQUIREMENTS: QuestRequirementType[];
356
+ 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.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,93 @@ 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
+ exports.QUEST_CLAIM_REQUIREMENTS = [
432
+ QuestRequirementType.RewardCooldownDays,
433
+ ];
434
+ exports.QUEST_TARGETLESS_REQUIREMENTS = [
435
+ QuestRequirementType.PaidPlan,
436
+ QuestRequirementType.PaymentMethod,
437
+ ];
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as ProjectAnalytics } from "./project_analytics";
4
4
  export { default as Preview } from "./project/preview";
5
5
  export { default as ProjectConnection } from "./project/connection";
6
6
  export { default as ProjectNetworkSettings } from "./project-network-settings";
7
+ export { default as Ratelimit } from "./ratelimit";
7
8
  export { default as Following } from "./following";
8
9
  export { default as Integration } from "./integration";
9
10
  export { default as Domain } from "./domain";
@@ -64,8 +65,15 @@ export { default as VolumeUsageSegment } from "./volume-usage-segment";
64
65
  export { default as ObjectStorageUsageSegment } from "./object-storage-usage-segment";
65
66
  export { default as IdempotencyRecord } from "./idempotency";
66
67
  export { StorageBucket, StorageObject, StorageUpload, StorageToken, StorageCredential, StorageMigration } from "./storage";
67
- export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IProjectNetworkSettings, 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";
68
- 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, } from "./enum";
69
77
  import mongoose from "mongoose";
70
78
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
71
79
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -12,9 +12,9 @@ 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.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainTransfer = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.ProjectNetworkSettings = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
16
- exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.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 = 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 = void 0;
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.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.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");
@@ -28,6 +28,8 @@ var connection_1 = require("./project/connection");
28
28
  Object.defineProperty(exports, "ProjectConnection", { enumerable: true, get: function () { return __importDefault(connection_1).default; } });
29
29
  var project_network_settings_1 = require("./project-network-settings");
30
30
  Object.defineProperty(exports, "ProjectNetworkSettings", { enumerable: true, get: function () { return __importDefault(project_network_settings_1).default; } });
31
+ var ratelimit_1 = require("./ratelimit");
32
+ Object.defineProperty(exports, "Ratelimit", { enumerable: true, get: function () { return __importDefault(ratelimit_1).default; } });
31
33
  var following_1 = require("./following");
32
34
  Object.defineProperty(exports, "Following", { enumerable: true, get: function () { return __importDefault(following_1).default; } });
33
35
  var integration_1 = require("./integration");
@@ -153,6 +155,20 @@ Object.defineProperty(exports, "StorageUpload", { enumerable: true, get: functio
153
155
  Object.defineProperty(exports, "StorageToken", { enumerable: true, get: function () { return storage_1.StorageToken; } });
154
156
  Object.defineProperty(exports, "StorageCredential", { enumerable: true, get: function () { return storage_1.StorageCredential; } });
155
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; } });
156
172
  var enum_1 = require("./enum");
157
173
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
158
174
  Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
@@ -201,6 +217,18 @@ Object.defineProperty(exports, "StorageMigrationStatus", { enumerable: true, get
201
217
  Object.defineProperty(exports, "XFrameOptions", { enumerable: true, get: function () { return enum_1.XFrameOptions; } });
202
218
  Object.defineProperty(exports, "XContentTypeOptions", { enumerable: true, get: function () { return enum_1.XContentTypeOptions; } });
203
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; } });
204
232
  const mongoose_1 = __importDefault(require("mongoose"));
205
233
  const utils_1 = require("@brimble/utils");
206
234
  const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -11,6 +11,7 @@ const PlanConfigurationSchema = new mongoose_1.Schema({
11
11
  preview_comments: { type: Boolean, default: false },
12
12
  analytics: { type: Boolean, default: false },
13
13
  build_minutes: { type: Number, required: true },
14
+ rate_limit_enabled: { type: Boolean, default: false },
14
15
  pull_request_preview: { type: Boolean, default: false, required: false },
15
16
  log_retention: { type: Number, required: true },
16
17
  bandwidth: { type: Number, required: true },
@@ -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 { IRatelimit } from "./types";
2
+ declare const _default: import("mongoose").Model<IRatelimit, {}, {}, {}, import("mongoose").Document<unknown, {}, IRatelimit, {}, import("mongoose").DefaultSchemaOptions> & IRatelimit & Required<{
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }> & {
5
+ __v: number;
6
+ } & {
7
+ id: string;
8
+ }, any, IRatelimit>;
9
+ export default _default;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const ratelimitSchema = new mongoose_1.Schema({
5
+ project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: true },
6
+ enabled: { type: Boolean, default: true },
7
+ zones: {
8
+ type: [
9
+ {
10
+ name: { type: String, required: true },
11
+ key: { type: String, required: true },
12
+ window: { type: String, required: true },
13
+ events: { type: Number, required: true },
14
+ matcher: {
15
+ methods: [{ type: String }],
16
+ paths: [{ type: String }],
17
+ },
18
+ ipv4Prefix: Number,
19
+ ipv6Prefix: Number,
20
+ },
21
+ ],
22
+ default: [],
23
+ },
24
+ distributed: {
25
+ enabled: { type: Boolean, default: false },
26
+ readInterval: String,
27
+ writeInterval: String,
28
+ purgeAge: String,
29
+ },
30
+ logKey: { type: Boolean, default: false },
31
+ disableMetrics: { type: Boolean, default: false },
32
+ jitter: Number,
33
+ sweepInterval: String,
34
+ }, { timestamps: true });
35
+ ratelimitSchema.index({ project: 1 }, { unique: true });
36
+ exports.default = (0, mongoose_1.model)("Ratelimit", ratelimitSchema, "ratelimits");
@@ -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);
@@ -26,6 +26,7 @@ export type { IProject } from "./project";
26
26
  export type { IProjectAnalytics } from "./project_analytics";
27
27
  export type { IProjectConnection } from "./project/connection";
28
28
  export type { IProjectNetworkSettings } from "./project-network-settings";
29
+ export type { IRatelimit, RatelimitConfig, RateLimitZone, RateLimitMatcher, DistributedRateLimitConfig, } from "./ratelimit";
29
30
  export type { IPreview } from "./project/preview";
30
31
  export type { IRegion } from "./region";
31
32
  export type { IRole } from "./role";
@@ -64,4 +65,11 @@ export type { ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSe
64
65
  export type { IVolumeUsageSegment, IVolumeUsageSegmentCosts, } from "./volume-usage-segment";
65
66
  export type { IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, } from "./object-storage-usage-segment";
66
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";
67
75
  export type { IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition } from "./storage";
@@ -8,6 +8,7 @@ export interface IPlanConfiguration extends Document {
8
8
  slack_support: boolean;
9
9
  autoscaling_enabled: boolean;
10
10
  concurrent_builds: number;
11
+ rate_limit_enabled: boolean;
11
12
  project_limit: number;
12
13
  deploy_private_organization: boolean;
13
14
  preview_comments: boolean;
@@ -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,41 @@
1
+ import { Document, Types } from "mongoose";
2
+ export type RateLimitMatcher = {
3
+ methods?: string[];
4
+ paths?: string[];
5
+ };
6
+ export type RateLimitZone = {
7
+ name: string;
8
+ key: string;
9
+ window: string;
10
+ events: number;
11
+ matcher?: RateLimitMatcher;
12
+ ipv4Prefix?: number;
13
+ ipv6Prefix?: number;
14
+ };
15
+ export type DistributedRateLimitConfig = {
16
+ enabled: boolean;
17
+ readInterval?: string;
18
+ writeInterval?: string;
19
+ purgeAge?: string;
20
+ };
21
+ export type RatelimitConfig = {
22
+ enabled: boolean;
23
+ zones: RateLimitZone[];
24
+ distributed?: DistributedRateLimitConfig;
25
+ logKey?: boolean;
26
+ disableMetrics?: boolean;
27
+ jitter?: number;
28
+ sweepInterval?: string;
29
+ };
30
+ export interface IRatelimit extends Document {
31
+ project: Types.ObjectId;
32
+ enabled: boolean;
33
+ zones: RateLimitZone[];
34
+ distributed?: DistributedRateLimitConfig;
35
+ logKey: boolean;
36
+ disableMetrics: boolean;
37
+ jitter?: number;
38
+ sweepInterval?: string;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ }
@@ -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.52",
3
+ "version": "3.8.54",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",