@natrave/shared-entities 7.1.0 → 7.3.0

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 (74) hide show
  1. package/dist/billing/billing-accounts/billing-account.entity.d.ts +12 -0
  2. package/dist/billing/billing-accounts/billing-account.entity.d.ts.map +1 -0
  3. package/dist/billing/billing-accounts/billing-account.entity.js +78 -0
  4. package/dist/billing/billing-accounts/enums/billing-account-owner-type.enum.d.ts +4 -0
  5. package/dist/billing/billing-accounts/enums/billing-account-owner-type.enum.d.ts.map +1 -0
  6. package/dist/billing/billing-accounts/enums/billing-account-owner-type.enum.js +7 -0
  7. package/dist/billing/billing-accounts/index.d.ts +3 -0
  8. package/dist/billing/billing-accounts/index.d.ts.map +1 -0
  9. package/dist/billing/billing-accounts/index.js +2 -0
  10. package/dist/billing/{billing-prices/billing-price.entity.d.ts → billing-plans/billing-plan.entity.d.ts} +5 -13
  11. package/dist/billing/billing-plans/billing-plan.entity.d.ts.map +1 -0
  12. package/dist/billing/billing-plans/billing-plan.entity.js +145 -0
  13. package/dist/billing/billing-plans/enums/charge-type.enum.d.ts +5 -0
  14. package/dist/billing/billing-plans/enums/charge-type.enum.d.ts.map +1 -0
  15. package/dist/billing/billing-plans/enums/charge-type.enum.js +8 -0
  16. package/dist/billing/billing-plans/enums/pricing-model.enum.d.ts +5 -0
  17. package/dist/billing/billing-plans/enums/pricing-model.enum.d.ts.map +1 -0
  18. package/dist/billing/{billing-prices → billing-plans}/enums/pricing-model.enum.js +0 -1
  19. package/dist/billing/billing-plans/enums/recurring-interval.enum.d.ts.map +1 -0
  20. package/dist/billing/billing-plans/index.d.ts +5 -0
  21. package/dist/billing/billing-plans/index.d.ts.map +1 -0
  22. package/dist/billing/billing-plans/index.js +4 -0
  23. package/dist/billing/billing-products/billing-product.entity.d.ts +4 -4
  24. package/dist/billing/billing-products/billing-product.entity.d.ts.map +1 -1
  25. package/dist/billing/billing-products/billing-product.entity.js +9 -8
  26. package/dist/billing/billing-products/enums/billing-product-key.constant.d.ts +6 -0
  27. package/dist/billing/billing-products/enums/billing-product-key.constant.d.ts.map +1 -0
  28. package/dist/billing/billing-products/enums/{billing-product-code.constant.js → billing-product-key.constant.js} +2 -2
  29. package/dist/billing/billing-products/index.d.ts +1 -1
  30. package/dist/billing/billing-products/index.d.ts.map +1 -1
  31. package/dist/billing/billing-products/index.js +1 -1
  32. package/dist/billing/billing-subscription-items/billing-subscription-item.entity.d.ts +13 -0
  33. package/dist/billing/billing-subscription-items/billing-subscription-item.entity.d.ts.map +1 -0
  34. package/dist/billing/billing-subscription-items/billing-subscription-item.entity.js +84 -0
  35. package/dist/billing/billing-subscription-items/index.d.ts +2 -0
  36. package/dist/billing/billing-subscription-items/index.d.ts.map +1 -0
  37. package/dist/billing/billing-subscription-items/index.js +1 -0
  38. package/dist/billing/billing-subscriptions/billing-subscription.entity.d.ts +22 -0
  39. package/dist/billing/billing-subscriptions/billing-subscription.entity.d.ts.map +1 -0
  40. package/dist/billing/billing-subscriptions/billing-subscription.entity.js +149 -0
  41. package/dist/billing/billing-subscriptions/enums/billing-resource-type.enum.d.ts +4 -0
  42. package/dist/billing/billing-subscriptions/enums/billing-resource-type.enum.d.ts.map +1 -0
  43. package/dist/billing/billing-subscriptions/enums/billing-resource-type.enum.js +7 -0
  44. package/dist/billing/billing-subscriptions/enums/billing-subscription-status.enum.d.ts +9 -0
  45. package/dist/billing/billing-subscriptions/enums/billing-subscription-status.enum.d.ts.map +1 -0
  46. package/dist/billing/billing-subscriptions/enums/billing-subscription-status.enum.js +12 -0
  47. package/dist/billing/billing-subscriptions/index.d.ts +4 -0
  48. package/dist/billing/billing-subscriptions/index.d.ts.map +1 -0
  49. package/dist/billing/billing-subscriptions/index.js +3 -0
  50. package/dist/billing/index.d.ts +4 -1
  51. package/dist/billing/index.d.ts.map +1 -1
  52. package/dist/billing/index.js +4 -1
  53. package/dist/database-entities/index.d.ts +2 -2
  54. package/dist/database-entities/index.d.ts.map +1 -1
  55. package/dist/database-entities/index.js +11 -2
  56. package/package.json +1 -1
  57. package/dist/billing/billing-prices/billing-price.entity.d.ts.map +0 -1
  58. package/dist/billing/billing-prices/billing-price.entity.js +0 -170
  59. package/dist/billing/billing-prices/enums/billing-scheme.enum.d.ts +0 -5
  60. package/dist/billing/billing-prices/enums/billing-scheme.enum.d.ts.map +0 -1
  61. package/dist/billing/billing-prices/enums/billing-scheme.enum.js +0 -8
  62. package/dist/billing/billing-prices/enums/pricing-model.enum.d.ts +0 -6
  63. package/dist/billing/billing-prices/enums/pricing-model.enum.d.ts.map +0 -1
  64. package/dist/billing/billing-prices/enums/recurring-interval.enum.d.ts.map +0 -1
  65. package/dist/billing/billing-prices/enums/tiers-mode.enum.d.ts +0 -5
  66. package/dist/billing/billing-prices/enums/tiers-mode.enum.d.ts.map +0 -1
  67. package/dist/billing/billing-prices/enums/tiers-mode.enum.js +0 -8
  68. package/dist/billing/billing-prices/index.d.ts +0 -6
  69. package/dist/billing/billing-prices/index.d.ts.map +0 -1
  70. package/dist/billing/billing-prices/index.js +0 -5
  71. package/dist/billing/billing-products/enums/billing-product-code.constant.d.ts +0 -6
  72. package/dist/billing/billing-products/enums/billing-product-code.constant.d.ts.map +0 -1
  73. /package/dist/billing/{billing-prices → billing-plans}/enums/recurring-interval.enum.d.ts +0 -0
  74. /package/dist/billing/{billing-prices → billing-plans}/enums/recurring-interval.enum.js +0 -0
@@ -0,0 +1,12 @@
1
+ import { BillingSubscription } from '../billing-subscriptions';
2
+ import { BillingAccountOwnerType } from './enums/billing-account-owner-type.enum';
3
+ export declare class BillingAccount {
4
+ id: string;
5
+ ownerType: BillingAccountOwnerType;
6
+ ownerId: number;
7
+ creditBalance: number;
8
+ createdAt: Date;
9
+ updatedAt: Date;
10
+ subscriptions: BillingSubscription[];
11
+ }
12
+ //# sourceMappingURL=billing-account.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-account.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-accounts/billing-account.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAalF,qBAGa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IASX,SAAS,EAAE,uBAAuB,CAAC;IAOnC,OAAO,EAAE,MAAM,CAAC;IAQhB,aAAa,EAAE,MAAM,CAAC;IAOtB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC"}
@@ -0,0 +1,78 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ Entity,
15
+ Index,
16
+ OneToMany,
17
+ PrimaryGeneratedColumn,
18
+ Unique,
19
+ UpdateDateColumn
20
+ } from "typeorm";
21
+ import { BillingSubscription } from "../billing-subscriptions/index.js";
22
+ import { BillingAccountOwnerType } from "./enums/billing-account-owner-type.enum.js";
23
+ let BillingAccount = class {
24
+ };
25
+ __decorateClass([
26
+ PrimaryGeneratedColumn("uuid", {
27
+ comment: "Identificador \xFAnico da conta de billing."
28
+ })
29
+ ], BillingAccount.prototype, "id", 2);
30
+ __decorateClass([
31
+ Column({
32
+ name: "owner_type",
33
+ type: "enum",
34
+ enum: BillingAccountOwnerType,
35
+ enumName: "billing_accounts_owner_type_enum",
36
+ comment: "Tipo do dono da conta (ex.: organization)."
37
+ })
38
+ ], BillingAccount.prototype, "ownerType", 2);
39
+ __decorateClass([
40
+ Column({
41
+ name: "owner_id",
42
+ type: "int",
43
+ comment: "Identificador do dono da conta no seu dom\xEDnio (ex.: organization.id)."
44
+ })
45
+ ], BillingAccount.prototype, "ownerId", 2);
46
+ __decorateClass([
47
+ Column({
48
+ name: "credit_balance",
49
+ type: "int",
50
+ default: 0,
51
+ comment: "Saldo de cr\xE9dito da conta em centavos (estornos/cr\xE9ditos). Nunca negativo."
52
+ })
53
+ ], BillingAccount.prototype, "creditBalance", 2);
54
+ __decorateClass([
55
+ CreateDateColumn({
56
+ name: "created_at",
57
+ type: "timestamptz",
58
+ comment: "Data de cria\xE7\xE3o do registro."
59
+ })
60
+ ], BillingAccount.prototype, "createdAt", 2);
61
+ __decorateClass([
62
+ UpdateDateColumn({
63
+ name: "updated_at",
64
+ type: "timestamptz",
65
+ comment: "Data da \xFAltima atualiza\xE7\xE3o do registro."
66
+ })
67
+ ], BillingAccount.prototype, "updatedAt", 2);
68
+ __decorateClass([
69
+ OneToMany(() => BillingSubscription, (subscription) => subscription.billingAccount)
70
+ ], BillingAccount.prototype, "subscriptions", 2);
71
+ BillingAccount = __decorateClass([
72
+ Entity("billing_accounts"),
73
+ Unique("UQ_billing_accounts_owner", ["ownerType", "ownerId"]),
74
+ Index("idx_billing_accounts_owner", ["ownerType", "ownerId"])
75
+ ], BillingAccount);
76
+ export {
77
+ BillingAccount
78
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum BillingAccountOwnerType {
2
+ ORGANIZATION = "organization"
3
+ }
4
+ //# sourceMappingURL=billing-account-owner-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-account-owner-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-accounts/enums/billing-account-owner-type.enum.ts"],"names":[],"mappings":"AAWA,oBAAY,uBAAuB;IAIjC,YAAY,iBAAiB;CAC9B"}
@@ -0,0 +1,7 @@
1
+ var BillingAccountOwnerType = /* @__PURE__ */ ((BillingAccountOwnerType2) => {
2
+ BillingAccountOwnerType2["ORGANIZATION"] = "organization";
3
+ return BillingAccountOwnerType2;
4
+ })(BillingAccountOwnerType || {});
5
+ export {
6
+ BillingAccountOwnerType
7
+ };
@@ -0,0 +1,3 @@
1
+ export * from './billing-account.entity';
2
+ export * from './enums/billing-account-owner-type.enum';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-accounts/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./billing-account.entity.js";
2
+ export * from "./enums/billing-account-owner-type.enum.js";
@@ -1,23 +1,15 @@
1
1
  import { BillingProduct } from '../billing-products';
2
- import { BillingScheme } from './enums/billing-scheme.enum';
2
+ import { ChargeType } from './enums/charge-type.enum';
3
3
  import { PricingModel } from './enums/pricing-model.enum';
4
4
  import { RecurringInterval } from './enums/recurring-interval.enum';
5
- import { TiersMode } from './enums/tiers-mode.enum';
6
- export interface BillingPriceTier {
7
- upTo: number | null;
8
- unitAmount: number;
9
- }
10
- export declare class BillingPrice {
5
+ export declare class BillingPlan {
11
6
  id: string;
12
7
  productId: string;
13
- nickname: string | null;
8
+ internalLabel: string | null;
14
9
  amount: number;
15
- currency: string;
16
- billingScheme: BillingScheme;
10
+ chargeType: ChargeType;
17
11
  recurringInterval: RecurringInterval | null;
18
12
  pricingModel: PricingModel;
19
- tiers: BillingPriceTier[] | null;
20
- tiersMode: TiersMode | null;
21
13
  trialPeriodDays: number;
22
14
  validFrom: Date;
23
15
  validUntil: Date | null;
@@ -26,4 +18,4 @@ export declare class BillingPrice {
26
18
  updatedAt: Date;
27
19
  product: BillingProduct;
28
20
  }
29
- //# sourceMappingURL=billing-price.entity.d.ts.map
21
+ //# sourceMappingURL=billing-plan.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-plan.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-plans/billing-plan.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAiBpE,qBAOa,WAAW;IAItB,EAAE,EAAE,MAAM,CAAC;IAOX,SAAS,EAAE,MAAM,CAAC;IASlB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAM7B,MAAM,EAAE,MAAM,CAAC;IASf,UAAU,EAAE,UAAU,CAAC;IAUvB,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAU5C,YAAY,EAAE,YAAY,CAAC;IAQ3B,eAAe,EAAE,MAAM,CAAC;IAQxB,SAAS,EAAE,IAAI,CAAC;IAQhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAQxB,QAAQ,EAAE,OAAO,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAYhB,OAAO,EAAE,cAAc,CAAC;CACzB"}
@@ -0,0 +1,145 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ Entity,
15
+ Index,
16
+ JoinColumn,
17
+ ManyToOne,
18
+ PrimaryGeneratedColumn,
19
+ UpdateDateColumn
20
+ } from "typeorm";
21
+ import { BillingProduct } from "../billing-products/index.js";
22
+ import { ChargeType } from "./enums/charge-type.enum.js";
23
+ import { PricingModel } from "./enums/pricing-model.enum.js";
24
+ import { RecurringInterval } from "./enums/recurring-interval.enum.js";
25
+ let BillingPlan = class {
26
+ };
27
+ __decorateClass([
28
+ PrimaryGeneratedColumn("uuid", {
29
+ comment: "Identificador \xFAnico do plano."
30
+ })
31
+ ], BillingPlan.prototype, "id", 2);
32
+ __decorateClass([
33
+ Column({
34
+ name: "product_id",
35
+ type: "uuid",
36
+ comment: "Identificador do produto ao qual o plano pertence."
37
+ })
38
+ ], BillingPlan.prototype, "productId", 2);
39
+ __decorateClass([
40
+ Column({
41
+ name: "internal_label",
42
+ type: "varchar",
43
+ length: 100,
44
+ nullable: true,
45
+ comment: 'R\xF3tulo interno do plano (ex.: "lan\xE7amento 2026"). N\xE3o exibido ao cliente.'
46
+ })
47
+ ], BillingPlan.prototype, "internalLabel", 2);
48
+ __decorateClass([
49
+ Column({
50
+ type: "int",
51
+ comment: "Valor do plano em centavos."
52
+ })
53
+ ], BillingPlan.prototype, "amount", 2);
54
+ __decorateClass([
55
+ Column({
56
+ name: "charge_type",
57
+ type: "enum",
58
+ enum: ChargeType,
59
+ enumName: "billing_plans_charge_type_enum",
60
+ comment: "Tipo de cobran\xE7a: \xFAnica (one_time) ou recorrente (recurring)."
61
+ })
62
+ ], BillingPlan.prototype, "chargeType", 2);
63
+ __decorateClass([
64
+ Column({
65
+ name: "recurring_interval",
66
+ type: "enum",
67
+ enum: RecurringInterval,
68
+ enumName: "billing_plans_recurring_interval_enum",
69
+ nullable: true,
70
+ comment: "Intervalo de recorr\xEAncia (month/year). Nulo quando a cobran\xE7a \xE9 \xFAnica."
71
+ })
72
+ ], BillingPlan.prototype, "recurringInterval", 2);
73
+ __decorateClass([
74
+ Column({
75
+ name: "pricing_model",
76
+ type: "enum",
77
+ enum: PricingModel,
78
+ enumName: "billing_plans_pricing_model_enum",
79
+ default: PricingModel.FLAT,
80
+ comment: "Modelo de precifica\xE7\xE3o: valor fixo (flat) ou por unidade (per_unit)."
81
+ })
82
+ ], BillingPlan.prototype, "pricingModel", 2);
83
+ __decorateClass([
84
+ Column({
85
+ name: "trial_period_days",
86
+ type: "int",
87
+ default: 0,
88
+ comment: "Dura\xE7\xE3o do trial gratuito em dias. 0 = sem trial."
89
+ })
90
+ ], BillingPlan.prototype, "trialPeriodDays", 2);
91
+ __decorateClass([
92
+ Column({
93
+ name: "valid_from",
94
+ type: "timestamptz",
95
+ default: () => "now()",
96
+ comment: "In\xEDcio da vig\xEAncia do plano."
97
+ })
98
+ ], BillingPlan.prototype, "validFrom", 2);
99
+ __decorateClass([
100
+ Column({
101
+ name: "valid_until",
102
+ type: "timestamptz",
103
+ nullable: true,
104
+ comment: "Fim da vig\xEAncia do plano. Nulo enquanto vigente."
105
+ })
106
+ ], BillingPlan.prototype, "validUntil", 2);
107
+ __decorateClass([
108
+ Column({
109
+ name: "is_active",
110
+ type: "boolean",
111
+ default: true,
112
+ comment: "Indica se o plano est\xE1 ativo. Permite desativa\xE7\xE3o imediata (kill switch)."
113
+ })
114
+ ], BillingPlan.prototype, "isActive", 2);
115
+ __decorateClass([
116
+ CreateDateColumn({
117
+ name: "created_at",
118
+ type: "timestamptz",
119
+ comment: "Data de cria\xE7\xE3o do registro."
120
+ })
121
+ ], BillingPlan.prototype, "createdAt", 2);
122
+ __decorateClass([
123
+ UpdateDateColumn({
124
+ name: "updated_at",
125
+ type: "timestamptz",
126
+ comment: "Data da \xFAltima atualiza\xE7\xE3o do registro."
127
+ })
128
+ ], BillingPlan.prototype, "updatedAt", 2);
129
+ __decorateClass([
130
+ ManyToOne(() => BillingProduct, (product) => product.plans, {
131
+ onDelete: "RESTRICT"
132
+ }),
133
+ JoinColumn({ name: "product_id" })
134
+ ], BillingPlan.prototype, "product", 2);
135
+ BillingPlan = __decorateClass([
136
+ Entity("billing_plans"),
137
+ Index("idx_billing_plans_product", ["productId"]),
138
+ Index("idx_billing_plans_product_valid_from", ["productId", "validFrom"]),
139
+ Index("idx_billing_plans_current", ["productId"], {
140
+ where: '"valid_until" IS NULL AND "is_active" = true'
141
+ })
142
+ ], BillingPlan);
143
+ export {
144
+ BillingPlan
145
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum ChargeType {
2
+ ONE_TIME = "one_time",
3
+ RECURRING = "recurring"
4
+ }
5
+ //# sourceMappingURL=charge-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"charge-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-plans/enums/charge-type.enum.ts"],"names":[],"mappings":"AAWA,oBAAY,UAAU;IAIpB,QAAQ,aAAa;IAKrB,SAAS,cAAc;CACxB"}
@@ -0,0 +1,8 @@
1
+ var ChargeType = /* @__PURE__ */ ((ChargeType2) => {
2
+ ChargeType2["ONE_TIME"] = "one_time";
3
+ ChargeType2["RECURRING"] = "recurring";
4
+ return ChargeType2;
5
+ })(ChargeType || {});
6
+ export {
7
+ ChargeType
8
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum PricingModel {
2
+ FLAT = "flat",
3
+ PER_UNIT = "per_unit"
4
+ }
5
+ //# sourceMappingURL=pricing-model.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-model.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-plans/enums/pricing-model.enum.ts"],"names":[],"mappings":"AAUA,oBAAY,YAAY;IAItB,IAAI,SAAS;IAKb,QAAQ,aAAa;CACtB"}
@@ -1,7 +1,6 @@
1
1
  var PricingModel = /* @__PURE__ */ ((PricingModel2) => {
2
2
  PricingModel2["FLAT"] = "flat";
3
3
  PricingModel2["PER_UNIT"] = "per_unit";
4
- PricingModel2["TIERED"] = "tiered";
5
4
  return PricingModel2;
6
5
  })(PricingModel || {});
7
6
  export {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recurring-interval.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-plans/enums/recurring-interval.enum.ts"],"names":[],"mappings":"AASA,oBAAY,iBAAiB;IAI3B,KAAK,UAAU;IAKf,IAAI,SAAS;CACd"}
@@ -0,0 +1,5 @@
1
+ export * from './billing-plan.entity';
2
+ export * from './enums/charge-type.enum';
3
+ export * from './enums/pricing-model.enum';
4
+ export * from './enums/recurring-interval.enum';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-plans/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./billing-plan.entity.js";
2
+ export * from "./enums/charge-type.enum.js";
3
+ export * from "./enums/pricing-model.enum.js";
4
+ export * from "./enums/recurring-interval.enum.js";
@@ -1,12 +1,12 @@
1
- import { BillingPrice } from '../billing-prices';
1
+ import { BillingPlan } from '../billing-plans';
2
2
  export declare class BillingProduct {
3
3
  id: string;
4
- code: string;
5
- name: string;
4
+ key: string;
5
+ displayName: string;
6
6
  description: string | null;
7
7
  isActive: boolean;
8
8
  createdAt: Date;
9
9
  updatedAt: Date;
10
- prices: BillingPrice[];
10
+ plans: BillingPlan[];
11
11
  }
12
12
  //# sourceMappingURL=billing-product.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"billing-product.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-products/billing-product.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,qBAIa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IAQX,IAAI,EAAE,MAAM,CAAC;IAOb,IAAI,EAAE,MAAM,CAAC;IAOb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,QAAQ,EAAE,OAAO,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB"}
1
+ {"version":3,"file":"billing-product.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-products/billing-product.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAiB/C,qBAIa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IAQX,GAAG,EAAE,MAAM,CAAC;IAQZ,WAAW,EAAE,MAAM,CAAC;IAOpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,QAAQ,EAAE,OAAO,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB"}
@@ -18,7 +18,7 @@ import {
18
18
  Unique,
19
19
  UpdateDateColumn
20
20
  } from "typeorm";
21
- import { BillingPrice } from "../billing-prices/index.js";
21
+ import { BillingPlan } from "../billing-plans/index.js";
22
22
  let BillingProduct = class {
23
23
  };
24
24
  __decorateClass([
@@ -30,16 +30,17 @@ __decorateClass([
30
30
  Column({
31
31
  type: "varchar",
32
32
  length: 60,
33
- comment: "C\xF3digo sem\xE2ntico est\xE1vel do produto (ex.: TOURNAMENT_LICENSE). Imut\xE1vel ap\xF3s a cria\xE7\xE3o."
33
+ comment: "Chave sem\xE2ntica est\xE1vel do produto em UPPER_SNAKE_CASE (ex.: TOURNAMENT_LICENSE). Imut\xE1vel ap\xF3s a cria\xE7\xE3o."
34
34
  })
35
- ], BillingProduct.prototype, "code", 2);
35
+ ], BillingProduct.prototype, "key", 2);
36
36
  __decorateClass([
37
37
  Column({
38
+ name: "display_name",
38
39
  type: "varchar",
39
40
  length: 255,
40
41
  comment: "Nome de exibi\xE7\xE3o do produto."
41
42
  })
42
- ], BillingProduct.prototype, "name", 2);
43
+ ], BillingProduct.prototype, "displayName", 2);
43
44
  __decorateClass([
44
45
  Column({
45
46
  type: "text",
@@ -70,12 +71,12 @@ __decorateClass([
70
71
  })
71
72
  ], BillingProduct.prototype, "updatedAt", 2);
72
73
  __decorateClass([
73
- OneToMany(() => BillingPrice, (price) => price.product)
74
- ], BillingProduct.prototype, "prices", 2);
74
+ OneToMany(() => BillingPlan, (plan) => plan.product)
75
+ ], BillingProduct.prototype, "plans", 2);
75
76
  BillingProduct = __decorateClass([
76
77
  Entity("billing_products"),
77
- Unique("UQ_billing_products_code", ["code"]),
78
- Index("idx_billing_products_code", ["code"]),
78
+ Unique("UQ_billing_products_key", ["key"]),
79
+ Index("idx_billing_products_key", ["key"]),
79
80
  Index("idx_billing_products_is_active", ["isActive"])
80
81
  ], BillingProduct);
81
82
  export {
@@ -0,0 +1,6 @@
1
+ export declare const BillingProductKey: {
2
+ readonly TOURNAMENT_LICENSE: "TOURNAMENT_LICENSE";
3
+ readonly EXTRA_CATEGORY: "EXTRA_CATEGORY";
4
+ };
5
+ export type BillingProductKey = (typeof BillingProductKey)[keyof typeof BillingProductKey];
6
+ //# sourceMappingURL=billing-product-key.constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-product-key.constant.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-products/enums/billing-product-key.constant.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,iBAAiB;;;CAUpB,CAAC;AAWX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- const BillingProductCode = {
1
+ const BillingProductKey = {
2
2
  /**
3
3
  * Licença de uso da plataforma por campeonato (agrupador de categorias).
4
4
  */
@@ -9,5 +9,5 @@ const BillingProductCode = {
9
9
  EXTRA_CATEGORY: "EXTRA_CATEGORY"
10
10
  };
11
11
  export {
12
- BillingProductCode
12
+ BillingProductKey
13
13
  };
@@ -1,3 +1,3 @@
1
1
  export * from './billing-product.entity';
2
- export * from './enums/billing-product-code.constant';
2
+ export * from './enums/billing-product-key.constant';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-products/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-products/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export * from "./billing-product.entity.js";
2
- export * from "./enums/billing-product-code.constant.js";
2
+ export * from "./enums/billing-product-key.constant.js";
@@ -0,0 +1,13 @@
1
+ import { BillingPlan } from '../billing-plans';
2
+ import { BillingSubscription } from '../billing-subscriptions';
3
+ export declare class BillingSubscriptionItem {
4
+ id: string;
5
+ subscriptionId: string;
6
+ planId: string;
7
+ quantity: number;
8
+ createdAt: Date;
9
+ updatedAt: Date;
10
+ subscription: BillingSubscription;
11
+ plan: BillingPlan;
12
+ }
13
+ //# sourceMappingURL=billing-subscription-item.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-subscription-item.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscription-items/billing-subscription-item.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAc/D,qBAGa,uBAAuB;IAIlC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,MAAM,EAAE,MAAM,CAAC;IAOf,QAAQ,EAAE,MAAM,CAAC;IAOjB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAYhB,YAAY,EAAE,mBAAmB,CAAC;IAUlC,IAAI,EAAE,WAAW,CAAC;CACnB"}
@@ -0,0 +1,84 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ Entity,
15
+ Index,
16
+ JoinColumn,
17
+ ManyToOne,
18
+ PrimaryGeneratedColumn,
19
+ UpdateDateColumn
20
+ } from "typeorm";
21
+ import { BillingPlan } from "../billing-plans/index.js";
22
+ import { BillingSubscription } from "../billing-subscriptions/index.js";
23
+ let BillingSubscriptionItem = class {
24
+ };
25
+ __decorateClass([
26
+ PrimaryGeneratedColumn("uuid", {
27
+ comment: "Identificador \xFAnico do item de assinatura."
28
+ })
29
+ ], BillingSubscriptionItem.prototype, "id", 2);
30
+ __decorateClass([
31
+ Column({
32
+ name: "subscription_id",
33
+ type: "uuid",
34
+ comment: "Identificador da assinatura \xE0 qual o item pertence."
35
+ })
36
+ ], BillingSubscriptionItem.prototype, "subscriptionId", 2);
37
+ __decorateClass([
38
+ Column({
39
+ name: "plan_id",
40
+ type: "uuid",
41
+ comment: "Identificador da vers\xE3o de plano contratada para este item."
42
+ })
43
+ ], BillingSubscriptionItem.prototype, "planId", 2);
44
+ __decorateClass([
45
+ Column({
46
+ type: "int",
47
+ default: 1,
48
+ comment: "Quantidade contratada deste plano (ex.: n\xBA de categorias extras)."
49
+ })
50
+ ], BillingSubscriptionItem.prototype, "quantity", 2);
51
+ __decorateClass([
52
+ CreateDateColumn({
53
+ name: "created_at",
54
+ type: "timestamptz",
55
+ comment: "Data de cria\xE7\xE3o do registro."
56
+ })
57
+ ], BillingSubscriptionItem.prototype, "createdAt", 2);
58
+ __decorateClass([
59
+ UpdateDateColumn({
60
+ name: "updated_at",
61
+ type: "timestamptz",
62
+ comment: "Data da \xFAltima atualiza\xE7\xE3o do registro."
63
+ })
64
+ ], BillingSubscriptionItem.prototype, "updatedAt", 2);
65
+ __decorateClass([
66
+ ManyToOne(() => BillingSubscription, (subscription) => subscription.items, {
67
+ onDelete: "CASCADE"
68
+ }),
69
+ JoinColumn({ name: "subscription_id" })
70
+ ], BillingSubscriptionItem.prototype, "subscription", 2);
71
+ __decorateClass([
72
+ ManyToOne(() => BillingPlan, {
73
+ onDelete: "RESTRICT"
74
+ }),
75
+ JoinColumn({ name: "plan_id" })
76
+ ], BillingSubscriptionItem.prototype, "plan", 2);
77
+ BillingSubscriptionItem = __decorateClass([
78
+ Entity("billing_subscription_items"),
79
+ Index("idx_billing_subscription_items_subscription", ["subscriptionId"]),
80
+ Index("idx_billing_subscription_items_plan", ["planId"])
81
+ ], BillingSubscriptionItem);
82
+ export {
83
+ BillingSubscriptionItem
84
+ };
@@ -0,0 +1,2 @@
1
+ export * from './billing-subscription-item.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscription-items/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./billing-subscription-item.entity.js";
@@ -0,0 +1,22 @@
1
+ import { BillingAccount } from '../billing-accounts';
2
+ import { BillingSubscriptionItem } from '../billing-subscription-items';
3
+ import { BillingResourceType } from './enums/billing-resource-type.enum';
4
+ import { BillingSubscriptionStatus } from './enums/billing-subscription-status.enum';
5
+ export declare class BillingSubscription {
6
+ id: string;
7
+ billingAccountId: string;
8
+ resourceType: BillingResourceType;
9
+ resourceId: number;
10
+ status: BillingSubscriptionStatus;
11
+ trialStartsAt: Date | null;
12
+ trialEndsAt: Date | null;
13
+ activatedAt: Date | null;
14
+ canceledAt: Date | null;
15
+ currentPeriodStart: Date | null;
16
+ currentPeriodEnd: Date | null;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ billingAccount: BillingAccount;
20
+ items: BillingSubscriptionItem[];
21
+ }
22
+ //# sourceMappingURL=billing-subscription.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-subscription.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscriptions/billing-subscription.entity.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAiBrF,qBAUa,mBAAmB;IAI9B,EAAE,EAAE,MAAM,CAAC;IAOX,gBAAgB,EAAE,MAAM,CAAC;IASzB,YAAY,EAAE,mBAAmB,CAAC;IAOlC,UAAU,EAAE,MAAM,CAAC;IASnB,MAAM,EAAE,yBAAyB,CAAC;IAQlC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAQ3B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAQxB,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAQhC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAO9B,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAYhB,cAAc,EAAE,cAAc,CAAC;IAM/B,KAAK,EAAE,uBAAuB,EAAE,CAAC;CAClC"}