@saasicat/persistence-testing 1.0.0-rc.6 → 1.0.0-rc.7

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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, TenantSubscriptionWritePort, BundleRepository, PlanRepository, PromoSubscriptionLookup } from '@saasicat/core';
1
+ import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup } from '@saasicat/core';
2
2
 
3
3
  /**
4
4
  * Port instances under test. Required members define the minimum an adapter
@@ -25,6 +25,14 @@ interface ContractAdapterInstances {
25
25
  tenantSubscriptionWrite?: TenantSubscriptionWritePort;
26
26
  /** Enables BundleVersion validity-window and auto-succession scenarios. */
27
27
  bundleRepository?: BundleRepository;
28
+ /**
29
+ * Enables the booking scenarios — the junction a tenant's bundles hang off.
30
+ *
31
+ * Separate from `bundleRepository`, which is the catalog: one answers what
32
+ * may be sold, the other what a tenant actually bought and for which
33
+ * period. `adapter-drizzle` has neither yet.
34
+ */
35
+ subscriptionBundleRepository?: SubscriptionBundleRepository;
28
36
  /** Enables PlanVersion lifecycle, identity and validity-window scenarios. */
29
37
  planRepository?: PlanRepository;
30
38
  /**
@@ -63,6 +71,34 @@ interface ContractSeed {
63
71
  }): Promise<{
64
72
  subscriptionId: string;
65
73
  }>;
74
+ /**
75
+ * A published BundleVersion to book against.
76
+ *
77
+ * A fixture writer rather than a call into `bundleRepository`: the catalog
78
+ * repository is a subject of the suite, not a tool for setting up someone
79
+ * else's scenario, and a booking scenario that failed because the catalog
80
+ * did would say the wrong thing.
81
+ *
82
+ * Optional because an adapter may not carry the catalog tables at all —
83
+ * `adapter-drizzle` does not. A required writer nobody can implement is a
84
+ * contract that lies about what conformance means; the booking scenarios
85
+ * gate on this and report the gap as a skip instead.
86
+ */
87
+ createBundleVersion?(input: {
88
+ bundleKey: string;
89
+ features: string[];
90
+ }): Promise<{
91
+ bundleVersionId: string;
92
+ }>;
93
+ /**
94
+ * Clears a booking's `canceledAt` while leaving `canceledEffectiveAt`.
95
+ *
96
+ * A shape no repository method produces, and one the nullable columns
97
+ * nonetheless permit — so the adapters have to agree on how to read it.
98
+ * Optional: a harness that cannot reach its store directly says so and the
99
+ * scenario skips, rather than the scenario inventing a way in.
100
+ */
101
+ clearBookingRequestDate?(subscriptionBundleId: string): Promise<void>;
66
102
  createPromoCode(input: {
67
103
  code: string;
68
104
  maxRedemptions: number | null;
@@ -82,8 +118,6 @@ interface PersistenceContractHarness {
82
118
  interface PersistenceAdapterContractOptions {
83
119
  /** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
84
120
  name: string;
85
- /** Project identity used by catalog lifecycle scenarios. */
86
- projectKey: string;
87
121
  /** Builds the harness once for the whole suite. */
88
122
  create(): Promise<PersistenceContractHarness>;
89
123
  }
@@ -94,7 +128,6 @@ interface PersistenceAdapterContractOptions {
94
128
  * ```ts
95
129
  * persistenceAdapterContract({
96
130
  * name: 'adapter-prisma @ postgres',
97
- * projectKey: 'my-app',
98
131
  * create: () => createPrismaHarness(),
99
132
  * });
100
133
  * ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, TenantSubscriptionWritePort, BundleRepository, PlanRepository, PromoSubscriptionLookup } from '@saasicat/core';
1
+ import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup } from '@saasicat/core';
2
2
 
3
3
  /**
4
4
  * Port instances under test. Required members define the minimum an adapter
@@ -25,6 +25,14 @@ interface ContractAdapterInstances {
25
25
  tenantSubscriptionWrite?: TenantSubscriptionWritePort;
26
26
  /** Enables BundleVersion validity-window and auto-succession scenarios. */
27
27
  bundleRepository?: BundleRepository;
28
+ /**
29
+ * Enables the booking scenarios — the junction a tenant's bundles hang off.
30
+ *
31
+ * Separate from `bundleRepository`, which is the catalog: one answers what
32
+ * may be sold, the other what a tenant actually bought and for which
33
+ * period. `adapter-drizzle` has neither yet.
34
+ */
35
+ subscriptionBundleRepository?: SubscriptionBundleRepository;
28
36
  /** Enables PlanVersion lifecycle, identity and validity-window scenarios. */
29
37
  planRepository?: PlanRepository;
30
38
  /**
@@ -63,6 +71,34 @@ interface ContractSeed {
63
71
  }): Promise<{
64
72
  subscriptionId: string;
65
73
  }>;
74
+ /**
75
+ * A published BundleVersion to book against.
76
+ *
77
+ * A fixture writer rather than a call into `bundleRepository`: the catalog
78
+ * repository is a subject of the suite, not a tool for setting up someone
79
+ * else's scenario, and a booking scenario that failed because the catalog
80
+ * did would say the wrong thing.
81
+ *
82
+ * Optional because an adapter may not carry the catalog tables at all —
83
+ * `adapter-drizzle` does not. A required writer nobody can implement is a
84
+ * contract that lies about what conformance means; the booking scenarios
85
+ * gate on this and report the gap as a skip instead.
86
+ */
87
+ createBundleVersion?(input: {
88
+ bundleKey: string;
89
+ features: string[];
90
+ }): Promise<{
91
+ bundleVersionId: string;
92
+ }>;
93
+ /**
94
+ * Clears a booking's `canceledAt` while leaving `canceledEffectiveAt`.
95
+ *
96
+ * A shape no repository method produces, and one the nullable columns
97
+ * nonetheless permit — so the adapters have to agree on how to read it.
98
+ * Optional: a harness that cannot reach its store directly says so and the
99
+ * scenario skips, rather than the scenario inventing a way in.
100
+ */
101
+ clearBookingRequestDate?(subscriptionBundleId: string): Promise<void>;
66
102
  createPromoCode(input: {
67
103
  code: string;
68
104
  maxRedemptions: number | null;
@@ -82,8 +118,6 @@ interface PersistenceContractHarness {
82
118
  interface PersistenceAdapterContractOptions {
83
119
  /** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
84
120
  name: string;
85
- /** Project identity used by catalog lifecycle scenarios. */
86
- projectKey: string;
87
121
  /** Builds the harness once for the whole suite. */
88
122
  create(): Promise<PersistenceContractHarness>;
89
123
  }
@@ -94,7 +128,6 @@ interface PersistenceAdapterContractOptions {
94
128
  * ```ts
95
129
  * persistenceAdapterContract({
96
130
  * name: 'adapter-prisma @ postgres',
97
- * projectKey: 'my-app',
98
131
  * create: () => createPrismaHarness(),
99
132
  * });
100
133
  * ```