@saasicat/persistence-testing 1.0.0-rc.14 → 1.0.0-rc.16
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/README.md +4 -1
- package/dist/.build-stamp +1 -1
- package/dist/index.cjs +534 -5
- package/dist/index.d.cts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +534 -5
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, SubscriberRepository, 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
|
|
@@ -18,6 +18,21 @@ interface ContractAdapterInstances {
|
|
|
18
18
|
audit?: AuditPort;
|
|
19
19
|
auditQuery?: AuditQueryPort;
|
|
20
20
|
subscriptionContractRepository?: SubscriptionContractRepository;
|
|
21
|
+
/**
|
|
22
|
+
* Enables the subscriber scenarios: a customer number the database
|
|
23
|
+
* counts, one live subscriber per tenant however many callers create one
|
|
24
|
+
* at once, and a correction that records the values it replaced. A
|
|
25
|
+
* contract names its subscriber, so the contract scenarios write theirs
|
|
26
|
+
* through `seed.createSubscriber` rather than through this port.
|
|
27
|
+
*/
|
|
28
|
+
subscriberRepository?: SubscriberRepository;
|
|
29
|
+
/**
|
|
30
|
+
* Enables the checkout offer scenarios: an offer is consumed once, and a
|
|
31
|
+
* consume on a transaction that rolls back leaves it open. Neither shipped
|
|
32
|
+
* adapter provides one; an application that implements the port wires it
|
|
33
|
+
* here.
|
|
34
|
+
*/
|
|
35
|
+
checkoutOfferRepository?: CheckoutOfferRepository;
|
|
21
36
|
/**
|
|
22
37
|
* Enables the atomic plan-binding scenarios. Adapters should expose this
|
|
23
38
|
* member only for a mode that promises to keep `plan`,
|
|
@@ -117,6 +132,19 @@ interface ContractSeed {
|
|
|
117
132
|
}): Promise<{
|
|
118
133
|
promoCodeId: string;
|
|
119
134
|
}>;
|
|
135
|
+
/**
|
|
136
|
+
* A subscriber row for a contract scenario to name, linked to no tenant.
|
|
137
|
+
*
|
|
138
|
+
* A fixture writer for the reason `createBundleVersion` is one: the
|
|
139
|
+
* subscriber repository is a subject of its own scenarios, and a contract
|
|
140
|
+
* scenario that failed because of it would say the wrong thing. Optional
|
|
141
|
+
* like the port it stands beside; the contract scenarios report it missing.
|
|
142
|
+
*/
|
|
143
|
+
createSubscriber?(input: {
|
|
144
|
+
legalName: string;
|
|
145
|
+
}): Promise<{
|
|
146
|
+
subscriberId: string;
|
|
147
|
+
}>;
|
|
120
148
|
}
|
|
121
149
|
interface PersistenceContractHarness {
|
|
122
150
|
adapter: ContractAdapterInstances;
|
|
@@ -132,7 +160,7 @@ interface PersistenceContractHarness {
|
|
|
132
160
|
* Each names the members its scenarios need; `contract.ts` holds the list with
|
|
133
161
|
* what each one checks.
|
|
134
162
|
*/
|
|
135
|
-
type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'appliedSettings';
|
|
163
|
+
type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'subscribers' | 'checkoutOffers' | 'appliedSettings';
|
|
136
164
|
interface PersistenceAdapterContractOptions {
|
|
137
165
|
/** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
|
|
138
166
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, SubscriberRepository, 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
|
|
@@ -18,6 +18,21 @@ interface ContractAdapterInstances {
|
|
|
18
18
|
audit?: AuditPort;
|
|
19
19
|
auditQuery?: AuditQueryPort;
|
|
20
20
|
subscriptionContractRepository?: SubscriptionContractRepository;
|
|
21
|
+
/**
|
|
22
|
+
* Enables the subscriber scenarios: a customer number the database
|
|
23
|
+
* counts, one live subscriber per tenant however many callers create one
|
|
24
|
+
* at once, and a correction that records the values it replaced. A
|
|
25
|
+
* contract names its subscriber, so the contract scenarios write theirs
|
|
26
|
+
* through `seed.createSubscriber` rather than through this port.
|
|
27
|
+
*/
|
|
28
|
+
subscriberRepository?: SubscriberRepository;
|
|
29
|
+
/**
|
|
30
|
+
* Enables the checkout offer scenarios: an offer is consumed once, and a
|
|
31
|
+
* consume on a transaction that rolls back leaves it open. Neither shipped
|
|
32
|
+
* adapter provides one; an application that implements the port wires it
|
|
33
|
+
* here.
|
|
34
|
+
*/
|
|
35
|
+
checkoutOfferRepository?: CheckoutOfferRepository;
|
|
21
36
|
/**
|
|
22
37
|
* Enables the atomic plan-binding scenarios. Adapters should expose this
|
|
23
38
|
* member only for a mode that promises to keep `plan`,
|
|
@@ -117,6 +132,19 @@ interface ContractSeed {
|
|
|
117
132
|
}): Promise<{
|
|
118
133
|
promoCodeId: string;
|
|
119
134
|
}>;
|
|
135
|
+
/**
|
|
136
|
+
* A subscriber row for a contract scenario to name, linked to no tenant.
|
|
137
|
+
*
|
|
138
|
+
* A fixture writer for the reason `createBundleVersion` is one: the
|
|
139
|
+
* subscriber repository is a subject of its own scenarios, and a contract
|
|
140
|
+
* scenario that failed because of it would say the wrong thing. Optional
|
|
141
|
+
* like the port it stands beside; the contract scenarios report it missing.
|
|
142
|
+
*/
|
|
143
|
+
createSubscriber?(input: {
|
|
144
|
+
legalName: string;
|
|
145
|
+
}): Promise<{
|
|
146
|
+
subscriberId: string;
|
|
147
|
+
}>;
|
|
120
148
|
}
|
|
121
149
|
interface PersistenceContractHarness {
|
|
122
150
|
adapter: ContractAdapterInstances;
|
|
@@ -132,7 +160,7 @@ interface PersistenceContractHarness {
|
|
|
132
160
|
* Each names the members its scenarios need; `contract.ts` holds the list with
|
|
133
161
|
* what each one checks.
|
|
134
162
|
*/
|
|
135
|
-
type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'appliedSettings';
|
|
163
|
+
type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'subscribers' | 'checkoutOffers' | 'appliedSettings';
|
|
136
164
|
interface PersistenceAdapterContractOptions {
|
|
137
165
|
/** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
|
|
138
166
|
name: string;
|