@saasicat/nest 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/admin/index.cjs +3 -8
  2. package/dist/admin/index.d.cts +5 -33
  3. package/dist/admin/index.d.ts +5 -33
  4. package/dist/admin/index.js +2 -2
  5. package/dist/{admin-manifest.config-DxTfZ8-L.d.cts → admin-manifest.config-DyrQNT7M.d.cts} +1 -1
  6. package/dist/{admin-manifest.config-DxTfZ8-L.d.ts → admin-manifest.config-DyrQNT7M.d.ts} +1 -1
  7. package/dist/admin-manifest.service-Cp6uwvmt.d.cts +33 -0
  8. package/dist/admin-manifest.service-UGgzR1x-.d.ts +33 -0
  9. package/dist/{aggregation-DGCyoN5d.d.ts → aggregation-BibpEO0t.d.ts} +6 -59
  10. package/dist/{aggregation-Bt1i_whS.d.cts → aggregation-CfI0bOsQ.d.cts} +6 -59
  11. package/dist/billing/index.cjs +19 -107
  12. package/dist/billing/index.d.cts +8 -30
  13. package/dist/billing/index.d.ts +8 -30
  14. package/dist/billing/index.js +6 -8
  15. package/dist/catalog/index.cjs +1160 -1985
  16. package/dist/catalog/index.d.cts +9 -124
  17. package/dist/catalog/index.d.ts +9 -124
  18. package/dist/catalog/index.js +3 -25
  19. package/dist/checkout-offer/index.js +2 -2
  20. package/dist/{chunk-2VNZYRDV.js → chunk-52UTQRD3.js} +1 -1
  21. package/dist/{chunk-V7HUZ6UQ.js → chunk-5DDCSGZC.js} +1106 -1919
  22. package/dist/{chunk-S2OZ5RIM.js → chunk-6LP7CDS2.js} +15 -68
  23. package/dist/{chunk-NWLOILP6.js → chunk-A2QBXDJC.js} +15 -7
  24. package/dist/{chunk-XSGU2Y2O.js → chunk-CK54YKVK.js} +2 -33
  25. package/dist/{chunk-SYEVGPFC.js → chunk-K3OPNVFR.js} +1 -1
  26. package/dist/{chunk-XCZ3TTFK.js → chunk-N3WANKSA.js} +0 -2
  27. package/dist/{chunk-MV6LW5UB.js → chunk-R2QOSVAA.js} +2 -2
  28. package/dist/{chunk-NFOSITWB.js → chunk-RZU4HIAN.js} +12 -45
  29. package/dist/{chunk-YNEW3L63.js → chunk-SD3TT2BR.js} +1 -1
  30. package/dist/{chunk-P6MYZMXQ.js → chunk-U6HT27J7.js} +3 -8
  31. package/dist/{chunk-7MLGHWKO.js → chunk-WKVBNTYC.js} +2 -0
  32. package/dist/{chunk-ZL4LLE2Z.js → chunk-ZLUGQE5D.js} +1 -1
  33. package/dist/{enforce-quota.interceptor-3HmbeHTM.d.ts → enforce-quota.interceptor-Dj1Kusr5.d.ts} +9 -4
  34. package/dist/{enforce-quota.interceptor-HmdZFg41.d.cts → enforce-quota.interceptor-cv7r80VM.d.cts} +9 -4
  35. package/dist/entitlement/index.cjs +13 -46
  36. package/dist/entitlement/index.d.cts +4 -3
  37. package/dist/entitlement/index.d.ts +4 -3
  38. package/dist/entitlement/index.js +6 -8
  39. package/dist/index.cjs +1348 -2300
  40. package/dist/index.d.cts +8 -7
  41. package/dist/index.d.ts +8 -7
  42. package/dist/index.js +14 -42
  43. package/dist/platform/index.cjs +28 -54
  44. package/dist/platform/index.d.cts +4 -3
  45. package/dist/platform/index.d.ts +4 -3
  46. package/dist/platform/index.js +9 -6
  47. package/dist/promo/index.cjs +2 -2
  48. package/dist/promo/index.js +3 -3
  49. package/dist/registration/index.cjs +2 -34
  50. package/dist/registration/index.d.cts +3 -21
  51. package/dist/registration/index.d.ts +3 -21
  52. package/dist/registration/index.js +1 -3
  53. package/dist/testing/index.cjs +26 -255
  54. package/dist/testing/index.d.cts +5 -37
  55. package/dist/testing/index.d.ts +5 -37
  56. package/dist/testing/index.js +6 -206
  57. package/package.json +3 -3
@@ -5,17 +5,17 @@ import {
5
5
  StaticEntitlementService,
6
6
  StaticFeatureGuard,
7
7
  StaticPlanResolver
8
- } from "../chunk-NWLOILP6.js";
9
- import "../chunk-P6MYZMXQ.js";
8
+ } from "../chunk-A2QBXDJC.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-NFOSITWB.js";
15
- import "../chunk-MV6LW5UB.js";
14
+ import "../chunk-RZU4HIAN.js";
15
+ import "../chunk-R2QOSVAA.js";
16
16
  import "../chunk-NYLON2VC.js";
17
- import "../chunk-7MLGHWKO.js";
18
- import "../chunk-XCZ3TTFK.js";
17
+ import "../chunk-WKVBNTYC.js";
18
+ import "../chunk-N3WANKSA.js";
19
19
  import "../chunk-SABTXESR.js";
20
20
  import "../chunk-L4SUWH5B.js";
21
21
  import {
@@ -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.5.0",
3
+ "version": "0.7.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.5.0",
141
- "@saasicat/types": "^0.5.0"
140
+ "@saasicat/spec": "^0.7.0",
141
+ "@saasicat/types": "^0.7.0"
142
142
  },
143
143
  "peerDependencies": {
144
144
  "@nestjs/common": "^11.0.0",