@things-factory/integration-accounting 9.0.20 → 9.0.25
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 accounting_api_1 = require("../../controllers/accounting-api");
|
|
|
7
7
|
const entities_1 = require("../../entities");
|
|
8
8
|
async function AccountingAPI(step, { logger, data, domain }) {
|
|
9
9
|
var { connection, params: { account: 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":"accounting-api.js","sourceRoot":"","sources":["../../../server/engine/task/accounting-api.ts"],"names":[],"mappings":";;AAAA,uEAAkF;AAClF,iDAAqD;AACrD,iDAA8C;AAE9C,qEAAuE;AACvE,6CAAwC;AAExC,KAAK,UAAU,aAAa,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IACzD,IAAI,EACF,UAAU,EACV,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,EACzC,GAAG,IAAI,CAAA;IAER,IAAI,MAAM,GAAG,oCAAiB,CAAC,2BAA2B,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"accounting-api.js","sourceRoot":"","sources":["../../../server/engine/task/accounting-api.ts"],"names":[],"mappings":";;AAAA,uEAAkF;AAClF,iDAAqD;AACrD,iDAA8C;AAE9C,qEAAuE;AACvE,6CAAwC;AAExC,KAAK,UAAU,aAAa,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IACzD,IAAI,EACF,UAAU,EACV,MAA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QACZ,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,EAAE,EAAE,uBAAuB,CAAC;SACvC;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,UAAU;KAClB;CACF,CAAA;AAED,+BAAY,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,aAAa,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 { AccountingAPI as API } from '../../controllers/accounting-api'\nimport { Account } from '../../entities'\n\nasync function AccountingAPI(step, { logger, data, domain }) {\n var {\n connection,\n params: { account: 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(Account)\n const account: Account = await repository.findOne({\n where: { domain: { id: domain.id }, name }\n })\n\n if (!account) {\n throw new Error(`no account defined`)\n }\n\n var result = await API[api](account, accessor ? access(accessor, data) : {})\n\n return {\n data: result\n }\n}\n\nAccountingAPI.parameterSpec = [\n {\n type: 'entity-selector',\n name: 'account',\n label: 'account',\n property: {\n queryName: 'accounts',\n valueKey: 'name'\n }\n },\n {\n type: 'select',\n name: 'api',\n label: 'api',\n property: {\n options: ['', 'getAccountingInvoices']\n }\n },\n {\n type: 'string',\n name: 'accessor',\n label: 'accessor'\n }\n]\n\nTaskRegistry.registerTaskHandler('accounting-api', AccountingAPI)\n"]}
|