@things-factory/integration-pos 4.3.671 → 4.3.675

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.
Files changed (84) hide show
  1. package/dist-server/controllers/index.js +19 -0
  2. package/dist-server/controllers/index.js.map +1 -0
  3. package/dist-server/controllers/pos-api/decorators.js +32 -0
  4. package/dist-server/controllers/pos-api/decorators.js.map +1 -0
  5. package/dist-server/controllers/pos-api/index.js +56 -0
  6. package/dist-server/controllers/pos-api/index.js.map +1 -0
  7. package/dist-server/controllers/xilnex/apis/get-outlet.js +17 -0
  8. package/dist-server/controllers/xilnex/apis/get-outlet.js.map +1 -0
  9. package/dist-server/controllers/xilnex/apis/get-outlets.js +23 -0
  10. package/dist-server/controllers/xilnex/apis/get-outlets.js.map +1 -0
  11. package/dist-server/controllers/xilnex/apis/index.js +18 -0
  12. package/dist-server/controllers/xilnex/apis/index.js.map +1 -0
  13. package/dist-server/controllers/xilnex/index.js +34 -0
  14. package/dist-server/controllers/xilnex/index.js.map +1 -0
  15. package/dist-server/controllers/xilnex/platform-action.js +37 -0
  16. package/dist-server/controllers/xilnex/platform-action.js.map +1 -0
  17. package/dist-server/controllers/xilnex/xilnex.js +95 -0
  18. package/dist-server/controllers/xilnex/xilnex.js.map +1 -0
  19. package/dist-server/engine/connector/index.js +4 -0
  20. package/dist-server/engine/connector/index.js.map +1 -0
  21. package/dist-server/engine/connector/pos-connector.js +28 -0
  22. package/dist-server/engine/connector/pos-connector.js.map +1 -0
  23. package/dist-server/engine/index.js +5 -0
  24. package/dist-server/engine/index.js.map +1 -0
  25. package/dist-server/engine/task/index.js +4 -0
  26. package/dist-server/engine/task/index.js.map +1 -0
  27. package/dist-server/engine/task/pos-api.js +54 -0
  28. package/dist-server/engine/task/pos-api.js.map +1 -0
  29. package/dist-server/entities/index.js +7 -0
  30. package/dist-server/entities/index.js.map +1 -0
  31. package/dist-server/entities/pos-store.js +106 -0
  32. package/dist-server/entities/pos-store.js.map +1 -0
  33. package/dist-server/graphql/index.js +33 -0
  34. package/dist-server/graphql/index.js.map +1 -0
  35. package/dist-server/graphql/resolvers/index.js +37 -0
  36. package/dist-server/graphql/resolvers/index.js.map +1 -0
  37. package/dist-server/graphql/resolvers/pos/create-pos-store.js +12 -0
  38. package/dist-server/graphql/resolvers/pos/create-pos-store.js.map +1 -0
  39. package/dist-server/graphql/resolvers/pos/delete-pos-store.js +16 -0
  40. package/dist-server/graphql/resolvers/pos/delete-pos-store.js.map +1 -0
  41. package/dist-server/graphql/resolvers/pos/delete-pos-stores.js +19 -0
  42. package/dist-server/graphql/resolvers/pos/delete-pos-stores.js.map +1 -0
  43. package/dist-server/graphql/resolvers/pos/index.js +37 -0
  44. package/dist-server/graphql/resolvers/pos/index.js.map +1 -0
  45. package/dist-server/graphql/resolvers/pos/pos-store.js +15 -0
  46. package/dist-server/graphql/resolvers/pos/pos-store.js.map +1 -0
  47. package/dist-server/graphql/resolvers/pos/pos-stores.js +14 -0
  48. package/dist-server/graphql/resolvers/pos/pos-stores.js.map +1 -0
  49. package/dist-server/graphql/resolvers/pos/update-multiple-pos-stores.js +30 -0
  50. package/dist-server/graphql/resolvers/pos/update-multiple-pos-stores.js.map +1 -0
  51. package/dist-server/graphql/resolvers/pos/update-pos-store.js +15 -0
  52. package/dist-server/graphql/resolvers/pos/update-pos-store.js.map +1 -0
  53. package/dist-server/graphql/resolvers/pos/xilnex/deactivate-xilnex-store.js +24 -0
  54. package/dist-server/graphql/resolvers/pos/xilnex/deactivate-xilnex-store.js.map +1 -0
  55. package/dist-server/graphql/resolvers/pos/xilnex/generate-xilnex-access-token.js +25 -0
  56. package/dist-server/graphql/resolvers/pos/xilnex/generate-xilnex-access-token.js.map +1 -0
  57. package/dist-server/graphql/resolvers/pos/xilnex/index.js +8 -0
  58. package/dist-server/graphql/resolvers/pos/xilnex/index.js.map +1 -0
  59. package/dist-server/graphql/resolvers/pos-api/index.js +7 -0
  60. package/dist-server/graphql/resolvers/pos-api/index.js.map +1 -0
  61. package/dist-server/graphql/resolvers/pos-api/pos-outlet.js +23 -0
  62. package/dist-server/graphql/resolvers/pos-api/pos-outlet.js.map +1 -0
  63. package/dist-server/graphql/types/index.js +42 -0
  64. package/dist-server/graphql/types/index.js.map +1 -0
  65. package/dist-server/graphql/types/pos/index.js +45 -0
  66. package/dist-server/graphql/types/pos/index.js.map +1 -0
  67. package/dist-server/graphql/types/pos/new-pos-store.js +17 -0
  68. package/dist-server/graphql/types/pos/new-pos-store.js.map +1 -0
  69. package/dist-server/graphql/types/pos/pos-store-list.js +14 -0
  70. package/dist-server/graphql/types/pos/pos-store-list.js.map +1 -0
  71. package/dist-server/graphql/types/pos/pos-store-patch.js +19 -0
  72. package/dist-server/graphql/types/pos/pos-store-patch.js.map +1 -0
  73. package/dist-server/graphql/types/pos/pos-store.js +26 -0
  74. package/dist-server/graphql/types/pos/pos-store.js.map +1 -0
  75. package/dist-server/graphql/types/pos-api/pos-outlet.js +44 -0
  76. package/dist-server/graphql/types/pos-api/pos-outlet.js.map +1 -0
  77. package/dist-server/index.js +24 -0
  78. package/dist-server/index.js.map +1 -0
  79. package/dist-server/migrations/index.js +12 -0
  80. package/dist-server/migrations/index.js.map +1 -0
  81. package/dist-server/routes.js +8 -0
  82. package/dist-server/routes.js.map +1 -0
  83. package/package.json +14 -14
  84. package/server/controllers/xilnex/xilnex.ts +22 -17
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("./xilnex");
18
+ __exportStar(require("./pos-api"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAiB;AAEjB,4CAAyB"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.api = void 0;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const debug = (0, debug_1.default)('things-factory:integration-pos:pos-api-decorator');
9
+ const NOOP = v => v;
10
+ const api = (target, property, descriptor) => {
11
+ const method = descriptor.value;
12
+ descriptor.value = async function (store, request) {
13
+ const POSAPI = this;
14
+ var { platform } = store;
15
+ var { action: platformAction, apis } = POSAPI.getPlatform(platform);
16
+ var m = apis[method.name];
17
+ if (!m) {
18
+ throw Error(`POS Platform '${platform}' doesn't have API ${method.name}`);
19
+ }
20
+ var { path, method: httpMethod = 'post', denormalize = NOOP, normalize = NOOP, action = platformAction } = m.apply(this, [request]);
21
+ var denormalized = await denormalize(request || {}, { store });
22
+ debug('request', denormalized);
23
+ var response = await action.apply(this, [
24
+ { store, method: httpMethod, path, request: denormalized, platformAction }
25
+ ]);
26
+ debug('response', response);
27
+ return await normalize(response, { store });
28
+ };
29
+ return descriptor;
30
+ };
31
+ exports.api = api;
32
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../server/controllers/pos-api/decorators.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,MAAM,KAAK,GAAG,IAA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AQ,CAAC,CAAA;QAE3B,OAAO,MAAM,SAAS,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AApCY,QAAA,GAAG,OAoCf"}
@@ -0,0 +1,56 @@
1
+ "use strict";
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.POSAPI = exports.POS_STORE_STATUS = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const entities_1 = require("../../entities");
15
+ const decorators_1 = require("./decorators");
16
+ exports.POS_STORE_STATUS = {
17
+ ACTIVE: 'active',
18
+ INACTIVE: 'inactive',
19
+ TERMINATED: 'terminated'
20
+ };
21
+ class POSAPI {
22
+ static registerPlatform(name, action, apis) {
23
+ POSAPI.platforms[name] = {
24
+ action,
25
+ apis
26
+ };
27
+ }
28
+ static getPlatform(name) {
29
+ return POSAPI.platforms[name];
30
+ }
31
+ static async getPosStore(id) {
32
+ const repository = (0, typeorm_1.getRepository)(entities_1.PosStore);
33
+ // return await repository.find(id)
34
+ return await repository.findOne({
35
+ where: { id },
36
+ relations: ['domain']
37
+ });
38
+ }
39
+ static getOutlets(store, req) { }
40
+ static getOutlet(store, req) { }
41
+ }
42
+ POSAPI.platforms = {};
43
+ __decorate([
44
+ decorators_1.api,
45
+ __metadata("design:type", Function),
46
+ __metadata("design:paramtypes", [Object, Object]),
47
+ __metadata("design:returntype", Object)
48
+ ], POSAPI, "getOutlets", null);
49
+ __decorate([
50
+ decorators_1.api,
51
+ __metadata("design:type", Function),
52
+ __metadata("design:paramtypes", [Object, Object]),
53
+ __metadata("design:returntype", Object)
54
+ ], POSAPI, "getOutlet", null);
55
+ exports.POSAPI = POSAPI;
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/pos-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuC;AACvC,6CAAyC;AACzC,6CAAkC;AAErB,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CACzB,CAAA;AAED,MAAa,MAAM;IAGjB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI;QACxC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YACvB,MAAM;YACN,IAAI;SACL,CAAA;IACH,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAI;QACrB,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;QACzB,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,mBAAQ,CAAC,CAAA;QAC1C,mCAAmC;QACnC,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC,CAAA;IACJ,CAAC;IAGM,AAAP,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,IAAQ,CAAC;IAG9B,AAAP,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,IAAQ,CAAC;;AA1B7B,gBAAS,GAAG,EAAE,CAAA;AAuBd;IADN,gBAAG;;;;8BACiC;AAG9B;IADN,gBAAG;;;;6BACgC;AA3BtC,wBA4BC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOutlet = void 0;
4
+ function getOutlet() {
5
+ return {
6
+ method: 'get',
7
+ path: '/outlet/{outletNo}',
8
+ denormalize(req) {
9
+ return {};
10
+ },
11
+ normalize(res) {
12
+ return Object.assign({}, res);
13
+ }
14
+ };
15
+ }
16
+ exports.getOutlet = getOutlet;
17
+ //# sourceMappingURL=get-outlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-outlet.js","sourceRoot":"","sources":["../../../../server/controllers/xilnex/apis/get-outlet.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS;IACvB,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,oBAAoB;QAC1B,WAAW,CAAC,GAAG;YACb,OAAO,EAAE,CAAA;QACX,CAAC;QACD,SAAS,CAAC,GAAG;YACX,yBACK,GAAG,EACP;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAbD,8BAaC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOutlets = void 0;
4
+ const debug = require('debug')('things-factory:integration-pos:xilnex:get-outlets');
5
+ function getOutlets() {
6
+ return {
7
+ method: 'get',
8
+ path: '/outlets',
9
+ denormalize(req) {
10
+ return {};
11
+ },
12
+ normalize(res) {
13
+ debug('response data', res);
14
+ const { outlets } = res;
15
+ return {
16
+ items: outlets,
17
+ total: outlets.length
18
+ };
19
+ }
20
+ };
21
+ }
22
+ exports.getOutlets = getOutlets;
23
+ //# sourceMappingURL=get-outlets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-outlets.js","sourceRoot":"","sources":["../../../../server/controllers/xilnex/apis/get-outlets.ts"],"names":[],"mappings":";;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,mDAAmD,CAAC,CAAA;AAEnF,SAAgB,UAAU;IACxB,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,UAAU;QAChB,WAAW,CAAC,GAAG;YACb,OAAO,EAAE,CAAA;QACX,CAAC;QACD,SAAS,CAAC,GAAG;YACX,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,CAAA;YAC3B,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;YAEvB,OAAO;gBACL,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,OAAO,CAAC,MAAM;aACtB,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAjBD,gCAiBC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-outlets"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/controllers/xilnex/apis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ __exportStar(require("./xilnex"), exports);
30
+ const platform_action_1 = require("./platform-action");
31
+ const pos_api_1 = require("../pos-api");
32
+ const APIS = __importStar(require("./apis"));
33
+ pos_api_1.POSAPI.registerPlatform('xilnex', platform_action_1.action, APIS);
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/xilnex/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwB;AAExB,uDAA0C;AAC1C,wCAAmC;AAEnC,6CAA8B;AAE9B,gBAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,wBAAM,EAAE,IAAI,CAAC,CAAA"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.action = void 0;
4
+ const xilnex_1 = require("./xilnex");
5
+ const env_1 = require("@things-factory/env");
6
+ const xilnexConfig = env_1.config.get('posIntegrationXilnex', {});
7
+ const { apiKey, apiSecret } = xilnexConfig;
8
+ function substitute(path, obj) {
9
+ var props = [];
10
+ var re = /{([^}]+)}/g;
11
+ var text;
12
+ while ((text = re.exec(path))) {
13
+ props.push(text[1]);
14
+ }
15
+ var result = path;
16
+ props.forEach(prop => {
17
+ let value = obj[prop.trim()];
18
+ result = result.replace(`{${prop}}`, value === undefined ? '' : value);
19
+ });
20
+ return result;
21
+ }
22
+ const action = async ({ store, method = 'get', path, request }) => {
23
+ const client = new xilnex_1.Xilnex({
24
+ store: store.storeId,
25
+ accessToken: store.accessToken,
26
+ storeId: store.storeId
27
+ });
28
+ const { resource = {}, payload = {} } = request;
29
+ path = substitute(path, resource);
30
+ var response = await client[method](path, payload);
31
+ if (!response.ok) {
32
+ throw response.error;
33
+ }
34
+ return response.data;
35
+ };
36
+ exports.action = action;
37
+ //# sourceMappingURL=platform-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-action.js","sourceRoot":"","sources":["../../../server/controllers/xilnex/platform-action.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,6CAA4C;AAC5C,MAAM,YAAY,GAAG,YAAM,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAA;AAC3D,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,YAAY,CAAA;AAE1C,SAAS,UAAU,CAAC,IAAI,EAAE,GAAG;IAC3B,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,IAAI,EAAE,GAAG,YAAY,CAAA;IACrB,IAAI,IAAI,CAAA;IAER,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;QAC7B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;KACpB;IAED,IAAI,MAAM,GAAG,IAAI,CAAA;IACjB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,IAAI,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAC5B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC;AAEM,MAAM,MAAM,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;QACxB,KAAK,EAAE,KAAK,CAAC,OAAO;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAA;IAEF,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;IAE/C,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAEjC,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;QAChB,MAAM,QAAQ,CAAC,KAAK,CAAA;KACrB;IAED,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC,CAAA;AAjBY,QAAA,MAAM,UAiBlB"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Xilnex = void 0;
7
+ const node_fetch_1 = __importDefault(require("node-fetch"));
8
+ const debug_1 = __importDefault(require("debug"));
9
+ const debug = (0, debug_1.default)('things-factory:integration-pos:xilnex');
10
+ class Xilnex {
11
+ constructor(config) {
12
+ this.config = Object.assign({}, config);
13
+ }
14
+ async get(path, data) {
15
+ const { store, accessToken, storeId: appid } = this.config;
16
+ const qs = Object.entries(data)
17
+ .map(([k, v]) => `${k}=${encodeURIComponent(String(v))}`)
18
+ .join('&');
19
+ const endpoint = `https://api.xilnex.com/logic/v2${path}${qs ? '?' + qs : ''}`;
20
+ debug('endpoint', endpoint);
21
+ const response = await (0, node_fetch_1.default)(endpoint, {
22
+ headers: {
23
+ appid: appid,
24
+ token: accessToken,
25
+ auth: '5'
26
+ }
27
+ });
28
+ const result = await response.json();
29
+ debug('response result', result);
30
+ return result;
31
+ }
32
+ async post(path, data = {}) {
33
+ const { store, accessToken, storeId: appid } = this.config;
34
+ debug('data', data);
35
+ const jsondata = JSON.stringify(data);
36
+ const endpoint = `https://api.xilnex.com/logic/v2${path}`;
37
+ let headers = {
38
+ appid: appid,
39
+ token: accessToken,
40
+ auth: '5',
41
+ 'Content-Type': 'application/json'
42
+ };
43
+ if (data === null || data === void 0 ? void 0 : data.releaseGoodId) {
44
+ headers['Idempotency_Key'] = data.releaseGoodId;
45
+ }
46
+ const response = await (0, node_fetch_1.default)(endpoint, {
47
+ method: 'post',
48
+ headers: headers,
49
+ body: jsondata
50
+ });
51
+ const result = await response.json();
52
+ debug('response result', result);
53
+ return result;
54
+ }
55
+ async put(path, data = {}) {
56
+ const { store, accessToken, storeId: appid } = this.config;
57
+ debug('data', data);
58
+ const jsondata = JSON.stringify(data);
59
+ const endpoint = `https://api.xilnex.com/logic/v2${path}`;
60
+ const response = await (0, node_fetch_1.default)(endpoint, {
61
+ method: 'put',
62
+ headers: {
63
+ appid: appid,
64
+ token: accessToken,
65
+ auth: '5',
66
+ 'Content-Type': 'application/json'
67
+ },
68
+ body: jsondata
69
+ });
70
+ const result = await response.json();
71
+ debug('response result', result);
72
+ return result;
73
+ }
74
+ async delete(path, data = {}) {
75
+ const { store, accessToken, storeId: appid } = this.config;
76
+ debug('data', data);
77
+ const jsondata = JSON.stringify(data);
78
+ const endpoint = `https://api.xilnex.com/logic/v2${path}`;
79
+ const response = await (0, node_fetch_1.default)(endpoint, {
80
+ method: 'delete',
81
+ headers: {
82
+ appid: appid,
83
+ token: accessToken,
84
+ auth: '5',
85
+ 'Content-Type': 'application/json'
86
+ },
87
+ body: jsondata
88
+ });
89
+ const result = await response.json();
90
+ debug('response result', result);
91
+ return result;
92
+ }
93
+ }
94
+ exports.Xilnex = Xilnex;
95
+ //# sourceMappingURL=xilnex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xilnex.js","sourceRoot":"","sources":["../../../server/controllers/xilnex/xilnex.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,kDAAyB;AAEzB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,uCAAuC,CAAC,CAAA;AAQ5D,MAAa,MAAM;IAGjB,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,qBACN,MAAM,CACV,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,IAAS;QAC/B,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE1D,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACxD,IAAI,CAAC,GAAG,CAAC,CAAA;QAEZ,MAAM,QAAQ,GAAG,kCAAkC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,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,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,GAAG;gBACT,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACpC,KAAK,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;QAEhC,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AApHD,wBAoHC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./pos-connector");
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/engine/connector/index.ts"],"names":[],"mappings":";;AAAA,2BAAwB"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.POSConnector = void 0;
4
+ const integration_base_1 = require("@things-factory/integration-base");
5
+ class POSConnector {
6
+ async ready(connectionConfigs) {
7
+ await Promise.all(connectionConfigs.map(this.connect));
8
+ integration_base_1.ConnectionManager.logger.info('pos-connector connections are ready');
9
+ }
10
+ async connect(connection) {
11
+ const { domain, name, endpoint } = connection;
12
+ integration_base_1.ConnectionManager.addConnectionInstance(connection, Object.assign({}, connection));
13
+ integration_base_1.ConnectionManager.logger.info(`pos-connector connection(${name}:${connection.endpoint}) is connected`);
14
+ }
15
+ async disconnect(connection) {
16
+ integration_base_1.ConnectionManager.removeConnectionInstance(connection);
17
+ integration_base_1.ConnectionManager.logger.info(`pos-connector connection(${connection.name}) is disconnected`);
18
+ }
19
+ get parameterSpec() {
20
+ return [];
21
+ }
22
+ get taskPrefixes() {
23
+ return ['pos'];
24
+ }
25
+ }
26
+ exports.POSConnector = POSConnector;
27
+ integration_base_1.ConnectionManager.registerConnector('pos-connector', new POSConnector());
28
+ //# sourceMappingURL=pos-connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pos-connector.js","sourceRoot":"","sources":["../../../server/engine/connector/pos-connector.ts"],"names":[],"mappings":";;;AAAA,uEAA2F;AAE3F,MAAa,YAAY;IACvB,KAAK,CAAC,KAAK,CAAC,iBAAiB;QAC3B,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;QAEtD,oCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAA;IACtE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAA;QAE7C,oCAAiB,CAAC,qBAAqB,CAAC,UAAU,oBAAO,UAAU,EAAG,CAAA;QAEtE,oCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,IAAI,IAAI,UAAU,CAAC,QAAQ,gBAAgB,CAAC,CAAA;IACxG,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,UAAsB;QACrC,oCAAiB,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAA;QAEtD,oCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,UAAU,CAAC,IAAI,mBAAmB,CAAC,CAAA;IAC/F,CAAC;IAED,IAAI,aAAa;QACf,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,YAAY;QACd,OAAO,CAAC,KAAK,CAAC,CAAA;IAChB,CAAC;CACF;AA5BD,oCA4BC;AAED,oCAAiB,CAAC,iBAAiB,CAAC,eAAe,EAAE,IAAI,YAAY,EAAE,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./connector");
4
+ require("./task");
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/engine/index.ts"],"names":[],"mappings":";;AAAA,uBAAoB;AACpB,kBAAe"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./pos-api");
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/engine/task/index.ts"],"names":[],"mappings":";;AAAA,qBAAkB"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const integration_base_1 = require("@things-factory/integration-base");
4
+ const utils_1 = require("@things-factory/utils");
5
+ const typeorm_1 = require("typeorm");
6
+ const entities_1 = require("../../entities");
7
+ const pos_api_1 = require("../../controllers/pos-api");
8
+ async function POSAPI(step, { logger, data, domain }) {
9
+ var { connection, params: { store: name, api, accessor } } = step;
10
+ var client = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connection) || {};
11
+ if (!client) {
12
+ throw new Error(`no connection : ${connection}`);
13
+ }
14
+ if (!api) {
15
+ throw new Error(`no api defined`);
16
+ }
17
+ const repository = (0, typeorm_1.getRepository)(entities_1.PosStore);
18
+ const store = await repository.findOne({
19
+ where: { domain, name }
20
+ });
21
+ if (!store) {
22
+ throw new Error(`no store defined`);
23
+ }
24
+ var result = await pos_api_1.POSAPI[api](store, accessor ? (0, utils_1.access)(accessor, data) : {});
25
+ return {
26
+ data: result
27
+ };
28
+ }
29
+ POSAPI.parameterSpec = [
30
+ {
31
+ type: 'entity-selector',
32
+ name: 'store',
33
+ label: 'store',
34
+ property: {
35
+ queryName: 'stores',
36
+ valueKey: 'name'
37
+ }
38
+ },
39
+ {
40
+ type: 'select',
41
+ name: 'api',
42
+ label: 'api',
43
+ property: {
44
+ options: ['', 'getPOSInvoices']
45
+ }
46
+ },
47
+ {
48
+ type: 'string',
49
+ name: 'accessor',
50
+ label: 'accessor'
51
+ }
52
+ ];
53
+ integration_base_1.TaskRegistry.registerTaskHandler('pos-api', POSAPI);
54
+ //# sourceMappingURL=pos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I,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE;YACR,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE,MAAM;SACjB;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,EAAE,EAAE,gBAAgB,CAAC;SAChC;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,UAAU;KAClB;CACF,CAAA;AAED,+BAAY,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PosStore = exports.entities = void 0;
4
+ const pos_store_1 = require("./pos-store");
5
+ Object.defineProperty(exports, "PosStore", { enumerable: true, get: function () { return pos_store_1.PosStore; } });
6
+ exports.entities = [pos_store_1.PosStore];
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/entities/index.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAI7B,yFAJA,oBAAQ,OAIA;AAFJ,QAAA,QAAQ,GAAG,CAAC,oBAAQ,CAAC,CAAA"}
@@ -0,0 +1,106 @@
1
+ "use strict";
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
+ var _a, _b, _c;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.PosStore = void 0;
14
+ const auth_base_1 = require("@things-factory/auth-base");
15
+ const shell_1 = require("@things-factory/shell");
16
+ const typeorm_1 = require("typeorm");
17
+ let PosStore = class PosStore {
18
+ };
19
+ __decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
21
+ __metadata("design:type", String)
22
+ ], PosStore.prototype, "id", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
25
+ __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
26
+ ], PosStore.prototype, "domain", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)(),
29
+ __metadata("design:type", String)
30
+ ], PosStore.prototype, "platform", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({
33
+ nullable: true
34
+ }),
35
+ __metadata("design:type", String)
36
+ ], PosStore.prototype, "storeId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)(),
39
+ __metadata("design:type", String)
40
+ ], PosStore.prototype, "countryCode", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({
43
+ nullable: true
44
+ }),
45
+ __metadata("design:type", String)
46
+ ], PosStore.prototype, "status", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)(),
49
+ __metadata("design:type", String)
50
+ ], PosStore.prototype, "name", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({
53
+ nullable: true
54
+ }),
55
+ __metadata("design:type", String)
56
+ ], PosStore.prototype, "accessInfo", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({
59
+ nullable: true
60
+ }),
61
+ __metadata("design:type", String)
62
+ ], PosStore.prototype, "accessToken", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({
65
+ nullable: true
66
+ }),
67
+ __metadata("design:type", String)
68
+ ], PosStore.prototype, "refreshToken", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({
71
+ nullable: true
72
+ }),
73
+ __metadata("design:type", String)
74
+ ], PosStore.prototype, "store", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({
77
+ nullable: true
78
+ }),
79
+ __metadata("design:type", String)
80
+ ], PosStore.prototype, "description", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.CreateDateColumn)(),
83
+ __metadata("design:type", Date)
84
+ ], PosStore.prototype, "createdAt", void 0);
85
+ __decorate([
86
+ (0, typeorm_1.UpdateDateColumn)(),
87
+ __metadata("design:type", Date)
88
+ ], PosStore.prototype, "updatedAt", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
91
+ nullable: true
92
+ }),
93
+ __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
94
+ ], PosStore.prototype, "creator", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
97
+ nullable: true
98
+ }),
99
+ __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
100
+ ], PosStore.prototype, "updater", void 0);
101
+ PosStore = __decorate([
102
+ (0, typeorm_1.Entity)(),
103
+ (0, typeorm_1.Index)('ix_pos-store_0', (store) => [store.domain, store.name], { unique: true })
104
+ ], PosStore);
105
+ exports.PosStore = PosStore;
106
+ //# sourceMappingURL=pos-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pos-store.js","sourceRoot":"","sources":["../../server/entities/pos-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAgD;AAChD,iDAA8C;AAC9C,qCAAsH;AAO/G,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAkEpB,CAAA;AAjEC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;oC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