@saasicat/nest 1.0.0-rc.2 → 1.0.0-rc.21

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 (154) hide show
  1. package/README.md +44 -8
  2. package/dist/.build-stamp +1 -1
  3. package/dist/_entries.cjs +10214 -4796
  4. package/dist/admin/index.d.cts +5 -4
  5. package/dist/admin/index.d.ts +5 -4
  6. package/dist/admin/index.js +13 -9
  7. package/dist/{admin-resources.module-CpvzcfCc.d.cts → admin-resources.module-B4XNvdH-.d.cts} +1 -2
  8. package/dist/{admin-resources.module-DF5_Q7RD.d.ts → admin-resources.module-CWqdI9BV.d.ts} +1 -2
  9. package/dist/{admin-stats.service-TYiSUwIR.d.ts → admin-stats.service-CsLNt19Z.d.ts} +11 -7
  10. package/dist/{admin-stats.service-DfKupywR.d.cts → admin-stats.service-DrZrU8IJ.d.cts} +11 -7
  11. package/dist/{aggregation-B3CD0v_d.d.cts → aggregation-ChpZDh0g.d.ts} +39 -6
  12. package/dist/{aggregation-BFzW07DE.d.ts → aggregation-OpnhwzF5.d.cts} +39 -6
  13. package/dist/billing/index.d.cts +448 -108
  14. package/dist/billing/index.d.ts +448 -108
  15. package/dist/billing/index.js +108 -41
  16. package/dist/catalog/index.d.cts +74 -45
  17. package/dist/catalog/index.d.ts +74 -45
  18. package/dist/catalog/index.js +21 -13
  19. package/dist/catalog.module-C9O7BxRq.d.ts +180 -0
  20. package/dist/catalog.module-T-I5Ricz.d.cts +180 -0
  21. package/dist/checkout-offer/index.d.cts +17 -22
  22. package/dist/checkout-offer/index.d.ts +17 -22
  23. package/dist/checkout-offer/index.js +21 -7
  24. package/dist/checkout-offer.module-DFhGy6JO.d.cts +58 -0
  25. package/dist/checkout-offer.module-x7SP_dX4.d.ts +58 -0
  26. package/dist/checkout-offer.service-BeHgYikI.d.ts +242 -0
  27. package/dist/checkout-offer.service-CCVxG9b2.d.cts +242 -0
  28. package/dist/chunk-34XVPR6P.js +222 -0
  29. package/dist/{chunk-AOQJEYOL.js → chunk-3QVGA6JX.js} +3 -1
  30. package/dist/chunk-3RLWML2S.js +896 -0
  31. package/dist/{chunk-TXC3LHHB.js → chunk-4SDSYV4A.js} +21 -13
  32. package/dist/chunk-55QEDAMX.js +946 -0
  33. package/dist/chunk-5CKC7O52.js +140 -0
  34. package/dist/chunk-6PJE7EWO.js +185 -0
  35. package/dist/chunk-7NJKVC5X.js +353 -0
  36. package/dist/{chunk-RUNZ3X4C.js → chunk-AOS2JPDD.js} +1263 -185
  37. package/dist/{chunk-WOVQPXV4.js → chunk-CQ2ZZMTD.js} +702 -725
  38. package/dist/{chunk-NA6O63B7.js → chunk-F5X66HF5.js} +5 -5
  39. package/dist/chunk-FEQZCWUL.js +174 -0
  40. package/dist/{chunk-VIJ5NJWC.js → chunk-G6EZWECL.js} +107 -31
  41. package/dist/chunk-G7RQO2XO.js +0 -0
  42. package/dist/{chunk-N3L3AICU.js → chunk-GPQWGA6B.js} +5 -6
  43. package/dist/chunk-GZTL64QK.js +7 -0
  44. package/dist/{chunk-SABTXESR.js → chunk-J7NJRK3K.js} +17 -1
  45. package/dist/{chunk-SEPN52AD.js → chunk-JBCC6C3M.js} +566 -307
  46. package/dist/{chunk-I7GTA3RX.js → chunk-JQRA724W.js} +1 -1
  47. package/dist/{chunk-WXYJHZCN.js → chunk-JVAEKTJ4.js} +2 -14
  48. package/dist/chunk-KPEMTBOP.js +26 -0
  49. package/dist/chunk-LF6J4YYN.js +301 -0
  50. package/dist/{chunk-LTT736P3.js → chunk-LLYVYRGJ.js} +228 -387
  51. package/dist/{chunk-6Z7JR4EW.js → chunk-M47BNEY2.js} +1897 -633
  52. package/dist/{chunk-KFT5AIIH.js → chunk-NDLC5GYK.js} +206 -24
  53. package/dist/{chunk-O2J2HDXA.js → chunk-OOTEXP47.js} +3 -8
  54. package/dist/chunk-QPVDCKYS.js +702 -0
  55. package/dist/{chunk-NHVDCYK5.js → chunk-R5YCJBHY.js} +71 -106
  56. package/dist/{chunk-XBYAFEOR.js → chunk-S33SO5XX.js} +1 -1
  57. package/dist/chunk-SZ7RFPXA.js +10 -0
  58. package/dist/chunk-TBBZWZQT.js +98 -0
  59. package/dist/chunk-TOEFN7DN.js +295 -0
  60. package/dist/{chunk-7ZEGFL42.js → chunk-WHJSYKNC.js} +6 -6
  61. package/dist/chunk-WOEJ6K7M.js +55 -0
  62. package/dist/{chunk-AU3OOREM.js → chunk-XSSWYPP5.js} +16 -3
  63. package/dist/contract-line-item-money-B0Z3Ogur.d.cts +43 -0
  64. package/dist/contract-line-item-money-B0Z3Ogur.d.ts +43 -0
  65. package/dist/discovery/index.d.cts +2 -2
  66. package/dist/discovery/index.d.ts +2 -2
  67. package/dist/discovery/index.js +6 -6
  68. package/dist/{discovery.scanner-9cMqF95o.d.cts → discovery.scanner-DXKc6JkV.d.cts} +1 -1
  69. package/dist/{discovery.scanner-9cMqF95o.d.ts → discovery.scanner-DXKc6JkV.d.ts} +1 -1
  70. package/dist/{enforce-quota.interceptor-Df0e3OWe.d.cts → enforce-quota.interceptor-BFyVdWe8.d.cts} +6 -6
  71. package/dist/{enforce-quota.interceptor-DW3etVyI.d.ts → enforce-quota.interceptor-GaBXboGx.d.ts} +6 -6
  72. package/dist/entitlement/index.d.cts +27 -4
  73. package/dist/entitlement/index.d.ts +27 -4
  74. package/dist/entitlement/index.js +13 -8
  75. package/dist/index.d.cts +209 -28
  76. package/dist/index.d.ts +209 -28
  77. package/dist/index.js +285 -163
  78. package/dist/issuer-identity.check-CBO0vcsq.d.cts +197 -0
  79. package/dist/issuer-identity.check-Cz9CEMkZ.d.ts +197 -0
  80. package/dist/{module-options-COSEb0VW.d.ts → module-options-DmQ3G4sZ.d.ts} +135 -41
  81. package/dist/{module-options-BG3MzQva.d.cts → module-options-qAOwinHR.d.cts} +135 -41
  82. package/dist/payment-callback.service-CR84Xw1Z.d.cts +125 -0
  83. package/dist/payment-callback.service-CR84Xw1Z.d.ts +125 -0
  84. package/dist/payments/index.cjs +4 -0
  85. package/dist/payments/index.d.cts +187 -0
  86. package/dist/payments/index.d.ts +187 -0
  87. package/dist/payments/index.js +141 -0
  88. package/dist/payments.module-BdUq9ot_.d.cts +57 -0
  89. package/dist/payments.module-CQGv_VG7.d.ts +57 -0
  90. package/dist/plan-catalog-source-DWe-BGY1.d.cts +21 -0
  91. package/dist/plan-catalog-source-DWe-BGY1.d.ts +21 -0
  92. package/dist/{plan-resolution-Cgo_TR1H.d.cts → plan-resolution-CwUy_OqC.d.cts} +14 -0
  93. package/dist/{plan-resolution-Cgo_TR1H.d.ts → plan-resolution-CwUy_OqC.d.ts} +14 -0
  94. package/dist/{plan-versions.service-DChhbK6h.d.ts → plan-versions.service-C0N-Em2W.d.ts} +38 -64
  95. package/dist/{plan-versions.service-TPEtbN0r.d.cts → plan-versions.service-DARLh-qI.d.cts} +38 -64
  96. package/dist/platform/index.d.cts +52 -23
  97. package/dist/platform/index.d.ts +52 -23
  98. package/dist/platform/index.js +57 -36
  99. package/dist/promo/index.d.cts +23 -8
  100. package/dist/promo/index.d.ts +23 -8
  101. package/dist/promo/index.js +15 -7
  102. package/dist/{promo.module-DtvIycpt.d.cts → promo.module-CKkECmU8.d.cts} +9 -3
  103. package/dist/{promo.module-Z8h1PNX-.d.ts → promo.module-DuIJdK3U.d.ts} +9 -3
  104. package/dist/promo.service-BYBu6dy3.d.cts +215 -0
  105. package/dist/promo.service-CFjfF0Xm.d.ts +215 -0
  106. package/dist/registration/index.d.cts +104 -47
  107. package/dist/registration/index.d.ts +104 -47
  108. package/dist/registration/index.js +15 -9
  109. package/dist/subscriber/index.cjs +4 -0
  110. package/dist/subscriber/index.d.cts +28 -0
  111. package/dist/subscriber/index.d.ts +28 -0
  112. package/dist/subscriber/index.js +16 -0
  113. package/dist/subscriber.service-5W6Gi-1B.d.cts +68 -0
  114. package/dist/subscriber.service-5W6Gi-1B.d.ts +68 -0
  115. package/dist/subscription-contract/index.d.cts +4 -2
  116. package/dist/subscription-contract/index.d.ts +4 -2
  117. package/dist/subscription-contract/index.js +13 -5
  118. package/dist/{subscription-contract.module-fDFdQ0jm.d.ts → subscription-contract.module-BfIRpc1o.d.ts} +8 -2
  119. package/dist/{subscription-contract.module-CEK8HS5-.d.cts → subscription-contract.module-DTMuUJYd.d.cts} +8 -2
  120. package/dist/{subscription-contract.service-hD87MKyg.d.cts → subscription-contract.service-CPZrTM9C.d.ts} +32 -3
  121. package/dist/{subscription-contract.service-hD87MKyg.d.ts → subscription-contract.service-CfNApLuP.d.cts} +32 -3
  122. package/dist/tenant-billing.controller-BLqbsONe.d.ts +812 -0
  123. package/dist/tenant-billing.controller-DKbAqTbM.d.cts +812 -0
  124. package/dist/tenant-billing.module-ClbjzocC.d.cts +364 -0
  125. package/dist/tenant-billing.module-DohgJJ2m.d.ts +364 -0
  126. package/dist/tenant-billing.tokens-G-1xOlMr.d.cts +129 -0
  127. package/dist/tenant-billing.tokens-G-1xOlMr.d.ts +129 -0
  128. package/dist/testing/index.d.cts +44 -17
  129. package/dist/testing/index.d.ts +44 -17
  130. package/dist/testing/index.js +189 -40
  131. package/package.json +24 -4
  132. package/dist/catalog.module-BDDO6iwq.d.cts +0 -103
  133. package/dist/catalog.module-BTnMsE6u.d.ts +0 -103
  134. package/dist/checkout-offer.module-CMtiQJTT.d.ts +0 -39
  135. package/dist/checkout-offer.module-CVpWrzbe.d.cts +0 -39
  136. package/dist/checkout-offer.service-BLOv2HOo.d.cts +0 -49
  137. package/dist/checkout-offer.service-BLOv2HOo.d.ts +0 -49
  138. package/dist/chunk-57V6ZTI6.js +0 -22
  139. package/dist/chunk-BSK6YBLI.js +0 -87
  140. package/dist/chunk-DQKCK7DX.js +0 -217
  141. package/dist/chunk-VXEYLNIB.js +0 -632
  142. package/dist/chunk-WUDYIPYH.js +0 -715
  143. package/dist/define-saasicat-DROBe-b1.d.ts +0 -69
  144. package/dist/define-saasicat-vGBCkFys.d.cts +0 -69
  145. package/dist/promo.service-BJbKAmw3.d.cts +0 -112
  146. package/dist/promo.service-BJbKAmw3.d.ts +0 -112
  147. package/dist/tenant-billing.controller-BQ67mlmI.d.ts +0 -438
  148. package/dist/tenant-billing.controller-DS8kB8a7.d.cts +0 -438
  149. package/dist/tenant-billing.module-BznC3XtW.d.cts +0 -299
  150. package/dist/tenant-billing.module-wUbsQSFG.d.ts +0 -299
  151. /package/dist/{chunk-2FR6ZL7R.js → chunk-BHZOH2DY.js} +0 -0
  152. /package/dist/{chunk-2SLTRKXC.js → chunk-DFOW3JVO.js} +0 -0
  153. /package/dist/{chunk-DBZGV3HC.js → chunk-DU56UKEH.js} +0 -0
  154. /package/dist/{chunk-OYNHOY45.js → chunk-GAUEVIAE.js} +0 -0
@@ -0,0 +1,295 @@
1
+ import {
2
+ CHECKOUT_OFFER_REPOSITORY_TOKEN,
3
+ CHECKOUT_OFFER_TRANSACTION_RUNNER_TOKEN,
4
+ CheckoutOfferPricing,
5
+ CheckoutOfferService
6
+ } from "./chunk-55QEDAMX.js";
7
+ import {
8
+ SubscriptionContractService
9
+ } from "./chunk-NDLC5GYK.js";
10
+ import {
11
+ SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
12
+ } from "./chunk-VBRYPU7V.js";
13
+ import {
14
+ BUNDLE_REPOSITORY_TOKEN,
15
+ CATALOG_ENTRY_REPOSITORY_TOKEN,
16
+ PLAN_REPOSITORY_TOKEN,
17
+ PROMOTION_REPOSITORY_TOKEN
18
+ } from "./chunk-3QVGA6JX.js";
19
+ import {
20
+ subscriberProviders
21
+ } from "./chunk-WOEJ6K7M.js";
22
+ import {
23
+ SaaSiCatPublicRoute
24
+ } from "./chunk-YSC46BGM.js";
25
+ import {
26
+ asProvider
27
+ } from "./chunk-J7NJRK3K.js";
28
+ import {
29
+ __name
30
+ } from "./chunk-SHUYVCID.js";
31
+
32
+ // src/checkout-offer/dto/checkout-offer.dto.ts
33
+ import { ArrayMaxSize, IsArray, IsDateString, IsIn, IsOptional, IsString, MaxLength, ValidateIf } from "class-validator";
34
+ function _ts_decorate(decorators, target, key, desc) {
35
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37
+ 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;
38
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
39
+ }
40
+ __name(_ts_decorate, "_ts_decorate");
41
+ function _ts_metadata(k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ }
44
+ __name(_ts_metadata, "_ts_metadata");
45
+ var CYCLES = [
46
+ "monthly",
47
+ "yearly"
48
+ ];
49
+ var MAX_BUNDLE_VERSIONS = 50;
50
+ var CreateCheckoutOfferDto = class {
51
+ static {
52
+ __name(this, "CreateCheckoutOfferDto");
53
+ }
54
+ planKey;
55
+ billingCycle;
56
+ bundleVersionIds;
57
+ promoCode;
58
+ locale;
59
+ validUntil;
60
+ };
61
+ _ts_decorate([
62
+ IsString(),
63
+ MaxLength(64),
64
+ _ts_metadata("design:type", String)
65
+ ], CreateCheckoutOfferDto.prototype, "planKey", void 0);
66
+ _ts_decorate([
67
+ IsString(),
68
+ IsIn(CYCLES),
69
+ _ts_metadata("design:type", String)
70
+ ], CreateCheckoutOfferDto.prototype, "billingCycle", void 0);
71
+ _ts_decorate([
72
+ IsOptional(),
73
+ IsArray(),
74
+ ArrayMaxSize(MAX_BUNDLE_VERSIONS),
75
+ IsString({
76
+ each: true
77
+ }),
78
+ _ts_metadata("design:type", Array)
79
+ ], CreateCheckoutOfferDto.prototype, "bundleVersionIds", void 0);
80
+ _ts_decorate([
81
+ IsOptional(),
82
+ ValidateIf((_o, value) => value !== null),
83
+ IsString(),
84
+ MaxLength(64),
85
+ _ts_metadata("design:type", Object)
86
+ ], CreateCheckoutOfferDto.prototype, "promoCode", void 0);
87
+ _ts_decorate([
88
+ IsOptional(),
89
+ IsString(),
90
+ MaxLength(8),
91
+ _ts_metadata("design:type", String)
92
+ ], CreateCheckoutOfferDto.prototype, "locale", void 0);
93
+ _ts_decorate([
94
+ IsOptional(),
95
+ ValidateIf((_o, value) => value !== null),
96
+ IsDateString(),
97
+ _ts_metadata("design:type", Object)
98
+ ], CreateCheckoutOfferDto.prototype, "validUntil", void 0);
99
+ var UpdateCheckoutOfferDto = class {
100
+ static {
101
+ __name(this, "UpdateCheckoutOfferDto");
102
+ }
103
+ billingCycle;
104
+ bundleVersionIds;
105
+ promoCode;
106
+ locale;
107
+ validUntil;
108
+ };
109
+ _ts_decorate([
110
+ IsOptional(),
111
+ IsString(),
112
+ IsIn(CYCLES),
113
+ _ts_metadata("design:type", String)
114
+ ], UpdateCheckoutOfferDto.prototype, "billingCycle", void 0);
115
+ _ts_decorate([
116
+ IsOptional(),
117
+ IsArray(),
118
+ ArrayMaxSize(MAX_BUNDLE_VERSIONS),
119
+ IsString({
120
+ each: true
121
+ }),
122
+ _ts_metadata("design:type", Array)
123
+ ], UpdateCheckoutOfferDto.prototype, "bundleVersionIds", void 0);
124
+ _ts_decorate([
125
+ IsOptional(),
126
+ ValidateIf((_o, value) => value !== null),
127
+ IsString(),
128
+ MaxLength(64),
129
+ _ts_metadata("design:type", Object)
130
+ ], UpdateCheckoutOfferDto.prototype, "promoCode", void 0);
131
+ _ts_decorate([
132
+ IsOptional(),
133
+ IsString(),
134
+ MaxLength(8),
135
+ _ts_metadata("design:type", String)
136
+ ], UpdateCheckoutOfferDto.prototype, "locale", void 0);
137
+ _ts_decorate([
138
+ IsOptional(),
139
+ ValidateIf((_o, value) => value !== null),
140
+ IsDateString(),
141
+ _ts_metadata("design:type", Object)
142
+ ], UpdateCheckoutOfferDto.prototype, "validUntil", void 0);
143
+
144
+ // src/checkout-offer/checkout-offer.controller.ts
145
+ import { Body, Controller, Get, Inject, Param, ParseUUIDPipe, Patch, Post, UseGuards } from "@nestjs/common";
146
+ function _ts_decorate2(decorators, target, key, desc) {
147
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
148
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
149
+ 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;
150
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
151
+ }
152
+ __name(_ts_decorate2, "_ts_decorate");
153
+ function _ts_metadata2(k, v) {
154
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
155
+ }
156
+ __name(_ts_metadata2, "_ts_metadata");
157
+ function _ts_param(paramIndex, decorator) {
158
+ return function(target, key) {
159
+ decorator(target, key, paramIndex);
160
+ };
161
+ }
162
+ __name(_ts_param, "_ts_param");
163
+ function buildCheckoutOfferController(guards) {
164
+ let GeneratedCheckoutOfferController = class GeneratedCheckoutOfferController {
165
+ static {
166
+ __name(this, "GeneratedCheckoutOfferController");
167
+ }
168
+ service;
169
+ constructor(service) {
170
+ this.service = service;
171
+ }
172
+ /** The website creates an offer when a package is clicked. */
173
+ create(dto) {
174
+ return this.service.create(dto);
175
+ }
176
+ /** Onboarding reads the pre-selected offer (`?offer=<id>`). */
177
+ getById(id) {
178
+ return this.service.getById(id);
179
+ }
180
+ /** Onboarding customization — as long as the offer is `open`. */
181
+ update(id, dto) {
182
+ return this.service.update(id, dto);
183
+ }
184
+ };
185
+ _ts_decorate2([
186
+ Post(),
187
+ _ts_param(0, Body()),
188
+ _ts_metadata2("design:type", Function),
189
+ _ts_metadata2("design:paramtypes", [
190
+ typeof CreateCheckoutOfferDto === "undefined" ? Object : CreateCheckoutOfferDto
191
+ ]),
192
+ _ts_metadata2("design:returntype", void 0)
193
+ ], GeneratedCheckoutOfferController.prototype, "create", null);
194
+ _ts_decorate2([
195
+ Get(":id"),
196
+ _ts_param(0, Param("id", new ParseUUIDPipe())),
197
+ _ts_metadata2("design:type", Function),
198
+ _ts_metadata2("design:paramtypes", [
199
+ String
200
+ ]),
201
+ _ts_metadata2("design:returntype", void 0)
202
+ ], GeneratedCheckoutOfferController.prototype, "getById", null);
203
+ _ts_decorate2([
204
+ Patch(":id"),
205
+ _ts_param(0, Param("id", new ParseUUIDPipe())),
206
+ _ts_param(1, Body()),
207
+ _ts_metadata2("design:type", Function),
208
+ _ts_metadata2("design:paramtypes", [
209
+ String,
210
+ typeof UpdateCheckoutOfferDto === "undefined" ? Object : UpdateCheckoutOfferDto
211
+ ]),
212
+ _ts_metadata2("design:returntype", void 0)
213
+ ], GeneratedCheckoutOfferController.prototype, "update", null);
214
+ GeneratedCheckoutOfferController = _ts_decorate2([
215
+ Controller("public/checkout-offer"),
216
+ SaaSiCatPublicRoute(),
217
+ UseGuards(...guards),
218
+ _ts_param(0, Inject(CheckoutOfferService)),
219
+ _ts_metadata2("design:type", Function),
220
+ _ts_metadata2("design:paramtypes", [
221
+ typeof CheckoutOfferService === "undefined" ? Object : CheckoutOfferService
222
+ ])
223
+ ], GeneratedCheckoutOfferController);
224
+ return GeneratedCheckoutOfferController;
225
+ }
226
+ __name(buildCheckoutOfferController, "buildCheckoutOfferController");
227
+
228
+ // src/checkout-offer/checkout-offer.module.ts
229
+ import { Module } from "@nestjs/common";
230
+ function _ts_decorate3(decorators, target, key, desc) {
231
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
232
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
233
+ 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;
234
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
235
+ }
236
+ __name(_ts_decorate3, "_ts_decorate");
237
+ var CheckoutOfferModule = class _CheckoutOfferModule {
238
+ static {
239
+ __name(this, "CheckoutOfferModule");
240
+ }
241
+ static forRoot(options) {
242
+ if (!options.planRepository) {
243
+ throw new Error("CheckoutOfferModule: `planRepository` is required \u2014 every offer is priced from the plan version on sale, and an offer without it would have to take its price from the request.");
244
+ }
245
+ if (options.conclusion && (!options.conclusion.subscriptionContractRepository || !options.conclusion.subscriberRepository || !options.conclusion.transactionRunner)) {
246
+ throw new Error("CheckoutOfferModule: `conclusion` needs `subscriptionContractRepository`, `subscriberRepository` and `transactionRunner` \u2014 concluding an offer writes the contract with its party and consumes the offer in one transaction, and without any of them it would do only part of that.");
247
+ }
248
+ const controllers = [];
249
+ if (options.controller) {
250
+ controllers.push(buildCheckoutOfferController(options.controller.guards));
251
+ }
252
+ return {
253
+ module: _CheckoutOfferModule,
254
+ global: options.global ?? false,
255
+ imports: options.imports ?? [],
256
+ controllers,
257
+ providers: [
258
+ asProvider(CHECKOUT_OFFER_REPOSITORY_TOKEN, options.checkoutOfferRepository),
259
+ ...options.bundleRepository ? [
260
+ asProvider(BUNDLE_REPOSITORY_TOKEN, options.bundleRepository)
261
+ ] : [],
262
+ asProvider(PLAN_REPOSITORY_TOKEN, options.planRepository),
263
+ ...options.promotionRepository ? [
264
+ asProvider(PROMOTION_REPOSITORY_TOKEN, options.promotionRepository)
265
+ ] : [],
266
+ ...options.catalogEntryRepository ? [
267
+ asProvider(CATALOG_ENTRY_REPOSITORY_TOKEN, options.catalogEntryRepository)
268
+ ] : [],
269
+ ...options.conclusion ? [
270
+ asProvider(SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN, options.conclusion.subscriptionContractRepository),
271
+ asProvider(CHECKOUT_OFFER_TRANSACTION_RUNNER_TOKEN, options.conclusion.transactionRunner),
272
+ ...subscriberProviders(options.conclusion.subscriberRepository),
273
+ SubscriptionContractService
274
+ ] : [],
275
+ CheckoutOfferPricing,
276
+ CheckoutOfferService,
277
+ ...options.extraProviders ?? []
278
+ ],
279
+ exports: [
280
+ CheckoutOfferService,
281
+ CHECKOUT_OFFER_REPOSITORY_TOKEN
282
+ ]
283
+ };
284
+ }
285
+ };
286
+ CheckoutOfferModule = _ts_decorate3([
287
+ Module({})
288
+ ], CheckoutOfferModule);
289
+
290
+ export {
291
+ CreateCheckoutOfferDto,
292
+ UpdateCheckoutOfferDto,
293
+ buildCheckoutOfferController,
294
+ CheckoutOfferModule
295
+ };
@@ -1,10 +1,7 @@
1
1
  import {
2
2
  EntitlementService,
3
3
  SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN
4
- } from "./chunk-VIJ5NJWC.js";
5
- import {
6
- SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
7
- } from "./chunk-VBRYPU7V.js";
4
+ } from "./chunk-G6EZWECL.js";
8
5
  import {
9
6
  ENTITLEMENT_RESOLUTION_CONFIG_TOKEN,
10
7
  ENTITLEMENT_SERVICE_TOKEN,
@@ -12,12 +9,15 @@ import {
12
9
  SUBSCRIPTION_REPOSITORY_TOKEN,
13
10
  TRANSACTION_RUNNER_TOKEN
14
11
  } from "./chunk-OUDSQ3PU.js";
12
+ import {
13
+ SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
14
+ } from "./chunk-VBRYPU7V.js";
15
15
  import {
16
16
  BUNDLE_REPOSITORY_TOKEN
17
- } from "./chunk-AOQJEYOL.js";
17
+ } from "./chunk-3QVGA6JX.js";
18
18
  import {
19
19
  asProvider
20
- } from "./chunk-SABTXESR.js";
20
+ } from "./chunk-J7NJRK3K.js";
21
21
  import {
22
22
  __name
23
23
  } from "./chunk-SHUYVCID.js";
@@ -0,0 +1,55 @@
1
+ import {
2
+ SUBSCRIBER_REPOSITORY_TOKEN,
3
+ SubscriberService
4
+ } from "./chunk-LF6J4YYN.js";
5
+ import {
6
+ asProvider
7
+ } from "./chunk-J7NJRK3K.js";
8
+ import {
9
+ __name
10
+ } from "./chunk-SHUYVCID.js";
11
+
12
+ // src/subscriber/subscriber.module.ts
13
+ import { Module } from "@nestjs/common";
14
+ function _ts_decorate(decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ 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;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ }
20
+ __name(_ts_decorate, "_ts_decorate");
21
+ var SubscriberModule = class _SubscriberModule {
22
+ static {
23
+ __name(this, "SubscriberModule");
24
+ }
25
+ static forRoot(options) {
26
+ return {
27
+ module: _SubscriberModule,
28
+ global: options.global ?? false,
29
+ imports: options.imports ?? [],
30
+ providers: [
31
+ ...subscriberProviders(options.subscriberRepository),
32
+ ...options.extraProviders ?? []
33
+ ],
34
+ exports: [
35
+ SubscriberService,
36
+ SUBSCRIBER_REPOSITORY_TOKEN
37
+ ]
38
+ };
39
+ }
40
+ };
41
+ SubscriberModule = _ts_decorate([
42
+ Module({})
43
+ ], SubscriberModule);
44
+ function subscriberProviders(repository) {
45
+ return [
46
+ asProvider(SUBSCRIBER_REPOSITORY_TOKEN, repository),
47
+ SubscriberService
48
+ ];
49
+ }
50
+ __name(subscriberProviders, "subscriberProviders");
51
+
52
+ export {
53
+ SubscriberModule,
54
+ subscriberProviders
55
+ };
@@ -1,12 +1,19 @@
1
1
  import {
2
2
  SubscriptionContractService
3
- } from "./chunk-KFT5AIIH.js";
3
+ } from "./chunk-NDLC5GYK.js";
4
4
  import {
5
5
  SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
6
6
  } from "./chunk-VBRYPU7V.js";
7
+ import {
8
+ subscriberProviders
9
+ } from "./chunk-WOEJ6K7M.js";
10
+ import {
11
+ SUBSCRIBER_REPOSITORY_TOKEN,
12
+ SubscriberService
13
+ } from "./chunk-LF6J4YYN.js";
7
14
  import {
8
15
  asProvider
9
- } from "./chunk-SABTXESR.js";
16
+ } from "./chunk-J7NJRK3K.js";
10
17
  import {
11
18
  __name
12
19
  } from "./chunk-SHUYVCID.js";
@@ -25,18 +32,24 @@ var SubscriptionContractModule = class _SubscriptionContractModule {
25
32
  __name(this, "SubscriptionContractModule");
26
33
  }
27
34
  static forRoot(options) {
35
+ if (!options.subscriberRepository) {
36
+ throw new Error("SubscriptionContractModule: `subscriberRepository` is required \u2014 every contract names the subscriber it is concluded with, and none can be written without it.");
37
+ }
28
38
  return {
29
39
  module: _SubscriptionContractModule,
30
40
  global: options.global ?? false,
31
41
  imports: options.imports ?? [],
32
42
  providers: [
33
43
  asProvider(SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN, options.subscriptionContractRepository),
44
+ ...subscriberProviders(options.subscriberRepository),
34
45
  SubscriptionContractService,
35
46
  ...options.extraProviders ?? []
36
47
  ],
37
48
  exports: [
38
49
  SubscriptionContractService,
39
- SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
50
+ SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN,
51
+ SubscriberService,
52
+ SUBSCRIBER_REPOSITORY_TOKEN
40
53
  ]
41
54
  };
42
55
  }
@@ -0,0 +1,43 @@
1
+ import { NewContractLineItemData } from '@saasicat/core';
2
+
3
+ type Cycle = 'monthly' | 'yearly';
4
+ /**
5
+ * A line as its source hands it over: priced in net, but not yet carrying the
6
+ * gross, the currency and the tax rate the installation applies.
7
+ */
8
+ type PricedContractLineItem = Omit<NewContractLineItemData, 'priceGross' | 'currency' | 'taxRate' | 'taxAmount'>;
9
+ /** The installation's money facts, as a contract's lines are recorded with them. */
10
+ interface ContractLineMoney {
11
+ /** ISO 4217. */
12
+ currency: string;
13
+ /** A percentage: 19 means 19 %. */
14
+ taxRate: number;
15
+ }
16
+ /** What a contract's lines add up to over one period of the contract. */
17
+ interface ContractLineTotals {
18
+ /** Every line that is not a discount. */
19
+ subtotalNet: number;
20
+ /** What the discount lines take off, as a positive amount. */
21
+ discountNet: number;
22
+ totalNet: number;
23
+ totalGross: number;
24
+ }
25
+ /**
26
+ * The lines of one contract with the installation's money recorded on them:
27
+ * each line's gross as its share of the tax its rhythm owes, the currency, the
28
+ * rate, and the tax as the gap between net and gross.
29
+ *
30
+ * The order of the lines is the order the shares are taken in, so the same
31
+ * lines in the same order always come out the same.
32
+ */
33
+ declare function recordContractLinesMoney(lines: readonly PricedContractLineItem[], money: ContractLineMoney): NewContractLineItemData[];
34
+ /**
35
+ * What the lines add up to over one period of a contract in `contractCycle`.
36
+ *
37
+ * Each line counts as often as it falls due in that period: a monthly add-on in
38
+ * a yearly contract twelve times. Summed in cents, so a total is exact rather
39
+ * than the float nearest to it.
40
+ */
41
+ declare function contractTotalsOf(lines: readonly Pick<NewContractLineItemData, 'kind' | 'priceNet' | 'priceGross' | 'billingCycle'>[], contractCycle: Cycle): ContractLineTotals;
42
+
43
+ export { type ContractLineMoney as C, type PricedContractLineItem as P, type ContractLineTotals as a, contractTotalsOf as c, recordContractLinesMoney as r };
@@ -0,0 +1,43 @@
1
+ import { NewContractLineItemData } from '@saasicat/core';
2
+
3
+ type Cycle = 'monthly' | 'yearly';
4
+ /**
5
+ * A line as its source hands it over: priced in net, but not yet carrying the
6
+ * gross, the currency and the tax rate the installation applies.
7
+ */
8
+ type PricedContractLineItem = Omit<NewContractLineItemData, 'priceGross' | 'currency' | 'taxRate' | 'taxAmount'>;
9
+ /** The installation's money facts, as a contract's lines are recorded with them. */
10
+ interface ContractLineMoney {
11
+ /** ISO 4217. */
12
+ currency: string;
13
+ /** A percentage: 19 means 19 %. */
14
+ taxRate: number;
15
+ }
16
+ /** What a contract's lines add up to over one period of the contract. */
17
+ interface ContractLineTotals {
18
+ /** Every line that is not a discount. */
19
+ subtotalNet: number;
20
+ /** What the discount lines take off, as a positive amount. */
21
+ discountNet: number;
22
+ totalNet: number;
23
+ totalGross: number;
24
+ }
25
+ /**
26
+ * The lines of one contract with the installation's money recorded on them:
27
+ * each line's gross as its share of the tax its rhythm owes, the currency, the
28
+ * rate, and the tax as the gap between net and gross.
29
+ *
30
+ * The order of the lines is the order the shares are taken in, so the same
31
+ * lines in the same order always come out the same.
32
+ */
33
+ declare function recordContractLinesMoney(lines: readonly PricedContractLineItem[], money: ContractLineMoney): NewContractLineItemData[];
34
+ /**
35
+ * What the lines add up to over one period of a contract in `contractCycle`.
36
+ *
37
+ * Each line counts as often as it falls due in that period: a monthly add-on in
38
+ * a yearly contract twelve times. Summed in cents, so a total is exact rather
39
+ * than the float nearest to it.
40
+ */
41
+ declare function contractTotalsOf(lines: readonly Pick<NewContractLineItemData, 'kind' | 'priceNet' | 'priceGross' | 'billingCycle'>[], contractCycle: Cycle): ContractLineTotals;
42
+
43
+ export { type ContractLineMoney as C, type PricedContractLineItem as P, type ContractLineTotals as a, contractTotalsOf as c, recordContractLinesMoney as r };
@@ -2,8 +2,8 @@ import * as _nestjs_common from '@nestjs/common';
2
2
  import { Type, CanActivate, DynamicModule, ForwardReference, LogLevel } from '@nestjs/common';
3
3
  import { DiscoveredQuotaPolicy, DiscoveryCodeStatus, CapabilityKind, DiscoverySnapshot } from '@saasicat/core';
4
4
  export { DiscoveredCapability, DiscoveredFeature, DiscoveredQuota, DiscoverySnapshot } from '@saasicat/core';
5
- import { b as DiscoveryAppInfo } from '../discovery.scanner-9cMqF95o.cjs';
6
- export { D as DISCOVERY_APP_INFO_TOKEN, a as DISCOVERY_SNAPSHOT_PATH_TOKEN, c as DiscoveryScanner, d as computeSnapshotHash } from '../discovery.scanner-9cMqF95o.cjs';
5
+ import { D as DiscoveryAppInfo } from '../discovery.scanner-DXKc6JkV.cjs';
6
+ export { b as DISCOVERY_APP_INFO_TOKEN, c as DISCOVERY_SNAPSHOT_PATH_TOKEN, a as DiscoveryScanner, d as computeSnapshotHash } from '../discovery.scanner-DXKc6JkV.cjs';
7
7
  import '@nestjs/core';
8
8
 
9
9
  /**
@@ -2,8 +2,8 @@ import * as _nestjs_common from '@nestjs/common';
2
2
  import { Type, CanActivate, DynamicModule, ForwardReference, LogLevel } from '@nestjs/common';
3
3
  import { DiscoveredQuotaPolicy, DiscoveryCodeStatus, CapabilityKind, DiscoverySnapshot } from '@saasicat/core';
4
4
  export { DiscoveredCapability, DiscoveredFeature, DiscoveredQuota, DiscoverySnapshot } from '@saasicat/core';
5
- import { b as DiscoveryAppInfo } from '../discovery.scanner-9cMqF95o.js';
6
- export { D as DISCOVERY_APP_INFO_TOKEN, a as DISCOVERY_SNAPSHOT_PATH_TOKEN, c as DiscoveryScanner, d as computeSnapshotHash } from '../discovery.scanner-9cMqF95o.js';
5
+ import { D as DiscoveryAppInfo } from '../discovery.scanner-DXKc6JkV.js';
6
+ export { b as DISCOVERY_APP_INFO_TOKEN, c as DISCOVERY_SNAPSHOT_PATH_TOKEN, a as DiscoveryScanner, d as computeSnapshotHash } from '../discovery.scanner-DXKc6JkV.js';
7
7
  import '@nestjs/core';
8
8
 
9
9
  /**
@@ -4,21 +4,21 @@ import {
4
4
  ImplementsCapability,
5
5
  RequiresCapability,
6
6
  runHeadlessDiscoveryScan
7
- } from "../chunk-I7GTA3RX.js";
7
+ } from "../chunk-JQRA724W.js";
8
+ import {
9
+ DiscoveryModule,
10
+ buildDiscoveryController
11
+ } from "../chunk-S33SO5XX.js";
8
12
  import {
9
13
  DiscoverySnapshotNotFoundError,
10
14
  loadDiscoverySnapshotFromFile
11
15
  } from "../chunk-74SCJ4HF.js";
12
- import {
13
- DiscoveryModule,
14
- buildDiscoveryController
15
- } from "../chunk-XBYAFEOR.js";
16
16
  import {
17
17
  DISCOVERY_APP_INFO_TOKEN,
18
18
  DISCOVERY_SNAPSHOT_PATH_TOKEN,
19
19
  DiscoveryScanner,
20
20
  computeSnapshotHash
21
- } from "../chunk-WXYJHZCN.js";
21
+ } from "../chunk-JVAEKTJ4.js";
22
22
  import {
23
23
  DEFINES_QUOTA_KEY,
24
24
  DISCOVERY_SNAPSHOT_TOKEN,
@@ -56,4 +56,4 @@ declare class DiscoveryScanner implements OnApplicationBootstrap {
56
56
  */
57
57
  declare function computeSnapshotHash(snapshot: Omit<DiscoverySnapshot, 'hash'>): string;
58
58
 
59
- export { DISCOVERY_APP_INFO_TOKEN as D, DISCOVERY_SNAPSHOT_PATH_TOKEN as a, type DiscoveryAppInfo as b, DiscoveryScanner as c, computeSnapshotHash as d };
59
+ export { type DiscoveryAppInfo as D, DiscoveryScanner as a, DISCOVERY_APP_INFO_TOKEN as b, DISCOVERY_SNAPSHOT_PATH_TOKEN as c, computeSnapshotHash as d };
@@ -56,4 +56,4 @@ declare class DiscoveryScanner implements OnApplicationBootstrap {
56
56
  */
57
57
  declare function computeSnapshotHash(snapshot: Omit<DiscoverySnapshot, 'hash'>): string;
58
58
 
59
- export { DISCOVERY_APP_INFO_TOKEN as D, DISCOVERY_SNAPSHOT_PATH_TOKEN as a, type DiscoveryAppInfo as b, DiscoveryScanner as c, computeSnapshotHash as d };
59
+ export { type DiscoveryAppInfo as D, DiscoveryScanner as a, DISCOVERY_APP_INFO_TOKEN as b, DISCOVERY_SNAPSHOT_PATH_TOKEN as c, computeSnapshotHash as d };
@@ -1,9 +1,10 @@
1
1
  import { CanActivate, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
2
2
  import { Reflector } from '@nestjs/core';
3
- import { F as FEATURE_GUARD_MARKER } from './tenant-billing.module-BznC3XtW.cjs';
3
+ import { F as FEATURE_GUARD_MARKER } from './tenant-billing.module-ClbjzocC.cjs';
4
4
  import { Observable } from 'rxjs';
5
- import { PlanCatalog, QuotaProvider } from '@saasicat/core';
6
- import { o as PlanResolverPort } from './module-options-BG3MzQva.cjs';
5
+ import { QuotaProvider } from '@saasicat/core';
6
+ import { P as PlanCatalogSource } from './plan-catalog-source-DWe-BGY1.cjs';
7
+ import { b as PlanResolverPort } from './module-options-qAOwinHR.cjs';
7
8
 
8
9
  interface StaticEntitlementSnapshot {
9
10
  planId: string | null;
@@ -12,9 +13,9 @@ interface StaticEntitlementSnapshot {
12
13
  quotas: Readonly<Record<string, number>>;
13
14
  }
14
15
  declare class StaticEntitlementService {
15
- private readonly catalog;
16
+ private readonly catalogs;
16
17
  private readonly resolver;
17
- constructor(catalog: PlanCatalog, resolver: PlanResolverPort);
18
+ constructor(catalogs: PlanCatalogSource, resolver: PlanResolverPort);
18
19
  /**
19
20
  * Returns the effective features + quotas of a tenant from the
20
21
  * plan catalog. When the plan is missing: an empty snapshot (no feature,
@@ -24,7 +25,6 @@ declare class StaticEntitlementService {
24
25
  /** Convenience helper for tests / synchronous checks in the UI manifest. */
25
26
  hasFeature(tenantId: string, featureKey: string): Promise<boolean>;
26
27
  quotaLimit(tenantId: string, quotaKey: string): Promise<number | null>;
27
- private findPlan;
28
28
  }
29
29
 
30
30
  declare const STATIC_FEATURE_GUARD_CONFIG_TOKEN: unique symbol;
@@ -1,9 +1,10 @@
1
1
  import { CanActivate, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
2
2
  import { Reflector } from '@nestjs/core';
3
- import { F as FEATURE_GUARD_MARKER } from './tenant-billing.module-wUbsQSFG.js';
3
+ import { F as FEATURE_GUARD_MARKER } from './tenant-billing.module-DohgJJ2m.js';
4
4
  import { Observable } from 'rxjs';
5
- import { PlanCatalog, QuotaProvider } from '@saasicat/core';
6
- import { o as PlanResolverPort } from './module-options-COSEb0VW.js';
5
+ import { QuotaProvider } from '@saasicat/core';
6
+ import { P as PlanCatalogSource } from './plan-catalog-source-DWe-BGY1.js';
7
+ import { b as PlanResolverPort } from './module-options-DmQ3G4sZ.js';
7
8
 
8
9
  interface StaticEntitlementSnapshot {
9
10
  planId: string | null;
@@ -12,9 +13,9 @@ interface StaticEntitlementSnapshot {
12
13
  quotas: Readonly<Record<string, number>>;
13
14
  }
14
15
  declare class StaticEntitlementService {
15
- private readonly catalog;
16
+ private readonly catalogs;
16
17
  private readonly resolver;
17
- constructor(catalog: PlanCatalog, resolver: PlanResolverPort);
18
+ constructor(catalogs: PlanCatalogSource, resolver: PlanResolverPort);
18
19
  /**
19
20
  * Returns the effective features + quotas of a tenant from the
20
21
  * plan catalog. When the plan is missing: an empty snapshot (no feature,
@@ -24,7 +25,6 @@ declare class StaticEntitlementService {
24
25
  /** Convenience helper for tests / synchronous checks in the UI manifest. */
25
26
  hasFeature(tenantId: string, featureKey: string): Promise<boolean>;
26
27
  quotaLimit(tenantId: string, quotaKey: string): Promise<number | null>;
27
- private findPlan;
28
28
  }
29
29
 
30
30
  declare const STATIC_FEATURE_GUARD_CONFIG_TOKEN: unique symbol;