@saasicat/nest 0.26.0 → 0.27.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 (43) hide show
  1. package/LICENSE +90 -201
  2. package/dist/_entries.cjs +3265 -2846
  3. package/dist/billing/index.d.cts +4 -4
  4. package/dist/billing/index.d.ts +4 -4
  5. package/dist/billing/index.js +33 -31
  6. package/dist/catalog/index.js +5 -5
  7. package/dist/checkout-offer/index.js +2 -2
  8. package/dist/chunk-2FR6ZL7R.js +0 -0
  9. package/dist/chunk-2JTISFUZ.js +792 -0
  10. package/dist/chunk-2SLTRKXC.js +0 -0
  11. package/dist/chunk-3E6ONOMG.js +50 -0
  12. package/dist/{chunk-UOWK2HYG.js → chunk-7ZPFQXHM.js} +1 -1
  13. package/dist/{chunk-B7NRY2LV.js → chunk-CJFAOD7K.js} +1 -39
  14. package/dist/{chunk-J62YI25C.js → chunk-EHKMPP6J.js} +1194 -775
  15. package/dist/{chunk-RPO4IVUY.js → chunk-F4B2NJUZ.js} +26 -91
  16. package/dist/chunk-H4DOTO7S.js +85 -0
  17. package/dist/{chunk-V3MRZ7SH.js → chunk-UHD6FJBQ.js} +421 -1197
  18. package/dist/{define-saasicat-BK6RRWWG.d.ts → define-saasicat-3ois8t8s.d.ts} +26 -3
  19. package/dist/{define-saasicat-D30I-WET.d.cts → define-saasicat-CFxut1VR.d.cts} +26 -3
  20. package/dist/{enforce-quota.interceptor-B9QueAFf.d.ts → enforce-quota.interceptor-CYDNvAQz.d.ts} +3 -3
  21. package/dist/{enforce-quota.interceptor-DY6CLjoP.d.cts → enforce-quota.interceptor-N80KC34N.d.cts} +3 -3
  22. package/dist/entitlement/index.js +7 -4
  23. package/dist/index.d.cts +5 -5
  24. package/dist/index.d.ts +5 -5
  25. package/dist/index.js +87 -79
  26. package/dist/{saas-platform.module-D1mUZPrz.d.ts → module-options-ByJL7FZm.d.ts} +40 -27
  27. package/dist/{saas-platform.module-CgalxzcT.d.cts → module-options-klrPnWGF.d.cts} +40 -27
  28. package/dist/platform/index.d.cts +201 -19
  29. package/dist/platform/index.d.ts +201 -19
  30. package/dist/platform/index.js +58 -33
  31. package/dist/promo/index.js +2 -2
  32. package/dist/subscription-contract/index.js +5 -2
  33. package/dist/{tenant-billing.controller-DHSUrT_N.d.cts → tenant-billing.controller-CAMMdfn1.d.cts} +1 -1
  34. package/dist/{tenant-billing.controller-BSlpFqVA.d.ts → tenant-billing.controller-CYYK0CpT.d.ts} +1 -1
  35. package/dist/{subscription-bundles.module-BDbODWvA.d.ts → tenant-billing.module-B0stLoJn.d.ts} +51 -51
  36. package/dist/{subscription-bundles.module-Cfi-lFWF.d.cts → tenant-billing.module-BxJS6fX4.d.cts} +51 -51
  37. package/dist/testing/index.d.cts +8 -8
  38. package/dist/testing/index.d.ts +8 -8
  39. package/dist/testing/index.js +13 -11
  40. package/package.json +4 -4
  41. package/dist/{chunk-QB7MICKQ.js → chunk-7X5MSAIL.js} +9 -9
  42. package/dist/{chunk-FY4EJTV4.js → chunk-OYNHOY45.js} +0 -0
  43. package/dist/{chunk-I4XD43AN.js → chunk-XTVAFJ3P.js} +3 -3
@@ -1,6 +1,6 @@
1
1
  import { CanActivate, Type, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
2
+ import { NewContractLineItemData, BillingCycle, SubscriptionUsagePort, SubscriptionBundleRepository, BundleRepository, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionContractRepository } from '@saasicat/types';
2
3
  import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
3
- import { NewContractLineItemData, BillingCycle, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, SubscriptionContractRepository, SubscriptionBundleRepository, BundleRepository } from '@saasicat/types';
4
4
 
5
5
  declare const FEATURE_GUARD_MARKER: unique symbol;
6
6
  /** A guard class or instance carrying the platform's marker. */
@@ -157,6 +157,56 @@ interface ContractFreezeSourcePort {
157
157
  loadBookedBundles(tenantId: string, cycle: 'monthly' | 'yearly', vatRate: number): Promise<ContractFreezeBundleSnapshot>;
158
158
  }
159
159
 
160
+ interface SubscriptionBundleControllerOptions {
161
+ extraGuards?: Array<Type<CanActivate>>;
162
+ /**
163
+ * Auth guard list analogous to `TenantBillingModule.forRoot.authGuards`.
164
+ * Without this list, `ComposedTenantAuthGuard` blocks fail-closed.
165
+ */
166
+ authGuards?: ProviderSpec<ReadonlyArray<CanActivate>>;
167
+ /**
168
+ * Usage port for subscription lookup and current plan compatibility.
169
+ * If not set, an imported module must export the token.
170
+ */
171
+ subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
172
+ /** Optional tenant-ID resolver. Default: `req.user.tenantId`. */
173
+ tenantIdResolver?: TenantIdResolver;
174
+ }
175
+ interface SubscriptionBundleModuleOptions {
176
+ subscriptionBundleRepository: ProviderSpec<SubscriptionBundleRepository>;
177
+ /**
178
+ * Optional — if omitted, `BUNDLE_REPOSITORY_TOKEN` is expected via
179
+ * default inject from the DI scope (typically via an imported
180
+ * `CatalogModule`).
181
+ */
182
+ bundleRepository?: ProviderSpec<BundleRepository>;
183
+ /** Default minimum term (months). Default = 12. */
184
+ defaultMinimumTermMonths?: number;
185
+ /**
186
+ * Self-service policy (#37): bundles that are only bookable via sales.
187
+ * Applies in `addBundleToSubscription` (422 BUNDLE_NOT_SELF_SERVICE)
188
+ * and in the preview (blocker).
189
+ */
190
+ selfServiceBlockedBundles?: SelfServiceBlockedBundles;
191
+ /**
192
+ * If set: the tenant self-service controller is mounted at
193
+ * `/billing/subscription-bundles` (GET/POST/DELETE). The
194
+ * `extraGuards` are applied in addition to the platform default
195
+ * `ComposedTenantAuthGuard` (role/MFA guards).
196
+ *
197
+ * Prerequisite: the consumer has already registered `TenantBillingModule`
198
+ * — the controller needs `SUBSCRIPTION_USAGE_PORT_TOKEN`
199
+ * + `TENANT_ID_RESOLVER_TOKEN` in the same DI scope.
200
+ */
201
+ controller?: SubscriptionBundleControllerOptions;
202
+ imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
203
+ extraProviders?: Provider[];
204
+ global?: boolean;
205
+ }
206
+ declare class SubscriptionBundleModule {
207
+ static forRoot(options: SubscriptionBundleModuleOptions): DynamicModule;
208
+ }
209
+
160
210
  interface TenantBillingModuleOptions {
161
211
  /**
162
212
  * App guards in the order in which they should be executed
@@ -246,54 +296,4 @@ declare class TenantBillingModule {
246
296
  static forRoot(options: TenantBillingModuleOptions): DynamicModule;
247
297
  }
248
298
 
249
- interface SubscriptionBundleControllerOptions {
250
- extraGuards?: Array<Type<CanActivate>>;
251
- /**
252
- * Auth guard list analogous to `TenantBillingModule.forRoot.authGuards`.
253
- * Without this list, `ComposedTenantAuthGuard` blocks fail-closed.
254
- */
255
- authGuards?: ProviderSpec<ReadonlyArray<CanActivate>>;
256
- /**
257
- * Usage port for subscription lookup and current plan compatibility.
258
- * If not set, an imported module must export the token.
259
- */
260
- subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
261
- /** Optional tenant-ID resolver. Default: `req.user.tenantId`. */
262
- tenantIdResolver?: TenantIdResolver;
263
- }
264
- interface SubscriptionBundleModuleOptions {
265
- subscriptionBundleRepository: ProviderSpec<SubscriptionBundleRepository>;
266
- /**
267
- * Optional — if omitted, `BUNDLE_REPOSITORY_TOKEN` is expected via
268
- * default inject from the DI scope (typically via an imported
269
- * `CatalogModule`).
270
- */
271
- bundleRepository?: ProviderSpec<BundleRepository>;
272
- /** Default minimum term (months). Default = 12. */
273
- defaultMinimumTermMonths?: number;
274
- /**
275
- * Self-service policy (#37): bundles that are only bookable via sales.
276
- * Applies in `addBundleToSubscription` (422 BUNDLE_NOT_SELF_SERVICE)
277
- * and in the preview (blocker).
278
- */
279
- selfServiceBlockedBundles?: SelfServiceBlockedBundles;
280
- /**
281
- * If set: the tenant self-service controller is mounted at
282
- * `/billing/subscription-bundles` (GET/POST/DELETE). The
283
- * `extraGuards` are applied in addition to the platform default
284
- * `ComposedTenantAuthGuard` (role/MFA guards).
285
- *
286
- * Prerequisite: the consumer has already registered `TenantBillingModule`
287
- * — the controller needs `SUBSCRIPTION_USAGE_PORT_TOKEN`
288
- * + `TENANT_ID_RESOLVER_TOKEN` in the same DI scope.
289
- */
290
- controller?: SubscriptionBundleControllerOptions;
291
- imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
292
- extraProviders?: Provider[];
293
- global?: boolean;
294
- }
295
- declare class SubscriptionBundleModule {
296
- static forRoot(options: SubscriptionBundleModuleOptions): DynamicModule;
297
- }
298
-
299
299
  export { AUDIT_CONTEXT_RESOLVER_TOKEN as A, type UserIdResolver as B, CONTRACT_FREEZE_PORT_TOKEN as C, type DuePendingPlanChange as D, isPlatformFeatureGuard as E, FEATURE_GUARD_MARKER as F, type MarkedFeatureGuard as M, PENDING_PLAN_QUERY_PORT_TOKEN as P, SELF_SERVICE_BLOCKED_BUNDLES_TOKEN as S, TENANT_AUTH_GUARDS_TOKEN as T, USAGE_SNAPSHOT_PORT_TOKEN as U, type AuditContextResolver as a, type AuthGuardList as b, CONTRACT_FREEZE_PROJECT_KEY_TOKEN as c, CONTRACT_FREEZE_SOURCE_PORT_TOKEN as d, type ContractFreezeBundleSnapshot as e, type ContractFreezePort as f, type ContractFreezeSourcePort as g, type PendingPlanQueryPort as h, SELF_SERVICE_BLOCKED_PLANS_TOKEN as i, SUBSCRIPTION_USAGE_PORT_TOKEN as j, SUBSCRIPTION_WRITE_PORT_TOKEN as k, type SelfServiceBlockedBundles as l, type SelfServiceBlockedPlans as m, type SubscriptionBundleControllerOptions as n, SubscriptionBundleModule as o, type SubscriptionBundleModuleOptions as p, TENANT_ID_RESOLVER_TOKEN as q, TRIAL_PROJECTION_PORT_TOKEN as r, TenantBillingModule as s, type TenantBillingModuleOptions as t, type TenantIdResolver as u, type TrialProjectionInput as v, type TrialProjectionPort as w, USER_EMAIL_RESOLVER_TOKEN as x, USER_ID_RESOLVER_TOKEN as y, type UserEmailResolver as z };
@@ -1,20 +1,20 @@
1
1
  import { BundleRepository, BundleRow, BundleVersionRow, BundleListFilter, CreateBundleData, UpdateBundleData, CreateBundleVersionDraftData, UpdateBundleVersionDraftData, VersionChange, MarketingProjectionRepository, MarketingProjectionRow, MarketingProjectionFilter, CreateMarketingProjectionData, UpdateMarketingProjectionData, PlanRepository, PlanRow, PlanVersionRow, PlanListFilter, CreatePlanData, UpdatePlanData, CreatePlanVersionDraftData, UpdatePlanVersionDraftData, PlanVersionRepository, PlanVersionRecord, TransactionContext, SubscriptionBundleRepository, SubscriptionBundleRecord, CreateSubscriptionBundleData, CancelSubscriptionBundleData, SubscriptionContractRepository, SubscriptionContractFilter, SubscriptionContractRecord, CreateSubscriptionContractData, TerminateSubscriptionContractData, SubscriptionRepository, SubscriptionRecord, TransactionRunner, PlanCatalog, QuotaProvider } from '@saasicat/types';
2
2
  import { Type, DynamicModule } from '@nestjs/common';
3
- import { a as SaasPlatformAdapters } from '../saas-platform.module-CgalxzcT.cjs';
4
- export { P as PLAN_RESOLVER_PORT_TOKEN, o as StaticPlanResolver } from '../saas-platform.module-CgalxzcT.cjs';
5
- export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-DY6CLjoP.cjs';
3
+ import { S as SaasPlatformAdapters } from '../module-options-klrPnWGF.cjs';
4
+ export { P as PLAN_RESOLVER_PORT_TOKEN, n as StaticPlanResolver } from '../module-options-klrPnWGF.cjs';
5
+ export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-N80KC34N.cjs';
6
6
  import '../di-CcNeq9v-.cjs';
7
7
  import '../admin-resources.module-DGgGSdzN.cjs';
8
8
  import '../admin-audit.service-9IqXMlZm.cjs';
9
+ import '../tenant-billing.module-BxJS6fX4.cjs';
10
+ import '../catalog.module-D-_pQDNA.cjs';
11
+ import '../discovery.scanner-DLgEvuoy.cjs';
12
+ import '@nestjs/core';
9
13
  import '../plan-resolution-CFCoUkrE.cjs';
10
- import '../subscription-contract.module-B2uNvUJL.cjs';
11
14
  import '../module-CHMIyWlf.cjs';
12
15
  import '../service-D48clObR.cjs';
13
- import '../discovery.scanner-DLgEvuoy.cjs';
14
- import '@nestjs/core';
15
- import '../catalog.module-D-_pQDNA.cjs';
16
16
  import '../checkout-offer.module-DmlpPevf.cjs';
17
- import '../subscription-bundles.module-Cfi-lFWF.cjs';
17
+ import '../subscription-contract.module-B2uNvUJL.cjs';
18
18
  import 'rxjs';
19
19
 
20
20
  /**
@@ -1,20 +1,20 @@
1
1
  import { BundleRepository, BundleRow, BundleVersionRow, BundleListFilter, CreateBundleData, UpdateBundleData, CreateBundleVersionDraftData, UpdateBundleVersionDraftData, VersionChange, MarketingProjectionRepository, MarketingProjectionRow, MarketingProjectionFilter, CreateMarketingProjectionData, UpdateMarketingProjectionData, PlanRepository, PlanRow, PlanVersionRow, PlanListFilter, CreatePlanData, UpdatePlanData, CreatePlanVersionDraftData, UpdatePlanVersionDraftData, PlanVersionRepository, PlanVersionRecord, TransactionContext, SubscriptionBundleRepository, SubscriptionBundleRecord, CreateSubscriptionBundleData, CancelSubscriptionBundleData, SubscriptionContractRepository, SubscriptionContractFilter, SubscriptionContractRecord, CreateSubscriptionContractData, TerminateSubscriptionContractData, SubscriptionRepository, SubscriptionRecord, TransactionRunner, PlanCatalog, QuotaProvider } from '@saasicat/types';
2
2
  import { Type, DynamicModule } from '@nestjs/common';
3
- import { a as SaasPlatformAdapters } from '../saas-platform.module-D1mUZPrz.js';
4
- export { P as PLAN_RESOLVER_PORT_TOKEN, o as StaticPlanResolver } from '../saas-platform.module-D1mUZPrz.js';
5
- export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-B9QueAFf.js';
3
+ import { S as SaasPlatformAdapters } from '../module-options-ByJL7FZm.js';
4
+ export { P as PLAN_RESOLVER_PORT_TOKEN, n as StaticPlanResolver } from '../module-options-ByJL7FZm.js';
5
+ export { E as EnforceQuotaInterceptor, S as StaticEntitlementService, a as StaticFeatureGuard } from '../enforce-quota.interceptor-CYDNvAQz.js';
6
6
  import '../di-CcNeq9v-.js';
7
7
  import '../admin-resources.module-BY5r_1MG.js';
8
8
  import '../admin-audit.service-9IqXMlZm.js';
9
+ import '../tenant-billing.module-B0stLoJn.js';
10
+ import '../catalog.module-CQr1FpkI.js';
11
+ import '../discovery.scanner-DLgEvuoy.js';
12
+ import '@nestjs/core';
9
13
  import '../plan-resolution-CFCoUkrE.js';
10
- import '../subscription-contract.module-edyhBr4n.js';
11
14
  import '../module-BE17XFLg.js';
12
15
  import '../service-D48clObR.js';
13
- import '../discovery.scanner-DLgEvuoy.js';
14
- import '@nestjs/core';
15
- import '../catalog.module-CQr1FpkI.js';
16
16
  import '../checkout-offer.module-Ca3_TieR.js';
17
- import '../subscription-bundles.module-BDbODWvA.js';
17
+ import '../subscription-contract.module-edyhBr4n.js';
18
18
  import 'rxjs';
19
19
 
20
20
  /**
@@ -5,28 +5,30 @@ import {
5
5
  StaticEntitlementService,
6
6
  StaticFeatureGuard,
7
7
  StaticPlanResolver
8
- } from "../chunk-J62YI25C.js";
8
+ } from "../chunk-EHKMPP6J.js";
9
9
  import "../chunk-B6IWLV7R.js";
10
- import "../chunk-V3MRZ7SH.js";
10
+ import "../chunk-3E6ONOMG.js";
11
+ import "../chunk-SN5UOC43.js";
12
+ import "../chunk-UHD6FJBQ.js";
11
13
  import "../chunk-37HEKVDH.js";
12
- import "../chunk-B7NRY2LV.js";
13
- import "../chunk-QB7MICKQ.js";
14
+ import "../chunk-CJFAOD7K.js";
15
+ import "../chunk-7X5MSAIL.js";
14
16
  import "../chunk-WPUVJRIN.js";
15
- import "../chunk-I4XD43AN.js";
17
+ import "../chunk-E56W4U2P.js";
18
+ import "../chunk-XTVAFJ3P.js";
16
19
  import "../chunk-BSK6YBLI.js";
20
+ import "../chunk-YSC46BGM.js";
17
21
  import "../chunk-6WL6VQ7Z.js";
18
22
  import "../chunk-5ZXBXYXU.js";
19
- import "../chunk-RPO4IVUY.js";
23
+ import "../chunk-H4DOTO7S.js";
24
+ import "../chunk-F4B2NJUZ.js";
20
25
  import "../chunk-DQKCK7DX.js";
21
26
  import "../chunk-NYLON2VC.js";
27
+ import "../chunk-EBJJNTW6.js";
22
28
  import "../chunk-WKVBNTYC.js";
23
29
  import "../chunk-L4KTQ6CL.js";
24
- import "../chunk-L4SUWH5B.js";
25
- import "../chunk-SN5UOC43.js";
26
- import "../chunk-E56W4U2P.js";
27
- import "../chunk-YSC46BGM.js";
28
- import "../chunk-EBJJNTW6.js";
29
30
  import "../chunk-SABTXESR.js";
31
+ import "../chunk-L4SUWH5B.js";
30
32
  import {
31
33
  __name
32
34
  } from "../chunk-SHUYVCID.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasicat/nest",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "NestJS implementation of SaaSiCat: capability discovery, catalog packaging, contracts, entitlement enforcement, billing and admin APIs.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -137,8 +137,8 @@
137
137
  "js-yaml": "^4.3.1",
138
138
  "otplib": "^13.4.1",
139
139
  "qrcode": "^1.5.4",
140
- "@saasicat/spec": "^0.26.0",
141
- "@saasicat/types": "^0.26.0"
140
+ "@saasicat/spec": "^0.27.0",
141
+ "@saasicat/types": "^0.27.0"
142
142
  },
143
143
  "peerDependencies": {
144
144
  "@nestjs/common": "^11.0.0",
@@ -165,7 +165,7 @@
165
165
  "typescript": "^6.0.0",
166
166
  "unplugin-swc": "^1.5.9"
167
167
  },
168
- "license": "Apache-2.0",
168
+ "license": "PolyForm-Shield-1.0.0",
169
169
  "author": "Taci Uelker",
170
170
  "homepage": "https://github.com/uelker70/saasicat",
171
171
  "repository": {
@@ -5,6 +5,12 @@ import {
5
5
  classifyBundleVersionDiff,
6
6
  classifyPlanDiff
7
7
  } from "./chunk-WPUVJRIN.js";
8
+ import {
9
+ AdminAuditService
10
+ } from "./chunk-E56W4U2P.js";
11
+ import {
12
+ SaaSiCatPublicRoute
13
+ } from "./chunk-YSC46BGM.js";
8
14
  import {
9
15
  DiscoveryScanner
10
16
  } from "./chunk-5ZXBXYXU.js";
@@ -21,18 +27,12 @@ import {
21
27
  PLAN_REPOSITORY_TOKEN,
22
28
  PROMOTION_REPOSITORY_TOKEN
23
29
  } from "./chunk-L4KTQ6CL.js";
24
- import {
25
- DISCOVERY_SNAPSHOT_TOKEN
26
- } from "./chunk-L4SUWH5B.js";
27
- import {
28
- AdminAuditService
29
- } from "./chunk-E56W4U2P.js";
30
- import {
31
- SaaSiCatPublicRoute
32
- } from "./chunk-YSC46BGM.js";
33
30
  import {
34
31
  asProvider
35
32
  } from "./chunk-SABTXESR.js";
33
+ import {
34
+ DISCOVERY_SNAPSHOT_TOKEN
35
+ } from "./chunk-L4SUWH5B.js";
36
36
  import {
37
37
  __name
38
38
  } from "./chunk-SHUYVCID.js";
File without changes
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  appendImplicitDiscountLineItem
3
3
  } from "./chunk-BSK6YBLI.js";
4
+ import {
5
+ SaaSiCatPublicRoute
6
+ } from "./chunk-YSC46BGM.js";
4
7
  import {
5
8
  BUNDLE_REPOSITORY_TOKEN,
6
9
  CATALOG_ENTRY_REPOSITORY_TOKEN,
7
10
  PLAN_REPOSITORY_TOKEN
8
11
  } from "./chunk-L4KTQ6CL.js";
9
- import {
10
- SaaSiCatPublicRoute
11
- } from "./chunk-YSC46BGM.js";
12
12
  import {
13
13
  asProvider
14
14
  } from "./chunk-SABTXESR.js";