@saasicat/persistence-testing 1.0.0-rc.15 → 1.0.0-rc.17
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 +14 -1
- package/dist/.build-stamp +1 -1
- package/dist/index.cjs +922 -10
- package/dist/index.d.cts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +922 -10
- 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, CheckoutOfferRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup, AppliedSettingsPort } from '@saasicat/core';
|
|
1
|
+
import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, SubscriberRepository, PaymentEventLog, SubscriberPaymentMethodRepository, 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,27 @@ 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 gateway event scenarios: an event is claimed once per
|
|
31
|
+
* account, a duplicate leaves the caller's transaction usable, and a claim
|
|
32
|
+
* rolled back with its transaction is free for the gateway's retry.
|
|
33
|
+
*/
|
|
34
|
+
paymentEventLog?: PaymentEventLog;
|
|
35
|
+
/**
|
|
36
|
+
* Enables the payment method scenarios: one payment method in use per
|
|
37
|
+
* subscriber however many confirmations arrive at once, the one it
|
|
38
|
+
* replaced kept as history, and a confirmation recorded twice recognised.
|
|
39
|
+
* Its subscribers come from `seed.createSubscriber`.
|
|
40
|
+
*/
|
|
41
|
+
subscriberPaymentMethodRepository?: SubscriberPaymentMethodRepository;
|
|
21
42
|
/**
|
|
22
43
|
* Enables the checkout offer scenarios: an offer is consumed once, and a
|
|
23
44
|
* consume on a transaction that rolls back leaves it open. Neither shipped
|
|
@@ -124,6 +145,19 @@ interface ContractSeed {
|
|
|
124
145
|
}): Promise<{
|
|
125
146
|
promoCodeId: string;
|
|
126
147
|
}>;
|
|
148
|
+
/**
|
|
149
|
+
* A subscriber row for a contract scenario to name, linked to no tenant.
|
|
150
|
+
*
|
|
151
|
+
* A fixture writer for the reason `createBundleVersion` is one: the
|
|
152
|
+
* subscriber repository is a subject of its own scenarios, and a contract
|
|
153
|
+
* scenario that failed because of it would say the wrong thing. Optional
|
|
154
|
+
* like the port it stands beside; the contract scenarios report it missing.
|
|
155
|
+
*/
|
|
156
|
+
createSubscriber?(input: {
|
|
157
|
+
legalName: string;
|
|
158
|
+
}): Promise<{
|
|
159
|
+
subscriberId: string;
|
|
160
|
+
}>;
|
|
127
161
|
}
|
|
128
162
|
interface PersistenceContractHarness {
|
|
129
163
|
adapter: ContractAdapterInstances;
|
|
@@ -139,7 +173,7 @@ interface PersistenceContractHarness {
|
|
|
139
173
|
* Each names the members its scenarios need; `contract.ts` holds the list with
|
|
140
174
|
* what each one checks.
|
|
141
175
|
*/
|
|
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';
|
|
176
|
+
type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'subscribers' | 'paymentEventLog' | 'subscriberPaymentMethods' | 'checkoutOffers' | 'appliedSettings';
|
|
143
177
|
interface PersistenceAdapterContractOptions {
|
|
144
178
|
/** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
|
|
145
179
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, CheckoutOfferRepository, TenantSubscriptionWritePort, BundleRepository, SubscriptionBundleRepository, PlanRepository, PromoSubscriptionLookup, AppliedSettingsPort } from '@saasicat/core';
|
|
1
|
+
import { PersistenceCapabilities, TransactionRunner, SubscriptionRepository, PlanVersionRepository, PromoCodeRepository, PromoCodeRedemptionRepository, MfaPort, AuditPort, AuditQueryPort, SubscriptionContractRepository, SubscriberRepository, PaymentEventLog, SubscriberPaymentMethodRepository, 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,27 @@ 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 gateway event scenarios: an event is claimed once per
|
|
31
|
+
* account, a duplicate leaves the caller's transaction usable, and a claim
|
|
32
|
+
* rolled back with its transaction is free for the gateway's retry.
|
|
33
|
+
*/
|
|
34
|
+
paymentEventLog?: PaymentEventLog;
|
|
35
|
+
/**
|
|
36
|
+
* Enables the payment method scenarios: one payment method in use per
|
|
37
|
+
* subscriber however many confirmations arrive at once, the one it
|
|
38
|
+
* replaced kept as history, and a confirmation recorded twice recognised.
|
|
39
|
+
* Its subscribers come from `seed.createSubscriber`.
|
|
40
|
+
*/
|
|
41
|
+
subscriberPaymentMethodRepository?: SubscriberPaymentMethodRepository;
|
|
21
42
|
/**
|
|
22
43
|
* Enables the checkout offer scenarios: an offer is consumed once, and a
|
|
23
44
|
* consume on a transaction that rolls back leaves it open. Neither shipped
|
|
@@ -124,6 +145,19 @@ interface ContractSeed {
|
|
|
124
145
|
}): Promise<{
|
|
125
146
|
promoCodeId: string;
|
|
126
147
|
}>;
|
|
148
|
+
/**
|
|
149
|
+
* A subscriber row for a contract scenario to name, linked to no tenant.
|
|
150
|
+
*
|
|
151
|
+
* A fixture writer for the reason `createBundleVersion` is one: the
|
|
152
|
+
* subscriber repository is a subject of its own scenarios, and a contract
|
|
153
|
+
* scenario that failed because of it would say the wrong thing. Optional
|
|
154
|
+
* like the port it stands beside; the contract scenarios report it missing.
|
|
155
|
+
*/
|
|
156
|
+
createSubscriber?(input: {
|
|
157
|
+
legalName: string;
|
|
158
|
+
}): Promise<{
|
|
159
|
+
subscriberId: string;
|
|
160
|
+
}>;
|
|
127
161
|
}
|
|
128
162
|
interface PersistenceContractHarness {
|
|
129
163
|
adapter: ContractAdapterInstances;
|
|
@@ -139,7 +173,7 @@ interface PersistenceContractHarness {
|
|
|
139
173
|
* Each names the members its scenarios need; `contract.ts` holds the list with
|
|
140
174
|
* what each one checks.
|
|
141
175
|
*/
|
|
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';
|
|
176
|
+
type ContractGap = 'atomicPlanBinding' | 'atomicOnboarding' | 'promoCodes' | 'promoCodeRedemptions' | 'promoSubscriptionLookup' | 'planRepository' | 'planLifecycle' | 'planRetirement' | 'planVersionReads' | 'planVersionRetirement' | 'bundleRepository' | 'bundleValidity' | 'bundleDraftDiscard' | 'bundleDraftPublish' | 'bundleRetirement' | 'bundleBookings' | 'halfCancelledBookingSeed' | 'countByPlanVersionId' | 'audit' | 'mfa' | 'subscriptionContracts' | 'subscribers' | 'paymentEventLog' | 'subscriberPaymentMethods' | 'checkoutOffers' | 'appliedSettings';
|
|
143
177
|
interface PersistenceAdapterContractOptions {
|
|
144
178
|
/** Display name in the test output, e.g. `'adapter-prisma @ postgres16'`. */
|
|
145
179
|
name: string;
|