@merkaly/api 0.37.7 → 0.38.0
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 +2 -0
- package/dist/finance/debt/debt.entity.d.ts +39 -0
- package/dist/finance/debt/debt.enum.d.ts +7 -0
- package/dist/finance/debt/debt.enum.js +9 -0
- package/dist/finance/debt/index.d.ts +2 -0
- package/dist/finance/debt/index.js +1 -0
- package/dist/finance/payment/payment.entity.d.ts +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/integration/payment/charge.enum.d.ts +0 -4
- package/dist/integration/payment/charge.enum.js +0 -5
- package/dist/integration/supplier/connection.d.ts +0 -2
- package/dist/integration/supplier/product.d.ts +5 -1
- package/dist/integration/supplier/provider.enum.d.ts +8 -0
- package/dist/integration/supplier/provider.enum.js +9 -0
- package/dist/inventory/catalog/product/request.validator.d.ts +1 -4
- package/dist/inventory/catalog/product/request.validator.js +0 -9
- package/dist/inventory/catalog/variant/request.validator.d.ts +0 -5
- package/dist/inventory/catalog/variant/request.validator.js +0 -20
- package/dist/order/sale/procurement.d.ts +0 -1
- package/dist/transform.validator.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ and used by the frontends (admin, store, dashboard). The source of truth is
|
|
|
10
10
|
2. `pnpm sync` here copies the `.d.ts`/`.js` files listed in `manifest.json` from that `dist/` into
|
|
11
11
|
`src/`, rewriting imports between them.
|
|
12
12
|
3. `pnpm build` here (`build.ts`) generates `dist/` with one barrel per entry point.
|
|
13
|
+
The `.js` files go from CommonJS to ESM: every `exports.x = x` must end as an
|
|
14
|
+
`export class|function|const x`, otherwise the build fails (the frontends would import `undefined`).
|
|
13
15
|
|
|
14
16
|
### `manifest.json`
|
|
15
17
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Schema as MongoSchema } from 'mongoose';
|
|
2
|
+
import { AbstractEntity } from '../../abstract.entity.js';
|
|
3
|
+
import { FinanceDebtReasonEnum, FinanceDebtStatusEnum } from './debt.enum.js';
|
|
4
|
+
import { FinancePaymentEntity } from '../payment';
|
|
5
|
+
import { FinanceWithdrawalEntity } from '../withdrawal';
|
|
6
|
+
export declare class FinanceDebtHistoryEntity {
|
|
7
|
+
date: Date;
|
|
8
|
+
status: FinanceDebtStatusEnum;
|
|
9
|
+
withdrawal?: FinanceWithdrawalEntity | string | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const FinanceDebtHistorySchema: MongoSchema<FinanceDebtHistoryEntity, import("mongoose").Model<FinanceDebtHistoryEntity, any, any, any, import("mongoose").Document<unknown, any, FinanceDebtHistoryEntity, any, {}> & FinanceDebtHistoryEntity & {
|
|
12
|
+
_id: import("mongoose").Types.ObjectId;
|
|
13
|
+
} & {
|
|
14
|
+
__v: number;
|
|
15
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FinanceDebtHistoryEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<FinanceDebtHistoryEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<FinanceDebtHistoryEntity> & {
|
|
16
|
+
_id: import("mongoose").Types.ObjectId;
|
|
17
|
+
} & {
|
|
18
|
+
__v: number;
|
|
19
|
+
}>;
|
|
20
|
+
export declare class FinanceDebtCollectedEntity {
|
|
21
|
+
withdrawal: FinanceWithdrawalEntity | string;
|
|
22
|
+
}
|
|
23
|
+
export declare const FinanceDebtCollectedSchema: MongoSchema<FinanceDebtCollectedEntity, import("mongoose").Model<FinanceDebtCollectedEntity, any, any, any, import("mongoose").Document<unknown, any, FinanceDebtCollectedEntity, any, {}> & FinanceDebtCollectedEntity & {
|
|
24
|
+
_id: import("mongoose").Types.ObjectId;
|
|
25
|
+
} & {
|
|
26
|
+
__v: number;
|
|
27
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FinanceDebtCollectedEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<FinanceDebtCollectedEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<FinanceDebtCollectedEntity> & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
} & {
|
|
30
|
+
__v: number;
|
|
31
|
+
}>;
|
|
32
|
+
export declare class FinanceDebtEntity extends AbstractEntity {
|
|
33
|
+
amount: number;
|
|
34
|
+
reason: FinanceDebtReasonEnum;
|
|
35
|
+
payment: FinancePaymentEntity | string;
|
|
36
|
+
status: FinanceDebtStatusEnum;
|
|
37
|
+
history: FinanceDebtHistoryEntity[];
|
|
38
|
+
collected?: FinanceDebtCollectedEntity | null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var FinanceDebtReasonEnum;
|
|
2
|
+
(function (FinanceDebtReasonEnum) {
|
|
3
|
+
FinanceDebtReasonEnum["REFUND_FEE"] = "REFUND_FEE";
|
|
4
|
+
})(FinanceDebtReasonEnum || (FinanceDebtReasonEnum = {}));
|
|
5
|
+
export var FinanceDebtStatusEnum;
|
|
6
|
+
(function (FinanceDebtStatusEnum) {
|
|
7
|
+
FinanceDebtStatusEnum["OPEN"] = "OPEN";
|
|
8
|
+
FinanceDebtStatusEnum["SETTLED"] = "SETTLED";
|
|
9
|
+
})(FinanceDebtStatusEnum || (FinanceDebtStatusEnum = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './debt.enum.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Schema as MongoSchema } from 'mongoose';
|
|
2
|
-
import { PaymentChargeAccountEnum } from '../../integration/payment';
|
|
3
2
|
import { OrderSaleEntity } from '../../order/sale';
|
|
4
3
|
import { AbstractEntity } from '../../abstract.entity.js';
|
|
5
4
|
import { StatusEntity } from '../../status.plugin.js';
|
|
6
5
|
import { ITransitionable } from '../../transitionable.types.js';
|
|
7
6
|
import { FinancePaymentMethodEnum, FinancePaymentStatusEnum } from './payment.enum.js';
|
|
7
|
+
import type { FinanceDebtEntity } from '../debt';
|
|
8
|
+
import type { FinanceRefundEntity } from '../refund';
|
|
8
9
|
import type { PaymentChargeStatusEnum } from '../../integration/payment';
|
|
9
10
|
export interface FinancePaymentPixDetails {
|
|
10
11
|
qrCode: string | null;
|
|
@@ -14,7 +15,6 @@ export type FinancePaymentGatewayDetails = FinancePaymentPixDetails | Record<str
|
|
|
14
15
|
export declare class FinancePaymentGatewayEntity {
|
|
15
16
|
provider: string;
|
|
16
17
|
reference?: string | null;
|
|
17
|
-
account?: PaymentChargeAccountEnum | null;
|
|
18
18
|
method: FinancePaymentMethodEnum;
|
|
19
19
|
status: string;
|
|
20
20
|
attempt: number;
|
|
@@ -77,4 +77,6 @@ export declare class FinancePaymentEntity extends AbstractEntity implements ITra
|
|
|
77
77
|
status: FinancePaymentStatusEnum;
|
|
78
78
|
history: StatusEntity<FinancePaymentStatusEnum>[];
|
|
79
79
|
readonly number: string;
|
|
80
|
+
readonly refunds?: FinanceRefundEntity[];
|
|
81
|
+
readonly refundFeeDebts?: FinanceDebtEntity[];
|
|
80
82
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './contact/vendor';
|
|
|
22
22
|
export * from './dashboard/home';
|
|
23
23
|
export * from './dashboard/client';
|
|
24
24
|
export * from './finance/chargeback';
|
|
25
|
+
export * from './finance/debt';
|
|
25
26
|
export * from './finance/payment';
|
|
26
27
|
export * from './finance/refund';
|
|
27
28
|
export * from './finance/withdrawal';
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from './contact/vendor/index.js';
|
|
|
13
13
|
export * from './dashboard/home/index.js';
|
|
14
14
|
export * from './dashboard/client/index.js';
|
|
15
15
|
export * from './finance/chargeback/index.js';
|
|
16
|
+
export * from './finance/debt/index.js';
|
|
16
17
|
export * from './finance/payment/index.js';
|
|
17
18
|
export * from './finance/refund/index.js';
|
|
18
19
|
export * from './finance/withdrawal/index.js';
|
|
@@ -32,8 +32,3 @@ export var PaymentAsaasRefundStatusEnum;
|
|
|
32
32
|
PaymentAsaasRefundStatusEnum["CANCELLED"] = "CANCELLED";
|
|
33
33
|
PaymentAsaasRefundStatusEnum["DONE"] = "DONE";
|
|
34
34
|
})(PaymentAsaasRefundStatusEnum || (PaymentAsaasRefundStatusEnum = {}));
|
|
35
|
-
export var PaymentChargeAccountEnum;
|
|
36
|
-
(function (PaymentChargeAccountEnum) {
|
|
37
|
-
PaymentChargeAccountEnum["MAIN"] = "MAIN";
|
|
38
|
-
PaymentChargeAccountEnum["SUBCONTA"] = "SUBCONTA";
|
|
39
|
-
})(PaymentChargeAccountEnum || (PaymentChargeAccountEnum = {}));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type SupplierConnectionSource = 'merchant' | 'platform';
|
|
2
1
|
export interface SupplierConnectionStatus {
|
|
3
2
|
account: string | null;
|
|
4
3
|
appKey: string | null;
|
|
@@ -7,7 +6,6 @@ export interface SupplierConnectionStatus {
|
|
|
7
6
|
expiresAt: Date | null;
|
|
8
7
|
expired: boolean;
|
|
9
8
|
reconnectBy: Date | null;
|
|
10
|
-
source: SupplierConnectionSource | null;
|
|
11
9
|
}
|
|
12
10
|
export interface SupplierConnectionCreateRequest {
|
|
13
11
|
code: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SupplierProviderEnum } from './provider.enum.js';
|
|
1
|
+
import type { SupplierErrorCodeEnum, SupplierProviderEnum } from './provider.enum.js';
|
|
2
2
|
import type { AssetType } from '../../assets/asset';
|
|
3
3
|
export interface SupplierProductAsset {
|
|
4
4
|
type: AssetType;
|
|
@@ -75,3 +75,7 @@ export interface SupplierProductPreviewRequest {
|
|
|
75
75
|
export interface SupplierProductReadRequest {
|
|
76
76
|
product: string;
|
|
77
77
|
}
|
|
78
|
+
export interface SupplierProductReadError {
|
|
79
|
+
code?: SupplierErrorCodeEnum;
|
|
80
|
+
message: string;
|
|
81
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export declare enum SupplierProviderEnum {
|
|
2
2
|
ALIEXPRESS = "aliexpress"
|
|
3
3
|
}
|
|
4
|
+
export declare enum SupplierErrorCodeEnum {
|
|
5
|
+
ACCESS_DENIED = "SUPPLIER_ACCESS_DENIED",
|
|
6
|
+
CONNECTION_EXPIRED = "SUPPLIER_CONNECTION_EXPIRED",
|
|
7
|
+
CONNECTION_REQUIRED = "SUPPLIER_CONNECTION_REQUIRED",
|
|
8
|
+
RECIPIENT_DOCUMENT_INVALID = "SUPPLIER_RECIPIENT_DOCUMENT_INVALID",
|
|
9
|
+
REQUEST_REJECTED = "SUPPLIER_REQUEST_REJECTED",
|
|
10
|
+
UNAVAILABLE = "SUPPLIER_UNAVAILABLE"
|
|
11
|
+
}
|
|
4
12
|
export declare enum SupplierReadinessEnum {
|
|
5
13
|
NOT_CONNECTED = "NOT_CONNECTED",
|
|
6
14
|
EXPIRED = "EXPIRED",
|
|
@@ -2,6 +2,15 @@ export var SupplierProviderEnum;
|
|
|
2
2
|
(function (SupplierProviderEnum) {
|
|
3
3
|
SupplierProviderEnum["ALIEXPRESS"] = "aliexpress";
|
|
4
4
|
})(SupplierProviderEnum || (SupplierProviderEnum = {}));
|
|
5
|
+
export var SupplierErrorCodeEnum;
|
|
6
|
+
(function (SupplierErrorCodeEnum) {
|
|
7
|
+
SupplierErrorCodeEnum["ACCESS_DENIED"] = "SUPPLIER_ACCESS_DENIED";
|
|
8
|
+
SupplierErrorCodeEnum["CONNECTION_EXPIRED"] = "SUPPLIER_CONNECTION_EXPIRED";
|
|
9
|
+
SupplierErrorCodeEnum["CONNECTION_REQUIRED"] = "SUPPLIER_CONNECTION_REQUIRED";
|
|
10
|
+
SupplierErrorCodeEnum["RECIPIENT_DOCUMENT_INVALID"] = "SUPPLIER_RECIPIENT_DOCUMENT_INVALID";
|
|
11
|
+
SupplierErrorCodeEnum["REQUEST_REJECTED"] = "SUPPLIER_REQUEST_REJECTED";
|
|
12
|
+
SupplierErrorCodeEnum["UNAVAILABLE"] = "SUPPLIER_UNAVAILABLE";
|
|
13
|
+
})(SupplierErrorCodeEnum || (SupplierErrorCodeEnum = {}));
|
|
5
14
|
export var SupplierReadinessEnum;
|
|
6
15
|
(function (SupplierReadinessEnum) {
|
|
7
16
|
SupplierReadinessEnum["NOT_CONNECTED"] = "NOT_CONNECTED";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../../abstract.validator.js';
|
|
2
|
-
import {
|
|
2
|
+
import { UpdateVariantRequestValidator } from '../variant';
|
|
3
3
|
import type { CatalogProductEntity } from './product.entity.js';
|
|
4
4
|
import type { CatalogVariantEntity } from '../variant';
|
|
5
5
|
declare class ProductMetadataRequestValidator extends AbstractRequestValidator {
|
|
@@ -24,7 +24,4 @@ export declare class UpdateProductRequestValidator extends ProductMetadataReques
|
|
|
24
24
|
variants?: UpdateProductVariantsItemRequestValidator[];
|
|
25
25
|
constructor(product?: CatalogProductEntity);
|
|
26
26
|
}
|
|
27
|
-
export declare class CreateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
28
|
-
variant: CreateVariantRequestValidator;
|
|
29
|
-
}
|
|
30
27
|
export {};
|
|
@@ -111,12 +111,3 @@ __decorate([
|
|
|
111
111
|
(0, class_transformer_1.Type)(() => UpdateProductVariantsItemRequestValidator),
|
|
112
112
|
__metadata("design:type", Array)
|
|
113
113
|
], UpdateProductRequestValidator.prototype, "variants", void 0);
|
|
114
|
-
export class CreateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
115
|
-
variant;
|
|
116
|
-
}
|
|
117
|
-
__decorate([
|
|
118
|
-
(0, class_validator_1.IsDefined)(),
|
|
119
|
-
(0, class_validator_1.ValidateNested)(),
|
|
120
|
-
(0, class_transformer_1.Type)(() => request_validator_1.CreateVariantRequestValidator),
|
|
121
|
-
__metadata("design:type", request_validator_1.CreateVariantRequestValidator)
|
|
122
|
-
], CreateProductRequestValidator.prototype, "variant", void 0);
|
|
@@ -5,8 +5,3 @@ export declare class UpdateVariantRequestValidator extends AbstractRequestValida
|
|
|
5
5
|
active?: boolean;
|
|
6
6
|
constructor(variant?: CatalogVariantEntity);
|
|
7
7
|
}
|
|
8
|
-
export declare class CreateVariantRequestValidator extends UpdateVariantRequestValidator {
|
|
9
|
-
supplierPrice: number;
|
|
10
|
-
retailPrice: number;
|
|
11
|
-
constructor(variant?: CatalogVariantEntity);
|
|
12
|
-
}
|
|
@@ -33,23 +33,3 @@ __decorate([
|
|
|
33
33
|
(0, class_validator_1.IsOptional)(),
|
|
34
34
|
__metadata("design:type", Boolean)
|
|
35
35
|
], UpdateVariantRequestValidator.prototype, "active", void 0);
|
|
36
|
-
export class CreateVariantRequestValidator extends UpdateVariantRequestValidator {
|
|
37
|
-
supplierPrice;
|
|
38
|
-
constructor(variant) {
|
|
39
|
-
super(variant);
|
|
40
|
-
if (variant)
|
|
41
|
-
this.supplierPrice = variant.price.cost;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, class_validator_1.IsInt)(),
|
|
46
|
-
(0, class_validator_1.Min)(0),
|
|
47
|
-
(0, class_validator_1.Max)(Number.MAX_SAFE_INTEGER),
|
|
48
|
-
__metadata("design:type", Number)
|
|
49
|
-
], CreateVariantRequestValidator.prototype, "supplierPrice", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, class_validator_1.IsInt)(),
|
|
52
|
-
(0, class_validator_1.Min)(0),
|
|
53
|
-
(0, class_validator_1.Max)(Number.MAX_SAFE_INTEGER),
|
|
54
|
-
__metadata("design:type", Number)
|
|
55
|
-
], CreateVariantRequestValidator.prototype, "retailPrice", void 0);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const trim = ({ value }) => typeof value === 'string' ? value.trim() : value;
|
|
2
|
-
const digits = ({ value }) => typeof value === 'string' ? value.replace(/\D/g, '') : value;
|
|
3
|
-
const upper = ({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value;
|
|
1
|
+
export const trim = ({ value }) => typeof value === 'string' ? value.trim() : value;
|
|
2
|
+
export const digits = ({ value }) => typeof value === 'string' ? value.replace(/\D/g, '') : value;
|
|
3
|
+
export const upper = ({ value }) => typeof value === 'string' ? value.trim().toUpperCase() : value;
|