@saasicat/nest 0.7.0 → 0.9.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.
- package/dist/admin/index.cjs +262 -7
- package/dist/admin/index.d.cts +6 -4
- package/dist/admin/index.d.ts +6 -4
- package/dist/admin/index.js +12 -4
- package/dist/{admin-manifest.service-Cp6uwvmt.d.cts → admin-manifest.service-BMeSLRW4.d.ts} +1 -1
- package/dist/{admin-manifest.service-UGgzR1x-.d.ts → admin-manifest.service-StAQe6QO.d.cts} +1 -1
- package/dist/admin-resources.module-BybEjZs-.d.cts +40 -0
- package/dist/admin-resources.module-CUCLlUAi.d.ts +40 -0
- package/dist/billing/index.cjs +3 -1
- package/dist/billing/index.d.cts +5 -287
- package/dist/billing/index.d.ts +5 -287
- package/dist/billing/index.js +5 -8
- package/dist/catalog/index.d.cts +4 -101
- package/dist/catalog/index.d.ts +4 -101
- package/dist/catalog/index.js +12 -10
- package/dist/catalog.module-BKObceo0.d.ts +103 -0
- package/dist/catalog.module-Dw2Hrbyu.d.cts +103 -0
- package/dist/{chunk-U6HT27J7.js → chunk-3M6VLT5N.js} +257 -6
- package/dist/chunk-7K5PT2LX.js +211 -0
- package/dist/{chunk-RZU4HIAN.js → chunk-GW2I3JZD.js} +25 -22
- package/dist/{chunk-6LP7CDS2.js → chunk-HXAWPPFW.js} +10 -5
- package/dist/chunk-OFBDEO45.js +755 -0
- package/dist/{chunk-5DDCSGZC.js → chunk-PBQRPDO2.js} +142 -354
- package/dist/{chunk-SD3TT2BR.js → chunk-WGVTXSYW.js} +1 -1
- package/dist/{chunk-A2QBXDJC.js → chunk-ZZMAHX22.js} +343 -16
- package/dist/{enforce-quota.interceptor-Dj1Kusr5.d.ts → enforce-quota.interceptor-B3CL5MSw.d.ts} +94 -12
- package/dist/{enforce-quota.interceptor-cv7r80VM.d.cts → enforce-quota.interceptor-SqrQVF91.d.cts} +94 -12
- package/dist/entitlement/index.cjs +1 -0
- package/dist/entitlement/index.d.cts +3 -1
- package/dist/entitlement/index.d.ts +3 -1
- package/dist/entitlement/index.js +1 -2
- package/dist/index.cjs +3503 -2811
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +75 -61
- package/dist/module-B5m080F0.d.ts +39 -0
- package/dist/module-DeH_Jkcq.d.cts +39 -0
- package/dist/platform/index.cjs +11113 -971
- package/dist/platform/index.d.cts +41 -7
- package/dist/platform/index.d.ts +41 -7
- package/dist/platform/index.js +26 -6
- package/dist/promo/index.cjs +530 -5
- package/dist/promo/index.d.cts +47 -30
- package/dist/promo/index.d.ts +47 -30
- package/dist/promo/index.js +9 -1
- package/dist/{service-DX8KbGXl.d.cts → service-DlhMnYjW.d.cts} +1 -1
- package/dist/{service-DX8KbGXl.d.ts → service-DlhMnYjW.d.ts} +1 -1
- package/dist/subscription-bundles.module-BQmoozm5.d.ts +291 -0
- package/dist/subscription-bundles.module-DCpV-Pb5.d.cts +291 -0
- package/dist/testing/index.cjs +11101 -973
- package/dist/testing/index.d.cts +9 -4
- package/dist/testing/index.d.ts +9 -4
- package/dist/testing/index.js +10 -4
- package/package.json +4 -4
- package/dist/admin-manifest.config-DyrQNT7M.d.cts +0 -10
- package/dist/admin-manifest.config-DyrQNT7M.d.ts +0 -10
- package/dist/chunk-52UTQRD3.js +0 -326
- package/dist/chunk-Q53N43LQ.js +0 -13
- /package/dist/{chunk-2FR6ZL7R.js → chunk-HWGIMNWR.js} +0 -0
package/dist/{enforce-quota.interceptor-cv7r80VM.d.cts → enforce-quota.interceptor-SqrQVF91.d.cts}
RENAMED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { Type, CanActivate, DynamicModule, ForwardReference, FactoryProvider, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
|
|
2
|
-
import { MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner,
|
|
1
|
+
import { Type, CanActivate, DynamicModule, ForwardReference, FactoryProvider, Provider, ExecutionContext, NestInterceptor, CallHandler } from '@nestjs/common';
|
|
2
|
+
import { PlanCatalog, SaasicatPersistenceAdapter, MfaPort, AuditPort, RlsBypassPort, PlanCatalogReadSink, SubscriptionRepository, PlanVersionRepository, TransactionRunner, QuotaProvider, FeatureUiRegistry, SubscriptionUsagePort, UsageSnapshotPort, TenantSubscriptionWritePort, AdminResourcesPort, FirstTimeCustomerCheck } from '@saasicat/types';
|
|
3
3
|
import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
|
|
4
|
-
import { A as AdminManifestConfig } from './admin-
|
|
5
|
-
import { b as DiscoveryAppInfo } from './discovery.scanner-DLgEvuoy.cjs';
|
|
4
|
+
import { A as AdminManifestConfig, d as AdminResourcesModuleOptions } from './admin-resources.module-BybEjZs-.cjs';
|
|
6
5
|
import { E as EntitlementResolutionConfig } from './plan-resolution-CFCoUkrE.cjs';
|
|
6
|
+
import { a as PromoCodesModuleOptions } from './module-DeH_Jkcq.cjs';
|
|
7
|
+
import { b as DiscoveryAppInfo } from './discovery.scanner-DLgEvuoy.cjs';
|
|
8
|
+
import { b as CatalogModuleOptions } from './catalog.module-Dw2Hrbyu.cjs';
|
|
9
|
+
import { t as TenantBillingModuleOptions, p as SubscriptionBundleModuleOptions, n as SubscriptionBundleControllerOptions } from './subscription-bundles.module-DCpV-Pb5.cjs';
|
|
7
10
|
import { Reflector } from '@nestjs/core';
|
|
8
11
|
import { Observable } from 'rxjs';
|
|
9
12
|
|
|
@@ -67,8 +70,8 @@ interface SaasPlatformAdapters {
|
|
|
67
70
|
* Optional — resolver `tenantId → planId`. The quickstart path uses this
|
|
68
71
|
* together with the `StaticEntitlementService` to automatically check
|
|
69
72
|
* `@RequireFeature` and `@EnforceQuota` against the plan catalog limit.
|
|
70
|
-
* If not set, `
|
|
71
|
-
*
|
|
73
|
+
* If not set, `tenantBilling` derives the resolver from the subscription
|
|
74
|
+
* repository. Lightweight setups can instead set `defaultPlanId`.
|
|
72
75
|
*/
|
|
73
76
|
planResolver?: ProviderSpec<PlanResolverPort>;
|
|
74
77
|
/**
|
|
@@ -79,6 +82,50 @@ interface SaasPlatformAdapters {
|
|
|
79
82
|
planVersionRepository?: ProviderSpec<PlanVersionRepository>;
|
|
80
83
|
transactionRunner?: ProviderSpec<TransactionRunner>;
|
|
81
84
|
}
|
|
85
|
+
type PlatformImports = Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
86
|
+
interface SaasPlatformCatalogOptions extends Pick<CatalogModuleOptions, 'strictModeCheckMode' | 'autoSyncDiscoveryAtBoot' | 'marketedOnlyFeatures' | 'publicMarketingCatalog' | 'extraProviders'> {
|
|
87
|
+
/** Labels/icons used by discovery review and the public catalog. */
|
|
88
|
+
featureUiRegistry: FeatureUiRegistry;
|
|
89
|
+
/** Mount the SuperAdmin catalog controllers. Default `true`. */
|
|
90
|
+
adminControllers?: boolean;
|
|
91
|
+
/** Mount `/billing/plans|bundles|feature-registry`. Default `true`. */
|
|
92
|
+
publicCatalog?: boolean;
|
|
93
|
+
/** Override the top-level module imports for catalog adapter factories. */
|
|
94
|
+
imports?: PlatformImports;
|
|
95
|
+
}
|
|
96
|
+
type SaasPlatformTenantAuthGuards = Array<Type<CanActivate>> | ProviderSpec<ReadonlyArray<CanActivate>>;
|
|
97
|
+
interface SaasPlatformTenantBillingOptions extends Omit<TenantBillingModuleOptions, 'authGuards' | 'subscriptionUsagePort' | 'usageSnapshotPort' | 'subscriptionWritePort' | 'global'> {
|
|
98
|
+
/**
|
|
99
|
+
* Tenant guards as classes (the common path) or as a custom provider
|
|
100
|
+
* factory. Guard classes are resolved from `imports`.
|
|
101
|
+
*/
|
|
102
|
+
authGuards: SaasPlatformTenantAuthGuards;
|
|
103
|
+
/** Optional overrides; otherwise the persistence bundle supplies them. */
|
|
104
|
+
subscriptionUsagePort?: ProviderSpec<SubscriptionUsagePort>;
|
|
105
|
+
usageSnapshotPort?: ProviderSpec<UsageSnapshotPort>;
|
|
106
|
+
subscriptionWritePort?: ProviderSpec<TenantSubscriptionWritePort>;
|
|
107
|
+
}
|
|
108
|
+
interface SaasPlatformSubscriptionBundlesOptions extends Omit<SubscriptionBundleModuleOptions, 'subscriptionBundleRepository' | 'bundleRepository' | 'controller' | 'imports' | 'extraProviders' | 'global'> {
|
|
109
|
+
/** Default mounts the tenant controller and reuses tenant-billing auth. */
|
|
110
|
+
controller?: false | Omit<SubscriptionBundleControllerOptions, 'authGuards' | 'subscriptionUsagePort'>;
|
|
111
|
+
imports?: PlatformImports;
|
|
112
|
+
extraProviders?: Provider[];
|
|
113
|
+
}
|
|
114
|
+
interface SaasPlatformAdminResourcesOptions extends Omit<AdminResourcesModuleOptions, 'resources' | 'guards' | 'global'> {
|
|
115
|
+
/** Override the default controller guards + `SuperAdminGuard` chain. */
|
|
116
|
+
guards?: Array<Type<CanActivate>>;
|
|
117
|
+
/** Custom schema override; the persistence bundle supplies the default. */
|
|
118
|
+
resources?: ProviderSpec<AdminResourcesPort>;
|
|
119
|
+
}
|
|
120
|
+
interface SaasPlatformPromoCodesOptions extends Omit<PromoCodesModuleOptions, 'promoCodeRepository' | 'redemptionRepository' | 'validationLogRepository' | 'subscriptionLookup' | 'revenueAggregator' | 'transactionRunner' | 'firstTimeCustomerCheck' | 'adminController' | 'global'> {
|
|
121
|
+
/**
|
|
122
|
+
* Required when the public preview/redeem flow is enabled. Admin-only
|
|
123
|
+
* setups do not need an app-specific customer-history check.
|
|
124
|
+
*/
|
|
125
|
+
firstTimeCustomerCheck?: ProviderSpec<FirstTimeCustomerCheck>;
|
|
126
|
+
/** Override the default controller guards + `SuperAdminGuard` chain. */
|
|
127
|
+
adminGuards?: Array<Type<CanActivate>>;
|
|
128
|
+
}
|
|
82
129
|
interface SaasPlatformModuleOptions {
|
|
83
130
|
/**
|
|
84
131
|
* Plan catalog. Either as an already-loaded object (quickstart, comes
|
|
@@ -135,7 +182,7 @@ interface SaasPlatformModuleOptions {
|
|
|
135
182
|
* Modules whose providers must be visible in the DI scope (typically:
|
|
136
183
|
* `AuthModule` with the `JwtAuthGuard`).
|
|
137
184
|
*/
|
|
138
|
-
imports?:
|
|
185
|
+
imports?: PlatformImports;
|
|
139
186
|
/**
|
|
140
187
|
* App identity for the DiscoveryScanner. If omitted, `planCatalog.app` is
|
|
141
188
|
* used (recommendation: simply declare it in the YAML).
|
|
@@ -154,10 +201,17 @@ interface SaasPlatformModuleOptions {
|
|
|
154
201
|
*/
|
|
155
202
|
adminManifestConfig?: AdminManifestConfig | Pick<FactoryProvider<AdminManifestConfig>, 'useFactory' | 'inject'>;
|
|
156
203
|
/**
|
|
157
|
-
*
|
|
204
|
+
* Infer manifest capabilities for platform endpoints mounted by this
|
|
205
|
+
* module. Default `true`; set `false` only when the app owns the complete
|
|
206
|
+
* manifest capability policy.
|
|
207
|
+
*/
|
|
208
|
+
autoManifest?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Default `false`. When set, `EntitlementModule.forRoot({...})` is called
|
|
158
211
|
* with the repositories from `adapters` — only meaningful if the app
|
|
159
212
|
* implements the V3 contract path (`subscriptionRepository` & co. must then
|
|
160
|
-
* be set).
|
|
213
|
+
* be set). `tenantBilling` and `subscriptionBundles` enable it
|
|
214
|
+
* automatically.
|
|
161
215
|
*/
|
|
162
216
|
entitlement?: false | {
|
|
163
217
|
resolutionConfig?: EntitlementResolutionConfig;
|
|
@@ -177,12 +231,40 @@ interface SaasPlatformModuleOptions {
|
|
|
177
231
|
* `QUOTA_PROVIDERS_TOKEN`.
|
|
178
232
|
*/
|
|
179
233
|
quotaProviders?: Array<Type<QuotaProvider>>;
|
|
234
|
+
/**
|
|
235
|
+
* Standard DB-backed catalog stack. Repositories are taken from
|
|
236
|
+
* `persistence.catalog`; no consumer forwarding module is needed.
|
|
237
|
+
*/
|
|
238
|
+
catalog?: false | SaasPlatformCatalogOptions;
|
|
239
|
+
/**
|
|
240
|
+
* Standard tenant self-service stack. Subscription read/write adapters
|
|
241
|
+
* come from `persistence.tenantBilling`; usage is derived from
|
|
242
|
+
* `quotaProviders` unless explicitly overridden.
|
|
243
|
+
*/
|
|
244
|
+
tenantBilling?: false | SaasPlatformTenantBillingOptions;
|
|
245
|
+
/**
|
|
246
|
+
* Add-on bundle service and tenant controller. `true` uses defaults and
|
|
247
|
+
* reuses tenant-billing auth/usage; an object customizes policy.
|
|
248
|
+
*/
|
|
249
|
+
subscriptionBundles?: false | true | SaasPlatformSubscriptionBundlesOptions;
|
|
250
|
+
/**
|
|
251
|
+
* Standard SuperAdmin Tenant/User/Audit/Subscription endpoints. `true`
|
|
252
|
+
* uses `persistence.adminResources` and the standard guard chain.
|
|
253
|
+
*/
|
|
254
|
+
adminResources?: false | true | SaasPlatformAdminResourcesOptions;
|
|
255
|
+
/**
|
|
256
|
+
* Promo-code domain and SuperAdmin CRUD. `true` enables the admin API
|
|
257
|
+
* without the public preview endpoint; pass an object to enable preview.
|
|
258
|
+
*/
|
|
259
|
+
promoCodes?: false | true | SaasPlatformPromoCodesOptions;
|
|
180
260
|
/**
|
|
181
261
|
* Enable the tenant manifest — the app UI gets a filtered manifest per
|
|
182
262
|
* tenant with features, quotas and visible navigation. Requires that
|
|
183
|
-
* `defaultPlanId
|
|
263
|
+
* `defaultPlanId`, `adapters.planResolver` or `tenantBilling` is set.
|
|
264
|
+
* `true` reuses tenant-billing guard classes when available, otherwise
|
|
265
|
+
* `controller.guards`.
|
|
184
266
|
*/
|
|
185
|
-
tenantManifest?: TenantManifestControllerOptions;
|
|
267
|
+
tenantManifest?: true | TenantManifestControllerOptions;
|
|
186
268
|
}
|
|
187
269
|
/**
|
|
188
270
|
* Bundles PlanCatalog + Discovery + Admin + AdminManifest (+ optionally
|
|
@@ -260,4 +342,4 @@ declare class EnforceQuotaInterceptor implements NestInterceptor {
|
|
|
260
342
|
private check;
|
|
261
343
|
}
|
|
262
344
|
|
|
263
|
-
export { EnforceQuotaInterceptor as E, PLAN_RESOLVER_PORT_TOKEN as P, QUOTA_PROVIDERS_TOKEN as Q,
|
|
345
|
+
export { EnforceQuotaInterceptor as E, PLAN_RESOLVER_PORT_TOKEN as P, QUOTA_PROVIDERS_TOKEN as Q, type SaasPlatformAdapters as S, type TenantManifestControllerOptions as T, StaticEntitlementService as a, StaticFeatureGuard as b, StaticPlanResolver as c, type SaasPlatformModuleOptions as d, type PlanResolverPort as e, STATIC_FEATURE_GUARD_CONFIG_TOKEN as f, SaasPlatformModule as g, type SaasPlatformAdminResourcesOptions as h, type SaasPlatformCatalogOptions as i, type SaasPlatformPromoCodesOptions as j, type SaasPlatformSubscriptionBundlesOptions as k, type SaasPlatformTenantAuthGuards as l, type SaasPlatformTenantBillingOptions as m, type StaticEntitlementSnapshot as n, type StaticFeatureGuardConfig as o, buildTenantManifestController as p };
|
|
@@ -2,7 +2,7 @@ export { C as CustomLimitsShape, E as EffectiveLimits, a as EffectiveLimitsSnaps
|
|
|
2
2
|
import { DiscoveredFeature, SubscriptionRepository, PlanVersionRepository, TransactionRunner, SubscriptionContractRepository, SubscriptionBundleRepository, BundleRepository } from '@saasicat/types';
|
|
3
3
|
import { E as EntitlementResolutionConfig } from '../plan-resolution-CFCoUkrE.cjs';
|
|
4
4
|
export { a as EntitlementResolutionInput, r as resolveEntitlementPlan } from '../plan-resolution-CFCoUkrE.cjs';
|
|
5
|
-
import { DynamicModule } from '@nestjs/common';
|
|
5
|
+
import { Type, DynamicModule, ForwardReference } from '@nestjs/common';
|
|
6
6
|
import { P as ProviderSpec } from '../di-CcNeq9v-.cjs';
|
|
7
7
|
|
|
8
8
|
/** Old feature key → direct successor keys (from their `replaces`). */
|
|
@@ -61,6 +61,8 @@ interface EntitlementModuleOptions {
|
|
|
61
61
|
subscriptionBundleRepository?: ProviderSpec<SubscriptionBundleRepository>;
|
|
62
62
|
/** See `subscriptionBundleRepository` — resolves BundleVersion features/quotas. */
|
|
63
63
|
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
64
|
+
/** Modules required by repository factory `inject` tokens. */
|
|
65
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
64
66
|
/** Register the module globally — default `false`. */
|
|
65
67
|
global?: boolean;
|
|
66
68
|
}
|
|
@@ -2,7 +2,7 @@ export { C as CustomLimitsShape, E as EffectiveLimits, a as EffectiveLimitsSnaps
|
|
|
2
2
|
import { DiscoveredFeature, SubscriptionRepository, PlanVersionRepository, TransactionRunner, SubscriptionContractRepository, SubscriptionBundleRepository, BundleRepository } from '@saasicat/types';
|
|
3
3
|
import { E as EntitlementResolutionConfig } from '../plan-resolution-CFCoUkrE.js';
|
|
4
4
|
export { a as EntitlementResolutionInput, r as resolveEntitlementPlan } from '../plan-resolution-CFCoUkrE.js';
|
|
5
|
-
import { DynamicModule } from '@nestjs/common';
|
|
5
|
+
import { Type, DynamicModule, ForwardReference } from '@nestjs/common';
|
|
6
6
|
import { P as ProviderSpec } from '../di-CcNeq9v-.js';
|
|
7
7
|
|
|
8
8
|
/** Old feature key → direct successor keys (from their `replaces`). */
|
|
@@ -61,6 +61,8 @@ interface EntitlementModuleOptions {
|
|
|
61
61
|
subscriptionBundleRepository?: ProviderSpec<SubscriptionBundleRepository>;
|
|
62
62
|
/** See `subscriptionBundleRepository` — resolves BundleVersion features/quotas. */
|
|
63
63
|
bundleRepository?: ProviderSpec<BundleRepository>;
|
|
64
|
+
/** Modules required by repository factory `inject` tokens. */
|
|
65
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
64
66
|
/** Register the module globally — default `false`. */
|
|
65
67
|
global?: boolean;
|
|
66
68
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../chunk-2FR6ZL7R.js";
|
|
2
1
|
import {
|
|
3
2
|
EntitlementModule,
|
|
4
3
|
EntitlementService,
|
|
@@ -17,7 +16,7 @@ import {
|
|
|
17
16
|
isLimitExceededError,
|
|
18
17
|
resolveEntitlementPlan,
|
|
19
18
|
toEffectiveLimitsSnapshot
|
|
20
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-GW2I3JZD.js";
|
|
21
20
|
import "../chunk-R2QOSVAA.js";
|
|
22
21
|
import "../chunk-NYLON2VC.js";
|
|
23
22
|
import {
|