@colijnit/articleapi 259.1.0 → 259.1.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.
@@ -68,6 +68,7 @@ export declare class ArticlesAuth extends IoneApiArticles {
68
68
  getArticleQuickSel(goodId: number, branch: string): Promise<DataServiceResponseData>;
69
69
  getSuperArticleQuickSel(id: string, branch: string): Promise<DataServiceResponseData>;
70
70
  getSingleImage(nodeId: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean): Promise<DataServiceResponseData>;
71
+ getImage(key: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean): Promise<DataServiceResponseData>;
71
72
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
72
73
  getPrintStockStickers(request: PrintStockStickers): Promise<DataServiceResponseData>;
73
74
  getStockStickerEmailLayouts(): Promise<DataServiceResponseData>;
@@ -108,6 +109,8 @@ export declare class ArticlesAuth extends IoneApiArticles {
108
109
  private isSuccesfulResponseRoot;
109
110
  private _getFrozenArticle;
110
111
  private _getFrozenArticleArray;
112
+ private _handleDocumentBody;
113
+ private _handleDocumentUrl;
111
114
  private selectMultiple;
112
115
  private _call;
113
116
  }
@@ -22,6 +22,7 @@ import { ArticleSearchFilterMethod } from './model/article-search-filter-method.
22
22
  import { GeneralObjectName } from './enum/general-object-name.enum';
23
23
  import { StockManagementMethod } from './enum/stock-management-method.enum';
24
24
  import { PricingMethod } from './enum/pricing-method.enum';
25
+ import { DataServiceResponseData } from '@colijnit/ioneconnector/build/model/data-service-response-data';
25
26
  import { BusinessObjectSerializer } from '@colijnit/ioneconnector/build/factory/business-object-serializer';
26
27
  import { isNill } from '@colijnit/ioneconnector/build/utils/function/is-nill.function';
27
28
  import { ReportingDocumentsMethod } from './enum/reporting-documents-method.enum';
@@ -29,6 +30,8 @@ import { LogisticsMethod } from './enum/logistics-method.enum';
29
30
  import { ExternalCatalogMethod } from "./enum/external-catalog-method.enum";
30
31
  import { ArticleFlatStorageRequest } from "./model/article-flat-storage-request";
31
32
  import { ArticleBulkUploadMethodEnum } from './enum/article-bulk-upload.method.enum';
33
+ import { documentType } from './enum/document-type.enum';
34
+ import { ImageContent } from './model/image-content.bo';
32
35
  export class ArticlesAuth extends IoneApiArticles {
33
36
  constructor() {
34
37
  super(...arguments);
@@ -557,6 +560,32 @@ export class ArticlesAuth extends IoneApiArticles {
557
560
  resolve(this._callGetSingleImage(params));
558
561
  });
559
562
  }
563
+ getImage(key, publication = 4, includeMimetype = false, thumb = true) {
564
+ return __awaiter(this, void 0, void 0, function* () {
565
+ const getImageObject = yield this.getSingleImage(key, publication, includeMimetype, thumb);
566
+ if (getImageObject.validationResult && getImageObject.validationResult.success) {
567
+ if (getImageObject.resultObject) {
568
+ const object = getImageObject.resultObject;
569
+ const type = object.documentType;
570
+ const hasPublicAccess = object.hasPublicAccess;
571
+ if (type === documentType.FileNoLocation) {
572
+ return this._handleDocumentBody(object.documentId, object.mimeType, thumb);
573
+ }
574
+ else if (type === documentType.LinkRandomLocation) {
575
+ return this._handleDocumentUrl(object.filePath);
576
+ }
577
+ else if (type === documentType.LinkDefaultLocation) {
578
+ }
579
+ else if (type === documentType.CDNLocation && hasPublicAccess === 'T') {
580
+ return this._handleDocumentUrl(object.filePath);
581
+ }
582
+ else if (type === documentType.CDNLocation && hasPublicAccess === 'F') {
583
+ return this._handleDocumentBody(object.documentId, object.mimeType, thumb);
584
+ }
585
+ }
586
+ }
587
+ });
588
+ }
560
589
  getDocumentContent(id, thumbnail = true) {
561
590
  const inputParams = {
562
591
  documentId: id,
@@ -932,6 +961,42 @@ export class ArticlesAuth extends IoneApiArticles {
932
961
  };
933
962
  return this._call(DataServiceMethod.ExecuteMethod, data, BackendServiceName.DataService, showLoader);
934
963
  }
964
+ _handleDocumentBody(documentId, mimeType, thumb) {
965
+ return __awaiter(this, void 0, void 0, function* () {
966
+ const returnObject = new DataServiceResponseData();
967
+ const documentBody = yield this.getDocumentContent(documentId, thumb);
968
+ const imageObject = new ImageContent();
969
+ imageObject.mimeType = mimeType;
970
+ if (documentBody && documentBody.validationResult.success) {
971
+ returnObject.validationResult.success = true;
972
+ imageObject.image = documentBody.resultObject.documentContent;
973
+ returnObject.resultObject = imageObject;
974
+ }
975
+ else {
976
+ returnObject.validationResult.success = false;
977
+ imageObject.image = null;
978
+ returnObject.resultObject = imageObject;
979
+ }
980
+ return returnObject;
981
+ });
982
+ }
983
+ _handleDocumentUrl(url) {
984
+ return __awaiter(this, void 0, void 0, function* () {
985
+ const returnObject = new DataServiceResponseData();
986
+ const imageObject = new ImageContent();
987
+ if (url) {
988
+ returnObject.validationResult.success = true;
989
+ imageObject.image = url;
990
+ returnObject.resultObject = imageObject;
991
+ }
992
+ else {
993
+ returnObject.validationResult.success = false;
994
+ imageObject.image = null;
995
+ returnObject.resultObject = imageObject;
996
+ }
997
+ return returnObject;
998
+ });
999
+ }
935
1000
  selectMultiple(moduleName, objectName, operationName, parameterValues, showLoader = true) {
936
1001
  let stronglyTypedResults = [];
937
1002
  const data = {
@@ -79,6 +79,7 @@ export declare class ArticlesPublic extends IoneApiArticles {
79
79
  getArticlePrice(request: GetArticlePriceRequest): Promise<DataServiceResponseData>;
80
80
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
81
81
  getSingleImage(nodeId: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean): Promise<DataServiceResponseData>;
82
+ getImage(): Promise<DataServiceResponseData>;
82
83
  getStockStickerEmailLayouts(): Promise<DataServiceResponseData>;
83
84
  getStockStickerPrintLayouts(): Promise<DataServiceResponseData>;
84
85
  getPackageStickerPrintLayouts(): Promise<DataServiceResponseData>;
@@ -300,6 +300,10 @@ export class ArticlesPublic extends IoneApiArticles {
300
300
  return this._call(PublicServiceMethod.GetSingleImage, data);
301
301
  });
302
302
  }
303
+ getImage() {
304
+ console.warn('getImage not implemented');
305
+ return Promise.resolve(new DataServiceResponseData());
306
+ }
303
307
  getStockStickerEmailLayouts() {
304
308
  console.warn('getStockStickerEmailLayouts not implemented');
305
309
  return Promise.resolve(new DataServiceResponseData());
@@ -85,6 +85,7 @@ export declare class Articles {
85
85
  getArticlePrice(request: GetArticlePriceRequest): Promise<DataServiceResponseData>;
86
86
  getGoodIdFromArticleNr(skuOrId: string): Promise<DataServiceResponseData>;
87
87
  getSingleImage(nodeId: number | string, publication: number, includeMimetype: boolean, thumb: boolean): Promise<DataServiceResponseData>;
88
+ getImage(key: number | string, publication: number, includeMimetype: boolean, thumb: boolean): Promise<DataServiceResponseData>;
88
89
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
89
90
  getArticleQuickSel(goodId: number, branch: string): Promise<DataServiceResponseData>;
90
91
  getSuperArticleQuickSel(id: string, branch: string): Promise<DataServiceResponseData>;
package/build/articles.js CHANGED
@@ -180,6 +180,9 @@ export class Articles {
180
180
  getSingleImage(nodeId, publication, includeMimetype, thumb) {
181
181
  return this.articles.getSingleImage(nodeId, publication, includeMimetype, thumb);
182
182
  }
183
+ getImage(key, publication, includeMimetype, thumb) {
184
+ return this.articles.getImage(key, publication, includeMimetype, thumb);
185
+ }
183
186
  getDocumentContent(id, thumbnail = true) {
184
187
  return this.articles.getDocumentContent(id, thumbnail);
185
188
  }
@@ -19,9 +19,9 @@ import { ExternalCatalogStartupInfoRequest } from "./model/external-catalog-star
19
19
  import { ArticleFlatTreeDTO } from "./model/article-flat-tree.bo";
20
20
  import { ArticleFlat } from "./model/article-flat.bo";
21
21
  const localOptions = {
22
- url: "http://localhost:8080/ione",
22
+ url: "https://develop.colijn-it.nl/",
23
23
  schema: "815",
24
- version: "253",
24
+ version: "258",
25
25
  useLoginEncryption: true,
26
26
  username: "elske",
27
27
  password: "elske1"
@@ -282,4 +282,9 @@ describe("ArticlesAPI", () => {
282
282
  const result = yield articles.storeCatFarmCompositionArticle(45, tree);
283
283
  expect(result).toBeDefined();
284
284
  }));
285
+ it('getimage', () => __awaiter(void 0, void 0, void 0, function* () {
286
+ yield articles.connect();
287
+ const result = yield articles.getImage(7902354, null, false, false);
288
+ expect(result).toBeDefined();
289
+ }));
285
290
  });
@@ -0,0 +1,6 @@
1
+ export declare enum documentType {
2
+ FileNoLocation = "BN",
3
+ LinkRandomLocation = "LS",
4
+ LinkDefaultLocation = "LW",
5
+ CDNLocation = "CD"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var documentType;
2
+ (function (documentType) {
3
+ documentType["FileNoLocation"] = "BN";
4
+ documentType["LinkRandomLocation"] = "LS";
5
+ documentType["LinkDefaultLocation"] = "LW";
6
+ documentType["CDNLocation"] = "CD";
7
+ })(documentType || (documentType = {}));
@@ -72,6 +72,7 @@ export declare abstract class IoneApiArticles {
72
72
  abstract getArticlePrice(request: GetArticlePriceRequest): Promise<DataServiceResponseData>;
73
73
  abstract getGoodIdFromArticleNr(skuOrId: string): Promise<DataServiceResponseData>;
74
74
  abstract getSingleImage(nodeId: number | string, publication: number, includeMimetype: boolean, thumb: boolean): Promise<DataServiceResponseData>;
75
+ abstract getImage(key: number | string, publication: number, includeMimetype: boolean, thumb: boolean): Promise<DataServiceResponseData>;
75
76
  abstract getDocumentContent(id: number, thumbnail: boolean): Promise<DataServiceResponseData>;
76
77
  abstract commit(): Promise<DataServiceResponseData>;
77
78
  abstract getInOutCollection(languageCode: string): Promise<DataServiceResponseData>;
@@ -40,4 +40,5 @@ export declare class ArticleExtended extends Article {
40
40
  totalDeliveryDays: number;
41
41
  storeGroupIds: string[];
42
42
  category: string;
43
+ isConfigurable: boolean;
43
44
  }
@@ -7,8 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Article } from "./article.bo";
8
8
  import { ComplexArray } from "@colijnit/ioneconnector/build/factory/decorators/complex-array.decorator";
9
9
  import { Colour } from "./colour";
10
+ import { BooleanText } from '@colijnit/ioneconnector/build/factory/decorators/boolean.decorator';
10
11
  export class ArticleExtended extends Article {
11
12
  }
12
13
  __decorate([
13
14
  ComplexArray(Colour)
14
15
  ], ArticleExtended.prototype, "colours", void 0);
16
+ __decorate([
17
+ BooleanText("T")
18
+ ], ArticleExtended.prototype, "isConfigurable", void 0);
@@ -0,0 +1,4 @@
1
+ export declare class ImageContent {
2
+ image: string;
3
+ mimeType?: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ export class ImageContent {
2
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colijnit/articleapi",
3
- "version": "259.1.0",
3
+ "version": "259.1.1",
4
4
  "scripts": {
5
5
  "build": "grunt clean && tsc",
6
6
  "browserify": "browserify build/connector.js --s colijn -o dist/out-tsc/bundle.js",