@isoftdata/ebay-utility 1.4.1 → 1.5.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 +100 -115
- package/lib/adapters/AuthServerRepo.d.ts +13 -0
- package/lib/adapters/AuthServerRepo.d.ts.map +1 -0
- package/lib/adapters/AuthServerRepo.js +23 -0
- package/lib/adapters/AuthServerRepo.js.map +1 -0
- package/lib/adapters/ebay/EbayAdapter.d.ts +6 -1
- package/lib/adapters/ebay/EbayAdapter.d.ts.map +1 -1
- package/lib/adapters/ebay/EbayAdapter.js +4 -0
- package/lib/adapters/ebay/EbayAdapter.js.map +1 -1
- package/lib/adapters/ebay/WebEbayAdapter.d.ts +2 -1
- package/lib/adapters/ebay/WebEbayAdapter.d.ts.map +1 -1
- package/lib/adapters/ebay/WebEbayAdapter.js +4 -0
- package/lib/adapters/ebay/WebEbayAdapter.js.map +1 -1
- package/lib/adapters/itrack/ItrackAdapter.d.ts +18 -3
- package/lib/adapters/itrack/ItrackAdapter.d.ts.map +1 -1
- package/lib/adapters/itrack/ItrackAdapter.js +86 -26
- package/lib/adapters/itrack/ItrackAdapter.js.map +1 -1
- package/lib/entities/ebay/Address.d.ts +2 -0
- package/lib/entities/ebay/Address.d.ts.map +1 -1
- package/lib/entities/ebay/Address.js +11 -0
- package/lib/entities/ebay/Address.js.map +1 -1
- package/lib/entities/ebay/EbayInventoryLocationDTO.d.ts +9 -0
- package/lib/entities/ebay/EbayInventoryLocationDTO.d.ts.map +1 -0
- package/lib/entities/ebay/EbayInventoryLocationDTO.js +24 -0
- package/lib/entities/ebay/EbayInventoryLocationDTO.js.map +1 -0
- package/lib/entities/ebay/InventoryItem.d.ts +3 -3
- package/lib/entities/ebay/InventoryItem.d.ts.map +1 -1
- package/lib/entities/ebay/InventoryItem.js +1 -3
- package/lib/entities/ebay/InventoryItem.js.map +1 -1
- package/lib/entities/ebay/InventoryLocationStoreInput.d.ts +12 -0
- package/lib/entities/ebay/InventoryLocationStoreInput.d.ts.map +1 -0
- package/lib/entities/ebay/InventoryLocationStoreInput.js +2 -0
- package/lib/entities/ebay/InventoryLocationStoreInput.js.map +1 -0
- package/lib/entities/ebay/MerchantLocationKey.d.ts +1 -0
- package/lib/entities/ebay/MerchantLocationKey.d.ts.map +1 -1
- package/lib/entities/ebay/MerchantLocationKey.js +1 -0
- package/lib/entities/ebay/MerchantLocationKey.js.map +1 -1
- package/lib/entities/itrack/EcommercePartner.d.ts +46 -0
- package/lib/entities/itrack/EcommercePartner.d.ts.map +1 -0
- package/lib/entities/itrack/EcommercePartner.js +19 -0
- package/lib/entities/itrack/EcommercePartner.js.map +1 -0
- package/lib/index.d.ts +5 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -3
- package/lib/index.js.map +1 -1
- package/lib/infrastructure/HttpToRepoConverter.d.ts.map +1 -1
- package/lib/infrastructure/HttpToRepoConverter.js +9 -2
- package/lib/infrastructure/HttpToRepoConverter.js.map +1 -1
- package/lib/ports/EbayInterface.d.ts +2 -1
- package/lib/ports/EbayInterface.d.ts.map +1 -1
- package/lib/ports/ItrackInterface.d.ts +2 -2
- package/lib/ports/ItrackInterface.d.ts.map +1 -1
- package/lib/repositories/ebay/CompanyRepo.d.ts +5 -0
- package/lib/repositories/ebay/CompanyRepo.d.ts.map +1 -0
- package/lib/repositories/ebay/CompanyRepo.js +15 -0
- package/lib/repositories/ebay/CompanyRepo.js.map +1 -0
- package/lib/repositories/ebay/ImageUploadRepo.js +4 -4
- package/lib/repositories/ebay/InventoryLocationRepo.d.ts +3 -1
- package/lib/repositories/ebay/InventoryLocationRepo.d.ts.map +1 -1
- package/lib/repositories/ebay/InventoryLocationRepo.js +15 -0
- package/lib/repositories/ebay/InventoryLocationRepo.js.map +1 -1
- package/lib/repositories/itrack/CompanyRepo.d.ts +5 -0
- package/lib/repositories/itrack/CompanyRepo.d.ts.map +1 -0
- package/lib/repositories/itrack/CompanyRepo.js +8 -0
- package/lib/repositories/itrack/CompanyRepo.js.map +1 -0
- package/lib/repositories/itrack/EbayInventoryItemRowRepo_deprecated.d.ts +27 -0
- package/lib/repositories/itrack/EbayInventoryItemRowRepo_deprecated.d.ts.map +1 -0
- package/lib/repositories/itrack/EbayInventoryItemRowRepo_deprecated.js +2 -0
- package/lib/repositories/itrack/EbayInventoryItemRowRepo_deprecated.js.map +1 -0
- package/lib/repositories/itrack/EbayLocationRepo.d.ts +16 -0
- package/lib/repositories/itrack/EbayLocationRepo.d.ts.map +1 -0
- package/lib/repositories/itrack/EbayLocationRepo.js +32 -0
- package/lib/repositories/itrack/EbayLocationRepo.js.map +1 -0
- package/lib/repositories/itrack/EcommercePartnerRepo.d.ts +9 -0
- package/lib/repositories/itrack/EcommercePartnerRepo.d.ts.map +1 -0
- package/lib/repositories/itrack/EcommercePartnerRepo.js +26 -0
- package/lib/repositories/itrack/EcommercePartnerRepo.js.map +1 -0
- package/lib/repositories/itrack/ItrackEbayInventoryListingDetailRepo_deprecated.d.ts +8 -0
- package/lib/repositories/itrack/ItrackEbayInventoryListingDetailRepo_deprecated.d.ts.map +1 -0
- package/lib/repositories/itrack/ItrackEbayInventoryListingDetailRepo_deprecated.js +66 -0
- package/lib/repositories/itrack/ItrackEbayInventoryListingDetailRepo_deprecated.js.map +1 -0
- package/lib/repositories/itrack/StoreRepo.d.ts +2 -2
- package/lib/repositories/itrack/StoreRepo.d.ts.map +1 -1
- package/lib/usecases/Agg_StoreEvent.d.ts +1 -10
- package/lib/usecases/Agg_StoreEvent.d.ts.map +1 -1
- package/lib/usecases/Agg_StoreEvent.js +3 -6
- package/lib/usecases/Agg_StoreEvent.js.map +1 -1
- package/lib/usecases/Location/PushInventoryLocationToEbay.d.ts +2 -2
- package/lib/usecases/Location/PushInventoryLocationToEbay.d.ts.map +1 -1
- package/lib/usecases/Location/PushInventoryLocations.d.ts +16 -0
- package/lib/usecases/Location/PushInventoryLocations.d.ts.map +1 -0
- package/lib/usecases/Location/PushInventoryLocations.js +56 -0
- package/lib/usecases/Location/PushInventoryLocations.js.map +1 -0
- package/lib/usecases/Location/ReconcileLocationToEbay.d.ts +18 -0
- package/lib/usecases/Location/ReconcileLocationToEbay.d.ts.map +1 -0
- package/lib/usecases/Location/ReconcileLocationToEbay.js +50 -0
- package/lib/usecases/Location/ReconcileLocationToEbay.js.map +1 -0
- package/lib/usecases/Location/SyncInventoryLocationToEbay.d.ts +19 -0
- package/lib/usecases/Location/SyncInventoryLocationToEbay.d.ts.map +1 -0
- package/lib/usecases/Location/SyncInventoryLocationToEbay.js +79 -0
- package/lib/usecases/Location/SyncInventoryLocationToEbay.js.map +1 -0
- package/lib/usecases/Location/SyncInventoryLocationsToEbay.d.ts +17 -0
- package/lib/usecases/Location/SyncInventoryLocationsToEbay.d.ts.map +1 -0
- package/lib/usecases/Location/SyncInventoryLocationsToEbay.js +69 -0
- package/lib/usecases/Location/SyncInventoryLocationsToEbay.js.map +1 -0
- package/lib/usecases/Location/SyncInventoryLocations_TODO.d.ts +13 -0
- package/lib/usecases/Location/SyncInventoryLocations_TODO.d.ts.map +1 -0
- package/lib/usecases/Location/SyncInventoryLocations_TODO.js +10 -0
- package/lib/usecases/Location/SyncInventoryLocations_TODO.js.map +1 -0
- package/package.json +58 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpToRepoConverter.js","sourceRoot":"","sources":["../../src/infrastructure/HttpToRepoConverter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAChD,YAA6B,EAC7B,OAAoB,EACF,EAAE;IACpB,yFAAyF;IACzF,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAA;IAC9F,MAAM,IAAI,GAAG,MAAM,IAAI,MAAM,EAAE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AAU,EAAE,YAAY,CAAC,UAAU;SACnC,CAAA;IACF,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -6,11 +6,12 @@ import { AdapterResult } from '../adapters/AdapterResult.js';
|
|
|
6
6
|
import { PushOfferResponse, PushOfferRequest, PublishOfferResponse } from '../entities/ebay/Offer.js';
|
|
7
7
|
import { Sku } from '../entities/ebay/Sku.js';
|
|
8
8
|
import { InventoryItem } from '../entities/ebay/InventoryItem.js';
|
|
9
|
-
import { PublishOfferRequest, CreateLocationRequest } from '../adapters/ebay/EbayAdapter.js';
|
|
9
|
+
import { PublishOfferRequest, CreateLocationRequest, UpdateLocationRequest } from '../adapters/ebay/EbayAdapter.js';
|
|
10
10
|
import { RepoResponse } from '../repositories/ebay/BaseRepo.js';
|
|
11
11
|
import { InventoryLocationResponse } from '../entities/ebay/InventoryLocation.js';
|
|
12
12
|
export interface EbayInterface {
|
|
13
13
|
createInventoryLocation: (req: CreateLocationRequest) => Promise<RepoResponse<void>>;
|
|
14
|
+
updateInventoryLocation: (req: UpdateLocationRequest) => Promise<RepoResponse<void>>;
|
|
14
15
|
getFulfillmentPolicies: (market: MarketplaceIdEnum) => Promise<AdapterResult<GetFulfillmentPoliciesResponse>>;
|
|
15
16
|
getInventoryLocation: (key: string) => Promise<RepoResponse<InventoryLocationResponse>>;
|
|
16
17
|
getInventoryLocations: (offset?: number, limit?: number) => Promise<RepoResponse<InventoryLocationResponse[]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EbayInterface.d.ts","sourceRoot":"","sources":["../../src/ports/EbayInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAA;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,EAAE,a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AAA;IACpF,sBAAsB,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,aAAa,CAAC,8BAA8B,CAAC,CAAC,CAAA;IAC7G,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAA;IACvF,qBAAqB,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAA;IAC9G,kBAAkB,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC,CAAA;IACnG,iBAAiB,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAA;IACjG,YAAY,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAC5F,aAAa,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;IACvF,SAAS,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAA;CACjF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EbayInventoryLocationDTO } from '../entities/ebay/EbayInventoryLocationDTO.js';
|
|
2
2
|
import { ItrackEbayDefaults } from '../adapters/itrack/ItrackAdapter.js';
|
|
3
3
|
import { AdapterResult } from '../adapters/AdapterResult.js';
|
|
4
4
|
export interface ItrackInterface {
|
|
5
|
-
getInventoryLocations: () => Promise<
|
|
5
|
+
getInventoryLocations: () => Promise<EbayInventoryLocationDTO[]>;
|
|
6
6
|
getItrackEbayDefaults: (ecommercePartnerId: number) => Promise<AdapterResult<ItrackEbayDefaults>>;
|
|
7
7
|
updateAuthServerToken: (prod: boolean, token: string) => Promise<void>;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItrackInterface.d.ts","sourceRoot":"","sources":["../../src/ports/ItrackInterface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ItrackInterface.d.ts","sourceRoot":"","sources":["../../src/ports/ItrackInterface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAA;AAEvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,MAAM,WAAW,eAAe;IAE/B,qBAAqB,EAAE,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAA;IAChE,qBAAqB,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAA;IACjG,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/ebay/CompanyRepo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAM7D,qBAAa,WAAW;IACvB,MAAM,CAAC,GAAG,GAAI,IAAI,SAAS,qBAIW;CAEtC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class CompanyRepo {
|
|
2
|
+
}
|
|
3
|
+
CompanyRepo.get = (db) => db.query({
|
|
4
|
+
sql: "SELECT f_get_setting('Global', -1, 'Company Info', 'Product Code', '', 'False', 'Important Configuration')"
|
|
5
|
+
+ " AS `companyId`",
|
|
6
|
+
values: [],
|
|
7
|
+
}).then(result => result[0].companyId);
|
|
8
|
+
// export class CompanyRepo {
|
|
9
|
+
// static get = (db: MysqlDatastore) => db.query<Row[]>({
|
|
10
|
+
// sql: "SELECT f_get_setting('Global', -1, 'Company Info', 'Product Code', '', 'False', 'Important Configuration')"
|
|
11
|
+
// + " AS `companyId`",
|
|
12
|
+
// values: [],
|
|
13
|
+
// }).then(result => result[0].companyId)
|
|
14
|
+
// }
|
|
15
|
+
//# sourceMappingURL=CompanyRepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyRepo.js","sourceRoot":"","sources":["../../../src/repositories/ebay/CompanyRepo.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,WAAW;;AAChB,eAAG,GAAG,CAAC,EAAa,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAQ;IAC/C,GAAG,EAAE,4GAA4G;UAC7G,iBAAiB;IACrB,MAAM,EAAE,EAAE;CACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;AAIvC,6BAA6B;AAC7B,0DAA0D;AAC1D,sHAAsH;AACtH,2BAA2B;AAC3B,gBAAgB;AAChB,0CAA0C;AAE1C,IAAI"}
|
|
@@ -21,10 +21,10 @@ export class ImageUploadRepo extends BaseRepo {
|
|
|
21
21
|
async uploadImage(token, options) {
|
|
22
22
|
const { pictureName, fileData, pictureSet = 'Standard' } = options;
|
|
23
23
|
// Create XML payload for UploadSiteHostedPictures
|
|
24
|
-
const xmlPayload = `<?xml version="1.0" encoding="utf-8"?>
|
|
25
|
-
<UploadSiteHostedPicturesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
|
|
26
|
-
<PictureName>${pictureName}</PictureName>
|
|
27
|
-
<PictureSet>${pictureSet}</PictureSet>
|
|
24
|
+
const xmlPayload = `<?xml version="1.0" encoding="utf-8"?>
|
|
25
|
+
<UploadSiteHostedPicturesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
|
|
26
|
+
<PictureName>${pictureName}</PictureName>
|
|
27
|
+
<PictureSet>${pictureSet}</PictureSet>
|
|
28
28
|
</UploadSiteHostedPicturesRequest>`;
|
|
29
29
|
const request = {
|
|
30
30
|
url: this.baseUrl,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LocationResponse } from '../../entities/ebay/LocationDetails.js';
|
|
2
|
-
import { InventoryLocationResponse } from '../../entities/ebay/InventoryLocation.js';
|
|
2
|
+
import { InventoryLocation, InventoryLocationResponse } from '../../entities/ebay/InventoryLocation.js';
|
|
3
3
|
import { InventoryLocationFull } from '../../entities/ebay/InventoryLocationFull.js';
|
|
4
4
|
import { Request } from '../../entities/Request.js';
|
|
5
5
|
import { BaseRepo } from './BaseRepo.js';
|
|
@@ -13,8 +13,10 @@ export declare class InventoryLocationRepo extends BaseRepo {
|
|
|
13
13
|
create: (token: string, key: string, location: InventoryLocationFull) => Promise<import("./BaseRepo.js").RepoResponse<void>>;
|
|
14
14
|
getOne: (token: string, merchantLocationKey: string) => Promise<import("./BaseRepo.js").RepoResponse<InventoryLocationResponse>>;
|
|
15
15
|
getMany: (token: string, offset?: number, limit?: number) => Promise<import("./BaseRepo.js").RepoResponse<LocationResponse>>;
|
|
16
|
+
update: (token: string, key: string, location: InventoryLocation) => Promise<import("./BaseRepo.js").RepoResponse<void>>;
|
|
16
17
|
static formatCreateInventoryLocationRequest: (production: boolean, token: string, key: string, location: InventoryLocationFull) => Request;
|
|
17
18
|
static formatGetInventoryLocationRequest: (production: boolean, token: string, merchantLocationKey: string) => Request;
|
|
19
|
+
static formatUpdateInventoryLocationRequest: (production: boolean, token: string, key: string, location: InventoryLocation) => Request;
|
|
18
20
|
static formatGetInventoryLocationsRequest: (production: boolean, token: string, offset?: number, limit?: number) => GetInventoryLocationsRequest;
|
|
19
21
|
}
|
|
20
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InventoryLocationRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/ebay/InventoryLocationRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAA;
|
|
1
|
+
{"version":3,"file":"InventoryLocationRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/ebay/InventoryLocationRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAA;AACvG,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAA;AAIpF,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,UAAU,4BAA6B,SAAQ,OAAO;IACrD,MAAM,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACD;AAED,qBAAa,qBAAsB,SAAQ,QAAQ;IAC3C,MAAM,GAAU,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,qBAAqB,yDAGjF;IAEM,MAAM,GAAI,OAAO,MAAM,EAAE,qBAAqB,MAAM,8EAG1D;IAEM,OAAO,GAAI,OAAO,MAAM,EAAE,SAAS,MAAM,EAAE,QAAQ,MAAM,qEAG/D;IAEM,MAAM,GAAU,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,iBAAiB,yDAG7E;IAGD,MAAM,CAAC,oCAAoC,GAC1C,YAAY,OAAO,EACnB,OAAO,MAAM,EACb,KAAK,MAAM,EACX,UAAU,qBAAqB,KAC7B,OAAO,CASR;IAGF,MAAM,CAAC,iCAAiC,GACvC,YAAY,OAAO,EACnB,OAAO,MAAM,EACb,qBAAqB,MAAM,KACzB,OAAO,CAMR;IAGF,MAAM,CAAC,oCAAoC,GAC1C,YAAY,OAAO,EACnB,OAAO,MAAM,EACb,KAAK,MAAM,EACX,UAAU,iBAAiB,KACzB,OAAO,CASR;IAGF,MAAM,CAAC,kCAAkC,GACxC,YAAY,OAAO,EACnB,OAAO,MAAM,EACb,SAAS,MAAM,EACf,QAAQ,MAAM,KACZ,4BAA4B,CAU7B;CACF"}
|
|
@@ -17,6 +17,10 @@ export class InventoryLocationRepo extends BaseRepo {
|
|
|
17
17
|
const request = InventoryLocationRepo.formatGetInventoryLocationsRequest(this.production, token, offset, limit);
|
|
18
18
|
return this.fetch(request);
|
|
19
19
|
};
|
|
20
|
+
this.update = async (token, key, location) => {
|
|
21
|
+
const request = InventoryLocationRepo.formatUpdateInventoryLocationRequest(this.production, token, key, location);
|
|
22
|
+
return this.fetch(request);
|
|
23
|
+
};
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
// https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/createInventoryLocation
|
|
@@ -38,6 +42,17 @@ InventoryLocationRepo.formatGetInventoryLocationRequest = (production, token, me
|
|
|
38
42
|
method: MethodEnum.Get,
|
|
39
43
|
url: `${getDomain(production)}/sell/inventory/v1/location/${merchantLocationKey}`,
|
|
40
44
|
});
|
|
45
|
+
// https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/updateInventoryLocation
|
|
46
|
+
InventoryLocationRepo.formatUpdateInventoryLocationRequest = (production, token, key, location) => ({
|
|
47
|
+
data: location,
|
|
48
|
+
headers: {
|
|
49
|
+
...HttpHeaders.Authorization(token),
|
|
50
|
+
...HttpHeaders.ContentLanguage,
|
|
51
|
+
...HttpHeaders.ContentType,
|
|
52
|
+
},
|
|
53
|
+
method: MethodEnum.Post,
|
|
54
|
+
url: `${getDomain(production)}/sell/inventory/v1/location/${key}/update_location_details`,
|
|
55
|
+
});
|
|
41
56
|
// https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/getInventoryLocations
|
|
42
57
|
InventoryLocationRepo.formatGetInventoryLocationsRequest = (production, token, offset, limit) => ({
|
|
43
58
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InventoryLocationRepo.js","sourceRoot":"","sources":["../../../src/repositories/ebay/InventoryLocationRepo.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AASxC,MAAM,OAAO,qBAAsB,SAAQ,QAAQ;IAAnD;;QACQ,WAAM,GAAG,KAAK,EAAE,KAAa,EAAE,GAAW,EAAE,QAA+B,EAAE,EAAE;YACrF,MAAM,OAAO,GAAG,qBAAqB,CAAC,oCAAoC,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;YACjH,OAAO,IAAI,CAAC,KAAK,CAAO,OAAO,CAAC,CAAA;QACjC,CAAC,CAAA;QAEM,WAAM,GAAG,CAAC,KAAa,EAAE,mBAA2B,EAAE,EAAE;YAC9D,MAAM,OAAO,GAAG,qBAAqB,CAAC,iCAAiC,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAA;YACpH,OAAO,IAAI,CAAC,KAAK,CAA4B,OAAO,CAAC,CAAA;QACtD,CAAC,CAAA;QAEM,YAAO,GAAG,CAAC,KAAa,EAAE,MAAe,EAAE,KAAc,EAAE,EAAE;YACnE,MAAM,OAAO,GAAG,qBAAqB,CAAC,kCAAkC,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;YAC/G,OAAO,IAAI,CAAC,KAAK,CAAmB,OAAO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AC,UAAU,CAAC,+BAA+B,GAAG,0BAA0B;CACzF,CAAC,AAdyC,CAczC;AAEF,sGAAsG;AAC/F,wDAAkC,GAAG,CAC3C,UAAmB,EACnB,KAAa,EACb,MAAe,EACf,KAAc,EACiB,EAAE,CAAC,CAAC;IACnC,OAAO,EAAE;QACR,GAAG,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC;KACnC;IACD,MAAM,EAAE,UAAU,CAAC,GAAG;IACtB,MAAM,EAAE;QACP,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;QACvB,GAAG,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;KACzB;IACD,GAAG,EAAE,GAAG,SAAS,CAAC,UAAU,CAAC,6BAA6B;CAC1D,CAAC,AAfuC,CAevC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/CompanyRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAM7D,qBAAa,WAAW;IACvB,MAAM,CAAC,GAAG,GAAI,IAAI,SAAS,qBAIW;CAEtC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export class CompanyRepo {
|
|
2
|
+
}
|
|
3
|
+
CompanyRepo.get = (db) => db.query({
|
|
4
|
+
sql: "SELECT f_get_setting('Global', -1, 'Company Info', 'Product Code', '', 'False', 'Important Configuration')"
|
|
5
|
+
+ " AS `companyId`",
|
|
6
|
+
values: [],
|
|
7
|
+
}).then(result => result[0].companyId);
|
|
8
|
+
//# sourceMappingURL=CompanyRepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyRepo.js","sourceRoot":"","sources":["../../../src/repositories/itrack/CompanyRepo.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,WAAW;;AAChB,eAAG,GAAG,CAAC,EAAa,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAQ;IAC/C,GAAG,EAAE,4GAA4G;UAC7G,iBAAiB;IACrB,MAAM,EAAE,EAAE;CACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ShouldBeOnEbayEnum } from "../../entities/itrack/ShouldBeOnEbayEnum.js";
|
|
2
|
+
import * as AvailabilityEntity from "../../entities/ebay/Availability.js";
|
|
3
|
+
export interface ItrackEbayInventoryItemRow {
|
|
4
|
+
id: number;
|
|
5
|
+
should_be_on_ebay: ShouldBeOnEbayEnum;
|
|
6
|
+
storeid: number;
|
|
7
|
+
tagnumber: string;
|
|
8
|
+
datemodified: Date;
|
|
9
|
+
inventoryid: number;
|
|
10
|
+
quantity_available: number;
|
|
11
|
+
quantity_on_order: number;
|
|
12
|
+
ebay_sku: string;
|
|
13
|
+
ebay_merchant_location_key: string;
|
|
14
|
+
ebay_availability_type: AvailabilityEntity.AvailabilityTypeEnum;
|
|
15
|
+
ebay_category_id: string | null;
|
|
16
|
+
ebay_condition: string | null;
|
|
17
|
+
ebay_condition_description: string;
|
|
18
|
+
ebay_marketplace: string;
|
|
19
|
+
ebay_price: number;
|
|
20
|
+
ebay_title: string;
|
|
21
|
+
ebay_description: string;
|
|
22
|
+
ebay_subtitle: string;
|
|
23
|
+
ebay_fulfillment_policy: string;
|
|
24
|
+
ebay_payment_policy: string;
|
|
25
|
+
ebay_return_policy: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=EbayInventoryItemRowRepo_deprecated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EbayInventoryItemRowRepo_deprecated.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/EbayInventoryItemRowRepo_deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,KAAK,kBAAkB,MAAM,qCAAqC,CAAA;AAIzE,MAAM,WAAW,0BAA0B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B,EAAE,MAAM,CAAC;IACnC,sBAAsB,EAAE,kBAAkB,CAAC,oBAAoB,CAAC;IAChE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,0BAA0B,EAAE,MAAM,CAAC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EbayInventoryItemRowRepo_deprecated.js","sourceRoot":"","sources":["../../../src/repositories/itrack/EbayInventoryItemRowRepo_deprecated.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MysqlDatastore } from '../../infrastructure/mysql/MysqlDatastore.js';
|
|
2
|
+
import { InventoryLocationFull } from '../../entities/ebay/InventoryLocationFull.js';
|
|
3
|
+
export interface EbayLocationRow {
|
|
4
|
+
storeId: number;
|
|
5
|
+
ebayName: string;
|
|
6
|
+
details: InventoryLocationFull;
|
|
7
|
+
production: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class EbayLocationRepo {
|
|
10
|
+
private readonly db;
|
|
11
|
+
constructor(db: MysqlDatastore);
|
|
12
|
+
getByStoreId: (storeId: number, production: boolean) => Promise<EbayLocationRow | null>;
|
|
13
|
+
getAll: (production: boolean) => Promise<EbayLocationRow[]>;
|
|
14
|
+
upsert: (row: EbayLocationRow) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=EbayLocationRepo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EbayLocationRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/EbayLocationRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAA;AAEpF,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,qBAAqB,CAAA;IAC9B,UAAU,EAAE,OAAO,CAAA;CACtB;AAiBD,qBAAa,gBAAgB;IACb,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,cAAc;IAExC,YAAY,GAAU,SAAS,MAAM,EAAE,YAAY,OAAO,KAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAMlG;IAEM,MAAM,GAAU,YAAY,OAAO,KAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAMtE;IAEM,MAAM,GAAU,KAAK,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC,CAK1D;CACJ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const convertToEbayLocationRow = (db) => ({
|
|
2
|
+
storeId: db.storeid,
|
|
3
|
+
ebayName: db.ebayname,
|
|
4
|
+
details: JSON.parse(db.details),
|
|
5
|
+
production: db.production === 'True',
|
|
6
|
+
});
|
|
7
|
+
export class EbayLocationRepo {
|
|
8
|
+
constructor(db) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
this.getByStoreId = async (storeId, production) => {
|
|
11
|
+
const rows = await this.db.query({
|
|
12
|
+
sql: 'SELECT * FROM ebay_location WHERE storeid = ? AND production = ?',
|
|
13
|
+
values: [storeId, production ? 'True' : 'False'],
|
|
14
|
+
});
|
|
15
|
+
return rows[0] ? convertToEbayLocationRow(rows[0]) : null;
|
|
16
|
+
};
|
|
17
|
+
this.getAll = async (production) => {
|
|
18
|
+
const rows = await this.db.query({
|
|
19
|
+
sql: 'SELECT * FROM ebay_location WHERE production = ?',
|
|
20
|
+
values: [production ? 'True' : 'False'],
|
|
21
|
+
});
|
|
22
|
+
return rows.map(convertToEbayLocationRow);
|
|
23
|
+
};
|
|
24
|
+
this.upsert = async (row) => {
|
|
25
|
+
await this.db.query({
|
|
26
|
+
sql: 'INSERT INTO ebay_location (`storeid`, `ebayname`, `details`, `production`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE ebayname = VALUES(ebayname), details = VALUES(details), production = VALUES(production)',
|
|
27
|
+
values: [row.storeId, row.ebayName, JSON.stringify(row.details), row.production ? 'True' : 'False'],
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=EbayLocationRepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EbayLocationRepo.js","sourceRoot":"","sources":["../../../src/repositories/itrack/EbayLocationRepo.ts"],"names":[],"mappings":"AAkBA,MAAM,wBAAwB,GAAG,CAAC,EAAqB,EAAmB,EAAE,CAAC,CAAC;IAC1E,OAAO,EAAE,EAAE,CAAC,OAAO;IACnB,QAAQ,EAAE,EAAE,CAAC,QAAQ;IACrB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAA0B;IACxD,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,MAAM;CACvC,CAAC,CAAA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,9 @@
|
|
|
1
|
+
import { MysqlDatastore } from '../../infrastructure/mysql/MysqlDatastore.js';
|
|
2
|
+
import { EcommercePartnerConfiguration, EcommercePartnerDefaults } from '../../entities/itrack/EcommercePartner.js';
|
|
3
|
+
export declare class EcommercePartnerRepo {
|
|
4
|
+
private readonly db;
|
|
5
|
+
constructor(db: MysqlDatastore);
|
|
6
|
+
getByName: (name: string) => Promise<EcommercePartnerConfiguration | null>;
|
|
7
|
+
updateDefaults: (ecommercePartnerId: number, defaults: EcommercePartnerDefaults) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=EcommercePartnerRepo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EcommercePartnerRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/EcommercePartnerRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAC7E,OAAO,EACH,6BAA6B,EAC7B,wBAAwB,EAC3B,MAAM,2CAA2C,CAAA;AAkBlD,qBAAa,oBAAoB;IACjB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,cAAc;IAExC,SAAS,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CAMrF;IAEM,cAAc,GACjB,oBAAoB,MAAM,EAC1B,UAAU,wBAAwB,KACnC,OAAO,CAAC,IAAI,CAAC,CAKf;CACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const toRow = (db) => ({
|
|
2
|
+
ecommercePartnerId: db.ecommercepartnerid,
|
|
3
|
+
name: db.name,
|
|
4
|
+
externalId: db.externalid,
|
|
5
|
+
active: db.active === 'True',
|
|
6
|
+
defaults: JSON.parse(db.defaults),
|
|
7
|
+
});
|
|
8
|
+
export class EcommercePartnerRepo {
|
|
9
|
+
constructor(db) {
|
|
10
|
+
this.db = db;
|
|
11
|
+
this.getByName = async (name) => {
|
|
12
|
+
const rows = await this.db.query({
|
|
13
|
+
sql: 'SELECT * FROM ecommercepartner WHERE name = ?',
|
|
14
|
+
values: [name],
|
|
15
|
+
});
|
|
16
|
+
return rows[0] ? toRow(rows[0]) : null;
|
|
17
|
+
};
|
|
18
|
+
this.updateDefaults = async (ecommercePartnerId, defaults) => {
|
|
19
|
+
await this.db.query({
|
|
20
|
+
sql: 'UPDATE ecommercepartner SET defaults = ? WHERE ecommercepartnerid = ?',
|
|
21
|
+
values: [JSON.stringify(defaults), ecommercePartnerId],
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=EcommercePartnerRepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EcommercePartnerRepo.js","sourceRoot":"","sources":["../../../src/repositories/itrack/EcommercePartnerRepo.ts"],"names":[],"mappings":"AAcA,MAAM,KAAK,GAAG,CAAC,EAAyB,EAAiC,EAAE,CAAC,CAAC;IACzE,kBAAkB,EAAE,EAAE,CAAC,kBAAkB;IACzC,IAAI,EAAE,EAAE,CAAC,IAAI;IACb,UAAU,EAAE,EAAE,CAAC,UAAU;IACzB,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM;IAC5B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAA6B;CAChE,CAAC,CAAA;AAEF,MAAM,OAAO,oBAAoB;IAC7B,YAA6B,EAAkB;QAAlB,OAAE,GAAF,EAAE,CAAgB;QAExC,cAAS,GAAG,KAAK,EAAE,IAAY,EAAiD,EAAE;YACrF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAA0B;gBACtD,GAAG,EAAE,+CAA+C;gBACpD,MAAM,EAAE,CAAC,IAAI,CAAC;aACjB,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC1C,CAAC,CAAA;QAEM,mBAAc,GAAG,KAAK,EACzB,kBAA0B,EAC1B,QAAkC,EACrB,EAAE;YACf,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC;gBAChB,GAAG,EAAE,uEAAuE;gBAC5E,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;aACzD,CAAC,CAAA;QACN,CAAC,CAAA;IAlBiD,CAAC;CAmBtD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MysqlDatastore } from "../../infrastructure/mysql/MysqlDatastore";
|
|
2
|
+
import { ItrackEbayListingRow } from "../../entities/itrack/ItrackEbayListing_deprecated.js";
|
|
3
|
+
export declare class ItrackEbayInventoryListingDetailRepo {
|
|
4
|
+
private readonly dataloader;
|
|
5
|
+
constructor(db: MysqlDatastore);
|
|
6
|
+
get: (id: number) => Promise<ItrackEbayListingRow>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ItrackEbayInventoryListingDetailRepo_deprecated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItrackEbayInventoryListingDetailRepo_deprecated.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/ItrackEbayInventoryListingDetailRepo_deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uDAAuD,CAAA;AAI5F,qBAAa,oCAAoC;IAEzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsD;gBAgBrE,EAAE,EAAE,cAAc;IA+C3B,GAAG,GAAS,IAAI,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAAC,CAG5D;CAIJ"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import Dataloader from "dataloader";
|
|
2
|
+
export class ItrackEbayInventoryListingDetailRepo {
|
|
3
|
+
// We'll need a default for category, if no match in category map
|
|
4
|
+
// We'll need a default for description if empty which may involve a template
|
|
5
|
+
// We'll need a way to get the preferred sku format and/or a default
|
|
6
|
+
//
|
|
7
|
+
// Whichever thing consumes this itrack inventory item will be responsible for figuring out
|
|
8
|
+
// overrides and defaults
|
|
9
|
+
// Note: The eBay sync utility uses f_ebay_availability_type which involves quantity on order to adjust the value
|
|
10
|
+
// As far as I can tell, SHIP_TO_STORE is intended for the seller's
|
|
11
|
+
// own warehouse locations, not vendors...especially since using it requires supplying one's merchant location key
|
|
12
|
+
// With that in mind, I will not be using it unless we can confirm a customer is using
|
|
13
|
+
// a location in the way eBay thinks of as a warehouse.
|
|
14
|
+
// TODO: a list of image urls is required but that should likely come from a separate step.
|
|
15
|
+
constructor(db) {
|
|
16
|
+
this.get = async (id) => {
|
|
17
|
+
// Not really sure a dataloader is necessary here but Mark uses it elsewhere
|
|
18
|
+
return await this.dataloader.load(id);
|
|
19
|
+
};
|
|
20
|
+
// TODO: this will need to be a view at some point
|
|
21
|
+
// TODO: join against an override table which doesn't exist yet
|
|
22
|
+
this.dataloader = new Dataloader(async (ids) => {
|
|
23
|
+
return db.query({
|
|
24
|
+
sql: `
|
|
25
|
+
SELECT
|
|
26
|
+
inventory.innodb_inventoryid AS id,
|
|
27
|
+
ebayconditionmap.ebaycondition AS ebay_condition,
|
|
28
|
+
inventory.condition AS condition_description,
|
|
29
|
+
COALESCE(inventorylistingoverride.description, IFNULL(inventory.description, '')) AS ebay_description,
|
|
30
|
+
inventory.inventoryid AS inventoryid,
|
|
31
|
+
inventory.public AS public,
|
|
32
|
+
f_quantityavailable(inventory.inventoryid, inventory.storeid) AS quantity_available,
|
|
33
|
+
COALESCE(inventorylistingoverride.price,inventory.retailprice) AS ebay_price,
|
|
34
|
+
inventory.shippingwidth AS shippingwidth,
|
|
35
|
+
inventory.shippinglength AS shippinglength,
|
|
36
|
+
inventory.shippingheight AS shippingheight,
|
|
37
|
+
inventory.shippingmeasurementunit AS shippingmeasurementunit,
|
|
38
|
+
inventory.storeid AS storeid,
|
|
39
|
+
inventory.tagnumber AS tagnumber,
|
|
40
|
+
inventory.upc AS upc,
|
|
41
|
+
inventory.weight AS weight,
|
|
42
|
+
inventory.weightunit AS weightunit,
|
|
43
|
+
ebaycategorymap.ebaycategoryid AS ebay_category_id,
|
|
44
|
+
'EBAY_MOTORS' AS ebay_marketplace,
|
|
45
|
+
manufacturer.name AS manufacturername,
|
|
46
|
+
model.name AS model
|
|
47
|
+
FROM
|
|
48
|
+
inventory
|
|
49
|
+
LEFT JOIN
|
|
50
|
+
ebayconditionmap ON inventory.category = ebayconditionmap.itrackcondition
|
|
51
|
+
LEFT JOIN
|
|
52
|
+
ebaycategorymap USING (inventorytypeid)
|
|
53
|
+
LEFT JOIN
|
|
54
|
+
manufacturer USING (manufacturerid)
|
|
55
|
+
LEFT JOIN
|
|
56
|
+
model USING (modelid)
|
|
57
|
+
LEFT JOIN
|
|
58
|
+
inventorylistingoverride ON inventory.innodb_inventoryid = inventorylistingoverride.id
|
|
59
|
+
WHERE inventory.innodb_inventoryid IN (?)
|
|
60
|
+
`,
|
|
61
|
+
values: [ids],
|
|
62
|
+
}).then(rows => ids.map(id => rows.find(row => row.id === id)));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=ItrackEbayInventoryListingDetailRepo_deprecated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItrackEbayInventoryListingDetailRepo_deprecated.js","sourceRoot":"","sources":["../../../src/repositories/itrack/ItrackEbayInventoryListingDetailRepo_deprecated.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,MAAM,OAAO,oCAAoC;IAIzC,iEAAiE;IACjE,6EAA6E;IAC7E,oEAAoE;IACpE,GAAG;IACH,2FAA2F;IAC3F,yBAAyB;IAEzB,iHAAiH;IACjH,mEAAmE;IACnE,mHAAmH;IACnH,uFAAuF;IACvF,uDAAuD;IAEvD,2FAA2F;IAC3F,YAAY,EAAkB;QA+C3B,QAAG,GAAG,KAAK,EAAC,EAAU,EAAiC,EAAE;YAC5D,4EAA4E;YAC5E,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACzC,CAAC,CAAA;QAjDO,kDAAkD;QAClD,+DAA+D;QAC/D,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,EAAC,GAAG,EAAC,EAAE;YACzC,OAAO,EAAE,CAAC,KAAK,CAAyB;gBACpC,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCJ;gBACD,MAAM,EAAE,CAAE,GAAG,CAAE;aAClB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;QACnE,CAAC,CAAC,CAAA;IACN,CAAC;CASR"}
|
|
@@ -2,7 +2,7 @@ import { MysqlDatastore } from '../../infrastructure/mysql/MysqlDatastore.js';
|
|
|
2
2
|
export interface StoreRow {
|
|
3
3
|
storeid: number;
|
|
4
4
|
dunsnumber: number;
|
|
5
|
-
|
|
5
|
+
companyname: string;
|
|
6
6
|
code: string;
|
|
7
7
|
number: string | null;
|
|
8
8
|
address: string;
|
|
@@ -19,7 +19,7 @@ export interface StoreRow {
|
|
|
19
19
|
remittancephone: string;
|
|
20
20
|
remittancecountry: string;
|
|
21
21
|
invoicememo: string | null;
|
|
22
|
-
|
|
22
|
+
website: string | null;
|
|
23
23
|
customlogo: string | null;
|
|
24
24
|
logofileid: number | null;
|
|
25
25
|
private: 'False' | 'True';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/StoreRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAG7E,MAAM,WAAW,QAAQ;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,
|
|
1
|
+
{"version":3,"file":"StoreRepo.d.ts","sourceRoot":"","sources":["../../../src/repositories/itrack/StoreRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAG7E,MAAM,WAAW,QAAQ;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,EAAE,OAAO,GAAG,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,aAAa,OAAO,KAAG,WAAW,IAAI,CAEjE,CAAA;AAeD,qBAAa,SAAS;IAGT,OAAO,CAAC,QAAQ,CAAC,EAAE;IAF/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;gBAExC,EAAE,EAAE,cAAc;IAWxC,MAAM,QAAa,OAAO,CAAC,QAAQ,EAAE,CAAC,CAGH;IAE1C,OAAO,CAAC,SAAS,CAM4B;CAC7C"}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import { EbayAdapter } from '../adapters/ebay/EbayAdapter.js';
|
|
2
2
|
import { ItrackAdapter } from '../adapters/itrack/ItrackAdapter.js';
|
|
3
3
|
import { TokenManager } from '../infrastructure/TokenManager.js';
|
|
4
|
-
/**
|
|
5
|
-
* This use case is to mimic the behavior of the SyncInventoryLocations use case on a store event or something like that.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* This use case should get run on store inserts/updates?
|
|
9
|
-
* Ideally we should first retrieve all of the existing ebay locations
|
|
10
|
-
* Then compare incoming changes and determine if they should be changed
|
|
11
|
-
* If there are any changes, add/update ebay location?
|
|
12
|
-
* This should also get run on startup since inventory depends on location(s) existing
|
|
13
|
-
*/
|
|
14
4
|
interface Input {
|
|
15
5
|
ebayAdapter: EbayAdapter;
|
|
16
6
|
itrackAdapter: ItrackAdapter;
|
|
17
7
|
tokenManager: TokenManager;
|
|
8
|
+
production: boolean;
|
|
18
9
|
}
|
|
19
10
|
export declare const storeEvent: (params: Input) => Promise<void>;
|
|
20
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agg_StoreEvent.d.ts","sourceRoot":"","sources":["../../src/usecases/Agg_StoreEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"Agg_StoreEvent.d.ts","sourceRoot":"","sources":["../../src/usecases/Agg_StoreEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAKhE,UAAU,KAAK;IACX,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,UAAU,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,UAAU,GAAU,QAAQ,KAAK,kBAM7C,CAAA"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// On store insert or update event call syncInventoryLocations
|
|
3
|
-
// TODO: maybe we need a use case for retrieving existing, comparing incoming with existing
|
|
4
|
-
// TODO: confirm if we can change location info on ebay
|
|
1
|
+
import { syncInventoryLocationsToEbay } from './Location/SyncInventoryLocationsToEbay.js';
|
|
5
2
|
export const storeEvent = async (params) => {
|
|
6
|
-
await
|
|
3
|
+
await syncInventoryLocationsToEbay({
|
|
7
4
|
ebayAdapter: params.ebayAdapter,
|
|
8
5
|
itrackAdapter: params.itrackAdapter,
|
|
9
|
-
|
|
6
|
+
production: params.production,
|
|
10
7
|
});
|
|
11
8
|
};
|
|
12
9
|
//# sourceMappingURL=Agg_StoreEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agg_StoreEvent.js","sourceRoot":"","sources":["../../src/usecases/Agg_StoreEvent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Agg_StoreEvent.js","sourceRoot":"","sources":["../../src/usecases/Agg_StoreEvent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAA;AAWzF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,MAAa,EAAE,EAAE;IAC9C,MAAM,4BAA4B,CAAC;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,UAAU,EAAE,MAAM,CAAC,UAAU;KAChC,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EbayInventoryLocationDTO } from '../../entities/ebay/EbayInventoryLocationDTO.js';
|
|
2
2
|
import { EbayInterface } from '../../ports/EbayInterface.js';
|
|
3
3
|
export interface PushLocationInput {
|
|
4
4
|
ebay: EbayInterface;
|
|
5
|
-
data:
|
|
5
|
+
data: EbayInventoryLocationDTO;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Checks if ebay location exists, creates if it doesn't
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushInventoryLocationToEbay.d.ts","sourceRoot":"","sources":["../../../src/usecases/Location/PushInventoryLocationToEbay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"PushInventoryLocationToEbay.d.ts","sourceRoot":"","sources":["../../../src/usecases/Location/PushInventoryLocationToEbay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,aAAa,CAAA;IACnB,IAAI,EAAE,wBAAwB,CAAA;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,iBAAiB,kBAKpE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EbayInterface } from '../../ports/EbayInterface.js';
|
|
2
|
+
import { EbayInventoryLocationDTO } from '../../entities/ebay/EbayInventoryLocationDTO.js';
|
|
3
|
+
export interface PushInventoryLocationsInput {
|
|
4
|
+
ebayAdapter: EbayInterface;
|
|
5
|
+
data: EbayInventoryLocationDTO[];
|
|
6
|
+
}
|
|
7
|
+
export interface PushInventoryLocationsResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
errors: Array<{
|
|
10
|
+
storeId: number | null;
|
|
11
|
+
message: string;
|
|
12
|
+
details?: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare const pushInventoryLocations: (params: PushInventoryLocationsInput) => Promise<PushInventoryLocationsResult>;
|
|
16
|
+
//# sourceMappingURL=PushInventoryLocations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PushInventoryLocations.d.ts","sourceRoot":"","sources":["../../../src/usecases/Location/PushInventoryLocations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAE1F,MAAM,WAAW,2BAA2B;IAC3C,WAAW,EAAE,aAAa,CAAA;IAC1B,IAAI,EAAE,wBAAwB,EAAE,CAAA;CAChC;AAED,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAC7E;AAED,eAAO,MAAM,sBAAsB,GAClC,QAAQ,2BAA2B,KACjC,OAAO,CAAC,4BAA4B,CA+DtC,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StoreTypeEnum } from '../../entities/ebay/InventoryLocationFull.js';
|
|
2
|
+
export const pushInventoryLocations = async (params) => {
|
|
3
|
+
try {
|
|
4
|
+
const locationsResponse = await params.ebayAdapter.getInventoryLocations();
|
|
5
|
+
if (!locationsResponse.success) {
|
|
6
|
+
return {
|
|
7
|
+
success: false,
|
|
8
|
+
errors: [{ storeId: null, message: 'Failed to retrieve inventory locations from eBay', details: locationsResponse }],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const ebayLocations = locationsResponse.data;
|
|
12
|
+
const errors = [];
|
|
13
|
+
for (const dto of params.data) {
|
|
14
|
+
const existingLocation = ebayLocations.find(l => l.merchantLocationKey === dto.key);
|
|
15
|
+
if (!existingLocation) {
|
|
16
|
+
const createResponse = await params.ebayAdapter.createInventoryLocation(dto);
|
|
17
|
+
if (!createResponse.success) {
|
|
18
|
+
errors.push({ storeId: dto.storeId, message: 'Failed to create inventory location on eBay', details: createResponse });
|
|
19
|
+
}
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const isWarehouse = existingLocation.locationTypes.includes(StoreTypeEnum.Warehouse);
|
|
23
|
+
const nameChanged = dto.location.name !== undefined && dto.location.name !== existingLocation.name;
|
|
24
|
+
const phoneChanged = dto.location.phone !== undefined && dto.location.phone !== existingLocation.phone;
|
|
25
|
+
let addressChanged = false;
|
|
26
|
+
if (isWarehouse) {
|
|
27
|
+
const incoming = dto.location.location.address;
|
|
28
|
+
const existing = existingLocation.location.address;
|
|
29
|
+
addressChanged =
|
|
30
|
+
incoming.addressLine1 !== existing.addressLine1 ||
|
|
31
|
+
incoming.postalCode !== existing.postalCode ||
|
|
32
|
+
incoming.city !== existing.city ||
|
|
33
|
+
incoming.stateOrProvince !== existing.stateOrProvince ||
|
|
34
|
+
incoming.country !== existing.country;
|
|
35
|
+
}
|
|
36
|
+
if (!nameChanged && !phoneChanged && !addressChanged) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const updatePayload = isWarehouse
|
|
40
|
+
? { name: dto.location.name, phone: dto.location.phone, location: { address: dto.location.location.address } }
|
|
41
|
+
: { name: dto.location.name, phone: dto.location.phone };
|
|
42
|
+
const updateResponse = await params.ebayAdapter.updateInventoryLocation({ key: dto.key, location: updatePayload });
|
|
43
|
+
if (!updateResponse.success) {
|
|
44
|
+
errors.push({ storeId: dto.storeId, message: 'Failed to update inventory location on eBay', details: updateResponse });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { success: errors.length === 0, errors };
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
errors: [{ storeId: null, message: error instanceof Error ? error.message : 'Unknown error', details: error }],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=PushInventoryLocations.js.map
|