clhq-postgres-module 1.1.0-alpha.113 → 1.1.0-alpha.114

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.
@@ -10,14 +10,17 @@ export declare class CreditAllocation {
10
10
  userId: string;
11
11
  user: User;
12
12
  planId: string;
13
- creditsAllocated: number;
14
- creditsRemaining: number;
13
+ cloudCreditsAllocated: number;
14
+ cloudCreditsRemaining: number;
15
+ cloudCreditsRollover: number;
15
16
  aiCreditsAllocated: number;
16
17
  aiCreditsRemaining: number;
18
+ aiCreditsRollover: number;
17
19
  periodStart: Date;
18
20
  periodEnd: Date;
19
- rolloverCredits: number;
21
+ billingCycle: 'monthly' | 'yearly';
20
22
  status: CreditAllocationStatus;
23
+ metadata: Record<string, any>;
21
24
  createdAt: Date;
22
25
  updatedAt: Date;
23
26
  }
@@ -36,37 +36,45 @@ __decorate([
36
36
  __metadata("design:type", user_entity_1.User)
37
37
  ], CreditAllocation.prototype, "user", void 0);
38
38
  __decorate([
39
- (0, typeorm_1.Column)({ name: 'plan_id', length: 50 }),
39
+ (0, typeorm_1.Column)({ name: 'plan_id', nullable: true }),
40
40
  __metadata("design:type", String)
41
41
  ], CreditAllocation.prototype, "planId", void 0);
42
42
  __decorate([
43
- (0, typeorm_1.Column)({ name: 'credits_allocated' }),
43
+ (0, typeorm_1.Column)({ name: 'cloud_credits_allocated', type: 'decimal', precision: 10, scale: 2, default: 0 }),
44
44
  __metadata("design:type", Number)
45
- ], CreditAllocation.prototype, "creditsAllocated", void 0);
45
+ ], CreditAllocation.prototype, "cloudCreditsAllocated", void 0);
46
46
  __decorate([
47
- (0, typeorm_1.Column)({ name: 'credits_remaining' }),
47
+ (0, typeorm_1.Column)({ name: 'cloud_credits_remaining', type: 'decimal', precision: 10, scale: 2, default: 0 }),
48
48
  __metadata("design:type", Number)
49
- ], CreditAllocation.prototype, "creditsRemaining", void 0);
49
+ ], CreditAllocation.prototype, "cloudCreditsRemaining", void 0);
50
50
  __decorate([
51
- (0, typeorm_1.Column)({ name: 'ai_credits_allocated', default: 0 }),
51
+ (0, typeorm_1.Column)({ name: 'cloud_credits_rollover', type: 'decimal', precision: 10, scale: 2, default: 0 }),
52
+ __metadata("design:type", Number)
53
+ ], CreditAllocation.prototype, "cloudCreditsRollover", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({ name: 'ai_credits_allocated', type: 'decimal', precision: 10, scale: 2, default: 0 }),
52
56
  __metadata("design:type", Number)
53
57
  ], CreditAllocation.prototype, "aiCreditsAllocated", void 0);
54
58
  __decorate([
55
- (0, typeorm_1.Column)({ name: 'ai_credits_remaining', default: 0 }),
59
+ (0, typeorm_1.Column)({ name: 'ai_credits_remaining', type: 'decimal', precision: 10, scale: 2, default: 0 }),
56
60
  __metadata("design:type", Number)
57
61
  ], CreditAllocation.prototype, "aiCreditsRemaining", void 0);
58
62
  __decorate([
59
- (0, typeorm_1.Column)({ name: 'period_start' }),
63
+ (0, typeorm_1.Column)({ name: 'ai_credits_rollover', type: 'decimal', precision: 10, scale: 2, default: 0 }),
64
+ __metadata("design:type", Number)
65
+ ], CreditAllocation.prototype, "aiCreditsRollover", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)({ name: 'period_start', type: 'timestamp' }),
60
68
  __metadata("design:type", Date)
61
69
  ], CreditAllocation.prototype, "periodStart", void 0);
62
70
  __decorate([
63
- (0, typeorm_1.Column)({ name: 'period_end' }),
71
+ (0, typeorm_1.Column)({ name: 'period_end', type: 'timestamp' }),
64
72
  __metadata("design:type", Date)
65
73
  ], CreditAllocation.prototype, "periodEnd", void 0);
66
74
  __decorate([
67
- (0, typeorm_1.Column)({ name: 'rollover_credits', default: 0 }),
68
- __metadata("design:type", Number)
69
- ], CreditAllocation.prototype, "rolloverCredits", void 0);
75
+ (0, typeorm_1.Column)({ name: 'billing_cycle', default: 'monthly' }),
76
+ __metadata("design:type", String)
77
+ ], CreditAllocation.prototype, "billingCycle", void 0);
70
78
  __decorate([
71
79
  (0, typeorm_1.Column)({
72
80
  type: 'enum',
@@ -75,6 +83,10 @@ __decorate([
75
83
  }),
76
84
  __metadata("design:type", String)
77
85
  ], CreditAllocation.prototype, "status", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
88
+ __metadata("design:type", Object)
89
+ ], CreditAllocation.prototype, "metadata", void 0);
78
90
  __decorate([
79
91
  (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
80
92
  __metadata("design:type", Date)
@@ -15,6 +15,7 @@ export * from './payment-transaction.entity';
15
15
  export * from './stripe-webhook.entity';
16
16
  export * from './credit-transaction.entity';
17
17
  export * from './credit-allocation.entity';
18
+ export * from './plan-credit-config.entity';
18
19
  export * from './credit-consumption-log.entity';
19
20
  export * from './reward-rule.entity';
20
21
  export * from './referral-event.entity';
@@ -32,6 +32,7 @@ __exportStar(require("./payment-transaction.entity"), exports);
32
32
  __exportStar(require("./stripe-webhook.entity"), exports);
33
33
  __exportStar(require("./credit-transaction.entity"), exports);
34
34
  __exportStar(require("./credit-allocation.entity"), exports);
35
+ __exportStar(require("./plan-credit-config.entity"), exports);
35
36
  __exportStar(require("./credit-consumption-log.entity"), exports);
36
37
  __exportStar(require("./reward-rule.entity"), exports);
37
38
  __exportStar(require("./referral-event.entity"), exports);
@@ -0,0 +1,16 @@
1
+ export declare class PlanCreditConfiguration {
2
+ id: string;
3
+ planId: string;
4
+ planName: string;
5
+ cloudCreditsMonthly: number;
6
+ cloudCreditsMaxRollover: number;
7
+ aiCreditsMonthly: number;
8
+ aiCreditsMaxRollover: number;
9
+ signupCloudBonus: number;
10
+ signupAiBonus: number;
11
+ upgradeBonusMultiplier: number;
12
+ isActive: boolean;
13
+ features: Record<string, any>;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PlanCreditConfiguration = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let PlanCreditConfiguration = class PlanCreditConfiguration {
15
+ };
16
+ exports.PlanCreditConfiguration = PlanCreditConfiguration;
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
19
+ __metadata("design:type", String)
20
+ ], PlanCreditConfiguration.prototype, "id", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ name: 'plan_id', unique: true }),
23
+ __metadata("design:type", String)
24
+ ], PlanCreditConfiguration.prototype, "planId", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ name: 'plan_name' }),
27
+ __metadata("design:type", String)
28
+ ], PlanCreditConfiguration.prototype, "planName", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ name: 'cloud_credits_monthly', type: 'integer', default: 0 }),
31
+ __metadata("design:type", Number)
32
+ ], PlanCreditConfiguration.prototype, "cloudCreditsMonthly", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ name: 'cloud_credits_max_rollover', type: 'integer', default: 0 }),
35
+ __metadata("design:type", Number)
36
+ ], PlanCreditConfiguration.prototype, "cloudCreditsMaxRollover", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ name: 'ai_credits_monthly', type: 'integer', default: 0 }),
39
+ __metadata("design:type", Number)
40
+ ], PlanCreditConfiguration.prototype, "aiCreditsMonthly", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ name: 'ai_credits_max_rollover', type: 'integer', default: 0 }),
43
+ __metadata("design:type", Number)
44
+ ], PlanCreditConfiguration.prototype, "aiCreditsMaxRollover", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ name: 'signup_cloud_bonus', type: 'integer', default: 0 }),
47
+ __metadata("design:type", Number)
48
+ ], PlanCreditConfiguration.prototype, "signupCloudBonus", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ name: 'signup_ai_bonus', type: 'integer', default: 0 }),
51
+ __metadata("design:type", Number)
52
+ ], PlanCreditConfiguration.prototype, "signupAiBonus", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ name: 'upgrade_bonus_multiplier', type: 'decimal', default: 0.2 }),
55
+ __metadata("design:type", Number)
56
+ ], PlanCreditConfiguration.prototype, "upgradeBonusMultiplier", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ name: 'is_active', default: true }),
59
+ __metadata("design:type", Boolean)
60
+ ], PlanCreditConfiguration.prototype, "isActive", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
63
+ __metadata("design:type", Object)
64
+ ], PlanCreditConfiguration.prototype, "features", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
67
+ __metadata("design:type", Date)
68
+ ], PlanCreditConfiguration.prototype, "createdAt", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
71
+ __metadata("design:type", Date)
72
+ ], PlanCreditConfiguration.prototype, "updatedAt", void 0);
73
+ exports.PlanCreditConfiguration = PlanCreditConfiguration = __decorate([
74
+ (0, typeorm_1.Entity)('plan_credit_configurations'),
75
+ (0, typeorm_1.Index)(['planId'], { unique: true }),
76
+ (0, typeorm_1.Index)(['isActive'], { unique: false })
77
+ ], PlanCreditConfiguration);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clhq-postgres-module",
3
- "version": "1.1.0-alpha.113",
3
+ "version": "1.1.0-alpha.114",
4
4
  "description": "PostgreSQL module using TypeORM for Clippy",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",