@things-factory/integration-pos 9.0.24 → 9.0.26
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.
|
@@ -7,7 +7,7 @@ const pos_api_1 = require("../../controllers/pos-api");
|
|
|
7
7
|
const entities_1 = require("../../entities");
|
|
8
8
|
async function POSAPI(step, { logger, data, domain }) {
|
|
9
9
|
var { connection, params: { store: name, api, accessor } } = step;
|
|
10
|
-
var client = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connection) || {};
|
|
10
|
+
var client = (await integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connection)) || {};
|
|
11
11
|
if (!client) {
|
|
12
12
|
throw new Error(`no connection : ${connection}`);
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pos-api.js","sourceRoot":"","sources":["../../../server/engine/task/pos-api.ts"],"names":[],"mappings":";;AAAA,uEAAkF;AAClF,iDAAqD;AACrD,iDAA8C;AAE9C,uDAAyD;AACzD,6CAAyC;AAEzC,KAAK,UAAU,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAClD,IAAI,EACF,UAAU,EACV,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,EACvC,GAAG,IAAI,CAAA;IAER,IAAI,MAAM,GAAG,oCAAiB,CAAC,2BAA2B,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"pos-api.js","sourceRoot":"","sources":["../../../server/engine/task/pos-api.ts"],"names":[],"mappings":";;AAAA,uEAAkF;AAClF,iDAAqD;AACrD,iDAA8C;AAE9C,uDAAyD;AACzD,6CAAyC;AAEzC,KAAK,UAAU,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAClD,IAAI,EACF,UAAU,EACV,MAAM,EAAE,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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","sourcesContent":["import { ConnectionManager, TaskRegistry } from '@things-factory/integration-base'\nimport { getRepository } from '@things-factory/shell'\nimport { access } from '@things-factory/utils'\n\nimport { POSAPI as API } from '../../controllers/pos-api'\nimport { PosStore } from '../../entities'\n\nasync function POSAPI(step, { logger, data, domain }) {\n var {\n connection,\n params: { store: name, api, accessor }\n } = step\n\n var client = (await ConnectionManager.getConnectionInstanceByName(domain, connection)) || {}\n if (!client) {\n throw new Error(`no connection : ${connection}`)\n }\n\n if (!api) {\n throw new Error(`no api defined`)\n }\n\n const repository = getRepository(PosStore)\n const store: PosStore = await repository.findOne({\n where: { domain: { id: domain.id }, name }\n })\n\n if (!store) {\n throw new Error(`no store defined`)\n }\n\n var result = await API[api](store, accessor ? access(accessor, data) : {})\n\n return {\n data: result\n }\n}\n\nPOSAPI.parameterSpec = [\n {\n type: 'entity-selector',\n name: 'store',\n label: 'store',\n property: {\n queryName: 'stores',\n valueKey: 'name'\n }\n },\n {\n type: 'select',\n name: 'api',\n label: 'api',\n property: {\n options: ['', 'getPOSInvoices']\n }\n },\n {\n type: 'string',\n name: 'accessor',\n label: 'accessor'\n }\n]\n\nTaskRegistry.registerTaskHandler('pos-api', POSAPI)\n"]}
|