@merkaly/api 0.10.0 → 0.11.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/dist/integration/supplier/connection.d.ts +9 -0
- package/dist/integration/supplier/index.d.ts +3 -0
- package/dist/integration/supplier/quote.d.ts +18 -0
- package/dist/integration/supplier/supplier.connection.entity.d.ts +18 -0
- package/dist/integration/supplier/supplier.entity.d.ts +2 -0
- package/dist/inventory/catalog/product/request.validator.d.ts +4 -0
- package/dist/inventory/catalog/product/request.validator.js +16 -0
- package/dist/order/sale/index.d.ts +2 -0
- package/dist/order/sale/index.js +1 -0
- package/dist/order/sale/procurement.d.ts +45 -0
- package/dist/order/sale/procurement.request.validator.d.ts +4 -0
- package/dist/order/sale/procurement.request.validator.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SupplierConnectionSource = 'merchant' | 'platform';
|
|
2
|
+
export interface SupplierConnectionStatus {
|
|
3
|
+
account: string | null;
|
|
4
|
+
appKey: string | null;
|
|
5
|
+
connected: boolean;
|
|
6
|
+
connectedAt: Date | null;
|
|
7
|
+
expiresAt: Date | null;
|
|
8
|
+
source: SupplierConnectionSource | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface SupplierQuoteRequest {
|
|
2
|
+
externalProductId: string;
|
|
3
|
+
externalVariantId: string;
|
|
4
|
+
quantity: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SupplierQuote extends SupplierQuoteRequest {
|
|
7
|
+
available: boolean;
|
|
8
|
+
currency: string;
|
|
9
|
+
issue?: string;
|
|
10
|
+
stock?: number;
|
|
11
|
+
unitCost?: number;
|
|
12
|
+
freight?: number;
|
|
13
|
+
freightService?: string;
|
|
14
|
+
deliveryDays?: {
|
|
15
|
+
max?: number;
|
|
16
|
+
min?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Schema as MongoSchema } from 'mongoose';
|
|
2
|
+
export declare class IntegrationSupplierConnectionEntity {
|
|
3
|
+
account?: string;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
refreshToken?: string;
|
|
6
|
+
expiresAt: Date;
|
|
7
|
+
refreshExpiresAt?: Date;
|
|
8
|
+
connectedAt: Date;
|
|
9
|
+
}
|
|
10
|
+
export declare const IntegrationSupplierConnectionSchema: MongoSchema<IntegrationSupplierConnectionEntity, import("mongoose").Model<IntegrationSupplierConnectionEntity, any, any, any, import("mongoose").Document<unknown, any, IntegrationSupplierConnectionEntity, any, {}> & IntegrationSupplierConnectionEntity & {
|
|
11
|
+
_id: import("mongoose").Types.ObjectId;
|
|
12
|
+
} & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IntegrationSupplierConnectionEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IntegrationSupplierConnectionEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<IntegrationSupplierConnectionEntity> & {
|
|
15
|
+
_id: import("mongoose").Types.ObjectId;
|
|
16
|
+
} & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AbstractEntity } from '../../abstract.entity.js';
|
|
2
2
|
import { SupplierProviderEnum } from './provider.enum.js';
|
|
3
|
+
import { IntegrationSupplierConnectionEntity } from './supplier.connection.entity.js';
|
|
3
4
|
export declare class IntegrationSupplierEntity extends AbstractEntity {
|
|
4
5
|
provider: SupplierProviderEnum;
|
|
6
|
+
connection?: IntegrationSupplierConnectionEntity;
|
|
5
7
|
}
|
|
@@ -14,10 +14,14 @@ declare class UpdateProductVariantRequestValidator extends UpdateVariantRequestV
|
|
|
14
14
|
_id?: string;
|
|
15
15
|
constructor(variant?: CatalogVariantEntity);
|
|
16
16
|
}
|
|
17
|
+
declare class UpdateProductVariantsItemRequestValidator extends UpdateVariantRequestValidator {
|
|
18
|
+
_id: string;
|
|
19
|
+
}
|
|
17
20
|
export declare class UpdateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
18
21
|
name: string;
|
|
19
22
|
active?: boolean;
|
|
20
23
|
variant?: UpdateProductVariantRequestValidator;
|
|
24
|
+
variants?: UpdateProductVariantsItemRequestValidator[];
|
|
21
25
|
constructor(product?: CatalogProductEntity);
|
|
22
26
|
}
|
|
23
27
|
export declare class CreateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
@@ -30,6 +30,7 @@ class ProductMetadataRequestValidator extends abstract_validator_1.AbstractReque
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
__decorate([
|
|
33
|
+
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'string' ? value.replace(/\s+/g, ' ').trim() : value),
|
|
33
34
|
(0, class_validator_1.IsString)(),
|
|
34
35
|
(0, class_validator_1.IsNotEmpty)(),
|
|
35
36
|
(0, class_validator_1.Length)(0, 100),
|
|
@@ -71,9 +72,17 @@ __decorate([
|
|
|
71
72
|
(0, class_validator_1.IsOptional)(),
|
|
72
73
|
__metadata("design:type", String)
|
|
73
74
|
], UpdateProductVariantRequestValidator.prototype, "_id", void 0);
|
|
75
|
+
class UpdateProductVariantsItemRequestValidator extends request_validator_1.UpdateVariantRequestValidator {
|
|
76
|
+
_id;
|
|
77
|
+
}
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, class_validator_1.IsMongoId)(),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], UpdateProductVariantsItemRequestValidator.prototype, "_id", void 0);
|
|
74
82
|
export class UpdateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
75
83
|
active;
|
|
76
84
|
variant;
|
|
85
|
+
variants;
|
|
77
86
|
constructor(product) {
|
|
78
87
|
super(product);
|
|
79
88
|
if (product)
|
|
@@ -97,6 +106,13 @@ __decorate([
|
|
|
97
106
|
(0, class_transformer_1.Type)(() => UpdateProductVariantRequestValidator),
|
|
98
107
|
__metadata("design:type", UpdateProductVariantRequestValidator)
|
|
99
108
|
], UpdateProductRequestValidator.prototype, "variant", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, class_validator_1.IsOptional)(),
|
|
111
|
+
(0, class_validator_1.IsArray)(),
|
|
112
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
113
|
+
(0, class_transformer_1.Type)(() => UpdateProductVariantsItemRequestValidator),
|
|
114
|
+
__metadata("design:type", Array)
|
|
115
|
+
], UpdateProductRequestValidator.prototype, "variants", void 0);
|
|
100
116
|
export class CreateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
101
117
|
variant;
|
|
102
118
|
}
|
package/dist/order/sale/index.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SupplierProviderEnum } from '../../integration/supplier';
|
|
2
|
+
import type { SupplierQuote } from '../../integration/supplier';
|
|
3
|
+
export interface ProcurementLine {
|
|
4
|
+
item: string;
|
|
5
|
+
product: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
variant: string;
|
|
10
|
+
quantity: number;
|
|
11
|
+
retailUnit: number;
|
|
12
|
+
storedUnitCost: number;
|
|
13
|
+
quotedUnitCost?: number;
|
|
14
|
+
freight?: number;
|
|
15
|
+
quote?: SupplierQuote;
|
|
16
|
+
}
|
|
17
|
+
export interface ProcurementGroup {
|
|
18
|
+
supplier: {
|
|
19
|
+
id: string;
|
|
20
|
+
provider: SupplierProviderEnum;
|
|
21
|
+
};
|
|
22
|
+
vendor: {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
} | null;
|
|
26
|
+
items: ProcurementLine[];
|
|
27
|
+
totals: {
|
|
28
|
+
retail: number;
|
|
29
|
+
cost: number;
|
|
30
|
+
freight: number;
|
|
31
|
+
margin: number;
|
|
32
|
+
};
|
|
33
|
+
available: boolean;
|
|
34
|
+
marginOk: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ProcurementQuote {
|
|
37
|
+
sale: string;
|
|
38
|
+
currency: string;
|
|
39
|
+
destination: {
|
|
40
|
+
country: string;
|
|
41
|
+
source: 'market';
|
|
42
|
+
};
|
|
43
|
+
groups: ProcurementGroup[];
|
|
44
|
+
manual: ProcurementLine[];
|
|
45
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
import * as class_validator_1 from "class-validator";
|
|
12
|
+
import * as abstract_validator_1 from '../../abstract.validator.js';
|
|
13
|
+
export class ProcureSaleRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
14
|
+
force = false;
|
|
15
|
+
}
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, class_validator_1.IsBoolean)(),
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
__metadata("design:type", Object)
|
|
20
|
+
], ProcureSaleRequestValidator.prototype, "force", void 0);
|