@saasicat/persistence-testing 1.0.0-rc.13 → 1.0.0-rc.15

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,10 +1,11 @@
1
- import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup, AppliedSettingsPort } from '@saasicat/core';
1
+ import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, CheckoutOfferRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup, AppliedSettingsPort } from '@saasicat/core';
2
2
 
3
3
  /**
4
4
  * Port instances under test. Required members define the minimum an adapter
5
5
  * must ship to call itself a SaaSiCat persistence adapter; optional members
6
- * activate additional scenario groups (absent the group reports as
7
- * skipped, never silently).
6
+ * activate additional scenario groups. An absent member fails its scenarios
7
+ * unless the contract options declare it in `gaps`, in which case they report
8
+ * as skipped.
8
9
  */
9
10
  interface ContractAdapterInstances {
10
11
  capabilities: PersistenceCapabilities;
@@ -17,6 +18,13 @@ interface ContractAdapterInstances {
17
18
  audit?: AuditPort;
18
19
  auditQuery?: AuditQueryPort;
19
20
  subscriptionContractRepository?: SubscriptionContractRepository;
21
+ /**
22
+ * Enables the checkout offer scenarios: an offer is consumed once, and a
23
+ * consume on a transaction that rolls back leaves it open. Neither shipped
24
+ * adapter provides one; an application that implements the port wires it
25
+ * here.
26
+ */
27
+ checkoutOfferRepository?: CheckoutOfferRepository;
20
28
  /**
21
29
  * Enables the atomic plan-binding scenarios. Adapters should expose this
22
30
  * member only for a mode that promises to keep `plan`,
@@ -125,11 +133,25 @@ interface PersistenceContractHarness {
125
133
  /** Teardown after the last scenario (close pools etc.). */
126
134
  close?(): Promise<void>;
127
135
  }
136
+ /**
137
+ * A part of the contract an adapter may deliberately not provide.
138
+ *
139
+ * Each names the members its scenarios need; `contract.ts` holds the list with
140
+ * what each one checks.
141
+ */
142
+ type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'checkoutOffers' | 'appliedSettings';
128
143
  interface PersistenceAdapterContractOptions {
129
144
  /** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
130
145
  name: string;
131
146
  /** Builds the harness once for the whole suite. */
132
147
  create(): Promise<PersistenceContractHarness>;
148
+ /**
149
+ * The parts this adapter deliberately does not provide. Their scenarios
150
+ * report as skipped; a part missing without being named here fails its
151
+ * scenarios, and a part named here that the harness does provide fails
152
+ * the suite.
153
+ */
154
+ gaps?: readonly ContractGap[];
133
155
  }
134
156
 
135
157
  /**
@@ -144,4 +166,4 @@ interface PersistenceAdapterContractOptions {
144
166
  */
145
167
  declare function persistenceAdapterContract(options: PersistenceAdapterContractOptions): void;
146
168
 
147
- export { type ContractAdapterInstances, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };
169
+ export { type ContractAdapterInstances, type ContractGap, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup, AppliedSettingsPort } from '@saasicat/core';
1
+ import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, CheckoutOfferRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup, AppliedSettingsPort } from '@saasicat/core';
2
2
 
3
3
  /**
4
4
  * Port instances under test. Required members define the minimum an adapter
5
5
  * must ship to call itself a SaaSiCat persistence adapter; optional members
6
- * activate additional scenario groups (absent the group reports as
7
- * skipped, never silently).
6
+ * activate additional scenario groups. An absent member fails its scenarios
7
+ * unless the contract options declare it in `gaps`, in which case they report
8
+ * as skipped.
8
9
  */
9
10
  interface ContractAdapterInstances {
10
11
  capabilities: PersistenceCapabilities;
@@ -17,6 +18,13 @@ interface ContractAdapterInstances {
17
18
  audit?: AuditPort;
18
19
  auditQuery?: AuditQueryPort;
19
20
  subscriptionContractRepository?: SubscriptionContractRepository;
21
+ /**
22
+ * Enables the checkout offer scenarios: an offer is consumed once, and a
23
+ * consume on a transaction that rolls back leaves it open. Neither shipped
24
+ * adapter provides one; an application that implements the port wires it
25
+ * here.
26
+ */
27
+ checkoutOfferRepository?: CheckoutOfferRepository;
20
28
  /**
21
29
  * Enables the atomic plan-binding scenarios. Adapters should expose this
22
30
  * member only for a mode that promises to keep `plan`,
@@ -125,11 +133,25 @@ interface PersistenceContractHarness {
125
133
  /** Teardown after the last scenario (close pools etc.). */
126
134
  close?(): Promise<void>;
127
135
  }
136
+ /**
137
+ * A part of the contract an adapter may deliberately not provide.
138
+ *
139
+ * Each names the members its scenarios need; `contract.ts` holds the list with
140
+ * what each one checks.
141
+ */
142
+ type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'checkoutOffers' | 'appliedSettings';
128
143
  interface PersistenceAdapterContractOptions {
129
144
  /** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
130
145
  name: string;
131
146
  /** Builds the harness once for the whole suite. */
132
147
  create(): Promise<PersistenceContractHarness>;
148
+ /**
149
+ * The parts this adapter deliberately does not provide. Their scenarios
150
+ * report as skipped; a part missing without being named here fails its
151
+ * scenarios, and a part named here that the harness does provide fails
152
+ * the suite.
153
+ */
154
+ gaps?: readonly ContractGap[];
133
155
  }
134
156
 
135
157
  /**
@@ -144,4 +166,4 @@ interface PersistenceAdapterContractOptions {
144
166
  */
145
167
  declare function persistenceAdapterContract(options: PersistenceAdapterContractOptions): void;
146
168
 
147
- export { type ContractAdapterInstances, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };
169
+ export { type ContractAdapterInstances, type ContractGap, type ContractSeed, type PersistenceAdapterContractOptions, type PersistenceContractHarness, persistenceAdapterContract };