@stancer/stancer 1.1.0 → 1.1.1
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/CHANGELOG.md +4 -1
- package/dist/index.d.ts +60 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/payment-intent/repository.d.ts +1 -1
- package/dist/payment-intent/repository.d.ts.map +1 -1
- package/package.json +33 -24
- package/src/address/api-endpoint.ts +0 -30
- package/src/address/model.ts +0 -79
- package/src/address/repository.ts +0 -18
- package/src/address/validator.ts +0 -34
- package/src/api-endpoint/abstract-api-endpoint.ts +0 -310
- package/src/api-endpoint/configuration.ts +0 -125
- package/src/api-endpoint/http/fetch-http-client.ts +0 -36
- package/src/api-endpoint/http/http.ts +0 -75
- package/src/api-endpoint/http/index.ts +0 -2
- package/src/api-endpoint/version.ts +0 -4
- package/src/card/api-endpoint.ts +0 -39
- package/src/card/enum/funding.ts +0 -11
- package/src/card/enum/nature.ts +0 -7
- package/src/card/enum/network.ts +0 -16
- package/src/card/model.ts +0 -139
- package/src/card/repository.ts +0 -11
- package/src/card/validator.ts +0 -79
- package/src/core/abstract-model.ts +0 -126
- package/src/core/abstract-repository.ts +0 -201
- package/src/core/common/branded-type.ts +0 -15
- package/src/core/common/handler/date-handler.ts +0 -31
- package/src/core/common/handler/enum-handler.ts +0 -18
- package/src/core/common/handler/handler.ts +0 -64
- package/src/core/common/handler/id-handler.ts +0 -27
- package/src/core/common/handler/metadata-handler.ts +0 -19
- package/src/core/common/id-validator.ts +0 -23
- package/src/core/common/mutation-tracked-object.ts +0 -49
- package/src/core/endpoint-interface.ts +0 -43
- package/src/core/error/base-error.ts +0 -1
- package/src/core/error/endpoint/api/api-conflict-error.ts +0 -7
- package/src/core/error/endpoint/api/api-error.ts +0 -10
- package/src/core/error/endpoint/api/api-not-found-error.ts +0 -7
- package/src/core/error/endpoint/api/api-unauthorized-error.ts +0 -7
- package/src/core/error/endpoint/api/api-unknown-error.ts +0 -7
- package/src/core/error/endpoint/api/api-validation-error.ts +0 -13
- package/src/core/error/endpoint/api/index.ts +0 -6
- package/src/core/error/endpoint/route-inaccessible-error.ts +0 -8
- package/src/core/error/unpopulated-error.ts +0 -3
- package/src/core/error/unsendable-error.ts +0 -3
- package/src/core/error/validation-error.ts +0 -3
- package/src/core/validator.ts +0 -129
- package/src/customer/api-endpoint.ts +0 -29
- package/src/customer/model.ts +0 -113
- package/src/customer/repository.ts +0 -14
- package/src/customer/validator.ts +0 -26
- package/src/event/model.ts +0 -42
- package/src/payment/api-endpoint.ts +0 -118
- package/src/payment/enum/currency.ts +0 -14
- package/src/payment/enum/method.ts +0 -2
- package/src/payment/enum/status.ts +0 -21
- package/src/payment/model.ts +0 -378
- package/src/payment/repository.ts +0 -73
- package/src/payment/validator.ts +0 -96
- package/src/payment-intent/api-endpoint.ts +0 -124
- package/src/payment-intent/enum/status.ts +0 -21
- package/src/payment-intent/enum/threeds.ts +0 -2
- package/src/payment-intent/model.ts +0 -271
- package/src/payment-intent/repository.ts +0 -85
- package/src/payment-intent/validator.ts +0 -45
- package/src/payout/model.ts +0 -8
- package/src/refund/api-endpoint.ts +0 -33
- package/src/refund/enum/refund-status.ts +0 -11
- package/src/refund/model.ts +0 -90
- package/src/refund/repository.ts +0 -14
- package/src/refund/validator.ts +0 -44
- package/src/sepa/api-endpoint.ts +0 -26
- package/src/sepa/model.ts +0 -80
- package/src/sepa/repository.ts +0 -11
- package/src/sepa/validator.ts +0 -56
- package/src/webhook/api-endpoint.ts +0 -36
- package/src/webhook/model.ts +0 -140
- package/src/webhook/repository.ts +0 -14
- package/src/webhook/validator.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -5,8 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [1.1.1] 2026-12-04
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- better import and export
|
|
10
13
|
|
|
11
14
|
## [1.1.0] 2026-11-27
|
|
12
15
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AddressRepository } from '#address/repository.js';
|
|
2
|
+
import { CardRepository } from '#card/repository.js';
|
|
3
|
+
import { CustomerRepository } from '#customer/repository.js';
|
|
4
|
+
import { PaymentIntentRepository } from '#payment-intent/repository.js';
|
|
5
|
+
import { PaymentRepository } from '#payment/repository.js';
|
|
6
|
+
import { RefundRepository } from '#refund/repository.js';
|
|
7
|
+
import { SepaRepository } from '#sepa/repository.js';
|
|
8
|
+
import { WebhookRepository } from '#webhook/repository.js';
|
|
9
|
+
export { ApiVersion } from '#api/version.js';
|
|
10
|
+
export { Configuration } from '#api/configuration.js';
|
|
11
|
+
export { StancerError } from '#error/base-error.js';
|
|
12
|
+
export { StancerUnpopulatedError } from '#error/unpopulated-error.js';
|
|
13
|
+
export { UnsendableError } from '#error/unsendable-error.js';
|
|
14
|
+
export { StancerValidationError } from '#error/validation-error.js';
|
|
15
|
+
export { StancerRouteInaccessibleError } from '#error/endpoint/route-inaccessible-error.js';
|
|
16
|
+
export { StancerApiConflictError, StancerApiError, StancerApiNotFoundError, StancerApiUnauthorizedError, StancerApiUnknownError, StancerApiValidationError, type StancerApiValidationErrorDetails, } from '#error/endpoint/api/index.js';
|
|
17
|
+
export { AddressRepository } from '#address/repository.js';
|
|
18
|
+
export { CardRepository } from '#card/repository.js';
|
|
19
|
+
export { CustomerRepository } from '#customer/repository.js';
|
|
20
|
+
export { PaymentIntentRepository } from '#payment-intent/repository.js';
|
|
21
|
+
export { PaymentRepository } from '#payment/repository.js';
|
|
22
|
+
export { RefundRepository } from '#refund/repository.js';
|
|
23
|
+
export { SepaRepository } from '#sepa/repository.js';
|
|
24
|
+
export { WebhookRepository } from '#webhook/repository.js';
|
|
25
|
+
export declare const addressRepository: AddressRepository;
|
|
26
|
+
export declare const cardRepository: CardRepository;
|
|
27
|
+
export declare const customerRepository: CustomerRepository;
|
|
28
|
+
export declare const paymentRepository: PaymentRepository;
|
|
29
|
+
export declare const paymentIntentRepository: PaymentIntentRepository;
|
|
30
|
+
export declare const refundRepository: RefundRepository;
|
|
31
|
+
export declare const sepaRepository: SepaRepository;
|
|
32
|
+
export declare const webhookRepository: WebhookRepository;
|
|
33
|
+
export { AddressModel } from '#address/model.js';
|
|
34
|
+
export { CardModel } from '#card/model.js';
|
|
35
|
+
export { CustomerModel } from '#customer/model.js';
|
|
36
|
+
export { EventModel, idEvent } from '#event/model.js';
|
|
37
|
+
export { PaymentIntentModel, idPaymentIntent } from '#payment-intent/model.js';
|
|
38
|
+
export { idPayment, paymentAmount, PaymentModel } from '#payment/model.js';
|
|
39
|
+
export { IdPayout, PayoutModel } from '#payout/model.js';
|
|
40
|
+
export { idRefund, isRefundAmount, refundAmount, RefundModel } from '#refund/model.js';
|
|
41
|
+
export { IdSepa, SepaModel } from '#sepa/model.js';
|
|
42
|
+
export { idWebhook, WebhookModel } from '#webhook/model.js';
|
|
43
|
+
export type { AddressData, IdAddress } from '#address/model.js';
|
|
44
|
+
export type { CardData, IdCard } from '#card/model.js';
|
|
45
|
+
export type { CustomerData, IdCustomer } from '#customer/model.js';
|
|
46
|
+
export type { EventData } from '#event/model.js';
|
|
47
|
+
export type { IdPaymentIntent, PaymentIntentData } from '#payment-intent/model.js';
|
|
48
|
+
export type { Auth, Device, IdPayment, PaymentAmount, PaymentData, Wallet } from '#payment/model.js';
|
|
49
|
+
export type { IdRefund, RefundAmount, RefundData } from '#refund/model.js';
|
|
50
|
+
export type { SepaData } from '#sepa/model.js';
|
|
51
|
+
export type { IdWebhook, WebhookData } from '#webhook/model.js';
|
|
52
|
+
export { type FundingCard, FundingCardEnum } from '#card/enum/funding.js';
|
|
53
|
+
export { type NatureCard, NatureCardEnum } from '#card/enum/nature.js';
|
|
54
|
+
export { type NetworkCard, NetworkCardEnum, type PreferredNetworkCard, PreferredNetworkCardEnum, } from '#card/enum/network.js';
|
|
55
|
+
export { type PaymentIntentStatus, PaymentIntentStatusEnum, failedPaymentIntentStatus, succeedPaymentIntentStatus, } from '#payment-intent/enum/status.js';
|
|
56
|
+
export { type ThreeDS, ThreeDSEnum } from '#payment-intent/enum/threeds.js';
|
|
57
|
+
export { type Currency, CurrencyEnum } from '#payment/enum/currency.js';
|
|
58
|
+
export { type Method, MethodEnum } from '#payment/enum/method.js';
|
|
59
|
+
export { type PaymentStatus, StatusEnum, succeedPaymentStatus } from '#payment/enum/status.js';
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,4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AAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,mBAAmB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,KAAK,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,KAAK,MAAM,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,KAAK,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AddressRepository } from '#address/repository.js';
|
|
2
|
+
import { CardRepository } from '#card/repository.js';
|
|
3
|
+
import { CustomerRepository } from '#customer/repository.js';
|
|
4
|
+
import { PaymentIntentRepository } from '#payment-intent/repository.js';
|
|
5
|
+
import { PaymentRepository } from '#payment/repository.js';
|
|
6
|
+
import { RefundRepository } from '#refund/repository.js';
|
|
7
|
+
import { SepaRepository } from '#sepa/repository.js';
|
|
8
|
+
import { WebhookRepository } from '#webhook/repository.js';
|
|
9
|
+
// Configuration
|
|
10
|
+
export { ApiVersion } from '#api/version.js';
|
|
11
|
+
export { Configuration } from '#api/configuration.js';
|
|
12
|
+
// Errors
|
|
13
|
+
export { StancerError } from '#error/base-error.js';
|
|
14
|
+
export { StancerUnpopulatedError } from '#error/unpopulated-error.js';
|
|
15
|
+
export { UnsendableError } from '#error/unsendable-error.js';
|
|
16
|
+
export { StancerValidationError } from '#error/validation-error.js';
|
|
17
|
+
export { StancerRouteInaccessibleError } from '#error/endpoint/route-inaccessible-error.js';
|
|
18
|
+
export { StancerApiConflictError, StancerApiError, StancerApiNotFoundError, StancerApiUnauthorizedError, StancerApiUnknownError, StancerApiValidationError, } from '#error/endpoint/api/index.js';
|
|
19
|
+
// Repository classes
|
|
20
|
+
export { AddressRepository } from '#address/repository.js';
|
|
21
|
+
export { CardRepository } from '#card/repository.js';
|
|
22
|
+
export { CustomerRepository } from '#customer/repository.js';
|
|
23
|
+
export { PaymentIntentRepository } from '#payment-intent/repository.js';
|
|
24
|
+
export { PaymentRepository } from '#payment/repository.js';
|
|
25
|
+
export { RefundRepository } from '#refund/repository.js';
|
|
26
|
+
export { SepaRepository } from '#sepa/repository.js';
|
|
27
|
+
export { WebhookRepository } from '#webhook/repository.js';
|
|
28
|
+
// Ready-to-use repositories (configure via Configuration.init() first)
|
|
29
|
+
export const addressRepository = new AddressRepository();
|
|
30
|
+
export const cardRepository = new CardRepository();
|
|
31
|
+
export const customerRepository = new CustomerRepository();
|
|
32
|
+
export const paymentRepository = new PaymentRepository();
|
|
33
|
+
export const paymentIntentRepository = new PaymentIntentRepository();
|
|
34
|
+
export const refundRepository = new RefundRepository();
|
|
35
|
+
export const sepaRepository = new SepaRepository();
|
|
36
|
+
export const webhookRepository = new WebhookRepository();
|
|
37
|
+
// Models
|
|
38
|
+
export { AddressModel } from '#address/model.js';
|
|
39
|
+
export { CardModel } from '#card/model.js';
|
|
40
|
+
export { CustomerModel } from '#customer/model.js';
|
|
41
|
+
export { EventModel, idEvent } from '#event/model.js';
|
|
42
|
+
export { PaymentIntentModel, idPaymentIntent } from '#payment-intent/model.js';
|
|
43
|
+
export { idPayment, paymentAmount, PaymentModel } from '#payment/model.js';
|
|
44
|
+
export { IdPayout, PayoutModel } from '#payout/model.js';
|
|
45
|
+
export { idRefund, isRefundAmount, refundAmount, RefundModel } from '#refund/model.js';
|
|
46
|
+
export { IdSepa, SepaModel } from '#sepa/model.js';
|
|
47
|
+
export { idWebhook, WebhookModel } from '#webhook/model.js';
|
|
48
|
+
// Enums
|
|
49
|
+
export { FundingCardEnum } from '#card/enum/funding.js';
|
|
50
|
+
export { NatureCardEnum } from '#card/enum/nature.js';
|
|
51
|
+
export { NetworkCardEnum, PreferredNetworkCardEnum, } from '#card/enum/network.js';
|
|
52
|
+
export { PaymentIntentStatusEnum, failedPaymentIntentStatus, succeedPaymentIntentStatus, } from '#payment-intent/enum/status.js';
|
|
53
|
+
export { ThreeDSEnum } from '#payment-intent/enum/threeds.js';
|
|
54
|
+
export { CurrencyEnum } from '#payment/enum/currency.js';
|
|
55
|
+
export { MethodEnum } from '#payment/enum/method.js';
|
|
56
|
+
export { StatusEnum, succeedPaymentStatus } from '#payment/enum/status.js';
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,gBAAgB;AAChB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;A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MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAa5D,QAAQ;AACR,OAAO,EAAoB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAmB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAEL,eAAe,EAEf,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAgB,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAiB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAe,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAsB,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -6,7 +6,7 @@ export declare class PaymentIntentRepository extends AbstractRepository<PaymentI
|
|
|
6
6
|
protected endpoint: PaymentIntentApiEndpoint;
|
|
7
7
|
constructor(endpoint?: PaymentIntentApiEndpoint);
|
|
8
8
|
capture(paymentIntent: PaymentIntentModel): Promise<void>;
|
|
9
|
-
getPayments(paymentIntent: PaymentIntentModel): Promise<import("../
|
|
9
|
+
getPayments(paymentIntent: PaymentIntentModel): Promise<import("../index.js").PaymentModel[]>;
|
|
10
10
|
getRefunds(paymentIntent: PaymentIntentModel): Promise<import("#refund/model.js").RefundModel[]>;
|
|
11
11
|
refund(paymentIntent: PaymentIntentModel, amount?: RefundAmount): Promise<PaymentIntentModel>;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/payment-intent/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGxE,qBAAa,uBACX,SAAQ,kBAAkB,CAAC,iBAAiB,EAAE,kBAAkB,CAChE,YAAW,UAAU,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAE5D,UAAmB,QAAQ,EAAE,wBAAwB,CAAC;IAEtD,YAAY,QAAQ,CAAC,EAAE,wBAAwB,EAQ9C;IAEY,OAAO,CAAC,aAAa,EAAE,kBAAkB,iBAUrD;IAEY,WAAW,CAAC,aAAa,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/payment-intent/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGxE,qBAAa,uBACX,SAAQ,kBAAkB,CAAC,iBAAiB,EAAE,kBAAkB,CAChE,YAAW,UAAU,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAE5D,UAAmB,QAAQ,EAAE,wBAAwB,CAAC;IAEtD,YAAY,QAAQ,CAAC,EAAE,wBAAwB,EAQ9C;IAEY,OAAO,CAAC,aAAa,EAAE,kBAAkB,iBAUrD;IAEY,WAAW,CAAC,aAAa,EAAE,kBAAkB,iDAQzD;IAEY,UAAU,CAAC,aAAa,EAAE,kBAAkB,qDAQxD;IAEY,MAAM,CAAC,aAAa,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,YAAY,+BA2B3E;CACF"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stancer/stancer",
|
|
3
3
|
"description": "Stancer node TypeScript SDK",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22"
|
|
8
8
|
},
|
|
9
|
+
"devEngines": {
|
|
10
|
+
"packageManager": {
|
|
11
|
+
"name": "pnpm",
|
|
12
|
+
"version": "^11.0.0",
|
|
13
|
+
"onFail": "download"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
9
16
|
"type": "module",
|
|
17
|
+
"imports": {
|
|
18
|
+
"#address/*": "./dist/address/*",
|
|
19
|
+
"#api/*": "./dist/api-endpoint/*",
|
|
20
|
+
"#card/*": "./dist/card/*",
|
|
21
|
+
"#core/*": "./dist/core/*",
|
|
22
|
+
"#customer/*": "./dist/customer/*",
|
|
23
|
+
"#error/*": "./dist/core/error/*",
|
|
24
|
+
"#event/*": "./dist/event/*",
|
|
25
|
+
"#payment-intent/*": "./dist/payment-intent/*",
|
|
26
|
+
"#payment/*": "./dist/payment/*",
|
|
27
|
+
"#payout/*": "./dist/payout/*",
|
|
28
|
+
"#refund/*": "./dist/refund/*",
|
|
29
|
+
"#sepa/*": "./dist/sepa/*",
|
|
30
|
+
"#test/*": "./test/*",
|
|
31
|
+
"#webhook/*": "./dist/webhook/*"
|
|
32
|
+
},
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"main": "./dist/index.js",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
10
41
|
"dependencies": {
|
|
11
42
|
"temporal-polyfill": "^1.0.0"
|
|
12
43
|
},
|
|
@@ -19,7 +50,7 @@
|
|
|
19
50
|
"eslint": "^10.0.0",
|
|
20
51
|
"eslint-formatter-junit": "^9.0.0",
|
|
21
52
|
"globals": "^17.0.0",
|
|
22
|
-
"libphonenumber-js": "^1.
|
|
53
|
+
"libphonenumber-js": "^1.0.0",
|
|
23
54
|
"prettier": "^3.0.0",
|
|
24
55
|
"typescript": "npm:@typescript/typescript6@^6.0.0",
|
|
25
56
|
"typescript-eslint": "^8.0.0",
|
|
@@ -30,28 +61,6 @@
|
|
|
30
61
|
"TypeScript",
|
|
31
62
|
"Stancer"
|
|
32
63
|
],
|
|
33
|
-
"devEngines": {
|
|
34
|
-
"packageManager": {
|
|
35
|
-
"name": "pnpm",
|
|
36
|
-
"version": "^11.0.0",
|
|
37
|
-
"onFail": "download"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"imports": {
|
|
41
|
-
"#api/*": "./src/api-endpoint/*",
|
|
42
|
-
"#address/*": "./src/address/*",
|
|
43
|
-
"#core/*": "./src/core/*",
|
|
44
|
-
"#event/*": "./src/event/*",
|
|
45
|
-
"#error/*": "./src/core/error/*",
|
|
46
|
-
"#test/*": "./test/*",
|
|
47
|
-
"#card/*": "./src/card/*",
|
|
48
|
-
"#sepa/*": "./src/sepa/*",
|
|
49
|
-
"#customer/*": "./src/customer/*",
|
|
50
|
-
"#payment/*": "./src/payment/*",
|
|
51
|
-
"#refund/*": "./src/refund/*",
|
|
52
|
-
"#payment-intent/*": "./src/payment-intent/*",
|
|
53
|
-
"#webhook/*": "./src/webhook/*"
|
|
54
|
-
},
|
|
55
64
|
"scripts": {
|
|
56
65
|
"build": "tsc",
|
|
57
66
|
"clean": "rm -rf dist/ node_modules/",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ApiEndpoint, baseHandler } from '#api/abstract-api-endpoint.js';
|
|
2
|
-
import { defaultHandler } from '#core/common/handler/handler.js';
|
|
3
|
-
import { IdHandler } from '#core/common/handler/id-handler.js';
|
|
4
|
-
|
|
5
|
-
import { type AddressData, AddressModel, type IdAddress } from './model.js';
|
|
6
|
-
|
|
7
|
-
export class AddressApiEndpoint extends ApiEndpoint<AddressData> {
|
|
8
|
-
protected override _handler = {
|
|
9
|
-
...baseHandler('created_at'),
|
|
10
|
-
id: IdHandler<IdAddress>(AddressModel.regex),
|
|
11
|
-
city: defaultHandler<AddressData['city']>('string', { postRequired: true }),
|
|
12
|
-
country: defaultHandler<AddressData['country']>('string', { postRequired: true }),
|
|
13
|
-
line1: defaultHandler<AddressData['line1']>('string'),
|
|
14
|
-
line2: defaultHandler<AddressData['line2']>('string'),
|
|
15
|
-
line3: defaultHandler<AddressData['line3']>('string'),
|
|
16
|
-
metadata: defaultHandler<AddressData['metadata']>('string'),
|
|
17
|
-
state: defaultHandler<AddressData['state']>('string'),
|
|
18
|
-
zipCode: defaultHandler<AddressData['zipCode']>('string', { postRequired: true }),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
constructor() {
|
|
22
|
-
super({
|
|
23
|
-
name: 'addresses',
|
|
24
|
-
patchable: false,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
endpointUrl(id?: IdAddress) {
|
|
28
|
-
return this._getResourceUri(id);
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/address/model.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { AbstractModel, type ModelType } from '#core/abstract-model.js';
|
|
2
|
-
import type { IdValue } from '#core/common/branded-type.js';
|
|
3
|
-
import { validateID } from '#core/common/id-validator.js';
|
|
4
|
-
|
|
5
|
-
export type IdAddress = IdValue<`addr_${string}`>;
|
|
6
|
-
export const idAddress = (id: string) => validateID<IdAddress>(id, AddressModel.regex);
|
|
7
|
-
|
|
8
|
-
export interface AddressData extends ModelType {
|
|
9
|
-
city: string;
|
|
10
|
-
country: string;
|
|
11
|
-
id: IdAddress;
|
|
12
|
-
line1: string;
|
|
13
|
-
line2: string;
|
|
14
|
-
line3: string;
|
|
15
|
-
metadata: string;
|
|
16
|
-
state: string;
|
|
17
|
-
zipCode: string;
|
|
18
|
-
}
|
|
19
|
-
export class AddressModel extends AbstractModel<AddressData> {
|
|
20
|
-
static regex = /^addr_[a-zA-Z0-9]{24}$/;
|
|
21
|
-
|
|
22
|
-
get city() {
|
|
23
|
-
return this._data.city;
|
|
24
|
-
}
|
|
25
|
-
get country() {
|
|
26
|
-
return this._data.country;
|
|
27
|
-
}
|
|
28
|
-
get line1() {
|
|
29
|
-
return this._data.line1;
|
|
30
|
-
}
|
|
31
|
-
get line2() {
|
|
32
|
-
return this._data.line2;
|
|
33
|
-
}
|
|
34
|
-
get line3() {
|
|
35
|
-
return this._data.line3;
|
|
36
|
-
}
|
|
37
|
-
get metadata() {
|
|
38
|
-
return this._data.metadata;
|
|
39
|
-
}
|
|
40
|
-
get state() {
|
|
41
|
-
return this._data.state;
|
|
42
|
-
}
|
|
43
|
-
get zipCode() {
|
|
44
|
-
return this._data.zipCode;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
setCity(value: string) {
|
|
48
|
-
this._data['city'] = value;
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
setCountry(value: string) {
|
|
52
|
-
this._data['country'] = value;
|
|
53
|
-
return this;
|
|
54
|
-
}
|
|
55
|
-
setLine1(value: string) {
|
|
56
|
-
this._data['line1'] = value;
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
setLine2(value: string) {
|
|
60
|
-
this._data['line2'] = value;
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
setLine3(value: string) {
|
|
64
|
-
this._data['line3'] = value;
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
setMetadata(value: string) {
|
|
68
|
-
this._data['metadata'] = value;
|
|
69
|
-
return this;
|
|
70
|
-
}
|
|
71
|
-
setState(value: string) {
|
|
72
|
-
this._data['state'] = value;
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
setZipCode(value: string) {
|
|
76
|
-
this._data['zipCode'] = value;
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AddressApiEndpoint } from '#address/api-endpoint.js';
|
|
2
|
-
import { type AddressData, AddressModel } from '#address/model.js';
|
|
3
|
-
import { addressValidator } from '#address/validator.js';
|
|
4
|
-
import { AbstractRepository, type Repository } from '#core/abstract-repository.js';
|
|
5
|
-
import type { EndpointInterface } from '#core/endpoint-interface.js';
|
|
6
|
-
|
|
7
|
-
export class AddressRepository
|
|
8
|
-
extends AbstractRepository<AddressData, AddressModel>
|
|
9
|
-
implements Repository<AddressData, AddressModel>
|
|
10
|
-
{
|
|
11
|
-
constructor(endpoint?: EndpointInterface<AddressData>) {
|
|
12
|
-
super({
|
|
13
|
-
endpoint: endpoint ?? new AddressApiEndpoint(),
|
|
14
|
-
validator: addressValidator,
|
|
15
|
-
model: AddressModel,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/address/validator.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type AddressData, AddressModel } from '#address/model.js';
|
|
2
|
-
import { IdValidator } from '#core/common/id-validator.js';
|
|
3
|
-
import { type Validator, createdAtValidator, goldilocksValidator } from '#core/validator.js';
|
|
4
|
-
|
|
5
|
-
const cityMaxLength = 50;
|
|
6
|
-
const cityMinLength = 1;
|
|
7
|
-
const countryLength = 2;
|
|
8
|
-
const lineMaxLength = 50;
|
|
9
|
-
const lineMinLength = 1;
|
|
10
|
-
const stateMaxLength = 3;
|
|
11
|
-
const stateMinLength = 1;
|
|
12
|
-
const zipCodeMaxLength = 16;
|
|
13
|
-
const zipCodeMinLength = 2;
|
|
14
|
-
|
|
15
|
-
const lineValidator = (lineName: string) => {
|
|
16
|
-
return goldilocksValidator(lineName, { max: lineMaxLength, min: lineMinLength });
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const addressValidator: Validator<AddressData> = {
|
|
20
|
-
id: IdValidator(AddressModel.regex),
|
|
21
|
-
city: goldilocksValidator('city', { min: cityMinLength, max: cityMaxLength }),
|
|
22
|
-
// country check for ISO 3166-1 alpha-2 country codes, because API wait for this precise type.
|
|
23
|
-
country: goldilocksValidator('country', { size: countryLength }),
|
|
24
|
-
createdAt: createdAtValidator,
|
|
25
|
-
// Deleted is a system-managed field for soft deletes, not validated on client side.
|
|
26
|
-
deleted: true,
|
|
27
|
-
line1: lineValidator('line1'),
|
|
28
|
-
line2: lineValidator('line2'),
|
|
29
|
-
line3: lineValidator('line3'),
|
|
30
|
-
// Metadata doesn't have strict set value, so we don't validate it, we let the API reject it.
|
|
31
|
-
metadata: true,
|
|
32
|
-
state: goldilocksValidator('state', { max: stateMaxLength, min: stateMinLength }),
|
|
33
|
-
zipCode: goldilocksValidator('zipCode', { min: zipCodeMinLength, max: zipCodeMaxLength }),
|
|
34
|
-
};
|