@merkaly/api 0.37.8 → 0.39.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/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/purchase/purchase.entity.d.ts +15 -2
- package/dist/order/sale/procurement.d.ts +0 -1
- package/dist/transform.validator.js +3 -3
- package/package.json +2 -2
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
|
|
|
@@ -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,10 +1,23 @@
|
|
|
1
1
|
import { Schema as MongoSchema } from 'mongoose';
|
|
2
2
|
import { ContactVendorEntity } from '../../contact/vendor';
|
|
3
|
-
import { SupplierProviderEnum } from '../../integration/supplier';
|
|
3
|
+
import { SupplierErrorCodeEnum, SupplierProviderEnum } from '../../integration/supplier';
|
|
4
4
|
import { ItemEntity } from '../item';
|
|
5
5
|
import { TransactionEntity } from '../../transaction.entity.js';
|
|
6
6
|
import { OrderPurchaseStatusEnum } from './purchase.enum.js';
|
|
7
7
|
import type { OrderSaleEntity } from '../sale';
|
|
8
|
+
export declare class OrderPurchaseSupplierErrorEntity {
|
|
9
|
+
code: SupplierErrorCodeEnum | null;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const OrderPurchaseSupplierErrorSchema: MongoSchema<OrderPurchaseSupplierErrorEntity, import("mongoose").Model<OrderPurchaseSupplierErrorEntity, any, any, any, import("mongoose").Document<unknown, any, OrderPurchaseSupplierErrorEntity, any, {}> & OrderPurchaseSupplierErrorEntity & {
|
|
13
|
+
_id: import("mongoose").Types.ObjectId;
|
|
14
|
+
} & {
|
|
15
|
+
__v: number;
|
|
16
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, OrderPurchaseSupplierErrorEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<OrderPurchaseSupplierErrorEntity>, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").FlatRecord<OrderPurchaseSupplierErrorEntity> & {
|
|
17
|
+
_id: import("mongoose").Types.ObjectId;
|
|
18
|
+
} & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}>;
|
|
8
21
|
export declare class OrderPurchaseSupplierOrderEntity {
|
|
9
22
|
provider: SupplierProviderEnum;
|
|
10
23
|
orderIds: string[];
|
|
@@ -13,7 +26,7 @@ export declare class OrderPurchaseSupplierOrderEntity {
|
|
|
13
26
|
placedAt: Date;
|
|
14
27
|
syncedAt?: Date;
|
|
15
28
|
payExpiryDate?: Date;
|
|
16
|
-
error?:
|
|
29
|
+
error?: OrderPurchaseSupplierErrorEntity | null;
|
|
17
30
|
paidAfterCancelAt?: Date;
|
|
18
31
|
}
|
|
19
32
|
export declare const OrderPurchaseSupplierOrderSchema: MongoSchema<OrderPurchaseSupplierOrderEntity, import("mongoose").Model<OrderPurchaseSupplierOrderEntity, any, any, any, import("mongoose").Document<unknown, any, OrderPurchaseSupplierOrderEntity, any, {}> & OrderPurchaseSupplierOrderEntity & {
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared TypeScript interfaces and enums for Merkaly API",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^26.6.1",
|
|
33
33
|
"changelogen": "^0.6.2",
|
|
34
|
-
"oxlint": "^1.
|
|
34
|
+
"oxlint": "^1.94.0",
|
|
35
35
|
"tsx": "^4.23.0",
|
|
36
36
|
"typescript": "^7.0.2"
|
|
37
37
|
},
|