@merkaly/api 0.9.0 → 0.11.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.
@@ -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
+ }
@@ -2,3 +2,6 @@ export * from './supplier.entity';
2
2
  export * from './provider.enum';
3
3
  export * from './product';
4
4
  export * from './request.validator';
5
+ export * from './supplier.connection.entity';
6
+ export * from './connection';
7
+ export * from './quote';
@@ -4,9 +4,18 @@ export interface SupplierProductAsset {
4
4
  type: AssetType;
5
5
  url: string;
6
6
  }
7
+ export interface SupplierProductOption {
8
+ name: string;
9
+ value: string;
10
+ label?: string;
11
+ externalNameId: string;
12
+ externalValueId: string;
13
+ }
7
14
  export interface SupplierProductVariant {
8
15
  externalVariantId: string;
9
16
  name: string;
17
+ options: SupplierProductOption[];
18
+ shipsFrom?: SupplierProductOption;
10
19
  supplierPrice: number;
11
20
  stock: number;
12
21
  picture?: string;
@@ -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
  }
@@ -21,5 +21,9 @@ export declare class CatalogProductEntity extends AbstractEntity {
21
21
  hashtags: string[];
22
22
  readonly picture: AssetEntity;
23
23
  readonly assets: AssetEntity[];
24
+ readonly options: {
25
+ name: string;
26
+ values: string[];
27
+ }[];
24
28
  readonly variants: CatalogVariantEntity[];
25
29
  }
@@ -1,2 +1,3 @@
1
1
  export * from './variant.entity';
2
+ export * from './variant.option.entity';
2
3
  export * from './request.validator';
@@ -1,5 +1,6 @@
1
1
  import { AssetEntity } from '../../../assets/asset';
2
2
  import { AbstractEntity } from '../../../abstract.entity.js';
3
+ import { CatalogVariantOptionEntity } from './variant.option.entity.js';
3
4
  import type { CatalogProductEntity } from '../product';
4
5
  export declare class CatalogVariantEntity extends AbstractEntity {
5
6
  product: CatalogProductEntity;
@@ -8,5 +9,7 @@ export declare class CatalogVariantEntity extends AbstractEntity {
8
9
  active: boolean;
9
10
  picture?: AssetEntity;
10
11
  assets: AssetEntity[];
12
+ options: CatalogVariantOptionEntity[];
13
+ shipsFrom?: CatalogVariantOptionEntity;
11
14
  externalVariantId?: string;
12
15
  }
@@ -0,0 +1,16 @@
1
+ export declare class CatalogVariantOptionEntity {
2
+ name: string;
3
+ value: string;
4
+ label?: string;
5
+ externalNameId?: string;
6
+ externalValueId?: string;
7
+ }
8
+ export declare const CatalogVariantOptionSchema: import("mongoose").Schema<CatalogVariantOptionEntity, import("mongoose").Model<CatalogVariantOptionEntity, any, any, any, import("mongoose").Document<unknown, any, CatalogVariantOptionEntity, any, {}> & CatalogVariantOptionEntity & {
9
+ _id: import("mongoose").Types.ObjectId;
10
+ } & {
11
+ __v: number;
12
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CatalogVariantOptionEntity, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<CatalogVariantOptionEntity>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<CatalogVariantOptionEntity> & {
13
+ _id: import("mongoose").Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ }>;
@@ -3,3 +3,5 @@ export * from './sale.enum';
3
3
  export * from './sale.transition';
4
4
  export * from './request.validator';
5
5
  export * from './item.request.validator';
6
+ export * from './procurement';
7
+ export * from './procurement.request.validator';
@@ -2,3 +2,4 @@ export * from './sale.enum.js';
2
2
  export * from './sale.transition.js';
3
3
  export * from './request.validator.js';
4
4
  export * from './item.request.validator.js';
5
+ export * from './procurement.request.validator.js';
@@ -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,4 @@
1
+ import { AbstractRequestValidator } from '../../abstract.validator.js';
2
+ export declare class ProcureSaleRequestValidator extends AbstractRequestValidator {
3
+ force: boolean;
4
+ }
@@ -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);
@@ -18,7 +18,9 @@ export interface SettingsOrganizationContactContract {
18
18
  website?: string;
19
19
  }
20
20
  export interface SettingsOrganizationLocalizationContract {
21
+ country?: string;
21
22
  currency?: string;
23
+ language?: string;
22
24
  }
23
25
  export interface SettingsOrganizationIdentityContract {
24
26
  legalName?: string;
@@ -22,7 +22,9 @@ export declare class UpdateOrganizationContactRequestValidator extends AbstractR
22
22
  constructor(contact?: SettingsOrganizationContactContract);
23
23
  }
24
24
  export declare class UpdateOrganizationLocalizationRequestValidator extends AbstractRequestValidator {
25
+ country?: string;
25
26
  currency?: string;
27
+ language?: string;
26
28
  constructor(localization?: SettingsOrganizationLocalizationContract);
27
29
  }
28
30
  export declare class UpdateOrganizationIdentityRequestValidator extends AbstractRequestValidator {
@@ -121,18 +121,34 @@ __decorate([
121
121
  __metadata("design:type", String)
122
122
  ], UpdateOrganizationContactRequestValidator.prototype, "website", void 0);
123
123
  export class UpdateOrganizationLocalizationRequestValidator extends abstract_validator_1.AbstractRequestValidator {
124
+ country;
124
125
  currency;
126
+ language;
125
127
  constructor(localization) {
126
128
  super();
129
+ this.country = localization?.country;
127
130
  this.currency = localization?.currency;
131
+ this.language = localization?.language;
128
132
  }
129
133
  }
134
+ __decorate([
135
+ (0, class_validator_1.IsString)(),
136
+ (0, class_validator_1.Length)(2, 2),
137
+ (0, class_validator_1.IsOptional)(),
138
+ __metadata("design:type", String)
139
+ ], UpdateOrganizationLocalizationRequestValidator.prototype, "country", void 0);
130
140
  __decorate([
131
141
  (0, class_validator_1.IsString)(),
132
142
  (0, class_validator_1.Length)(0, 3),
133
143
  (0, class_validator_1.IsOptional)(),
134
144
  __metadata("design:type", String)
135
145
  ], UpdateOrganizationLocalizationRequestValidator.prototype, "currency", void 0);
146
+ __decorate([
147
+ (0, class_validator_1.IsString)(),
148
+ (0, class_validator_1.Length)(2, 5),
149
+ (0, class_validator_1.IsOptional)(),
150
+ __metadata("design:type", String)
151
+ ], UpdateOrganizationLocalizationRequestValidator.prototype, "language", void 0);
136
152
  export class UpdateOrganizationIdentityRequestValidator extends abstract_validator_1.AbstractRequestValidator {
137
153
  legalName;
138
154
  name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "description": "Shared TypeScript interfaces and enums for Merkaly API",
6
6
  "repository": {