@nomalism-com/api 0.13.6 → 0.13.8

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/index.d.ts CHANGED
@@ -258,15 +258,15 @@ export * as EmailTemplate from './modules/integration/emailTemplate';
258
258
  export * as EmailTemplateAttachment from './modules/integration/emailTemplateAttachment';
259
259
  export { shared };
260
260
  export type IEnvironment = 'production' | 'uat' | 'development' | 'localhost';
261
- declare const serviceEnum: readonly ["stock", "user", "integration", "documentmanagement", "view", "print", "ticket", "pdf"];
261
+ declare const serviceEnum: readonly ["stock", "user", "integration", "documentmanagement", "view", "print", "ticket", "stockworker"];
262
262
  type IService = (typeof serviceEnum)[number];
263
- export interface IServiceExternalPath {
263
+ interface IServiceExternalPath {
264
264
  authPath: string;
265
265
  publicPath: string;
266
266
  }
267
267
  interface IOptions {
268
268
  processEnvironment: IEnvironment;
269
- gatewayUrl?: string;
269
+ services: Record<IService, string>;
270
270
  apikey?: string;
271
271
  }
272
272
  export interface IModuleConstructor {
@@ -277,7 +277,6 @@ export interface IModuleConstructor {
277
277
  }
278
278
  export declare class API {
279
279
  processEnvironment: IEnvironment;
280
- gatewayUrl: string;
281
280
  private defaultHeaders;
282
281
  client: AxiosInstance;
283
282
  services: Record<IService, IServiceExternalPath>;
@@ -409,5 +408,5 @@ export declare class API {
409
408
  SavedEmPicking: SavedEmPickingClass;
410
409
  EmailTemplate: EmailTemplateClass;
411
410
  EmailTemplateAttachment: EmailTemplateAttachmentClass;
412
- constructor({ processEnvironment, gatewayUrl, apikey }: IOptions);
411
+ constructor({ processEnvironment, services, apikey }: IOptions);
413
412
  }
package/dist/index.js CHANGED
@@ -296,71 +296,41 @@ var serviceEnum = [
296
296
  'view',
297
297
  'print',
298
298
  'ticket',
299
- 'pdf',
299
+ 'stockworker',
300
300
  ];
301
301
  var API = (function () {
302
302
  function API(_a) {
303
- var processEnvironment = _a.processEnvironment, gatewayUrl = _a.gatewayUrl, apikey = _a.apikey;
303
+ var processEnvironment = _a.processEnvironment, services = _a.services, apikey = _a.apikey;
304
304
  var _this = this;
305
305
  this.processEnvironment = processEnvironment || 'localhost';
306
- this.gatewayUrl = gatewayUrl || 'localhost';
307
306
  this.defaultHeaders = apikey
308
307
  ? {
309
308
  apikey: apikey,
310
309
  }
311
310
  : undefined;
312
311
  this.client = axios_1.default.create({
313
- baseURL: gatewayUrl,
314
312
  headers: this.defaultHeaders,
315
313
  });
316
- var getServicePaths = function (service) { return ({
317
- jwtPath: processEnvironment === 'localhost' ? '/' : "".concat(service, "/auth"),
318
- apikeyPath: processEnvironment === 'localhost' ? '/' : "".concat(service, "/apikey"),
319
- publicPath: processEnvironment === 'localhost' ? '/' : "".concat(service, "/public"),
320
- }); };
321
- var stock = getServicePaths('stock');
322
- var user = getServicePaths('user');
323
- var integration = getServicePaths('integration');
324
- var documentmanagement = getServicePaths('documentmanagement');
325
- var view = getServicePaths('view');
326
- var print = getServicePaths('print');
327
- var ticket = getServicePaths('ticket');
328
- var pdf = getServicePaths('pdf');
314
+ var getServicePaths = function (service) {
315
+ var baseUrl = services[service];
316
+ var serviceAuthPath = processEnvironment === 'localhost'
317
+ ? '/'
318
+ : "".concat(service, "/").concat(apikey ? 'apikey' : 'auth');
319
+ var servicePublicPath = processEnvironment === 'localhost' ? '/' : "".concat(service, "/public");
320
+ return {
321
+ authPath: "".concat(baseUrl).concat(serviceAuthPath),
322
+ publicPath: "".concat(baseUrl).concat(servicePublicPath),
323
+ };
324
+ };
329
325
  this.services = {
330
- stock: {
331
- authPath: apikey ? stock.apikeyPath : stock.jwtPath,
332
- publicPath: stock.publicPath,
333
- },
334
- user: {
335
- authPath: apikey ? user.apikeyPath : user.jwtPath,
336
- publicPath: user.publicPath,
337
- },
338
- integration: {
339
- authPath: apikey ? integration.apikeyPath : integration.jwtPath,
340
- publicPath: integration.publicPath,
341
- },
342
- documentmanagement: {
343
- authPath: apikey
344
- ? documentmanagement.apikeyPath
345
- : documentmanagement.jwtPath,
346
- publicPath: documentmanagement.publicPath,
347
- },
348
- view: {
349
- authPath: apikey ? view.apikeyPath : view.jwtPath,
350
- publicPath: view.publicPath,
351
- },
352
- print: {
353
- authPath: apikey ? print.apikeyPath : print.jwtPath,
354
- publicPath: print.publicPath,
355
- },
356
- ticket: {
357
- authPath: apikey ? ticket.apikeyPath : ticket.jwtPath,
358
- publicPath: ticket.publicPath,
359
- },
360
- pdf: {
361
- authPath: apikey ? pdf.apikeyPath : pdf.jwtPath,
362
- publicPath: pdf.publicPath,
363
- },
326
+ stock: getServicePaths('stock'),
327
+ user: getServicePaths('user'),
328
+ integration: getServicePaths('integration'),
329
+ documentmanagement: getServicePaths('documentmanagement'),
330
+ view: getServicePaths('view'),
331
+ print: getServicePaths('print'),
332
+ ticket: getServicePaths('ticket'),
333
+ stockworker: getServicePaths('stockworker'),
364
334
  };
365
335
  var getModuleParams = function (service, module) { return ({
366
336
  api: _this.client,
@@ -6,12 +6,13 @@ export import IFindByGooglesheetIdResponse = Entity.IFindByGooglesheetIdResponse
6
6
  export import IDocumentLinePendingConflict = Entity.Entity;
7
7
  export import IConflictFindByOwnerIdResponse = Entity.IConflictFindByOwnerIdResponse;
8
8
  export import ICreateSheetFromDocumentResponse = Entity.ICreateSheetFromDocumentResponse;
9
+ export import IIsProcessingResponse = Entity.IIsProcessingResponse;
9
10
  export default class Repository implements Entity.IRepository {
10
11
  route: string;
11
12
  publicRoute: string;
12
13
  private api;
13
14
  constructor({ api, route, publicRoute }: IModuleConstructor);
14
- isProcessing(params: shared.IFindByIdRequest): Promise<boolean>;
15
+ isProcessing(params: shared.IFindByIdRequest): Promise<IIsProcessingResponse>;
15
16
  importFromSheet(params: shared.IFindByIdRequest): Promise<IFindByGooglesheetIdResponse>;
16
17
  createSheetFromDocument(params: shared.IFindByIdRequest): Promise<ICreateSheetFromDocumentResponse>;
17
18
  conflictAccept(params: shared.IFindByIdRequest): Promise<void>;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "typescript",
10
10
  "helper"
11
11
  ],
12
- "version": "0.13.6",
12
+ "version": "0.13.8",
13
13
  "main": "dist/index.js",
14
14
  "types": "./dist/index.d.ts",
15
15
  "files": [
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/convert-units": "^2.3.9",
35
- "@types/node": "^18.18.12",
35
+ "@types/node": "^20.9.4",
36
36
  "@typescript-eslint/eslint-plugin": "^6.12.0",
37
37
  "@typescript-eslint/parser": "^6.12.0",
38
38
  "concurrently": "^8.2.2",
@@ -43,11 +43,11 @@
43
43
  "eslint-plugin-import": "^2.29.0",
44
44
  "eslint-plugin-prettier": "^5.0.1",
45
45
  "prettier": "^3.1.0",
46
- "tsx": "^4.3.0",
46
+ "tsx": "^4.4.0",
47
47
  "typescript": "^5.3.2"
48
48
  },
49
49
  "dependencies": {
50
- "@nomalism-com/types": "^0.13.1",
50
+ "@nomalism-com/types": "^0.13.2",
51
51
  "axios": "^0.27.2"
52
52
  }
53
53
  }