@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/catalog/index.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatPreflightReport,
|
|
3
|
+
formatSeedGateReport,
|
|
4
|
+
preflightExitCode,
|
|
5
|
+
runPreflight,
|
|
6
|
+
runSeedGateFromFile,
|
|
7
|
+
seedGateExitCode,
|
|
8
|
+
validateSeedAgainstSnapshot
|
|
9
|
+
} from "../chunk-7K5PT2LX.js";
|
|
10
|
+
import "../chunk-ABB2CRAS.js";
|
|
1
11
|
import {
|
|
2
12
|
ADVISORY_STRICT_MODE_CODES,
|
|
3
13
|
BundlesService,
|
|
@@ -42,20 +52,12 @@ import {
|
|
|
42
52
|
buildPromotionsController,
|
|
43
53
|
buildPublicMarketingCatalogController,
|
|
44
54
|
featureApprovalSignature,
|
|
45
|
-
formatPreflightReport,
|
|
46
|
-
formatSeedGateReport,
|
|
47
55
|
loadApprovedCatalogKeys,
|
|
48
|
-
preflightExitCode,
|
|
49
56
|
quotaApprovalSignature,
|
|
50
|
-
runPreflight,
|
|
51
|
-
runSeedGateFromFile,
|
|
52
|
-
seedGateExitCode,
|
|
53
57
|
validateBundleDraft,
|
|
54
|
-
validatePlanDraft
|
|
55
|
-
|
|
56
|
-
} from "../chunk-5DDCSGZC.js";
|
|
58
|
+
validatePlanDraft
|
|
59
|
+
} from "../chunk-PBQRPDO2.js";
|
|
57
60
|
import "../chunk-WPUVJRIN.js";
|
|
58
|
-
import "../chunk-ABB2CRAS.js";
|
|
59
61
|
import "../chunk-E56W4U2P.js";
|
|
60
62
|
import "../chunk-M6CZQYPY.js";
|
|
61
63
|
import "../chunk-WKVBNTYC.js";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Type, CanActivate, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
2
|
+
import { BundleRepository, MarketingProjectionRepository, CatalogEntryRepository, PromotionRepository, MarketingSettingsRepository, PlanRepository, FeatureUiRegistry } from '@saasicat/types';
|
|
3
|
+
import { P as ProviderSpec } from './di-CcNeq9v-.js';
|
|
4
|
+
|
|
5
|
+
interface CatalogControllerConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Class-level guards for `BundlesController` and `BundleVersionsController`.
|
|
8
|
+
* REQUIRED — otherwise `forRoot()` throws at boot. Pass `[]` explicitly
|
|
9
|
+
* if the endpoints should intentionally be auth-free.
|
|
10
|
+
*/
|
|
11
|
+
guards: Array<Type<CanActivate>>;
|
|
12
|
+
}
|
|
13
|
+
interface CatalogModuleOptions {
|
|
14
|
+
/** Adapter for `bundles` + `bundle_versions` persistence. */
|
|
15
|
+
bundleRepository: ProviderSpec<BundleRepository>;
|
|
16
|
+
/**
|
|
17
|
+
* Adapter for `marketing_projections` persistence. Optional — if
|
|
18
|
+
* omitted, MarketingProjectionsService + controller are not
|
|
19
|
+
* registered.
|
|
20
|
+
*/
|
|
21
|
+
marketingProjectionRepository?: ProviderSpec<MarketingProjectionRepository>;
|
|
22
|
+
/**
|
|
23
|
+
* Adapter for `capability_/feature_/quota_catalog_entries` persistence
|
|
24
|
+
* (discovery review, SPEC_V2 §6.3). Optional — if omitted,
|
|
25
|
+
* CatalogEntriesService + controller are not registered.
|
|
26
|
+
*/
|
|
27
|
+
catalogEntryRepository?: ProviderSpec<CatalogEntryRepository>;
|
|
28
|
+
/**
|
|
29
|
+
* Adapter for `promotions` persistence (SPEC_V2 §9a). Optional — if
|
|
30
|
+
* omitted, PromotionsService + controller are not registered.
|
|
31
|
+
*/
|
|
32
|
+
promotionRepository?: ProviderSpec<PromotionRepository>;
|
|
33
|
+
/**
|
|
34
|
+
* Adapter for `marketing_settings` persistence (SPEC_V2 §6.5 —
|
|
35
|
+
* `activeLocales`). Optional.
|
|
36
|
+
*/
|
|
37
|
+
marketingSettingsRepository?: ProviderSpec<MarketingSettingsRepository>;
|
|
38
|
+
/**
|
|
39
|
+
* Auth-free pricing-page endpoint `GET /public/marketing-catalog`
|
|
40
|
+
* (SPEC_V2 §9). Registered only when plan-, marketingProjection-
|
|
41
|
+
* and promotionRepository are set. `guards` is usually `[]`.
|
|
42
|
+
*/
|
|
43
|
+
publicMarketingCatalog?: {
|
|
44
|
+
guards: Array<Type<CanActivate>>;
|
|
45
|
+
projectKey: string;
|
|
46
|
+
currency: string;
|
|
47
|
+
vatRate: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* SPEC_V2 §11.1 M6 (Pack 1) — adapter for `plans` master-record persistence.
|
|
51
|
+
* Optional; if omitted, PlansService + controller are not
|
|
52
|
+
* registered (apps without a need for the plan editor stay unchanged).
|
|
53
|
+
*/
|
|
54
|
+
planRepository?: ProviderSpec<PlanRepository>;
|
|
55
|
+
/**
|
|
56
|
+
* Controller mount for `/admin/catalog/bundles` + `/admin/catalog/bundle-versions`.
|
|
57
|
+
* If omitted, the endpoints are not registered — but the services remain usable via DI.
|
|
58
|
+
*/
|
|
59
|
+
controller?: CatalogControllerConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Strict-mode mode. `blocking` (default, #12) throws HTTP 422 on
|
|
62
|
+
* violations and requires a DiscoverySnapshot; `warn-only` returns them
|
|
63
|
+
* only as a warning (transition until 100% discovery coverage).
|
|
64
|
+
*/
|
|
65
|
+
strictModeCheckMode?: 'warn-only' | 'blocking';
|
|
66
|
+
/**
|
|
67
|
+
* Discovery→catalog auto-sync at boot (#12). Default `true` — as soon as a
|
|
68
|
+
* `catalogEntryRepository` is wired and a DiscoverySnapshot is available,
|
|
69
|
+
* `CatalogEntriesService` mirrors the discovery into the DB at startup. `false`
|
|
70
|
+
* disables the boot sync; the manual sync endpoint remains usable.
|
|
71
|
+
*/
|
|
72
|
+
autoSyncDiscoveryAtBoot?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Feature keys the catalog is deliberately allowed to carry without them
|
|
75
|
+
* existing in the discovery snapshot (marketed non-code features such as
|
|
76
|
+
* support SLAs, e.g. `['PRIORITY_SUPPORT']`). The strict-mode check excludes
|
|
77
|
+
* them from BUNDLE_/PLAN_FEATURE_UNKNOWN. Use sparingly.
|
|
78
|
+
*/
|
|
79
|
+
marketedOnlyFeatures?: string[];
|
|
80
|
+
/**
|
|
81
|
+
* Optional consumer-curated FeatureUiRegistry (label/description/icon
|
|
82
|
+
* per feature — the same one passed to `PublicCatalogModule.forRoot`). The
|
|
83
|
+
* discovery auto-sync seeds EMPTY `FeatureCatalogEntry` fields
|
|
84
|
+
* (label/description/icon) from it at boot; SuperAdmin edits stay untouched. This
|
|
85
|
+
* makes `FeatureCatalogEntry` the SSOT for UI metadata (SPEC_V2 §6.3 / #12).
|
|
86
|
+
*/
|
|
87
|
+
featureUiRegistry?: FeatureUiRegistry;
|
|
88
|
+
/**
|
|
89
|
+
* Modules whose providers must be visible in the DI scope of this
|
|
90
|
+
* DynamicModule — typically: `AuthModule`/`PlatformAdminModule`, because the
|
|
91
|
+
* controller guards come from there.
|
|
92
|
+
*/
|
|
93
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
94
|
+
/** Additional providers registered in the DynamicModule itself. */
|
|
95
|
+
extraProviders?: Provider[];
|
|
96
|
+
/** Register the module globally — default `false`. */
|
|
97
|
+
global?: boolean;
|
|
98
|
+
}
|
|
99
|
+
declare class CatalogModule {
|
|
100
|
+
static forRoot(options: CatalogModuleOptions): DynamicModule;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { type CatalogControllerConfig as C, CatalogModule as a, type CatalogModuleOptions as b };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Type, CanActivate, DynamicModule, ForwardReference, Provider } from '@nestjs/common';
|
|
2
|
+
import { BundleRepository, MarketingProjectionRepository, CatalogEntryRepository, PromotionRepository, MarketingSettingsRepository, PlanRepository, FeatureUiRegistry } from '@saasicat/types';
|
|
3
|
+
import { P as ProviderSpec } from './di-CcNeq9v-.cjs';
|
|
4
|
+
|
|
5
|
+
interface CatalogControllerConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Class-level guards for `BundlesController` and `BundleVersionsController`.
|
|
8
|
+
* REQUIRED — otherwise `forRoot()` throws at boot. Pass `[]` explicitly
|
|
9
|
+
* if the endpoints should intentionally be auth-free.
|
|
10
|
+
*/
|
|
11
|
+
guards: Array<Type<CanActivate>>;
|
|
12
|
+
}
|
|
13
|
+
interface CatalogModuleOptions {
|
|
14
|
+
/** Adapter for `bundles` + `bundle_versions` persistence. */
|
|
15
|
+
bundleRepository: ProviderSpec<BundleRepository>;
|
|
16
|
+
/**
|
|
17
|
+
* Adapter for `marketing_projections` persistence. Optional — if
|
|
18
|
+
* omitted, MarketingProjectionsService + controller are not
|
|
19
|
+
* registered.
|
|
20
|
+
*/
|
|
21
|
+
marketingProjectionRepository?: ProviderSpec<MarketingProjectionRepository>;
|
|
22
|
+
/**
|
|
23
|
+
* Adapter for `capability_/feature_/quota_catalog_entries` persistence
|
|
24
|
+
* (discovery review, SPEC_V2 §6.3). Optional — if omitted,
|
|
25
|
+
* CatalogEntriesService + controller are not registered.
|
|
26
|
+
*/
|
|
27
|
+
catalogEntryRepository?: ProviderSpec<CatalogEntryRepository>;
|
|
28
|
+
/**
|
|
29
|
+
* Adapter for `promotions` persistence (SPEC_V2 §9a). Optional — if
|
|
30
|
+
* omitted, PromotionsService + controller are not registered.
|
|
31
|
+
*/
|
|
32
|
+
promotionRepository?: ProviderSpec<PromotionRepository>;
|
|
33
|
+
/**
|
|
34
|
+
* Adapter for `marketing_settings` persistence (SPEC_V2 §6.5 —
|
|
35
|
+
* `activeLocales`). Optional.
|
|
36
|
+
*/
|
|
37
|
+
marketingSettingsRepository?: ProviderSpec<MarketingSettingsRepository>;
|
|
38
|
+
/**
|
|
39
|
+
* Auth-free pricing-page endpoint `GET /public/marketing-catalog`
|
|
40
|
+
* (SPEC_V2 §9). Registered only when plan-, marketingProjection-
|
|
41
|
+
* and promotionRepository are set. `guards` is usually `[]`.
|
|
42
|
+
*/
|
|
43
|
+
publicMarketingCatalog?: {
|
|
44
|
+
guards: Array<Type<CanActivate>>;
|
|
45
|
+
projectKey: string;
|
|
46
|
+
currency: string;
|
|
47
|
+
vatRate: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* SPEC_V2 §11.1 M6 (Pack 1) — adapter for `plans` master-record persistence.
|
|
51
|
+
* Optional; if omitted, PlansService + controller are not
|
|
52
|
+
* registered (apps without a need for the plan editor stay unchanged).
|
|
53
|
+
*/
|
|
54
|
+
planRepository?: ProviderSpec<PlanRepository>;
|
|
55
|
+
/**
|
|
56
|
+
* Controller mount for `/admin/catalog/bundles` + `/admin/catalog/bundle-versions`.
|
|
57
|
+
* If omitted, the endpoints are not registered — but the services remain usable via DI.
|
|
58
|
+
*/
|
|
59
|
+
controller?: CatalogControllerConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Strict-mode mode. `blocking` (default, #12) throws HTTP 422 on
|
|
62
|
+
* violations and requires a DiscoverySnapshot; `warn-only` returns them
|
|
63
|
+
* only as a warning (transition until 100% discovery coverage).
|
|
64
|
+
*/
|
|
65
|
+
strictModeCheckMode?: 'warn-only' | 'blocking';
|
|
66
|
+
/**
|
|
67
|
+
* Discovery→catalog auto-sync at boot (#12). Default `true` — as soon as a
|
|
68
|
+
* `catalogEntryRepository` is wired and a DiscoverySnapshot is available,
|
|
69
|
+
* `CatalogEntriesService` mirrors the discovery into the DB at startup. `false`
|
|
70
|
+
* disables the boot sync; the manual sync endpoint remains usable.
|
|
71
|
+
*/
|
|
72
|
+
autoSyncDiscoveryAtBoot?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Feature keys the catalog is deliberately allowed to carry without them
|
|
75
|
+
* existing in the discovery snapshot (marketed non-code features such as
|
|
76
|
+
* support SLAs, e.g. `['PRIORITY_SUPPORT']`). The strict-mode check excludes
|
|
77
|
+
* them from BUNDLE_/PLAN_FEATURE_UNKNOWN. Use sparingly.
|
|
78
|
+
*/
|
|
79
|
+
marketedOnlyFeatures?: string[];
|
|
80
|
+
/**
|
|
81
|
+
* Optional consumer-curated FeatureUiRegistry (label/description/icon
|
|
82
|
+
* per feature — the same one passed to `PublicCatalogModule.forRoot`). The
|
|
83
|
+
* discovery auto-sync seeds EMPTY `FeatureCatalogEntry` fields
|
|
84
|
+
* (label/description/icon) from it at boot; SuperAdmin edits stay untouched. This
|
|
85
|
+
* makes `FeatureCatalogEntry` the SSOT for UI metadata (SPEC_V2 §6.3 / #12).
|
|
86
|
+
*/
|
|
87
|
+
featureUiRegistry?: FeatureUiRegistry;
|
|
88
|
+
/**
|
|
89
|
+
* Modules whose providers must be visible in the DI scope of this
|
|
90
|
+
* DynamicModule — typically: `AuthModule`/`PlatformAdminModule`, because the
|
|
91
|
+
* controller guards come from there.
|
|
92
|
+
*/
|
|
93
|
+
imports?: Array<Type<unknown> | DynamicModule | Promise<DynamicModule> | ForwardReference>;
|
|
94
|
+
/** Additional providers registered in the DynamicModule itself. */
|
|
95
|
+
extraProviders?: Provider[];
|
|
96
|
+
/** Register the module globally — default `false`. */
|
|
97
|
+
global?: boolean;
|
|
98
|
+
}
|
|
99
|
+
declare class CatalogModule {
|
|
100
|
+
static forRoot(options: CatalogModuleOptions): DynamicModule;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { type CatalogControllerConfig as C, CatalogModule as a, type CatalogModuleOptions as b };
|
|
@@ -296,6 +296,7 @@ var AdminModule = class _AdminModule {
|
|
|
296
296
|
return {
|
|
297
297
|
module: _AdminModule,
|
|
298
298
|
global: options.global ?? false,
|
|
299
|
+
imports: options.imports ?? [],
|
|
299
300
|
providers,
|
|
300
301
|
exports: [
|
|
301
302
|
MFA_PORT_TOKEN,
|
|
@@ -537,7 +538,7 @@ var PLATFORM_CORE_MANIFEST_CONTRIBUTION = {
|
|
|
537
538
|
// section is deliberately curated:
|
|
538
539
|
// Overview: dashboard
|
|
539
540
|
// Product catalog: discovery → bundles → plans →
|
|
540
|
-
//
|
|
541
|
+
// marketingCatalog → promoCodes
|
|
541
542
|
// (promoCodes is appended by the app contributions
|
|
542
543
|
// and therefore lands at the end of the section)
|
|
543
544
|
// Customers: tenants → users → pilots
|
|
@@ -565,10 +566,6 @@ var PLATFORM_CORE_MANIFEST_CONTRIBUTION = {
|
|
|
565
566
|
enabled: true,
|
|
566
567
|
requiredCapability: "plans.read"
|
|
567
568
|
},
|
|
568
|
-
planVersions: {
|
|
569
|
-
enabled: true,
|
|
570
|
-
requiredCapability: "plans.read"
|
|
571
|
-
},
|
|
572
569
|
// SPEC_V2 §11.1 M3 — marketing catalog (locale pivot).
|
|
573
570
|
// Apps that market a public catalog set
|
|
574
571
|
// `marketingProjections.read = true`.
|
|
@@ -929,6 +926,256 @@ AdminManifestModule = _ts_decorate8([
|
|
|
929
926
|
Module2({})
|
|
930
927
|
], AdminManifestModule);
|
|
931
928
|
|
|
929
|
+
// src/admin/admin-resources.module.ts
|
|
930
|
+
import { Body, Controller as Controller3, Get as Get3, Inject as Inject7, Injectable as Injectable6, Module as Module3, NotFoundException, Param, Post as Post2, Query, Req, UseGuards as UseGuards2 } from "@nestjs/common";
|
|
931
|
+
import { IsOptional, IsString, MaxLength } from "class-validator";
|
|
932
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
933
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
934
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
935
|
+
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;
|
|
936
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
937
|
+
}
|
|
938
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
939
|
+
function _ts_metadata7(k, v) {
|
|
940
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
941
|
+
}
|
|
942
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
943
|
+
function _ts_param7(paramIndex, decorator) {
|
|
944
|
+
return function(target, key) {
|
|
945
|
+
decorator(target, key, paramIndex);
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
__name(_ts_param7, "_ts_param");
|
|
949
|
+
var ADMIN_RESOURCES_PORT_TOKEN = /* @__PURE__ */ Symbol.for("saas-platform/AdminResourcesPort");
|
|
950
|
+
var SuspendTenantDto = class {
|
|
951
|
+
static {
|
|
952
|
+
__name(this, "SuspendTenantDto");
|
|
953
|
+
}
|
|
954
|
+
reason;
|
|
955
|
+
};
|
|
956
|
+
_ts_decorate9([
|
|
957
|
+
IsOptional(),
|
|
958
|
+
IsString(),
|
|
959
|
+
MaxLength(500),
|
|
960
|
+
_ts_metadata7("design:type", String)
|
|
961
|
+
], SuspendTenantDto.prototype, "reason", void 0);
|
|
962
|
+
var AdminResourcesService = class {
|
|
963
|
+
static {
|
|
964
|
+
__name(this, "AdminResourcesService");
|
|
965
|
+
}
|
|
966
|
+
resources;
|
|
967
|
+
audit;
|
|
968
|
+
constructor(resources, audit) {
|
|
969
|
+
this.resources = resources;
|
|
970
|
+
this.audit = audit;
|
|
971
|
+
}
|
|
972
|
+
listTenants(filter) {
|
|
973
|
+
return this.resources.listTenants(filter);
|
|
974
|
+
}
|
|
975
|
+
async getTenantDetail(slug) {
|
|
976
|
+
const tenant = await this.resources.getTenantDetail(slug);
|
|
977
|
+
if (!tenant) throw new NotFoundException(`Tenant ${slug} not found`);
|
|
978
|
+
return tenant;
|
|
979
|
+
}
|
|
980
|
+
listUsers(filter) {
|
|
981
|
+
return this.resources.listUsers(filter);
|
|
982
|
+
}
|
|
983
|
+
listAudit(filter) {
|
|
984
|
+
return this.resources.listAudit(filter);
|
|
985
|
+
}
|
|
986
|
+
listSubscriptions() {
|
|
987
|
+
return this.resources.listSubscriptions();
|
|
988
|
+
}
|
|
989
|
+
suspendTenant(slug, reason, actor) {
|
|
990
|
+
return this.setTenantActive(slug, false, "PAST_DUE", actor, {
|
|
991
|
+
action: "TENANT_SUSPEND",
|
|
992
|
+
reason: reason ?? ""
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
reactivateTenant(slug, actor) {
|
|
996
|
+
return this.setTenantActive(slug, true, "ACTIVE", actor, {
|
|
997
|
+
action: "TENANT_REACTIVATE",
|
|
998
|
+
reason: ""
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
async setTenantActive(slug, active, subscriptionStatus, actor, audit) {
|
|
1002
|
+
const result = await this.resources.setTenantActive(slug, active, subscriptionStatus);
|
|
1003
|
+
if (!result) throw new NotFoundException(`Tenant ${slug} not found`);
|
|
1004
|
+
await this.audit.log({
|
|
1005
|
+
actor,
|
|
1006
|
+
entity: "Tenant",
|
|
1007
|
+
entityId: result.id,
|
|
1008
|
+
action: audit.action,
|
|
1009
|
+
changes: {
|
|
1010
|
+
slug,
|
|
1011
|
+
reason: audit.reason
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
return result;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
AdminResourcesService = _ts_decorate9([
|
|
1018
|
+
Injectable6(),
|
|
1019
|
+
_ts_param7(0, Inject7(ADMIN_RESOURCES_PORT_TOKEN)),
|
|
1020
|
+
_ts_param7(1, Inject7(AdminAuditService)),
|
|
1021
|
+
_ts_metadata7("design:type", Function),
|
|
1022
|
+
_ts_metadata7("design:paramtypes", [
|
|
1023
|
+
typeof AdminResourcesPort === "undefined" ? Object : AdminResourcesPort,
|
|
1024
|
+
typeof AdminAuditService === "undefined" ? Object : AdminAuditService
|
|
1025
|
+
])
|
|
1026
|
+
], AdminResourcesService);
|
|
1027
|
+
function actorFromRequest(request) {
|
|
1028
|
+
const userId = request.user?.id ?? request.user?.userId ?? "unknown";
|
|
1029
|
+
return {
|
|
1030
|
+
userId,
|
|
1031
|
+
email: request.user?.email ?? `${userId}@unknown`,
|
|
1032
|
+
source: "web",
|
|
1033
|
+
context: request.user?.sessionId ?? "unknown"
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
__name(actorFromRequest, "actorFromRequest");
|
|
1037
|
+
function buildAdminResourcesController(guards) {
|
|
1038
|
+
let GeneratedAdminResourcesController = class GeneratedAdminResourcesController {
|
|
1039
|
+
static {
|
|
1040
|
+
__name(this, "GeneratedAdminResourcesController");
|
|
1041
|
+
}
|
|
1042
|
+
resources;
|
|
1043
|
+
constructor(resources) {
|
|
1044
|
+
this.resources = resources;
|
|
1045
|
+
}
|
|
1046
|
+
listTenants(query) {
|
|
1047
|
+
return this.resources.listTenants(query);
|
|
1048
|
+
}
|
|
1049
|
+
getTenant(slug) {
|
|
1050
|
+
return this.resources.getTenantDetail(slug);
|
|
1051
|
+
}
|
|
1052
|
+
suspendTenant(request, slug, dto) {
|
|
1053
|
+
return this.resources.suspendTenant(slug, dto.reason, actorFromRequest(request));
|
|
1054
|
+
}
|
|
1055
|
+
reactivateTenant(request, slug) {
|
|
1056
|
+
return this.resources.reactivateTenant(slug, actorFromRequest(request));
|
|
1057
|
+
}
|
|
1058
|
+
listUsers(query) {
|
|
1059
|
+
return this.resources.listUsers(query);
|
|
1060
|
+
}
|
|
1061
|
+
listAudit(query) {
|
|
1062
|
+
return this.resources.listAudit({
|
|
1063
|
+
actor: query.actor,
|
|
1064
|
+
action: query.action,
|
|
1065
|
+
entity: query.entity,
|
|
1066
|
+
since: query.since,
|
|
1067
|
+
limit: query.limit ? Number.parseInt(query.limit, 10) : void 0
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
listSubscriptions() {
|
|
1071
|
+
return this.resources.listSubscriptions();
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
_ts_decorate9([
|
|
1075
|
+
Get3("tenants"),
|
|
1076
|
+
_ts_param7(0, Query()),
|
|
1077
|
+
_ts_metadata7("design:type", Function),
|
|
1078
|
+
_ts_metadata7("design:paramtypes", [
|
|
1079
|
+
Object
|
|
1080
|
+
]),
|
|
1081
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1082
|
+
], GeneratedAdminResourcesController.prototype, "listTenants", null);
|
|
1083
|
+
_ts_decorate9([
|
|
1084
|
+
Get3("tenants/:slug"),
|
|
1085
|
+
_ts_param7(0, Param("slug")),
|
|
1086
|
+
_ts_metadata7("design:type", Function),
|
|
1087
|
+
_ts_metadata7("design:paramtypes", [
|
|
1088
|
+
String
|
|
1089
|
+
]),
|
|
1090
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1091
|
+
], GeneratedAdminResourcesController.prototype, "getTenant", null);
|
|
1092
|
+
_ts_decorate9([
|
|
1093
|
+
Post2("tenants/:slug/suspend"),
|
|
1094
|
+
_ts_param7(0, Req()),
|
|
1095
|
+
_ts_param7(1, Param("slug")),
|
|
1096
|
+
_ts_param7(2, Body()),
|
|
1097
|
+
_ts_metadata7("design:type", Function),
|
|
1098
|
+
_ts_metadata7("design:paramtypes", [
|
|
1099
|
+
typeof AdminRequest === "undefined" ? Object : AdminRequest,
|
|
1100
|
+
String,
|
|
1101
|
+
typeof SuspendTenantDto === "undefined" ? Object : SuspendTenantDto
|
|
1102
|
+
]),
|
|
1103
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1104
|
+
], GeneratedAdminResourcesController.prototype, "suspendTenant", null);
|
|
1105
|
+
_ts_decorate9([
|
|
1106
|
+
Post2("tenants/:slug/reactivate"),
|
|
1107
|
+
_ts_param7(0, Req()),
|
|
1108
|
+
_ts_param7(1, Param("slug")),
|
|
1109
|
+
_ts_metadata7("design:type", Function),
|
|
1110
|
+
_ts_metadata7("design:paramtypes", [
|
|
1111
|
+
typeof AdminRequest === "undefined" ? Object : AdminRequest,
|
|
1112
|
+
String
|
|
1113
|
+
]),
|
|
1114
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1115
|
+
], GeneratedAdminResourcesController.prototype, "reactivateTenant", null);
|
|
1116
|
+
_ts_decorate9([
|
|
1117
|
+
Get3("users"),
|
|
1118
|
+
_ts_param7(0, Query()),
|
|
1119
|
+
_ts_metadata7("design:type", Function),
|
|
1120
|
+
_ts_metadata7("design:paramtypes", [
|
|
1121
|
+
Object
|
|
1122
|
+
]),
|
|
1123
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1124
|
+
], GeneratedAdminResourcesController.prototype, "listUsers", null);
|
|
1125
|
+
_ts_decorate9([
|
|
1126
|
+
Get3("audit"),
|
|
1127
|
+
_ts_param7(0, Query()),
|
|
1128
|
+
_ts_metadata7("design:type", Function),
|
|
1129
|
+
_ts_metadata7("design:paramtypes", [
|
|
1130
|
+
Object
|
|
1131
|
+
]),
|
|
1132
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1133
|
+
], GeneratedAdminResourcesController.prototype, "listAudit", null);
|
|
1134
|
+
_ts_decorate9([
|
|
1135
|
+
Get3("subscriptions"),
|
|
1136
|
+
_ts_metadata7("design:type", Function),
|
|
1137
|
+
_ts_metadata7("design:paramtypes", []),
|
|
1138
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1139
|
+
], GeneratedAdminResourcesController.prototype, "listSubscriptions", null);
|
|
1140
|
+
GeneratedAdminResourcesController = _ts_decorate9([
|
|
1141
|
+
Controller3("admin"),
|
|
1142
|
+
UseGuards2(...guards),
|
|
1143
|
+
_ts_param7(0, Inject7(AdminResourcesService)),
|
|
1144
|
+
_ts_metadata7("design:type", Function),
|
|
1145
|
+
_ts_metadata7("design:paramtypes", [
|
|
1146
|
+
typeof AdminResourcesService === "undefined" ? Object : AdminResourcesService
|
|
1147
|
+
])
|
|
1148
|
+
], GeneratedAdminResourcesController);
|
|
1149
|
+
return GeneratedAdminResourcesController;
|
|
1150
|
+
}
|
|
1151
|
+
__name(buildAdminResourcesController, "buildAdminResourcesController");
|
|
1152
|
+
var AdminResourcesModule = class _AdminResourcesModule {
|
|
1153
|
+
static {
|
|
1154
|
+
__name(this, "AdminResourcesModule");
|
|
1155
|
+
}
|
|
1156
|
+
static forRoot(options) {
|
|
1157
|
+
return {
|
|
1158
|
+
module: _AdminResourcesModule,
|
|
1159
|
+
global: options.global ?? false,
|
|
1160
|
+
imports: options.imports ?? [],
|
|
1161
|
+
controllers: [
|
|
1162
|
+
buildAdminResourcesController(options.guards)
|
|
1163
|
+
],
|
|
1164
|
+
providers: [
|
|
1165
|
+
asProvider(ADMIN_RESOURCES_PORT_TOKEN, options.resources),
|
|
1166
|
+
AdminResourcesService
|
|
1167
|
+
],
|
|
1168
|
+
exports: [
|
|
1169
|
+
ADMIN_RESOURCES_PORT_TOKEN,
|
|
1170
|
+
AdminResourcesService
|
|
1171
|
+
]
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
AdminResourcesModule = _ts_decorate9([
|
|
1176
|
+
Module3({})
|
|
1177
|
+
], AdminResourcesModule);
|
|
1178
|
+
|
|
932
1179
|
export {
|
|
933
1180
|
SuperAdminGuard,
|
|
934
1181
|
MfaService,
|
|
@@ -942,5 +1189,9 @@ export {
|
|
|
942
1189
|
AdminManifestService,
|
|
943
1190
|
AdminPublicBootController,
|
|
944
1191
|
PLATFORM_CORE_MANIFEST_CONTRIBUTION,
|
|
945
|
-
AdminManifestModule
|
|
1192
|
+
AdminManifestModule,
|
|
1193
|
+
ADMIN_RESOURCES_PORT_TOKEN,
|
|
1194
|
+
SuspendTenantDto,
|
|
1195
|
+
AdminResourcesService,
|
|
1196
|
+
AdminResourcesModule
|
|
946
1197
|
};
|