@saasicat/nest 1.0.0-rc.21 → 1.0.0-rc.23
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/.build-stamp +1 -1
- package/dist/_entries.cjs +15561 -12478
- package/dist/admin/index.d.cts +4 -4
- package/dist/admin/index.d.ts +4 -4
- package/dist/admin/index.js +8 -5
- package/dist/{admin-resources.module-CWqdI9BV.d.ts → admin-resources.module-DtWAFI-G.d.ts} +1 -1
- package/dist/{admin-resources.module-B4XNvdH-.d.cts → admin-resources.module-pS7LbdbI.d.cts} +1 -1
- package/dist/{admin-stats.service-CsLNt19Z.d.ts → admin-stats.service--1sRNpUx.d.ts} +2 -2
- package/dist/{admin-stats.service-DrZrU8IJ.d.cts → admin-stats.service-ChATI9YK.d.cts} +2 -2
- package/dist/{aggregation-ChpZDh0g.d.ts → aggregation-B8iZBesJ.d.ts} +63 -4
- package/dist/{aggregation-OpnhwzF5.d.cts → aggregation-BRzgRXDb.d.cts} +63 -4
- package/dist/billing/index.d.cts +280 -13
- package/dist/billing/index.d.ts +280 -13
- package/dist/billing/index.js +32 -8
- package/dist/catalog/index.d.cts +2 -2
- package/dist/catalog/index.d.ts +2 -2
- package/dist/catalog/index.js +4 -2
- package/dist/{catalog.module-T-I5Ricz.d.cts → catalog.module-CeKslGHW.d.cts} +1 -1
- package/dist/{catalog.module-C9O7BxRq.d.ts → catalog.module-CiurcIjI.d.ts} +1 -1
- package/dist/checkout-offer/index.d.cts +4 -4
- package/dist/checkout-offer/index.d.ts +4 -4
- package/dist/checkout-offer/index.js +5 -5
- package/dist/{checkout-offer.module-x7SP_dX4.d.ts → checkout-offer.module-C761mcEv.d.ts} +1 -1
- package/dist/{checkout-offer.module-DFhGy6JO.d.cts → checkout-offer.module-CSHB4bB8.d.cts} +1 -1
- package/dist/{checkout-offer.service-BeHgYikI.d.ts → checkout-offer.service-Dux8EgEM.d.ts} +3 -3
- package/dist/{checkout-offer.service-CCVxG9b2.d.cts → checkout-offer.service-HKoTZ3JH.d.cts} +3 -3
- package/dist/{chunk-F5X66HF5.js → chunk-2ECX7BST.js} +1 -1
- package/dist/{chunk-G6EZWECL.js → chunk-2XBWYMOL.js} +141 -26
- package/dist/{chunk-R5YCJBHY.js → chunk-3HBP2HK3.js} +6 -2
- package/dist/{chunk-S33SO5XX.js → chunk-4OFJLVVH.js} +4 -0
- package/dist/{chunk-AOS2JPDD.js → chunk-5LL2554P.js} +757 -163
- package/dist/chunk-5MZH3VVU.js +292 -0
- package/dist/{chunk-WHJSYKNC.js → chunk-7LHUENAT.js} +2 -2
- package/dist/{chunk-M47BNEY2.js → chunk-7MLB6T5B.js} +2072 -407
- package/dist/{chunk-NDLC5GYK.js → chunk-CVCKXKGT.js} +138 -21
- package/dist/{chunk-VBRYPU7V.js → chunk-E224LKO2.js} +3 -1
- package/dist/{chunk-QPVDCKYS.js → chunk-ESEWSAOV.js} +4 -3
- package/dist/{chunk-CQ2ZZMTD.js → chunk-MU4O4EKX.js} +711 -828
- package/dist/{chunk-JBCC6C3M.js → chunk-NQIPQI2Q.js} +26 -7
- package/dist/{chunk-4SDSYV4A.js → chunk-PBL7N5J3.js} +18 -2
- package/dist/{chunk-LLYVYRGJ.js → chunk-QTJEZDKC.js} +15 -275
- package/dist/{chunk-3RLWML2S.js → chunk-QWKBOLBH.js} +35 -0
- package/dist/{chunk-XSSWYPP5.js → chunk-TR3L6FRF.js} +6 -2
- package/dist/chunk-TSLGMPGZ.js +21 -0
- package/dist/chunk-UJZCESIC.js +466 -0
- package/dist/{chunk-TOEFN7DN.js → chunk-W6VNCMOQ.js} +3 -3
- package/dist/{chunk-7NJKVC5X.js → chunk-WQNOCOI2.js} +53 -6
- package/dist/chunk-YZSILFW4.js +142 -0
- package/dist/{chunk-55QEDAMX.js → chunk-ZCXW24NH.js} +4 -9
- package/dist/discovery/index.js +2 -1
- package/dist/{enforce-quota.interceptor-BFyVdWe8.d.cts → enforce-quota.interceptor-Dc-1_zQf.d.cts} +2 -2
- package/dist/{enforce-quota.interceptor-GaBXboGx.d.ts → enforce-quota.interceptor-MXpwsOJ2.d.ts} +2 -2
- package/dist/entitlement/index.d.cts +1 -1
- package/dist/entitlement/index.d.ts +1 -1
- package/dist/entitlement/index.js +5 -3
- package/dist/index.d.cts +62 -25
- package/dist/index.d.ts +62 -25
- package/dist/index.js +81 -26
- package/dist/{issuer-identity.check-CBO0vcsq.d.cts → issuer-identity.check-BrZXesOF.d.cts} +3 -3
- package/dist/{issuer-identity.check-Cz9CEMkZ.d.ts → issuer-identity.check-BzlFSmSZ.d.ts} +3 -3
- package/dist/maintenance.service-CNMI3tSm.d.cts +133 -0
- package/dist/maintenance.service-yx6fxjUj.d.ts +133 -0
- package/dist/{module-options-DmQ3G4sZ.d.ts → module-options-BSYxlA38.d.ts} +50 -9
- package/dist/{module-options-qAOwinHR.d.cts → module-options-BkufuqlM.d.cts} +50 -9
- package/dist/payments/index.d.cts +2 -2
- package/dist/payments/index.d.ts +2 -2
- package/dist/payments/index.js +2 -2
- package/dist/{payments.module-BdUq9ot_.d.cts → payments.module-CwLeaflk.d.cts} +1 -1
- package/dist/{payments.module-CQGv_VG7.d.ts → payments.module-DmIN-HWx.d.ts} +1 -1
- package/dist/{plan-versions.service-DARLh-qI.d.cts → plan-versions.service-2mD0iEvY.d.cts} +1 -1
- package/dist/{plan-versions.service-C0N-Em2W.d.ts → plan-versions.service-C4a9aCEU.d.ts} +1 -1
- package/dist/platform/index.d.cts +34 -25
- package/dist/platform/index.d.ts +34 -25
- package/dist/platform/index.js +22 -17
- package/dist/promo/index.d.cts +15 -5
- package/dist/promo/index.d.ts +15 -5
- package/dist/promo/index.js +9 -3
- package/dist/{promo.module-CKkECmU8.d.cts → promo.module-Ddx-swUV.d.cts} +1 -1
- package/dist/{promo.module-DuIJdK3U.d.ts → promo.module-PsIvDcUp.d.ts} +1 -1
- package/dist/{promo.service-BYBu6dy3.d.cts → promo.service-BextPvx5.d.cts} +23 -1
- package/dist/{promo.service-CFjfF0Xm.d.ts → promo.service-Dqqh0JXn.d.ts} +23 -1
- package/dist/registration/index.d.cts +7 -4
- package/dist/registration/index.d.ts +7 -4
- package/dist/registration/index.js +11 -6
- package/dist/subscription-contract/index.d.cts +13 -3
- package/dist/subscription-contract/index.d.ts +13 -3
- package/dist/subscription-contract/index.js +5 -3
- package/dist/{subscription-contract.module-BfIRpc1o.d.ts → subscription-contract.module-B5wrmzkz.d.ts} +8 -1
- package/dist/{subscription-contract.module-DTMuUJYd.d.cts → subscription-contract.module-qaswPXwT.d.cts} +8 -1
- package/dist/{subscription-contract.service-CfNApLuP.d.cts → subscription-contract.service-CH2TKw-j.d.cts} +45 -3
- package/dist/{subscription-contract.service-CPZrTM9C.d.ts → subscription-contract.service-Dm2xEFZi.d.ts} +45 -3
- package/dist/{tenant-billing.controller-BLqbsONe.d.ts → tenant-billing.controller-BMH9YODT.d.ts} +92 -11
- package/dist/{tenant-billing.controller-DKbAqTbM.d.cts → tenant-billing.controller-BX3VExL3.d.cts} +92 -11
- package/dist/{tenant-billing.module-ClbjzocC.d.cts → tenant-billing.module-Do3QyKbr.d.cts} +33 -3
- package/dist/{tenant-billing.module-DohgJJ2m.d.ts → tenant-billing.module-W5_Y4ogN.d.ts} +33 -3
- package/dist/{tenant-billing.tokens-G-1xOlMr.d.cts → tenant-billing.tokens-D0vr1lfj.d.cts} +1 -1
- package/dist/{tenant-billing.tokens-G-1xOlMr.d.ts → tenant-billing.tokens-D0vr1lfj.d.ts} +1 -1
- package/dist/testing/index.d.cts +14 -13
- package/dist/testing/index.d.ts +14 -13
- package/dist/testing/index.js +54 -35
- package/package.json +5 -3
|
@@ -1,64 +1,79 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromoCodesModule
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PBL7N5J3.js";
|
|
4
|
+
import {
|
|
5
|
+
MAINTENANCE_NOTIFICATION_PORT_TOKEN,
|
|
6
|
+
MAINTENANCE_WINDOW_PORT_TOKEN,
|
|
7
|
+
MaintenanceService
|
|
8
|
+
} from "./chunk-UJZCESIC.js";
|
|
4
9
|
import {
|
|
5
10
|
SubscriptionContractModule
|
|
6
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TR3L6FRF.js";
|
|
7
12
|
import {
|
|
8
13
|
AdminManifestModule,
|
|
9
14
|
AdminManifestService,
|
|
10
15
|
AdminModule,
|
|
11
|
-
AdminResourcesModule,
|
|
12
16
|
AdminStatsModule,
|
|
13
17
|
SuperAdminGuard
|
|
14
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QTJEZDKC.js";
|
|
15
19
|
import {
|
|
16
20
|
FEATURE_GUARD_MARKER,
|
|
17
21
|
PublicCatalogModule,
|
|
18
22
|
REQUIRE_FEATURE_KEY,
|
|
23
|
+
SubscriberAccountModule,
|
|
19
24
|
SubscriptionBundleModule,
|
|
20
25
|
TenantBillingModule,
|
|
21
26
|
catalogSource,
|
|
22
27
|
isPlatformFeatureGuard,
|
|
23
28
|
loadPlanCatalogFromFile
|
|
24
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-7MLB6T5B.js";
|
|
30
|
+
import {
|
|
31
|
+
AdminResourcesModule
|
|
32
|
+
} from "./chunk-5MZH3VVU.js";
|
|
33
|
+
import {
|
|
34
|
+
CatalogModule
|
|
35
|
+
} from "./chunk-MU4O4EKX.js";
|
|
25
36
|
import {
|
|
26
|
-
CatalogModule,
|
|
27
37
|
WebAuditLogger,
|
|
28
38
|
actorTagOf,
|
|
29
39
|
defaultActorFromRequest
|
|
30
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-YZSILFW4.js";
|
|
31
41
|
import {
|
|
42
|
+
EnforceMfa,
|
|
32
43
|
MfaService
|
|
33
44
|
} from "./chunk-34XVPR6P.js";
|
|
34
45
|
import {
|
|
35
46
|
CheckoutOfferModule
|
|
36
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-W6VNCMOQ.js";
|
|
37
48
|
import {
|
|
38
49
|
DiscoveryModule
|
|
39
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-4OFJLVVH.js";
|
|
51
|
+
import {
|
|
52
|
+
AllowDuringMaintenance,
|
|
53
|
+
isAllowedDuringMaintenance
|
|
54
|
+
} from "./chunk-TSLGMPGZ.js";
|
|
40
55
|
import {
|
|
41
56
|
EntitlementModule
|
|
42
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-7LHUENAT.js";
|
|
43
58
|
import {
|
|
44
59
|
LimitExceededError,
|
|
45
60
|
cancellationHasLanded
|
|
46
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-2XBWYMOL.js";
|
|
47
62
|
import {
|
|
48
63
|
findPlan
|
|
49
64
|
} from "./chunk-TBBZWZQT.js";
|
|
50
65
|
import {
|
|
51
66
|
SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
|
|
52
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-E224LKO2.js";
|
|
53
68
|
import {
|
|
54
69
|
ENFORCE_QUOTA_KEY
|
|
55
70
|
} from "./chunk-QUZU2M33.js";
|
|
56
71
|
import {
|
|
57
72
|
PaymentsModule
|
|
58
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-ESEWSAOV.js";
|
|
59
74
|
import {
|
|
60
75
|
PaymentGatewayRegistry
|
|
61
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-WQNOCOI2.js";
|
|
62
77
|
import {
|
|
63
78
|
RLS_BYPASS_PORT_TOKEN
|
|
64
79
|
} from "./chunk-SZ7RFPXA.js";
|
|
@@ -325,6 +340,7 @@ _ts_decorate2([
|
|
|
325
340
|
], SetupController.prototype, "confirm", null);
|
|
326
341
|
SetupController = _ts_decorate2([
|
|
327
342
|
Controller("admin/setup"),
|
|
343
|
+
AllowDuringMaintenance(),
|
|
328
344
|
SaaSiCatPublicRoute(),
|
|
329
345
|
_ts_metadata2("design:type", Function),
|
|
330
346
|
_ts_metadata2("design:paramtypes", [
|
|
@@ -810,6 +826,7 @@ function buildSettingsController(guards) {
|
|
|
810
826
|
], GeneratedSettingsController.prototype, "acknowledge", null);
|
|
811
827
|
GeneratedSettingsController = _ts_decorate6([
|
|
812
828
|
Controller2("admin"),
|
|
829
|
+
AllowDuringMaintenance(),
|
|
813
830
|
UseGuards(...guards),
|
|
814
831
|
_ts_param5(0, Inject4(PLAN_CATALOG_SETTINGS_TOKEN)),
|
|
815
832
|
_ts_param5(1, Inject4(SETTINGS_SOURCE_TOKEN)),
|
|
@@ -898,9 +915,12 @@ SettingsModule = _ts_decorate7([
|
|
|
898
915
|
Module2({})
|
|
899
916
|
], SettingsModule);
|
|
900
917
|
|
|
901
|
-
// src/
|
|
902
|
-
import { Inject as Inject5,
|
|
903
|
-
import {
|
|
918
|
+
// src/maintenance/maintenance-admin.controller.ts
|
|
919
|
+
import { BadRequestException as BadRequestException2, Body as Body2, Controller as Controller3, Get as Get3, Inject as Inject5, Param as Param2, Patch, Post as Post3, Req as Req2, UseGuards as UseGuards2 } from "@nestjs/common";
|
|
920
|
+
import { MAINTENANCE_ERROR_CODES, MAINTENANCE_STATE_MAX_AGE_SECONDS, maintenanceWindowViewOf, parseZonedInstant } from "@saasicat/core";
|
|
921
|
+
|
|
922
|
+
// src/maintenance/dto/maintenance.dto.ts
|
|
923
|
+
import { IsOptional as IsOptional2, IsString as IsString2 } from "class-validator";
|
|
904
924
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
905
925
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
906
926
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -912,12 +932,498 @@ function _ts_metadata6(k, v) {
|
|
|
912
932
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
913
933
|
}
|
|
914
934
|
__name(_ts_metadata6, "_ts_metadata");
|
|
935
|
+
var AnnounceMaintenanceDto = class {
|
|
936
|
+
static {
|
|
937
|
+
__name(this, "AnnounceMaintenanceDto");
|
|
938
|
+
}
|
|
939
|
+
startsAt;
|
|
940
|
+
endsAt;
|
|
941
|
+
message;
|
|
942
|
+
};
|
|
943
|
+
_ts_decorate8([
|
|
944
|
+
IsString2(),
|
|
945
|
+
_ts_metadata6("design:type", String)
|
|
946
|
+
], AnnounceMaintenanceDto.prototype, "startsAt", void 0);
|
|
947
|
+
_ts_decorate8([
|
|
948
|
+
IsString2(),
|
|
949
|
+
_ts_metadata6("design:type", String)
|
|
950
|
+
], AnnounceMaintenanceDto.prototype, "endsAt", void 0);
|
|
951
|
+
_ts_decorate8([
|
|
952
|
+
IsOptional2(),
|
|
953
|
+
IsString2(),
|
|
954
|
+
_ts_metadata6("design:type", Object)
|
|
955
|
+
], AnnounceMaintenanceDto.prototype, "message", void 0);
|
|
956
|
+
var RescheduleMaintenanceDto = class {
|
|
957
|
+
static {
|
|
958
|
+
__name(this, "RescheduleMaintenanceDto");
|
|
959
|
+
}
|
|
960
|
+
startsAt;
|
|
961
|
+
endsAt;
|
|
962
|
+
/** `null` takes the message away; left out, it stays. */
|
|
963
|
+
message;
|
|
964
|
+
};
|
|
965
|
+
_ts_decorate8([
|
|
966
|
+
IsOptional2(),
|
|
967
|
+
IsString2(),
|
|
968
|
+
_ts_metadata6("design:type", String)
|
|
969
|
+
], RescheduleMaintenanceDto.prototype, "startsAt", void 0);
|
|
970
|
+
_ts_decorate8([
|
|
971
|
+
IsOptional2(),
|
|
972
|
+
IsString2(),
|
|
973
|
+
_ts_metadata6("design:type", String)
|
|
974
|
+
], RescheduleMaintenanceDto.prototype, "endsAt", void 0);
|
|
975
|
+
_ts_decorate8([
|
|
976
|
+
IsOptional2(),
|
|
977
|
+
IsString2(),
|
|
978
|
+
_ts_metadata6("design:type", Object)
|
|
979
|
+
], RescheduleMaintenanceDto.prototype, "message", void 0);
|
|
980
|
+
var LockMaintenanceDto = class {
|
|
981
|
+
static {
|
|
982
|
+
__name(this, "LockMaintenanceDto");
|
|
983
|
+
}
|
|
984
|
+
/** The window the operator is looking at; left out, the open one or a new one. */
|
|
985
|
+
windowId;
|
|
986
|
+
endsAt;
|
|
987
|
+
message;
|
|
988
|
+
};
|
|
989
|
+
_ts_decorate8([
|
|
990
|
+
IsOptional2(),
|
|
991
|
+
IsString2(),
|
|
992
|
+
_ts_metadata6("design:type", String)
|
|
993
|
+
], LockMaintenanceDto.prototype, "windowId", void 0);
|
|
994
|
+
_ts_decorate8([
|
|
995
|
+
IsOptional2(),
|
|
996
|
+
IsString2(),
|
|
997
|
+
_ts_metadata6("design:type", String)
|
|
998
|
+
], LockMaintenanceDto.prototype, "endsAt", void 0);
|
|
999
|
+
_ts_decorate8([
|
|
1000
|
+
IsOptional2(),
|
|
1001
|
+
IsString2(),
|
|
1002
|
+
_ts_metadata6("design:type", Object)
|
|
1003
|
+
], LockMaintenanceDto.prototype, "message", void 0);
|
|
1004
|
+
var UnlockMaintenanceDto = class {
|
|
1005
|
+
static {
|
|
1006
|
+
__name(this, "UnlockMaintenanceDto");
|
|
1007
|
+
}
|
|
1008
|
+
windowId;
|
|
1009
|
+
};
|
|
1010
|
+
_ts_decorate8([
|
|
1011
|
+
IsOptional2(),
|
|
1012
|
+
IsString2(),
|
|
1013
|
+
_ts_metadata6("design:type", String)
|
|
1014
|
+
], UnlockMaintenanceDto.prototype, "windowId", void 0);
|
|
1015
|
+
|
|
1016
|
+
// src/maintenance/maintenance-admin.controller.ts
|
|
1017
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1018
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1019
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1020
|
+
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;
|
|
1021
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1022
|
+
}
|
|
1023
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1024
|
+
function _ts_metadata7(k, v) {
|
|
1025
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1026
|
+
}
|
|
1027
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
915
1028
|
function _ts_param6(paramIndex, decorator) {
|
|
916
1029
|
return function(target, key) {
|
|
917
1030
|
decorator(target, key, paramIndex);
|
|
918
1031
|
};
|
|
919
1032
|
}
|
|
920
1033
|
__name(_ts_param6, "_ts_param");
|
|
1034
|
+
function instantOf(value, field) {
|
|
1035
|
+
const moment = parseZonedInstant(value);
|
|
1036
|
+
if (!moment) {
|
|
1037
|
+
throw new BadRequestException2(codedError(MAINTENANCE_ERROR_CODES.MAINTENANCE_TIME_INVALID, {
|
|
1038
|
+
field
|
|
1039
|
+
}));
|
|
1040
|
+
}
|
|
1041
|
+
return moment;
|
|
1042
|
+
}
|
|
1043
|
+
__name(instantOf, "instantOf");
|
|
1044
|
+
function optionalInstantOf(value, field) {
|
|
1045
|
+
return value === void 0 ? void 0 : instantOf(value, field);
|
|
1046
|
+
}
|
|
1047
|
+
__name(optionalInstantOf, "optionalInstantOf");
|
|
1048
|
+
var viewOf = /* @__PURE__ */ __name((window) => maintenanceWindowViewOf(window, /* @__PURE__ */ new Date()), "viewOf");
|
|
1049
|
+
function buildMaintenanceAdminController(guards) {
|
|
1050
|
+
let GeneratedMaintenanceAdminController = class GeneratedMaintenanceAdminController {
|
|
1051
|
+
static {
|
|
1052
|
+
__name(this, "GeneratedMaintenanceAdminController");
|
|
1053
|
+
}
|
|
1054
|
+
maintenance;
|
|
1055
|
+
audit;
|
|
1056
|
+
// Explicit @Inject: tsup/esbuild emit no `design:paramtypes`.
|
|
1057
|
+
constructor(maintenance, audit) {
|
|
1058
|
+
this.maintenance = maintenance;
|
|
1059
|
+
this.audit = audit;
|
|
1060
|
+
}
|
|
1061
|
+
overview() {
|
|
1062
|
+
return this.maintenance.overview();
|
|
1063
|
+
}
|
|
1064
|
+
async announce(dto, request) {
|
|
1065
|
+
const window = await this.maintenance.announce({
|
|
1066
|
+
startsAt: instantOf(dto.startsAt, "startsAt"),
|
|
1067
|
+
endsAt: instantOf(dto.endsAt, "endsAt"),
|
|
1068
|
+
message: dto.message
|
|
1069
|
+
}, this.audit.actorFromRequest(request));
|
|
1070
|
+
return viewOf(window);
|
|
1071
|
+
}
|
|
1072
|
+
async reschedule(id, dto, request) {
|
|
1073
|
+
const window = await this.maintenance.reschedule(id, {
|
|
1074
|
+
startsAt: optionalInstantOf(dto.startsAt, "startsAt"),
|
|
1075
|
+
endsAt: optionalInstantOf(dto.endsAt, "endsAt"),
|
|
1076
|
+
message: dto.message
|
|
1077
|
+
}, this.audit.actorFromRequest(request));
|
|
1078
|
+
return viewOf(window);
|
|
1079
|
+
}
|
|
1080
|
+
async cancel(id, request) {
|
|
1081
|
+
return viewOf(await this.maintenance.cancel(id, this.audit.actorFromRequest(request)));
|
|
1082
|
+
}
|
|
1083
|
+
async lock(dto, request) {
|
|
1084
|
+
const outcome = await this.maintenance.lock({
|
|
1085
|
+
windowId: dto.windowId,
|
|
1086
|
+
endsAt: optionalInstantOf(dto.endsAt, "endsAt"),
|
|
1087
|
+
message: dto.message
|
|
1088
|
+
}, this.audit.actorFromRequest(request));
|
|
1089
|
+
return {
|
|
1090
|
+
window: viewOf(outcome.window),
|
|
1091
|
+
alreadyLocked: outcome.alreadyLocked,
|
|
1092
|
+
takesEffectWithinSeconds: MAINTENANCE_STATE_MAX_AGE_SECONDS
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
async unlock(dto, request) {
|
|
1096
|
+
const outcome = await this.maintenance.unlock({
|
|
1097
|
+
windowId: dto.windowId
|
|
1098
|
+
}, this.audit.actorFromRequest(request));
|
|
1099
|
+
return {
|
|
1100
|
+
window: outcome.window ? viewOf(outcome.window) : null,
|
|
1101
|
+
wasLocked: outcome.wasLocked
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
_ts_decorate9([
|
|
1106
|
+
Get3("maintenance"),
|
|
1107
|
+
_ts_metadata7("design:type", Function),
|
|
1108
|
+
_ts_metadata7("design:paramtypes", []),
|
|
1109
|
+
_ts_metadata7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1110
|
+
], GeneratedMaintenanceAdminController.prototype, "overview", null);
|
|
1111
|
+
_ts_decorate9([
|
|
1112
|
+
Post3("maintenance"),
|
|
1113
|
+
_ts_param6(0, Body2()),
|
|
1114
|
+
_ts_param6(1, Req2()),
|
|
1115
|
+
_ts_metadata7("design:type", Function),
|
|
1116
|
+
_ts_metadata7("design:paramtypes", [
|
|
1117
|
+
typeof AnnounceMaintenanceDto === "undefined" ? Object : AnnounceMaintenanceDto,
|
|
1118
|
+
Object
|
|
1119
|
+
]),
|
|
1120
|
+
_ts_metadata7("design:returntype", Promise)
|
|
1121
|
+
], GeneratedMaintenanceAdminController.prototype, "announce", null);
|
|
1122
|
+
_ts_decorate9([
|
|
1123
|
+
Patch("maintenance/:id"),
|
|
1124
|
+
_ts_param6(0, Param2("id")),
|
|
1125
|
+
_ts_param6(1, Body2()),
|
|
1126
|
+
_ts_param6(2, Req2()),
|
|
1127
|
+
_ts_metadata7("design:type", Function),
|
|
1128
|
+
_ts_metadata7("design:paramtypes", [
|
|
1129
|
+
String,
|
|
1130
|
+
typeof RescheduleMaintenanceDto === "undefined" ? Object : RescheduleMaintenanceDto,
|
|
1131
|
+
Object
|
|
1132
|
+
]),
|
|
1133
|
+
_ts_metadata7("design:returntype", Promise)
|
|
1134
|
+
], GeneratedMaintenanceAdminController.prototype, "reschedule", null);
|
|
1135
|
+
_ts_decorate9([
|
|
1136
|
+
Post3("maintenance/:id/cancel"),
|
|
1137
|
+
_ts_param6(0, Param2("id")),
|
|
1138
|
+
_ts_param6(1, Req2()),
|
|
1139
|
+
_ts_metadata7("design:type", Function),
|
|
1140
|
+
_ts_metadata7("design:paramtypes", [
|
|
1141
|
+
String,
|
|
1142
|
+
Object
|
|
1143
|
+
]),
|
|
1144
|
+
_ts_metadata7("design:returntype", Promise)
|
|
1145
|
+
], GeneratedMaintenanceAdminController.prototype, "cancel", null);
|
|
1146
|
+
_ts_decorate9([
|
|
1147
|
+
Post3("maintenance/lock"),
|
|
1148
|
+
EnforceMfa(),
|
|
1149
|
+
_ts_param6(0, Body2()),
|
|
1150
|
+
_ts_param6(1, Req2()),
|
|
1151
|
+
_ts_metadata7("design:type", Function),
|
|
1152
|
+
_ts_metadata7("design:paramtypes", [
|
|
1153
|
+
typeof LockMaintenanceDto === "undefined" ? Object : LockMaintenanceDto,
|
|
1154
|
+
Object
|
|
1155
|
+
]),
|
|
1156
|
+
_ts_metadata7("design:returntype", Promise)
|
|
1157
|
+
], GeneratedMaintenanceAdminController.prototype, "lock", null);
|
|
1158
|
+
_ts_decorate9([
|
|
1159
|
+
Post3("maintenance/unlock"),
|
|
1160
|
+
EnforceMfa(),
|
|
1161
|
+
_ts_param6(0, Body2()),
|
|
1162
|
+
_ts_param6(1, Req2()),
|
|
1163
|
+
_ts_metadata7("design:type", Function),
|
|
1164
|
+
_ts_metadata7("design:paramtypes", [
|
|
1165
|
+
typeof UnlockMaintenanceDto === "undefined" ? Object : UnlockMaintenanceDto,
|
|
1166
|
+
Object
|
|
1167
|
+
]),
|
|
1168
|
+
_ts_metadata7("design:returntype", Promise)
|
|
1169
|
+
], GeneratedMaintenanceAdminController.prototype, "unlock", null);
|
|
1170
|
+
GeneratedMaintenanceAdminController = _ts_decorate9([
|
|
1171
|
+
Controller3("admin"),
|
|
1172
|
+
UseGuards2(...guards),
|
|
1173
|
+
AllowDuringMaintenance(),
|
|
1174
|
+
_ts_param6(0, Inject5(MaintenanceService)),
|
|
1175
|
+
_ts_param6(1, Inject5(WebAuditLogger)),
|
|
1176
|
+
_ts_metadata7("design:type", Function),
|
|
1177
|
+
_ts_metadata7("design:paramtypes", [
|
|
1178
|
+
typeof MaintenanceService === "undefined" ? Object : MaintenanceService,
|
|
1179
|
+
typeof WebAuditLogger === "undefined" ? Object : WebAuditLogger
|
|
1180
|
+
])
|
|
1181
|
+
], GeneratedMaintenanceAdminController);
|
|
1182
|
+
return GeneratedMaintenanceAdminController;
|
|
1183
|
+
}
|
|
1184
|
+
__name(buildMaintenanceAdminController, "buildMaintenanceAdminController");
|
|
1185
|
+
|
|
1186
|
+
// src/maintenance/maintenance-status.controller.ts
|
|
1187
|
+
import { Controller as Controller4, Get as Get4, Inject as Inject6 } from "@nestjs/common";
|
|
1188
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1189
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1190
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1191
|
+
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;
|
|
1192
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1193
|
+
}
|
|
1194
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1195
|
+
function _ts_metadata8(k, v) {
|
|
1196
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1197
|
+
}
|
|
1198
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
1199
|
+
function _ts_param7(paramIndex, decorator) {
|
|
1200
|
+
return function(target, key) {
|
|
1201
|
+
decorator(target, key, paramIndex);
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
__name(_ts_param7, "_ts_param");
|
|
1205
|
+
var MaintenanceStatusController = class {
|
|
1206
|
+
static {
|
|
1207
|
+
__name(this, "MaintenanceStatusController");
|
|
1208
|
+
}
|
|
1209
|
+
maintenance;
|
|
1210
|
+
// Explicit @Inject: tsup/esbuild emit no `design:paramtypes`.
|
|
1211
|
+
constructor(maintenance) {
|
|
1212
|
+
this.maintenance = maintenance;
|
|
1213
|
+
}
|
|
1214
|
+
status() {
|
|
1215
|
+
return this.maintenance.status();
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
_ts_decorate10([
|
|
1219
|
+
Get4("maintenance"),
|
|
1220
|
+
_ts_metadata8("design:type", Function),
|
|
1221
|
+
_ts_metadata8("design:paramtypes", []),
|
|
1222
|
+
_ts_metadata8("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1223
|
+
], MaintenanceStatusController.prototype, "status", null);
|
|
1224
|
+
MaintenanceStatusController = _ts_decorate10([
|
|
1225
|
+
Controller4("public"),
|
|
1226
|
+
SaaSiCatPublicRoute(),
|
|
1227
|
+
AllowDuringMaintenance(),
|
|
1228
|
+
_ts_param7(0, Inject6(MaintenanceService)),
|
|
1229
|
+
_ts_metadata8("design:type", Function),
|
|
1230
|
+
_ts_metadata8("design:paramtypes", [
|
|
1231
|
+
typeof MaintenanceService === "undefined" ? Object : MaintenanceService
|
|
1232
|
+
])
|
|
1233
|
+
], MaintenanceStatusController);
|
|
1234
|
+
|
|
1235
|
+
// src/maintenance/maintenance.guard.ts
|
|
1236
|
+
import { Inject as Inject7, Injectable as Injectable4, ServiceUnavailableException } from "@nestjs/common";
|
|
1237
|
+
import { Reflector } from "@nestjs/core";
|
|
1238
|
+
import { MAINTENANCE_ERROR_CODES as MAINTENANCE_ERROR_CODES2, maintenanceRetryAfterSeconds, maintenanceStatusOf, maintenanceWindowStatusOf } from "@saasicat/core";
|
|
1239
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1240
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1241
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1242
|
+
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;
|
|
1243
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1244
|
+
}
|
|
1245
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1246
|
+
function _ts_metadata9(k, v) {
|
|
1247
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1248
|
+
}
|
|
1249
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1250
|
+
function _ts_param8(paramIndex, decorator) {
|
|
1251
|
+
return function(target, key) {
|
|
1252
|
+
decorator(target, key, paramIndex);
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
__name(_ts_param8, "_ts_param");
|
|
1256
|
+
function isPlatformAdministrator(user) {
|
|
1257
|
+
return (user?.platformRole ?? user?.role) === "SUPER_ADMIN";
|
|
1258
|
+
}
|
|
1259
|
+
__name(isPlatformAdministrator, "isPlatformAdministrator");
|
|
1260
|
+
function setHeader(response, name, value) {
|
|
1261
|
+
if (typeof response.header === "function") response.header(name, value);
|
|
1262
|
+
else if (typeof response.setHeader === "function") response.setHeader(name, value);
|
|
1263
|
+
}
|
|
1264
|
+
__name(setHeader, "setHeader");
|
|
1265
|
+
var MaintenanceGuard = class {
|
|
1266
|
+
static {
|
|
1267
|
+
__name(this, "MaintenanceGuard");
|
|
1268
|
+
}
|
|
1269
|
+
reflector;
|
|
1270
|
+
maintenance;
|
|
1271
|
+
constructor(reflector, maintenance) {
|
|
1272
|
+
this.reflector = reflector;
|
|
1273
|
+
this.maintenance = maintenance;
|
|
1274
|
+
}
|
|
1275
|
+
async canActivate(context) {
|
|
1276
|
+
if (context.getType() !== "http") return true;
|
|
1277
|
+
if (isAllowedDuringMaintenance(this.reflector, context)) return true;
|
|
1278
|
+
const open = await this.maintenance.openWindow();
|
|
1279
|
+
if (!open || maintenanceWindowStatusOf(open) !== "locked") return true;
|
|
1280
|
+
const http = context.switchToHttp();
|
|
1281
|
+
if (isPlatformAdministrator(http.getRequest().user)) return true;
|
|
1282
|
+
const now = /* @__PURE__ */ new Date();
|
|
1283
|
+
setHeader(http.getResponse(), "Retry-After", String(maintenanceRetryAfterSeconds(open, now)));
|
|
1284
|
+
throw new ServiceUnavailableException({
|
|
1285
|
+
...codedError(MAINTENANCE_ERROR_CODES2.MAINTENANCE, {
|
|
1286
|
+
endsAt: open.endsAt?.toISOString() ?? null
|
|
1287
|
+
}),
|
|
1288
|
+
maintenance: maintenanceStatusOf(open, now)
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
MaintenanceGuard = _ts_decorate11([
|
|
1293
|
+
Injectable4(),
|
|
1294
|
+
_ts_param8(0, Inject7(Reflector)),
|
|
1295
|
+
_ts_param8(1, Inject7(MaintenanceService)),
|
|
1296
|
+
_ts_metadata9("design:type", Function),
|
|
1297
|
+
_ts_metadata9("design:paramtypes", [
|
|
1298
|
+
typeof Reflector === "undefined" ? Object : Reflector,
|
|
1299
|
+
typeof MaintenanceService === "undefined" ? Object : MaintenanceService
|
|
1300
|
+
])
|
|
1301
|
+
], MaintenanceGuard);
|
|
1302
|
+
|
|
1303
|
+
// src/maintenance/maintenance.module.ts
|
|
1304
|
+
import { Module as Module3 } from "@nestjs/common";
|
|
1305
|
+
|
|
1306
|
+
// src/maintenance/maintenance-manifest.ts
|
|
1307
|
+
import { MAINTENANCE_CAPABILITY } from "@saasicat/core";
|
|
1308
|
+
var MAINTENANCE_MANIFEST_CONTRIBUTION = {
|
|
1309
|
+
capabilities: {
|
|
1310
|
+
[MAINTENANCE_CAPABILITY]: true
|
|
1311
|
+
},
|
|
1312
|
+
audit: {
|
|
1313
|
+
actions: [
|
|
1314
|
+
{
|
|
1315
|
+
key: "MAINTENANCE_WINDOW_ANNOUNCE",
|
|
1316
|
+
label: "Maintenance window announced",
|
|
1317
|
+
severity: "medium"
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
key: "MAINTENANCE_WINDOW_RESCHEDULE",
|
|
1321
|
+
label: "Maintenance window moved",
|
|
1322
|
+
severity: "low"
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
key: "MAINTENANCE_WINDOW_CANCEL",
|
|
1326
|
+
label: "Maintenance window cancelled",
|
|
1327
|
+
severity: "medium"
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
key: "MAINTENANCE_LOCK",
|
|
1331
|
+
label: "Tenants locked out for maintenance",
|
|
1332
|
+
severity: "high"
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
key: "MAINTENANCE_UNLOCK",
|
|
1336
|
+
label: "Tenants let back in",
|
|
1337
|
+
severity: "high"
|
|
1338
|
+
}
|
|
1339
|
+
]
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
// src/maintenance/maintenance.module.ts
|
|
1344
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1345
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1346
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1347
|
+
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;
|
|
1348
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1349
|
+
}
|
|
1350
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1351
|
+
var MAINTENANCE_MANIFEST_REGISTRATION_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/MaintenanceManifestRegistration");
|
|
1352
|
+
var MaintenanceModule = class _MaintenanceModule {
|
|
1353
|
+
static {
|
|
1354
|
+
__name(this, "MaintenanceModule");
|
|
1355
|
+
}
|
|
1356
|
+
static forRoot(options) {
|
|
1357
|
+
const withAdmin = options.includeAdminController !== false;
|
|
1358
|
+
const providers = [
|
|
1359
|
+
asProvider(MAINTENANCE_WINDOW_PORT_TOKEN, options.windows),
|
|
1360
|
+
options.notifications ? asProvider(MAINTENANCE_NOTIFICATION_PORT_TOKEN, options.notifications) : {
|
|
1361
|
+
provide: MAINTENANCE_NOTIFICATION_PORT_TOKEN,
|
|
1362
|
+
useValue: null
|
|
1363
|
+
},
|
|
1364
|
+
MaintenanceService,
|
|
1365
|
+
MaintenanceGuard,
|
|
1366
|
+
WebAuditLogger
|
|
1367
|
+
];
|
|
1368
|
+
if (withAdmin) {
|
|
1369
|
+
providers.push({
|
|
1370
|
+
provide: MAINTENANCE_MANIFEST_REGISTRATION_TOKEN,
|
|
1371
|
+
useFactory: /* @__PURE__ */ __name((manifest) => {
|
|
1372
|
+
manifest?.register(MAINTENANCE_MANIFEST_CONTRIBUTION);
|
|
1373
|
+
return MAINTENANCE_MANIFEST_CONTRIBUTION;
|
|
1374
|
+
}, "useFactory"),
|
|
1375
|
+
inject: [
|
|
1376
|
+
{
|
|
1377
|
+
token: AdminManifestService,
|
|
1378
|
+
optional: true
|
|
1379
|
+
}
|
|
1380
|
+
]
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
return {
|
|
1384
|
+
module: _MaintenanceModule,
|
|
1385
|
+
global: true,
|
|
1386
|
+
imports: options.imports ?? [],
|
|
1387
|
+
controllers: [
|
|
1388
|
+
MaintenanceStatusController,
|
|
1389
|
+
...withAdmin ? [
|
|
1390
|
+
buildMaintenanceAdminController(options.controller.guards)
|
|
1391
|
+
] : []
|
|
1392
|
+
],
|
|
1393
|
+
providers,
|
|
1394
|
+
exports: [
|
|
1395
|
+
MaintenanceService,
|
|
1396
|
+
MaintenanceGuard,
|
|
1397
|
+
MAINTENANCE_WINDOW_PORT_TOKEN,
|
|
1398
|
+
MAINTENANCE_NOTIFICATION_PORT_TOKEN
|
|
1399
|
+
]
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
MaintenanceModule = _ts_decorate12([
|
|
1404
|
+
Module3({})
|
|
1405
|
+
], MaintenanceModule);
|
|
1406
|
+
|
|
1407
|
+
// src/platform/enforcement-chain.check.ts
|
|
1408
|
+
import { Inject as Inject8, Injectable as Injectable5, Optional as Optional4 } from "@nestjs/common";
|
|
1409
|
+
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
1410
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1411
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1412
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1413
|
+
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;
|
|
1414
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1415
|
+
}
|
|
1416
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1417
|
+
function _ts_metadata10(k, v) {
|
|
1418
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1419
|
+
}
|
|
1420
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1421
|
+
function _ts_param9(paramIndex, decorator) {
|
|
1422
|
+
return function(target, key) {
|
|
1423
|
+
decorator(target, key, paramIndex);
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
__name(_ts_param9, "_ts_param");
|
|
921
1427
|
var GUARDS_METADATA = "__guards__";
|
|
922
1428
|
var METHOD_METADATA = "method";
|
|
923
1429
|
var ENFORCEMENT_CHAIN_STATE_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/EnforcementChainState");
|
|
@@ -1006,14 +1512,14 @@ Two things this cannot see, and the way out of each: a guard of your own that wr
|
|
|
1006
1512
|
return annotated;
|
|
1007
1513
|
}
|
|
1008
1514
|
};
|
|
1009
|
-
EnforcementChainCheck =
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1515
|
+
EnforcementChainCheck = _ts_decorate13([
|
|
1516
|
+
Injectable5(),
|
|
1517
|
+
_ts_param9(0, Inject8(DiscoveryService)),
|
|
1518
|
+
_ts_param9(1, Inject8(MetadataScanner)),
|
|
1519
|
+
_ts_param9(2, Optional4()),
|
|
1520
|
+
_ts_param9(2, Inject8(ENFORCEMENT_CHAIN_STATE_TOKEN)),
|
|
1521
|
+
_ts_metadata10("design:type", Function),
|
|
1522
|
+
_ts_metadata10("design:paramtypes", [
|
|
1017
1523
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
1018
1524
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
1019
1525
|
typeof EnforcementChainState === "undefined" ? Object : EnforcementChainState
|
|
@@ -1051,25 +1557,25 @@ function readGuards(target) {
|
|
|
1051
1557
|
__name(readGuards, "readGuards");
|
|
1052
1558
|
|
|
1053
1559
|
// src/platform/issuer-identity.check.ts
|
|
1054
|
-
import { Inject as
|
|
1560
|
+
import { Inject as Inject9, Injectable as Injectable6, Logger as Logger3, Optional as Optional5 } from "@nestjs/common";
|
|
1055
1561
|
import { classifyIssuerChange, recordedIssuerIdentity } from "@saasicat/core";
|
|
1056
|
-
function
|
|
1562
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1057
1563
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1058
1564
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1059
1565
|
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;
|
|
1060
1566
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1061
1567
|
}
|
|
1062
|
-
__name(
|
|
1063
|
-
function
|
|
1568
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1569
|
+
function _ts_metadata11(k, v) {
|
|
1064
1570
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1065
1571
|
}
|
|
1066
|
-
__name(
|
|
1067
|
-
function
|
|
1572
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1573
|
+
function _ts_param10(paramIndex, decorator) {
|
|
1068
1574
|
return function(target, key) {
|
|
1069
1575
|
decorator(target, key, paramIndex);
|
|
1070
1576
|
};
|
|
1071
1577
|
}
|
|
1072
|
-
__name(
|
|
1578
|
+
__name(_ts_param10, "_ts_param");
|
|
1073
1579
|
var CONTRACTS_NAMED = 5;
|
|
1074
1580
|
var NOT_RECORDED = "this installation records no applied settings";
|
|
1075
1581
|
var ISSUER_BLOCK_KEYS = [
|
|
@@ -1249,18 +1755,18 @@ var IssuerIdentityInspector = class _IssuerIdentityInspector {
|
|
|
1249
1755
|
}
|
|
1250
1756
|
}
|
|
1251
1757
|
};
|
|
1252
|
-
IssuerIdentityInspector =
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1758
|
+
IssuerIdentityInspector = _ts_decorate14([
|
|
1759
|
+
Injectable6(),
|
|
1760
|
+
_ts_param10(0, Inject9(PLAN_CATALOG_SETTINGS_TOKEN)),
|
|
1761
|
+
_ts_param10(1, Inject9(SETTINGS_SOURCE_TOKEN)),
|
|
1762
|
+
_ts_param10(2, Optional5()),
|
|
1763
|
+
_ts_param10(2, Inject9(APPLIED_SETTINGS_PORT_TOKEN)),
|
|
1764
|
+
_ts_param10(3, Optional5()),
|
|
1765
|
+
_ts_param10(3, Inject9(SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN)),
|
|
1766
|
+
_ts_param10(4, Optional5()),
|
|
1767
|
+
_ts_param10(4, Inject9(RLS_BYPASS_PORT_TOKEN)),
|
|
1768
|
+
_ts_metadata11("design:type", Function),
|
|
1769
|
+
_ts_metadata11("design:paramtypes", [
|
|
1264
1770
|
typeof PlanCatalogSettings === "undefined" ? Object : PlanCatalogSettings,
|
|
1265
1771
|
String,
|
|
1266
1772
|
Object,
|
|
@@ -1282,10 +1788,10 @@ var IssuerIdentityCheck = class {
|
|
|
1282
1788
|
this.inspector.report(verdict);
|
|
1283
1789
|
}
|
|
1284
1790
|
};
|
|
1285
|
-
IssuerIdentityCheck =
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1791
|
+
IssuerIdentityCheck = _ts_decorate14([
|
|
1792
|
+
Injectable6(),
|
|
1793
|
+
_ts_metadata11("design:type", Function),
|
|
1794
|
+
_ts_metadata11("design:paramtypes", [
|
|
1289
1795
|
typeof IssuerIdentityInspector === "undefined" ? Object : IssuerIdentityInspector
|
|
1290
1796
|
])
|
|
1291
1797
|
], IssuerIdentityCheck);
|
|
@@ -1511,6 +2017,12 @@ var RULE_SPECS = [
|
|
|
1511
2017
|
assert: /* @__PURE__ */ __name((c) => Boolean(optionsOf(c.options.adminStats)?.auditStatsPort ?? bundle(c)?.core.auditStats), "assert"),
|
|
1512
2018
|
message: "adminStats is enabled, but no auditStatsPort is available. Set `adminStats.auditStatsPort` or use a bundle providing `persistence.core.auditStats`."
|
|
1513
2019
|
},
|
|
2020
|
+
{
|
|
2021
|
+
id: "maintenance.requires-windows-port",
|
|
2022
|
+
when: /* @__PURE__ */ __name((c) => Boolean(c.options.maintenance), "when"),
|
|
2023
|
+
assert: /* @__PURE__ */ __name((c) => Boolean(optionsOf(c.options.maintenance)?.windows ?? bundle(c)?.core.maintenanceWindows), "assert"),
|
|
2024
|
+
message: "maintenance is enabled, but there is nowhere to keep the windows. Set `maintenance.windows` or use a bundle providing `persistence.core.maintenanceWindows` \u2014 both shipped adapters do."
|
|
2025
|
+
},
|
|
1514
2026
|
{
|
|
1515
2027
|
id: "subscription-contract.requires-repository",
|
|
1516
2028
|
when: /* @__PURE__ */ __name((c) => Boolean(c.options.subscriptionContract), "when"),
|
|
@@ -1705,18 +2217,23 @@ function optionsOf2(slot) {
|
|
|
1705
2217
|
__name(optionsOf2, "optionsOf");
|
|
1706
2218
|
|
|
1707
2219
|
// src/platform/compose/admin-resources.ts
|
|
1708
|
-
function composeAdminResources({ options, persistence }) {
|
|
2220
|
+
function composeAdminResources({ options, persistence, shared }) {
|
|
1709
2221
|
if (!options.adminResources) return [];
|
|
1710
2222
|
const config = optionsOf2(options.adminResources);
|
|
2223
|
+
shared.adminResourcesModule = AdminResourcesModule.forRoot({
|
|
2224
|
+
resources: config.resources ?? persistence?.adminResources?.resources,
|
|
2225
|
+
guards: adminResourceGuards(options),
|
|
2226
|
+
imports: config.imports ?? options.imports
|
|
2227
|
+
});
|
|
1711
2228
|
return [
|
|
1712
|
-
|
|
1713
|
-
resources: config.resources ?? persistence?.adminResources?.resources,
|
|
1714
|
-
guards: config.guards ?? operatorGuards(options),
|
|
1715
|
-
imports: config.imports ?? options.imports
|
|
1716
|
-
})
|
|
2229
|
+
shared.adminResourcesModule
|
|
1717
2230
|
];
|
|
1718
2231
|
}
|
|
1719
2232
|
__name(composeAdminResources, "composeAdminResources");
|
|
2233
|
+
function adminResourceGuards(options) {
|
|
2234
|
+
return optionsOf2(options.adminResources).guards ?? operatorGuards(options);
|
|
2235
|
+
}
|
|
2236
|
+
__name(adminResourceGuards, "adminResourceGuards");
|
|
1720
2237
|
|
|
1721
2238
|
// src/platform/compose/catalog.ts
|
|
1722
2239
|
function composeCatalog({ options, persistence }) {
|
|
@@ -1781,6 +2298,36 @@ function composeEntitlement({ options, adapters, persistence, requiresFullEntitl
|
|
|
1781
2298
|
}
|
|
1782
2299
|
__name(composeEntitlement, "composeEntitlement");
|
|
1783
2300
|
|
|
2301
|
+
// src/platform/compose/maintenance.ts
|
|
2302
|
+
import { APP_GUARD } from "@nestjs/core";
|
|
2303
|
+
function composeMaintenance({ options, persistence }) {
|
|
2304
|
+
if (!options.maintenance) return [];
|
|
2305
|
+
const config = optionsOf2(options.maintenance);
|
|
2306
|
+
return [
|
|
2307
|
+
MaintenanceModule.forRoot({
|
|
2308
|
+
// `maintenance.requires-windows-port` has refused a configuration
|
|
2309
|
+
// that reaches here without one.
|
|
2310
|
+
windows: config.windows ?? persistence?.core.maintenanceWindows,
|
|
2311
|
+
notifications: config.notifications,
|
|
2312
|
+
controller: {
|
|
2313
|
+
guards: operatorGuards(options)
|
|
2314
|
+
},
|
|
2315
|
+
includeAdminController: config.includeAdminController,
|
|
2316
|
+
imports: options.imports
|
|
2317
|
+
})
|
|
2318
|
+
];
|
|
2319
|
+
}
|
|
2320
|
+
__name(composeMaintenance, "composeMaintenance");
|
|
2321
|
+
function maintenanceGuardProviders({ options }) {
|
|
2322
|
+
return options.maintenance ? [
|
|
2323
|
+
{
|
|
2324
|
+
provide: APP_GUARD,
|
|
2325
|
+
useExisting: MaintenanceGuard
|
|
2326
|
+
}
|
|
2327
|
+
] : [];
|
|
2328
|
+
}
|
|
2329
|
+
__name(maintenanceGuardProviders, "maintenanceGuardProviders");
|
|
2330
|
+
|
|
1784
2331
|
// src/platform/compose/optional-modules.ts
|
|
1785
2332
|
function composeSetup({ options, persistence }) {
|
|
1786
2333
|
if (!options.setup) return [];
|
|
@@ -1833,7 +2380,7 @@ function composeCheckoutOffer({ options, adapters, persistence }) {
|
|
|
1833
2380
|
];
|
|
1834
2381
|
}
|
|
1835
2382
|
__name(composeCheckoutOffer, "composeCheckoutOffer");
|
|
1836
|
-
function composeSubscriptionContract({ options, persistence }) {
|
|
2383
|
+
function composeSubscriptionContract({ options, adapters, persistence }) {
|
|
1837
2384
|
if (!options.subscriptionContract) return [];
|
|
1838
2385
|
const config = optionsOf2(options.subscriptionContract);
|
|
1839
2386
|
return [
|
|
@@ -1841,6 +2388,7 @@ function composeSubscriptionContract({ options, persistence }) {
|
|
|
1841
2388
|
...config,
|
|
1842
2389
|
subscriptionContractRepository: config.subscriptionContractRepository ?? persistence?.entitlement?.subscriptionContractRepository,
|
|
1843
2390
|
subscriberRepository: config.subscriberRepository ?? persistence?.entitlement?.subscriberRepository,
|
|
2391
|
+
transactionRunner: config.transactionRunner ?? adapters.transactionRunner,
|
|
1844
2392
|
imports: config.imports ?? options.imports
|
|
1845
2393
|
})
|
|
1846
2394
|
];
|
|
@@ -1905,6 +2453,29 @@ function composePromoCodes({ options, adapters, persistence }) {
|
|
|
1905
2453
|
}
|
|
1906
2454
|
__name(composePromoCodes, "composePromoCodes");
|
|
1907
2455
|
|
|
2456
|
+
// src/platform/compose/subscriber-account.ts
|
|
2457
|
+
function servesSubscriberAccounts(options) {
|
|
2458
|
+
return Boolean(options.adminResources && optionsOf2(options.tenantBilling).chargeJournal);
|
|
2459
|
+
}
|
|
2460
|
+
__name(servesSubscriberAccounts, "servesSubscriberAccounts");
|
|
2461
|
+
function composeSubscriberAccount(ctx) {
|
|
2462
|
+
const { adminResourcesModule, tenantBillingModule } = ctx.shared;
|
|
2463
|
+
if (!servesSubscriberAccounts(ctx.options) || !adminResourcesModule || !tenantBillingModule) {
|
|
2464
|
+
return [];
|
|
2465
|
+
}
|
|
2466
|
+
return [
|
|
2467
|
+
SubscriberAccountModule.forRoot({
|
|
2468
|
+
guards: adminResourceGuards(ctx.options),
|
|
2469
|
+
imports: [
|
|
2470
|
+
adminResourcesModule,
|
|
2471
|
+
tenantBillingModule,
|
|
2472
|
+
...optionsOf2(ctx.options.adminResources).imports ?? ctx.options.imports ?? []
|
|
2473
|
+
]
|
|
2474
|
+
})
|
|
2475
|
+
];
|
|
2476
|
+
}
|
|
2477
|
+
__name(composeSubscriberAccount, "composeSubscriberAccount");
|
|
2478
|
+
|
|
1908
2479
|
// src/platform/compose/tenant-bindings.ts
|
|
1909
2480
|
function normalizeTenantAuthGuards(guards) {
|
|
1910
2481
|
if (!Array.isArray(guards)) return guards;
|
|
@@ -1934,29 +2505,37 @@ function composeTenantBilling(ctx) {
|
|
|
1934
2505
|
ctx.shared.quotaProvidersHostedByTenantBilling = quotaProviders.length > 0;
|
|
1935
2506
|
ctx.shared.authGuards = normalizeTenantAuthGuards(authGuards);
|
|
1936
2507
|
ctx.shared.subscriptionUsagePort = subscriptionUsagePort ?? tenantSlice?.subscriptionUsagePort;
|
|
2508
|
+
ctx.shared.tenantBillingModule = TenantBillingModule.forRoot({
|
|
2509
|
+
...tenantOptions,
|
|
2510
|
+
authGuards: ctx.shared.authGuards,
|
|
2511
|
+
// The same adapter `SubscriptionBundleModule` gets. That module
|
|
2512
|
+
// exports the token, but it is a sibling import here rather than an
|
|
2513
|
+
// ancestor, so its exports never reach this module's providers —
|
|
2514
|
+
// and the plan-change rule that reads bookings would resolve to
|
|
2515
|
+
// "none" and allow the move it exists to refuse.
|
|
2516
|
+
subscriptionBundleRepository: ctx.persistence?.entitlement?.subscriptionBundleRepository,
|
|
2517
|
+
subscriptionUsagePort: ctx.shared.subscriptionUsagePort,
|
|
2518
|
+
usageSnapshotPort: usageSnapshotPort ?? tenantSlice?.usageSnapshotPort ?? quotaUsageSnapshotProvider(quotaProviders),
|
|
2519
|
+
subscriptionWritePort: subscriptionWritePort ?? tenantSlice?.subscriptionWritePort,
|
|
2520
|
+
// The platform's runner, unless the application names its own: a
|
|
2521
|
+
// successor contract and the end of the one it replaces are written
|
|
2522
|
+
// on one transaction.
|
|
2523
|
+
contractFreeze: tenantOptions.contractFreeze && {
|
|
2524
|
+
transactionRunner: ctx.adapters.transactionRunner,
|
|
2525
|
+
...tenantOptions.contractFreeze
|
|
2526
|
+
},
|
|
2527
|
+
imports: tenantImports ?? ctx.options.imports,
|
|
2528
|
+
extraProviders: [
|
|
2529
|
+
...quotaProviders,
|
|
2530
|
+
...extraProviders ?? []
|
|
2531
|
+
],
|
|
2532
|
+
extraExports: [
|
|
2533
|
+
...quotaProviders,
|
|
2534
|
+
...extraExports ?? []
|
|
2535
|
+
]
|
|
2536
|
+
});
|
|
1937
2537
|
return [
|
|
1938
|
-
|
|
1939
|
-
...tenantOptions,
|
|
1940
|
-
authGuards: ctx.shared.authGuards,
|
|
1941
|
-
// The same adapter `SubscriptionBundleModule` gets. That module
|
|
1942
|
-
// exports the token, but it is a sibling import here rather than an
|
|
1943
|
-
// ancestor, so its exports never reach this module's providers —
|
|
1944
|
-
// and the plan-change rule that reads bookings would resolve to
|
|
1945
|
-
// "none" and allow the move it exists to refuse.
|
|
1946
|
-
subscriptionBundleRepository: ctx.persistence?.entitlement?.subscriptionBundleRepository,
|
|
1947
|
-
subscriptionUsagePort: ctx.shared.subscriptionUsagePort,
|
|
1948
|
-
usageSnapshotPort: usageSnapshotPort ?? tenantSlice?.usageSnapshotPort ?? quotaUsageSnapshotProvider(quotaProviders),
|
|
1949
|
-
subscriptionWritePort: subscriptionWritePort ?? tenantSlice?.subscriptionWritePort,
|
|
1950
|
-
imports: tenantImports ?? ctx.options.imports,
|
|
1951
|
-
extraProviders: [
|
|
1952
|
-
...quotaProviders,
|
|
1953
|
-
...extraProviders ?? []
|
|
1954
|
-
],
|
|
1955
|
-
extraExports: [
|
|
1956
|
-
...quotaProviders,
|
|
1957
|
-
...extraExports ?? []
|
|
1958
|
-
]
|
|
1959
|
-
})
|
|
2538
|
+
ctx.shared.tenantBillingModule
|
|
1960
2539
|
];
|
|
1961
2540
|
}
|
|
1962
2541
|
__name(composeTenantBilling, "composeTenantBilling");
|
|
@@ -1998,7 +2577,10 @@ var FEATURE_COMPOSERS = [
|
|
|
1998
2577
|
composeSetup,
|
|
1999
2578
|
composeAdminStats,
|
|
2000
2579
|
composeCheckoutOffer,
|
|
2001
|
-
composeSubscriptionContract
|
|
2580
|
+
composeSubscriptionContract,
|
|
2581
|
+
// After the admin resources and tenant billing: it imports both.
|
|
2582
|
+
composeSubscriberAccount,
|
|
2583
|
+
composeMaintenance
|
|
2002
2584
|
];
|
|
2003
2585
|
function composeFeatures(ctx) {
|
|
2004
2586
|
return FEATURE_COMPOSERS.flatMap((compose) => compose(ctx));
|
|
@@ -2056,6 +2638,10 @@ function optionalExports({ options, requiresFullEntitlement: requiresFullEntitle
|
|
|
2056
2638
|
[
|
|
2057
2639
|
options.subscriptionContract,
|
|
2058
2640
|
SubscriptionContractModule
|
|
2641
|
+
],
|
|
2642
|
+
[
|
|
2643
|
+
options.maintenance,
|
|
2644
|
+
MaintenanceModule
|
|
2059
2645
|
]
|
|
2060
2646
|
];
|
|
2061
2647
|
}
|
|
@@ -2088,24 +2674,24 @@ var StaticPlanResolver = class {
|
|
|
2088
2674
|
};
|
|
2089
2675
|
|
|
2090
2676
|
// src/platform/static-entitlement.service.ts
|
|
2091
|
-
import { Inject as
|
|
2092
|
-
function
|
|
2677
|
+
import { Inject as Inject10, Injectable as Injectable7 } from "@nestjs/common";
|
|
2678
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
2093
2679
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2094
2680
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2095
2681
|
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;
|
|
2096
2682
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2097
2683
|
}
|
|
2098
|
-
__name(
|
|
2099
|
-
function
|
|
2684
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
2685
|
+
function _ts_metadata12(k, v) {
|
|
2100
2686
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2101
2687
|
}
|
|
2102
|
-
__name(
|
|
2103
|
-
function
|
|
2688
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
2689
|
+
function _ts_param11(paramIndex, decorator) {
|
|
2104
2690
|
return function(target, key) {
|
|
2105
2691
|
decorator(target, key, paramIndex);
|
|
2106
2692
|
};
|
|
2107
2693
|
}
|
|
2108
|
-
__name(
|
|
2694
|
+
__name(_ts_param11, "_ts_param");
|
|
2109
2695
|
var StaticEntitlementService = class {
|
|
2110
2696
|
static {
|
|
2111
2697
|
__name(this, "StaticEntitlementService");
|
|
@@ -2155,30 +2741,30 @@ var StaticEntitlementService = class {
|
|
|
2155
2741
|
return value === void 0 ? null : value;
|
|
2156
2742
|
}
|
|
2157
2743
|
};
|
|
2158
|
-
StaticEntitlementService =
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2744
|
+
StaticEntitlementService = _ts_decorate15([
|
|
2745
|
+
Injectable7(),
|
|
2746
|
+
_ts_param11(0, Inject10(PLAN_CATALOG_SOURCE_TOKEN)),
|
|
2747
|
+
_ts_param11(1, Inject10(PLAN_RESOLVER_PORT_TOKEN)),
|
|
2748
|
+
_ts_metadata12("design:type", Function),
|
|
2749
|
+
_ts_metadata12("design:paramtypes", [
|
|
2164
2750
|
typeof PlanCatalogSource === "undefined" ? Object : PlanCatalogSource,
|
|
2165
2751
|
typeof PlanResolverPort === "undefined" ? Object : PlanResolverPort
|
|
2166
2752
|
])
|
|
2167
2753
|
], StaticEntitlementService);
|
|
2168
2754
|
|
|
2169
2755
|
// src/platform/tenant-manifest.service.ts
|
|
2170
|
-
import { Injectable as
|
|
2171
|
-
function
|
|
2756
|
+
import { Injectable as Injectable8 } from "@nestjs/common";
|
|
2757
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
2172
2758
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2173
2759
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2174
2760
|
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;
|
|
2175
2761
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2176
2762
|
}
|
|
2177
|
-
__name(
|
|
2178
|
-
function
|
|
2763
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
2764
|
+
function _ts_metadata13(k, v) {
|
|
2179
2765
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2180
2766
|
}
|
|
2181
|
-
__name(
|
|
2767
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
2182
2768
|
var TenantManifestService = class {
|
|
2183
2769
|
static {
|
|
2184
2770
|
__name(this, "TenantManifestService");
|
|
@@ -2224,10 +2810,10 @@ var TenantManifestService = class {
|
|
|
2224
2810
|
};
|
|
2225
2811
|
}
|
|
2226
2812
|
};
|
|
2227
|
-
TenantManifestService =
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2813
|
+
TenantManifestService = _ts_decorate16([
|
|
2814
|
+
Injectable8(),
|
|
2815
|
+
_ts_metadata13("design:type", Function),
|
|
2816
|
+
_ts_metadata13("design:paramtypes", [
|
|
2231
2817
|
typeof StaticEntitlementService === "undefined" ? Object : StaticEntitlementService
|
|
2232
2818
|
])
|
|
2233
2819
|
], TenantManifestService);
|
|
@@ -2241,24 +2827,24 @@ function isVisible(item, features) {
|
|
|
2241
2827
|
__name(isVisible, "isVisible");
|
|
2242
2828
|
|
|
2243
2829
|
// src/platform/tenant-manifest.controller.ts
|
|
2244
|
-
import { Controller as
|
|
2245
|
-
function
|
|
2830
|
+
import { Controller as Controller5, Get as Get5, Inject as Inject11, Req as Req3, UseGuards as UseGuards3 } from "@nestjs/common";
|
|
2831
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
2246
2832
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2247
2833
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2248
2834
|
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;
|
|
2249
2835
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2250
2836
|
}
|
|
2251
|
-
__name(
|
|
2252
|
-
function
|
|
2837
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
2838
|
+
function _ts_metadata14(k, v) {
|
|
2253
2839
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2254
2840
|
}
|
|
2255
|
-
__name(
|
|
2256
|
-
function
|
|
2841
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
2842
|
+
function _ts_param12(paramIndex, decorator) {
|
|
2257
2843
|
return function(target, key) {
|
|
2258
2844
|
decorator(target, key, paramIndex);
|
|
2259
2845
|
};
|
|
2260
2846
|
}
|
|
2261
|
-
__name(
|
|
2847
|
+
__name(_ts_param12, "_ts_param");
|
|
2262
2848
|
function buildTenantManifestController(options) {
|
|
2263
2849
|
const path = options.path ?? "tenant/manifest";
|
|
2264
2850
|
let GeneratedTenantManifestController = class GeneratedTenantManifestController {
|
|
@@ -2277,21 +2863,21 @@ function buildTenantManifestController(options) {
|
|
|
2277
2863
|
return this.svc.getManifest(tenantId);
|
|
2278
2864
|
}
|
|
2279
2865
|
};
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2866
|
+
_ts_decorate17([
|
|
2867
|
+
Get5(),
|
|
2868
|
+
_ts_param12(0, Req3()),
|
|
2869
|
+
_ts_metadata14("design:type", Function),
|
|
2870
|
+
_ts_metadata14("design:paramtypes", [
|
|
2285
2871
|
typeof RequestWithUser === "undefined" ? Object : RequestWithUser
|
|
2286
2872
|
]),
|
|
2287
|
-
|
|
2873
|
+
_ts_metadata14("design:returntype", Promise)
|
|
2288
2874
|
], GeneratedTenantManifestController.prototype, "get", null);
|
|
2289
|
-
GeneratedTenantManifestController =
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2875
|
+
GeneratedTenantManifestController = _ts_decorate17([
|
|
2876
|
+
Controller5(path),
|
|
2877
|
+
UseGuards3(...options.guards),
|
|
2878
|
+
_ts_param12(0, Inject11(TenantManifestService)),
|
|
2879
|
+
_ts_metadata14("design:type", Function),
|
|
2880
|
+
_ts_metadata14("design:paramtypes", [
|
|
2295
2881
|
typeof TenantManifestService === "undefined" ? Object : TenantManifestService
|
|
2296
2882
|
])
|
|
2297
2883
|
], GeneratedTenantManifestController);
|
|
@@ -2300,27 +2886,27 @@ function buildTenantManifestController(options) {
|
|
|
2300
2886
|
__name(buildTenantManifestController, "buildTenantManifestController");
|
|
2301
2887
|
|
|
2302
2888
|
// src/platform/enforce-quota.interceptor.ts
|
|
2303
|
-
import { Inject as
|
|
2304
|
-
import { Reflector } from "@nestjs/core";
|
|
2889
|
+
import { Inject as Inject12, Injectable as Injectable9, Optional as Optional6 } from "@nestjs/common";
|
|
2890
|
+
import { Reflector as Reflector2 } from "@nestjs/core";
|
|
2305
2891
|
import { from } from "rxjs";
|
|
2306
2892
|
import { switchMap } from "rxjs/operators";
|
|
2307
|
-
function
|
|
2893
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
2308
2894
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2309
2895
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2310
2896
|
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;
|
|
2311
2897
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2312
2898
|
}
|
|
2313
|
-
__name(
|
|
2314
|
-
function
|
|
2899
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
2900
|
+
function _ts_metadata15(k, v) {
|
|
2315
2901
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2316
2902
|
}
|
|
2317
|
-
__name(
|
|
2318
|
-
function
|
|
2903
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
2904
|
+
function _ts_param13(paramIndex, decorator) {
|
|
2319
2905
|
return function(target, key) {
|
|
2320
2906
|
decorator(target, key, paramIndex);
|
|
2321
2907
|
};
|
|
2322
2908
|
}
|
|
2323
|
-
__name(
|
|
2909
|
+
__name(_ts_param13, "_ts_param");
|
|
2324
2910
|
var QUOTA_PROVIDERS_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/QuotaProviders");
|
|
2325
2911
|
var EnforceQuotaInterceptor = class {
|
|
2326
2912
|
static {
|
|
@@ -2363,41 +2949,41 @@ var EnforceQuotaInterceptor = class {
|
|
|
2363
2949
|
}
|
|
2364
2950
|
}
|
|
2365
2951
|
};
|
|
2366
|
-
EnforceQuotaInterceptor =
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
typeof
|
|
2952
|
+
EnforceQuotaInterceptor = _ts_decorate18([
|
|
2953
|
+
Injectable9(),
|
|
2954
|
+
_ts_param13(0, Inject12(Reflector2)),
|
|
2955
|
+
_ts_param13(1, Inject12(StaticEntitlementService)),
|
|
2956
|
+
_ts_param13(2, Optional6()),
|
|
2957
|
+
_ts_param13(2, Inject12(QUOTA_PROVIDERS_TOKEN)),
|
|
2958
|
+
_ts_metadata15("design:type", Function),
|
|
2959
|
+
_ts_metadata15("design:paramtypes", [
|
|
2960
|
+
typeof Reflector2 === "undefined" ? Object : Reflector2,
|
|
2375
2961
|
typeof StaticEntitlementService === "undefined" ? Object : StaticEntitlementService,
|
|
2376
2962
|
Object
|
|
2377
2963
|
])
|
|
2378
2964
|
], EnforceQuotaInterceptor);
|
|
2379
2965
|
|
|
2380
2966
|
// src/platform/static-feature.guard.ts
|
|
2381
|
-
import { ForbiddenException as ForbiddenException2, Inject as
|
|
2382
|
-
import { Reflector as
|
|
2967
|
+
import { ForbiddenException as ForbiddenException2, Inject as Inject13, Injectable as Injectable10, Optional as Optional7 } from "@nestjs/common";
|
|
2968
|
+
import { Reflector as Reflector3 } from "@nestjs/core";
|
|
2383
2969
|
import { AUTH_ERROR_CODES, FEATURE_NOT_LICENSED } from "@saasicat/core";
|
|
2384
|
-
function
|
|
2970
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
2385
2971
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2386
2972
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2387
2973
|
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;
|
|
2388
2974
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2389
2975
|
}
|
|
2390
|
-
__name(
|
|
2391
|
-
function
|
|
2976
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
2977
|
+
function _ts_metadata16(k, v) {
|
|
2392
2978
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2393
2979
|
}
|
|
2394
|
-
__name(
|
|
2395
|
-
function
|
|
2980
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
2981
|
+
function _ts_param14(paramIndex, decorator) {
|
|
2396
2982
|
return function(target, key) {
|
|
2397
2983
|
decorator(target, key, paramIndex);
|
|
2398
2984
|
};
|
|
2399
2985
|
}
|
|
2400
|
-
__name(
|
|
2986
|
+
__name(_ts_param14, "_ts_param");
|
|
2401
2987
|
var STATIC_FEATURE_GUARD_CONFIG_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/StaticFeatureGuardConfig");
|
|
2402
2988
|
var StaticFeatureGuard = class {
|
|
2403
2989
|
static {
|
|
@@ -2451,15 +3037,15 @@ var StaticFeatureGuard = class {
|
|
|
2451
3037
|
return true;
|
|
2452
3038
|
}
|
|
2453
3039
|
};
|
|
2454
|
-
StaticFeatureGuard =
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
typeof
|
|
3040
|
+
StaticFeatureGuard = _ts_decorate19([
|
|
3041
|
+
Injectable10(),
|
|
3042
|
+
_ts_param14(0, Inject13(Reflector3)),
|
|
3043
|
+
_ts_param14(1, Inject13(StaticEntitlementService)),
|
|
3044
|
+
_ts_param14(2, Optional7()),
|
|
3045
|
+
_ts_param14(2, Inject13(STATIC_FEATURE_GUARD_CONFIG_TOKEN)),
|
|
3046
|
+
_ts_metadata16("design:type", Function),
|
|
3047
|
+
_ts_metadata16("design:paramtypes", [
|
|
3048
|
+
typeof Reflector3 === "undefined" ? Object : Reflector3,
|
|
2463
3049
|
typeof StaticEntitlementService === "undefined" ? Object : StaticEntitlementService,
|
|
2464
3050
|
Object
|
|
2465
3051
|
])
|
|
@@ -2494,16 +3080,17 @@ var SubscriptionPlanResolver = class {
|
|
|
2494
3080
|
};
|
|
2495
3081
|
|
|
2496
3082
|
// src/platform/saasicat.module.ts
|
|
2497
|
-
import { Logger as Logger4, Module as
|
|
3083
|
+
import { Logger as Logger4, Module as Module4 } from "@nestjs/common";
|
|
2498
3084
|
import { DiscoveryModule as NestDiscoveryModule } from "@nestjs/core";
|
|
2499
3085
|
|
|
2500
3086
|
// src/platform/compose/base.ts
|
|
2501
3087
|
import { planCatalogSettingsOf } from "@saasicat/core";
|
|
2502
3088
|
|
|
2503
3089
|
// src/platform/compose/manifest.ts
|
|
3090
|
+
import { SUBSCRIBER_ACCOUNT_CAPABILITY } from "@saasicat/core";
|
|
2504
3091
|
var PLATFORM_SUBSCRIPTION_REPOSITORY_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/PlatformSubscriptionRepository");
|
|
2505
3092
|
var STANDARD_MANIFEST_REGISTRATION_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/StandardManifestRegistration");
|
|
2506
|
-
function buildStandardManifestContribution(catalog, adminResources, promoCodes) {
|
|
3093
|
+
function buildStandardManifestContribution(catalog, adminResources, promoCodes, subscriberAccounts) {
|
|
2507
3094
|
const capabilities = {
|
|
2508
3095
|
"discovery.read": true,
|
|
2509
3096
|
"settings.read": true
|
|
@@ -2536,6 +3123,7 @@ function buildStandardManifestContribution(catalog, adminResources, promoCodes)
|
|
|
2536
3123
|
}
|
|
2537
3124
|
};
|
|
2538
3125
|
}
|
|
3126
|
+
if (subscriberAccounts) capabilities[SUBSCRIBER_ACCOUNT_CAPABILITY] = true;
|
|
2539
3127
|
if (promoCodes) {
|
|
2540
3128
|
Object.assign(capabilities, {
|
|
2541
3129
|
"promoCodes.read": true,
|
|
@@ -2697,7 +3285,7 @@ function composeTenantManifest(ctx) {
|
|
|
2697
3285
|
__name(composeTenantManifest, "composeTenantManifest");
|
|
2698
3286
|
|
|
2699
3287
|
// src/platform/compose/enforcement-runtime.ts
|
|
2700
|
-
import { APP_GUARD, APP_INTERCEPTOR } from "@nestjs/core";
|
|
3288
|
+
import { APP_GUARD as APP_GUARD2, APP_INTERCEPTOR } from "@nestjs/core";
|
|
2701
3289
|
function resolvePlanResolution(ctx) {
|
|
2702
3290
|
const explicit = !!ctx.adapters.planResolver;
|
|
2703
3291
|
const viaSubscriptions = Boolean(ctx.options.tenantBilling && ctx.adapters.subscriptionRepository);
|
|
@@ -2733,7 +3321,7 @@ function composeEnforcementRuntime(ctx, resolution) {
|
|
|
2733
3321
|
},
|
|
2734
3322
|
...options.globalFeatureGuard === false ? [] : [
|
|
2735
3323
|
{
|
|
2736
|
-
provide:
|
|
3324
|
+
provide: APP_GUARD2,
|
|
2737
3325
|
useExisting: StaticFeatureGuard
|
|
2738
3326
|
}
|
|
2739
3327
|
],
|
|
@@ -2786,13 +3374,13 @@ function planResolverProvider(ctx, resolution) {
|
|
|
2786
3374
|
__name(planResolverProvider, "planResolverProvider");
|
|
2787
3375
|
|
|
2788
3376
|
// src/platform/saasicat.module.ts
|
|
2789
|
-
function
|
|
3377
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
2790
3378
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2791
3379
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2792
3380
|
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;
|
|
2793
3381
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2794
3382
|
}
|
|
2795
|
-
__name(
|
|
3383
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
2796
3384
|
var PLATFORM_LOGGER = new Logger4("SaaSiCat");
|
|
2797
3385
|
function enforcementChainState(state) {
|
|
2798
3386
|
return {
|
|
@@ -2862,10 +3450,12 @@ var SaaSiCatModule = class _SaaSiCatModule {
|
|
|
2862
3450
|
}
|
|
2863
3451
|
};
|
|
2864
3452
|
imports.push(...composeFeatures(composition));
|
|
2865
|
-
const lightweightProviders = [
|
|
3453
|
+
const lightweightProviders = [
|
|
3454
|
+
...maintenanceGuardProviders(composition)
|
|
3455
|
+
];
|
|
2866
3456
|
const lightweightExports = [];
|
|
2867
3457
|
if (options.autoManifest !== false) {
|
|
2868
|
-
const contribution = buildStandardManifestContribution(catalogConfig, adminResourcesConfig, promoCodesConfig);
|
|
3458
|
+
const contribution = buildStandardManifestContribution(catalogConfig, adminResourcesConfig, promoCodesConfig, servesSubscriberAccounts(options));
|
|
2869
3459
|
lightweightProviders.push({
|
|
2870
3460
|
provide: STANDARD_MANIFEST_REGISTRATION_TOKEN,
|
|
2871
3461
|
useFactory: /* @__PURE__ */ __name((manifest) => {
|
|
@@ -2912,8 +3502,8 @@ var SaaSiCatModule = class _SaaSiCatModule {
|
|
|
2912
3502
|
};
|
|
2913
3503
|
}
|
|
2914
3504
|
};
|
|
2915
|
-
SaaSiCatModule =
|
|
2916
|
-
|
|
3505
|
+
SaaSiCatModule = _ts_decorate20([
|
|
3506
|
+
Module4({})
|
|
2917
3507
|
], SaaSiCatModule);
|
|
2918
3508
|
|
|
2919
3509
|
export {
|
|
@@ -2931,6 +3521,10 @@ export {
|
|
|
2931
3521
|
AppliedSettingsRecorder,
|
|
2932
3522
|
buildSettingsController,
|
|
2933
3523
|
SettingsModule,
|
|
3524
|
+
buildMaintenanceAdminController,
|
|
3525
|
+
MaintenanceStatusController,
|
|
3526
|
+
MaintenanceGuard,
|
|
3527
|
+
MaintenanceModule,
|
|
2934
3528
|
ENFORCEMENT_CHAIN_STATE_TOKEN,
|
|
2935
3529
|
EnforcementChainCheck,
|
|
2936
3530
|
IssuerIdentityInspector,
|