@colijnit/mainapi 1.0.22 → 1.0.24

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,8 @@
1
+ export declare enum PrintServiceMethod {
2
+ ListPrinters = "listPrinters",
3
+ PrintReport = "printReport",
4
+ SendEmail = "sendEmail",
5
+ TextingReport = "textingReport",
6
+ CutReceipt = "cutReceipt",
7
+ OpenDrawer = "openDrawer"
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrintServiceMethod = void 0;
4
+ var PrintServiceMethod;
5
+ (function (PrintServiceMethod) {
6
+ PrintServiceMethod["ListPrinters"] = "listPrinters";
7
+ PrintServiceMethod["PrintReport"] = "printReport";
8
+ PrintServiceMethod["SendEmail"] = "sendEmail";
9
+ PrintServiceMethod["TextingReport"] = "textingReport";
10
+ PrintServiceMethod["CutReceipt"] = "cutReceipt";
11
+ PrintServiceMethod["OpenDrawer"] = "openDrawer";
12
+ })(PrintServiceMethod = exports.PrintServiceMethod || (exports.PrintServiceMethod = {}));
@@ -16,6 +16,7 @@ export declare abstract class MainApiConnection {
16
16
  branchNr: string;
17
17
  abstract getSequenceValue(sequenceName: SequenceName, noSequence: boolean): Promise<DataServiceResponseData>;
18
18
  abstract listAllPrinters(): Promise<DataServiceResponseData>;
19
+ abstract listPrinters(showAll: boolean): Promise<DataServiceResponseData>;
19
20
  abstract getSendMethods(): Promise<DataServiceResponseData>;
20
21
  abstract getDocumentContent(id: number, thumbnail: boolean): Promise<DataServiceResponseData>;
21
22
  abstract getCurrencies(active: boolean): Promise<DataServiceResponseData>;
@@ -8,6 +8,7 @@ import { DomainName } from './enum/domain-name.enum';
8
8
  import { TagCategory } from "./enum/tab-category.enum";
9
9
  import { TagTreeItem } from "./model/tag-tree-item.bo";
10
10
  import { Preset } from "./model/preset.bo";
11
+ import { ServerResponseData } from '@colijnit/ioneconnector/build/model/server-response-data';
11
12
  export declare class MainApi {
12
13
  readonly showLoader: Subject<boolean>;
13
14
  readonly connectionAborted: Subject<void>;
@@ -23,8 +24,11 @@ export declare class MainApi {
23
24
  private readonly _subs;
24
25
  private _connector;
25
26
  constructor(options?: Options);
27
+ connect(): Promise<boolean>;
28
+ logOut(): Promise<ServerResponseData>;
26
29
  getSequenceValue(sequenceName: SequenceName, noSequence?: boolean): Promise<DataServiceResponseData>;
27
30
  listAllPrinters(): Promise<DataServiceResponseData>;
31
+ listPrinters(showAll?: boolean): Promise<DataServiceResponseData>;
28
32
  getSendMethods(): Promise<DataServiceResponseData>;
29
33
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
30
34
  getCurrencies(active?: boolean): Promise<DataServiceResponseData>;
@@ -47,6 +51,6 @@ export declare class MainApi {
47
51
  getPreset(presetId: string): Promise<DataServiceResponseData>;
48
52
  savePreset(preset: Preset): Promise<DataServiceResponseData>;
49
53
  updatePreset(presetName: string): Promise<DataServiceResponseData>;
50
- static createConnector(options: Options): MainApiConnection;
54
+ static createConnector(options: Options, sessionExists: boolean): MainApiConnection;
51
55
  private _handleConnectionReset;
52
56
  }
package/build/main-api.js CHANGED
@@ -32,12 +32,22 @@ class MainApi {
32
32
  this.useLoginEncryption = options.hasOwnProperty("useLoginEncryption") ? options.useLoginEncryption === true : false;
33
33
  }
34
34
  this._connector = new ioneconnector_1.Connector(options);
35
- this.mainApi = MainApi.createConnector(options);
35
+ this.mainApi = MainApi.createConnector(options, this._connector.hasSession());
36
36
  this.mainApi.connector = this._connector;
37
37
  this.mainApi.languageCode = this.languageCode;
38
38
  this.mainApi.branchNr = this.branch;
39
39
  this._subs.push(this._connector.showLoader.subscribe(value => this.showLoader.next(value)), this._connector.connectionAborted.subscribe(() => this.connectionAborted.next()), this._connector.connectionResetInactivity.subscribe(() => this._handleConnectionReset()));
40
40
  }
41
+ connect() {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ return this._connector.connect();
44
+ });
45
+ }
46
+ logOut() {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ return this._connector.logOut();
49
+ });
50
+ }
41
51
  getSequenceValue(sequenceName, noSequence = false) {
42
52
  return __awaiter(this, void 0, void 0, function* () {
43
53
  return this.mainApi.getSequenceValue(sequenceName, noSequence);
@@ -46,6 +56,9 @@ class MainApi {
46
56
  listAllPrinters() {
47
57
  return this.mainApi.listAllPrinters();
48
58
  }
59
+ listPrinters(showAll = false) {
60
+ return this.mainApi.listPrinters(showAll);
61
+ }
49
62
  getSendMethods() {
50
63
  return this.mainApi.getSendMethods();
51
64
  }
@@ -124,8 +137,8 @@ class MainApi {
124
137
  return this.mainApi.updatePreset(presetName);
125
138
  });
126
139
  }
127
- static createConnector(options) {
128
- if (options.username && options.password) {
140
+ static createConnector(options, sessionExists) {
141
+ if ((options.username && options.password) || sessionExists) {
129
142
  return new main_auth_1.MainAuth();
130
143
  }
131
144
  return new main_public_1.MainPublic();
@@ -108,4 +108,10 @@ describe("Connector", () => {
108
108
  const result = yield connector.savePreset(testPreset);
109
109
  expect(result).toBeDefined();
110
110
  }));
111
+ it('listPrinters', () => __awaiter(void 0, void 0, void 0, function* () {
112
+ const showAll = false;
113
+ yield connector.connect();
114
+ const result = yield connector.listPrinters(showAll);
115
+ expect(result).toBeDefined();
116
+ }));
111
117
  });
@@ -3,13 +3,14 @@ import { SequenceName } from './enum/sequence-name.enum';
3
3
  import { DataServiceResponseData } from '@colijnit/ioneconnector/build/model/data-service-response-data';
4
4
  import { InternalParam } from './enum/internal-param.enum';
5
5
  import { DomainName } from './enum/domain-name.enum';
6
- import { Preset } from "./model/preset.bo";
7
- import { TagCategory } from "./enum/tab-category.enum";
8
- import { TagTreeItem } from "./model/tag-tree-item.bo";
6
+ import { Preset } from './model/preset.bo';
7
+ import { TagCategory } from './enum/tab-category.enum';
8
+ import { TagTreeItem } from './model/tag-tree-item.bo';
9
9
  export declare class MainAuth extends MainApiConnection {
10
10
  private _boSerializer;
11
11
  getSequenceValue(sequenceName: SequenceName, noSequence?: boolean): Promise<DataServiceResponseData>;
12
12
  listAllPrinters(): Promise<DataServiceResponseData>;
13
+ listPrinters(showAll?: boolean): Promise<DataServiceResponseData>;
13
14
  getSendMethods(): Promise<DataServiceResponseData>;
14
15
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
15
16
  getCurrencies(active?: boolean): Promise<DataServiceResponseData>;
@@ -28,6 +28,7 @@ const preset_object_name_enum_1 = require("./enum/preset-object-name.enum");
28
28
  const public_service_method_1 = require("./enum/public-service-method");
29
29
  const tag_object_enum_1 = require("./enum/tag-object.enum");
30
30
  const tag_operation_name_enum_1 = require("./enum/tag-operation-name.enum");
31
+ const printing_service_method_1 = require("./enum/printing-service-method");
31
32
  class MainAuth extends main_api_connection_1.MainApiConnection {
32
33
  constructor() {
33
34
  super(...arguments);
@@ -62,6 +63,12 @@ class MainAuth extends main_api_connection_1.MainApiConnection {
62
63
  };
63
64
  return this._call(data_service_method_enum_1.DataServiceMethod.ExecuteMethod, data);
64
65
  }
66
+ listPrinters(showAll = false) {
67
+ const data = {
68
+ showAll: showAll
69
+ };
70
+ return this._call(printing_service_method_1.PrintServiceMethod.ListPrinters, data, backend_service_name_enum_1.BackendServiceName.PrintingService);
71
+ }
65
72
  getSendMethods() {
66
73
  const data = {
67
74
  moduleName: module_name_enum_1.ModuleName.Report,
@@ -10,6 +10,7 @@ export declare class MainPublic extends MainApiConnection {
10
10
  protected endPoint: string;
11
11
  getSequenceValue(sequenceName: SequenceName, noSequence?: boolean): Promise<DataServiceResponseData>;
12
12
  listAllPrinters(): Promise<DataServiceResponseData>;
13
+ listPrinters(showAll?: boolean): Promise<DataServiceResponseData>;
13
14
  getSendMethods(): Promise<DataServiceResponseData>;
14
15
  getDocumentContent(id: number, thumbnail: boolean): Promise<DataServiceResponseData>;
15
16
  getInternalParameterValue(param: InternalParam): Promise<DataServiceResponseData>;
@@ -34,6 +34,10 @@ class MainPublic extends main_api_connection_1.MainApiConnection {
34
34
  console.warn('listAllPrinters not implemented');
35
35
  return Promise.resolve(new data_service_response_data_1.DataServiceResponseData());
36
36
  }
37
+ listPrinters(showAll = false) {
38
+ console.warn('listPrinters not implemented');
39
+ return Promise.resolve(new data_service_response_data_1.DataServiceResponseData());
40
+ }
37
41
  getSendMethods() {
38
42
  console.warn('getSendMethods not implemented');
39
43
  return Promise.resolve(new data_service_response_data_1.DataServiceResponseData());
@@ -0,0 +1,16 @@
1
+ import { TrueFalseDbType } from '../enum/true-false-db-type.enum';
2
+ export interface PrintingServiceRequestData {
3
+ reportId?: number;
4
+ showAll?: boolean;
5
+ locale?: string;
6
+ copies?: number;
7
+ printerName?: string;
8
+ parameterValues?: any;
9
+ emailTo?: string;
10
+ subject?: string;
11
+ ccToSelf?: TrueFalseDbType;
12
+ message?: string;
13
+ attachments?: string[];
14
+ receiver?: string;
15
+ receiverId?: string;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colijnit/mainapi",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "scripts": {
5
5
  "build": "grunt clean && tsc",
6
6
  "browserify": "browserify build/connector.js --s colijn -o dist/out-tsc/bundle.js",
@@ -23,11 +23,11 @@
23
23
  "rxjs": "6.6.3"
24
24
  },
25
25
  "peerDependencies": {
26
- "@colijnit/ioneconnector": ">=3.1.0"
26
+ "@colijnit/ioneconnector": ">=3.1.5"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^24.0.13",
30
- "@colijnit/ioneconnector": "3.1.0",
30
+ "@colijnit/ioneconnector": "3.1.5",
31
31
  "grunt": "^1.0.3",
32
32
  "grunt-clean": "^0.4.0",
33
33
  "grunt-contrib-clean": "^1.1.0",