@saasicat/nest 0.4.0 → 0.6.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 +3 -8
- package/dist/admin/index.d.cts +5 -33
- package/dist/admin/index.d.ts +5 -33
- package/dist/admin/index.js +2 -2
- package/dist/{admin-manifest.config-DxTfZ8-L.d.cts → admin-manifest.config-DyrQNT7M.d.cts} +1 -1
- package/dist/{admin-manifest.config-DxTfZ8-L.d.ts → admin-manifest.config-DyrQNT7M.d.ts} +1 -1
- package/dist/admin-manifest.service-Cp6uwvmt.d.cts +33 -0
- package/dist/admin-manifest.service-UGgzR1x-.d.ts +33 -0
- package/dist/{aggregation-DGCyoN5d.d.ts → aggregation-BibpEO0t.d.ts} +6 -59
- package/dist/{aggregation-Bt1i_whS.d.cts → aggregation-CfI0bOsQ.d.cts} +6 -59
- package/dist/billing/index.cjs +18 -106
- package/dist/billing/index.d.cts +8 -30
- package/dist/billing/index.d.ts +8 -30
- package/dist/billing/index.js +12 -14
- package/dist/catalog/index.cjs +1160 -1985
- package/dist/catalog/index.d.cts +9 -124
- package/dist/catalog/index.d.ts +9 -124
- package/dist/catalog/index.js +5 -27
- package/dist/checkout-offer/index.js +2 -2
- package/dist/{chunk-2VNZYRDV.js → chunk-52UTQRD3.js} +1 -1
- package/dist/{chunk-FN65XZKH.js → chunk-5DDCSGZC.js} +1110 -1923
- package/dist/{chunk-VHEHZMHB.js → chunk-BTL66TR6.js} +22 -75
- package/dist/{chunk-XSGU2Y2O.js → chunk-CK54YKVK.js} +2 -33
- package/dist/{chunk-SG34XT7J.js → chunk-FSGBRFLX.js} +18 -10
- package/dist/{chunk-SYEVGPFC.js → chunk-K3OPNVFR.js} +1 -1
- package/dist/{chunk-XCZ3TTFK.js → chunk-N3WANKSA.js} +0 -2
- package/dist/{chunk-K42EQPBB.js → chunk-ND7OOKOG.js} +18 -51
- package/dist/{chunk-MV6LW5UB.js → chunk-R2QOSVAA.js} +2 -2
- package/dist/{chunk-YNEW3L63.js → chunk-SD3TT2BR.js} +1 -1
- package/dist/{chunk-P6MYZMXQ.js → chunk-U6HT27J7.js} +3 -8
- package/dist/{chunk-7MLGHWKO.js → chunk-WKVBNTYC.js} +2 -0
- package/dist/{chunk-ZL4LLE2Z.js → chunk-ZLUGQE5D.js} +1 -1
- package/dist/discovery/index.js +4 -4
- package/dist/{enforce-quota.interceptor-3HmbeHTM.d.ts → enforce-quota.interceptor-Dj1Kusr5.d.ts} +9 -4
- package/dist/{enforce-quota.interceptor-HmdZFg41.d.cts → enforce-quota.interceptor-cv7r80VM.d.cts} +9 -4
- package/dist/entitlement/index.cjs +13 -46
- package/dist/entitlement/index.d.cts +4 -3
- package/dist/entitlement/index.d.ts +4 -3
- package/dist/entitlement/index.js +7 -9
- package/dist/index.cjs +1348 -2300
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +85 -113
- package/dist/platform/index.cjs +28 -54
- package/dist/platform/index.d.cts +4 -3
- package/dist/platform/index.d.ts +4 -3
- package/dist/platform/index.js +10 -7
- package/dist/promo/index.cjs +2 -2
- package/dist/promo/index.js +3 -3
- package/dist/registration/index.cjs +2 -34
- package/dist/registration/index.d.cts +3 -21
- package/dist/registration/index.d.ts +3 -21
- package/dist/registration/index.js +1 -3
- package/dist/testing/index.cjs +26 -255
- package/dist/testing/index.d.cts +5 -37
- package/dist/testing/index.d.ts +5 -37
- package/dist/testing/index.js +7 -207
- package/package.json +3 -3
package/dist/testing/index.js
CHANGED
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
StaticEntitlementService,
|
|
6
6
|
StaticFeatureGuard,
|
|
7
7
|
StaticPlanResolver
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-FSGBRFLX.js";
|
|
9
|
+
import "../chunk-U6HT27J7.js";
|
|
10
10
|
import "../chunk-Q53N43LQ.js";
|
|
11
11
|
import "../chunk-E56W4U2P.js";
|
|
12
12
|
import "../chunk-AJ3EPELS.js";
|
|
13
13
|
import "../chunk-M6CZQYPY.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-ND7OOKOG.js";
|
|
15
15
|
import "../chunk-NYLON2VC.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-MV6LW5UB.js";
|
|
16
|
+
import "../chunk-R2QOSVAA.js";
|
|
17
|
+
import "../chunk-WKVBNTYC.js";
|
|
18
|
+
import "../chunk-N3WANKSA.js";
|
|
20
19
|
import "../chunk-SABTXESR.js";
|
|
20
|
+
import "../chunk-L4SUWH5B.js";
|
|
21
21
|
import {
|
|
22
22
|
__name
|
|
23
23
|
} from "../chunk-SHUYVCID.js";
|
|
@@ -544,205 +544,6 @@ var FakeBundleRepository = class {
|
|
|
544
544
|
return published;
|
|
545
545
|
}
|
|
546
546
|
};
|
|
547
|
-
var FakeBusinessTypeRepository = class {
|
|
548
|
-
static {
|
|
549
|
-
__name(this, "FakeBusinessTypeRepository");
|
|
550
|
-
}
|
|
551
|
-
types = /* @__PURE__ */ new Map();
|
|
552
|
-
versions = /* @__PURE__ */ new Map();
|
|
553
|
-
nextId = 1;
|
|
554
|
-
genId(prefix) {
|
|
555
|
-
const n = this.nextId++;
|
|
556
|
-
const suffix = n.toString(16).padStart(12, "0");
|
|
557
|
-
return `${prefix}aaaa-aaaa-aaaa-aaaa-${suffix}`;
|
|
558
|
-
}
|
|
559
|
-
nowIso() {
|
|
560
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
561
|
-
}
|
|
562
|
-
seedBusinessType(row) {
|
|
563
|
-
this.types.set(row.id, row);
|
|
564
|
-
}
|
|
565
|
-
seedVersion(row) {
|
|
566
|
-
this.versions.set(row.id, row);
|
|
567
|
-
}
|
|
568
|
-
clear() {
|
|
569
|
-
this.types.clear();
|
|
570
|
-
this.versions.clear();
|
|
571
|
-
}
|
|
572
|
-
async list(filter) {
|
|
573
|
-
const excludeDeleted = filter.excludeDeleted ?? true;
|
|
574
|
-
return [
|
|
575
|
-
...this.types.values()
|
|
576
|
-
].filter((t) => t.projectKey === filter.projectKey && (!excludeDeleted || t.deletedAt === null));
|
|
577
|
-
}
|
|
578
|
-
async findById(businessTypeId) {
|
|
579
|
-
return this.types.get(businessTypeId) ?? null;
|
|
580
|
-
}
|
|
581
|
-
async findByKey(projectKey, businessTypeKey) {
|
|
582
|
-
for (const t of this.types.values()) {
|
|
583
|
-
if (t.projectKey === projectKey && t.businessTypeKey === businessTypeKey && t.deletedAt === null) {
|
|
584
|
-
return t;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
return null;
|
|
588
|
-
}
|
|
589
|
-
async create(data) {
|
|
590
|
-
const now = this.nowIso();
|
|
591
|
-
const row = {
|
|
592
|
-
id: this.genId("cccc"),
|
|
593
|
-
projectKey: data.projectKey,
|
|
594
|
-
businessTypeKey: data.businessTypeKey,
|
|
595
|
-
label: data.label,
|
|
596
|
-
description: data.description ?? null,
|
|
597
|
-
icon: data.icon ?? null,
|
|
598
|
-
sortOrder: data.sortOrder ?? 0,
|
|
599
|
-
createdAt: now,
|
|
600
|
-
updatedAt: now,
|
|
601
|
-
deletedAt: null
|
|
602
|
-
};
|
|
603
|
-
this.types.set(row.id, row);
|
|
604
|
-
return row;
|
|
605
|
-
}
|
|
606
|
-
async update(businessTypeId, data) {
|
|
607
|
-
const existing = this.types.get(businessTypeId);
|
|
608
|
-
if (!existing) throw new Error(`BusinessType '${businessTypeId}' nicht gefunden`);
|
|
609
|
-
const updated = {
|
|
610
|
-
...existing,
|
|
611
|
-
label: data.label ?? existing.label,
|
|
612
|
-
description: data.description !== void 0 ? data.description : existing.description,
|
|
613
|
-
icon: data.icon !== void 0 ? data.icon : existing.icon,
|
|
614
|
-
sortOrder: data.sortOrder ?? existing.sortOrder,
|
|
615
|
-
updatedAt: this.nowIso()
|
|
616
|
-
};
|
|
617
|
-
this.types.set(businessTypeId, updated);
|
|
618
|
-
return updated;
|
|
619
|
-
}
|
|
620
|
-
async softDelete(businessTypeId) {
|
|
621
|
-
const existing = this.types.get(businessTypeId);
|
|
622
|
-
if (!existing) throw new Error(`BusinessType '${businessTypeId}' nicht gefunden`);
|
|
623
|
-
this.types.set(businessTypeId, {
|
|
624
|
-
...existing,
|
|
625
|
-
deletedAt: this.nowIso()
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
async listVersions(businessTypeId) {
|
|
629
|
-
return [
|
|
630
|
-
...this.versions.values()
|
|
631
|
-
].filter((v) => v.businessTypeId === businessTypeId).sort((a, b) => a.version - b.version);
|
|
632
|
-
}
|
|
633
|
-
async findVersionById(versionId) {
|
|
634
|
-
return this.versions.get(versionId) ?? null;
|
|
635
|
-
}
|
|
636
|
-
async findCurrentDraft(businessTypeId) {
|
|
637
|
-
for (const v of this.versions.values()) {
|
|
638
|
-
if (v.businessTypeId === businessTypeId && v.publishedAt === null) return v;
|
|
639
|
-
}
|
|
640
|
-
return null;
|
|
641
|
-
}
|
|
642
|
-
async findLatestLive(businessTypeId) {
|
|
643
|
-
for (const v of this.versions.values()) {
|
|
644
|
-
if (v.businessTypeId === businessTypeId && v.publishedAt !== null && v.supersededAt === null) {
|
|
645
|
-
return v;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
|
-
async createDraft(data) {
|
|
651
|
-
const draft = await this.findCurrentDraft(data.businessTypeId);
|
|
652
|
-
if (draft) {
|
|
653
|
-
throw new Error(`BusinessType '${data.businessTypeId}' hat bereits eine Draft-Version v${draft.version}`);
|
|
654
|
-
}
|
|
655
|
-
const all = await this.listVersions(data.businessTypeId);
|
|
656
|
-
const nextVersion = all.length === 0 ? 1 : Math.max(...all.map((v) => v.version)) + 1;
|
|
657
|
-
const now = this.nowIso();
|
|
658
|
-
const businessType = this.types.get(data.businessTypeId);
|
|
659
|
-
const bundles = data.bundles.map((b) => ({
|
|
660
|
-
bundleVersionId: b.bundleVersionId,
|
|
661
|
-
bundleKey: "",
|
|
662
|
-
bundleLabel: "",
|
|
663
|
-
bundleVersion: 0,
|
|
664
|
-
sortOrder: b.sortOrder ?? 0
|
|
665
|
-
}));
|
|
666
|
-
const row = {
|
|
667
|
-
id: this.genId("wwww"),
|
|
668
|
-
version: nextVersion,
|
|
669
|
-
baseVersionId: data.baseVersionId ?? null,
|
|
670
|
-
publishedAt: null,
|
|
671
|
-
supersededAt: null,
|
|
672
|
-
publishedChanges: null,
|
|
673
|
-
changeNote: data.changeNote ?? "",
|
|
674
|
-
nonRegressive: true,
|
|
675
|
-
createdByUserId: data.createdByUserId ?? null,
|
|
676
|
-
publishedByUserId: null,
|
|
677
|
-
validFrom: null,
|
|
678
|
-
validUntil: null,
|
|
679
|
-
createdAt: now,
|
|
680
|
-
updatedAt: now,
|
|
681
|
-
businessTypeId: data.businessTypeId,
|
|
682
|
-
businessTypeKey: businessType?.businessTypeKey ?? "",
|
|
683
|
-
label: businessType?.label ?? "",
|
|
684
|
-
quotaOverrides: data.quotaOverrides ?? {},
|
|
685
|
-
monthlyNet: data.monthlyNet ?? null,
|
|
686
|
-
yearlyNet: data.yearlyNet ?? null,
|
|
687
|
-
marketed: data.marketed ?? true,
|
|
688
|
-
bundles
|
|
689
|
-
};
|
|
690
|
-
this.versions.set(row.id, row);
|
|
691
|
-
return row;
|
|
692
|
-
}
|
|
693
|
-
async updateDraft(versionId, data) {
|
|
694
|
-
const existing = this.versions.get(versionId);
|
|
695
|
-
if (!existing) throw new Error(`BusinessTypeVersion '${versionId}' nicht gefunden`);
|
|
696
|
-
if (existing.publishedAt !== null) {
|
|
697
|
-
throw new Error(`BusinessTypeVersion '${versionId}' ist bereits published`);
|
|
698
|
-
}
|
|
699
|
-
const bundles = data.bundles ? data.bundles.map((b) => ({
|
|
700
|
-
bundleVersionId: b.bundleVersionId,
|
|
701
|
-
bundleKey: "",
|
|
702
|
-
bundleLabel: "",
|
|
703
|
-
bundleVersion: 0,
|
|
704
|
-
sortOrder: b.sortOrder ?? 0
|
|
705
|
-
})) : existing.bundles;
|
|
706
|
-
const updated = {
|
|
707
|
-
...existing,
|
|
708
|
-
quotaOverrides: data.quotaOverrides ?? existing.quotaOverrides,
|
|
709
|
-
monthlyNet: data.monthlyNet !== void 0 ? data.monthlyNet : existing.monthlyNet,
|
|
710
|
-
yearlyNet: data.yearlyNet !== void 0 ? data.yearlyNet : existing.yearlyNet,
|
|
711
|
-
marketed: data.marketed ?? existing.marketed,
|
|
712
|
-
changeNote: data.changeNote ?? existing.changeNote,
|
|
713
|
-
bundles,
|
|
714
|
-
updatedAt: this.nowIso()
|
|
715
|
-
};
|
|
716
|
-
this.versions.set(versionId, updated);
|
|
717
|
-
return updated;
|
|
718
|
-
}
|
|
719
|
-
async publishDraft(versionId, publishMeta) {
|
|
720
|
-
const draft = this.versions.get(versionId);
|
|
721
|
-
if (!draft) throw new Error(`BusinessTypeVersion '${versionId}' nicht gefunden`);
|
|
722
|
-
if (draft.publishedAt !== null) {
|
|
723
|
-
throw new Error(`BusinessTypeVersion '${versionId}' ist bereits published`);
|
|
724
|
-
}
|
|
725
|
-
const now = this.nowIso();
|
|
726
|
-
const previous = await this.findLatestLive(draft.businessTypeId);
|
|
727
|
-
if (previous) {
|
|
728
|
-
this.versions.set(previous.id, {
|
|
729
|
-
...previous,
|
|
730
|
-
supersededAt: now,
|
|
731
|
-
updatedAt: now
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
const published = {
|
|
735
|
-
...draft,
|
|
736
|
-
publishedAt: now,
|
|
737
|
-
publishedChanges: publishMeta.publishedChanges,
|
|
738
|
-
nonRegressive: publishMeta.nonRegressive,
|
|
739
|
-
publishedByUserId: publishMeta.publishedByUserId,
|
|
740
|
-
updatedAt: now
|
|
741
|
-
};
|
|
742
|
-
this.versions.set(versionId, published);
|
|
743
|
-
return published;
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
547
|
var FakeMarketingProjectionRepository = class {
|
|
747
548
|
static {
|
|
748
549
|
__name(this, "FakeMarketingProjectionRepository");
|
|
@@ -1186,7 +987,6 @@ __name(createSaasPlatformTestModule, "createSaasPlatformTestModule");
|
|
|
1186
987
|
export {
|
|
1187
988
|
EnforceQuotaInterceptor,
|
|
1188
989
|
FakeBundleRepository,
|
|
1189
|
-
FakeBusinessTypeRepository,
|
|
1190
990
|
FakeMarketingProjectionRepository,
|
|
1191
991
|
FakePlanRepository,
|
|
1192
992
|
FakePlanVersionRepository,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasicat/nest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "NestJS implementation of the SaaS platform: billing, promo codes, admin backend, audit, MFA, adapter ports.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
"js-yaml": "^4.1.0",
|
|
138
138
|
"otplib": "^13.4.1",
|
|
139
139
|
"qrcode": "^1.5.4",
|
|
140
|
-
"@saasicat/spec": "^0.
|
|
141
|
-
"@saasicat/types": "^0.
|
|
140
|
+
"@saasicat/spec": "^0.6.0",
|
|
141
|
+
"@saasicat/types": "^0.6.0"
|
|
142
142
|
},
|
|
143
143
|
"peerDependencies": {
|
|
144
144
|
"@nestjs/common": "^11.0.0",
|