@things-factory/integration-accounting 4.3.740 → 4.3.745
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-server/controllers/accounting-api/decorators.js +23 -7
- package/dist-server/controllers/accounting-api/decorators.js.map +1 -1
- package/dist-server/controllers/xilnex/apis/purchase-order/create-purchase-receive.js +2 -1
- package/dist-server/controllers/xilnex/apis/purchase-order/create-purchase-receive.js.map +1 -1
- package/package.json +15 -15
- package/server/controllers/accounting-api/decorators.ts +44 -8
- package/server/controllers/xilnex/apis/purchase-order/create-purchase-receive.ts +2 -1
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.api = void 0;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const debug = (0, debug_1.default)('things-factory:integration-accounting:accounting-api-decorator');
|
|
9
|
+
const integration_base_1 = require("@things-factory/integration-base");
|
|
9
10
|
const NOOP = v => v;
|
|
10
11
|
const api = (target, property, descriptor) => {
|
|
11
12
|
const method = descriptor.value;
|
|
@@ -20,14 +21,29 @@ const api = (target, property, descriptor) => {
|
|
|
20
21
|
var { path, method: httpMethod = 'post', denormalize = NOOP, normalize = NOOP, action = platformAction } = m.apply(this, [request]);
|
|
21
22
|
var denormalized = await denormalize(request || {}, { accounting });
|
|
22
23
|
debug('request', denormalized);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const fullPath = `${accounting.platform}${path}`;
|
|
25
|
+
const requestPayload = JSON.stringify(denormalized.payload || denormalized);
|
|
26
|
+
try {
|
|
27
|
+
var response = await action.apply(this, [
|
|
28
|
+
{ accounting, method: httpMethod, path, request: denormalized, platformAction }
|
|
29
|
+
]);
|
|
30
|
+
debug('response', response);
|
|
31
|
+
const responsePayload = typeof response === 'string' ? response : JSON.stringify(response);
|
|
32
|
+
// Log payload if context is available
|
|
33
|
+
if (request === null || request === void 0 ? void 0 : request.context) {
|
|
34
|
+
(0, integration_base_1.createPayloadLog)(`${accounting.platform}-${method.name}`, fullPath, requestPayload, responsePayload, request.context, integration_base_1.PayloadType.EGESTION, accounting.platform);
|
|
35
|
+
}
|
|
36
|
+
return await normalize(response, { accounting });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const errorMessage = (error === null || error === void 0 ? void 0 : error.message) || String(error);
|
|
40
|
+
const errorPayload = typeof errorMessage === 'string' ? errorMessage : JSON.stringify(errorMessage);
|
|
41
|
+
// Log error payload if context is available
|
|
42
|
+
if (request === null || request === void 0 ? void 0 : request.context) {
|
|
43
|
+
(0, integration_base_1.createPayloadLog)(`${accounting.platform}-${method.name}`, fullPath, requestPayload, errorPayload, request.context, integration_base_1.PayloadType.EGESTION, accounting.platform);
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
29
46
|
}
|
|
30
|
-
return await normalize(response, { accounting });
|
|
31
47
|
};
|
|
32
48
|
return descriptor;
|
|
33
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../server/controllers/accounting-api/decorators.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,gEAAgE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../server/controllers/accounting-api/decorators.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,gEAAgE,CAAC,CAAA;AAGrF,uEAAgF;AAEhF,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAEZ,MAAM,GAAG,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAE,UAAwC,EAAO,EAAE;IACrG,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAA;IAE/B,UAAU,CAA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a,uBAAb,aAAa,CAAE,eAAe,KAAI,GAAG;aAC3D,CAAA;YAED,OAAO;gBACL,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;gBACpD,OAAO,EAAE,EAAE,eAAe,kCAAO,eAAe,KAAE,aAAa,GAAE,EAAE;aACpE,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"create-purchase-receive.js","sourceRoot":"","sources":["../../../../../server/controllers/xilnex/apis/purchase-order/create-purchase-receive.ts"],"names":[],"mappings":";;;AAAA,SAAgB,qBAAqB;IACnC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,+BAA+B;QACrC,WAAW,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE;YAC7B,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,GAAG,CAAA;YAC5C,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;YACxC,IAAI,WAAW,GAAQ,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,EAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YACxF,IAAI,qBAAqB,GAAG,CAAC,CAAA;YAE7B,IAAI,aAAa,GAAQ,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;gBAC9C,qBAAqB,IAAI,EAAE,CAAC,aAAa,CAAA;gBACzC,OAAO;oBACL,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG;oBACxB,aAAa,EAAE,EAAE,CAAC,aAAa;oBAC/B,SAAS,EAAE,EAAE,CAAC,SAAS;oBACvB,SAAS,EAAE,EAAE,CAAC,SAAS;iBACxB,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,IAAI,eAAe,GAAQ;gBACzB,KAAK,EAAE,CAAC;gBACR,WAAW,EAAE,OAAO;gBACpB,aAAa,EAAE,OAAO;gBACtB,cAAc,EAAE,WAAW;gBAC3B,gBAAgB,EAAE,KAAK;gBACvB,MAAM,EAAE,aAAa,CAAC,MAAM,IAAI,IAAI;gBACpC,MAAM,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,KAAI,aAAa;gBAC5C,QAAQ,EAAE,aAAa,CAAC,KAAK;gBAC7B,SAAS,EAAE,aAAa,CAAC,MAAM,IAAI,GAAG;gBACtC,WAAW,EAAE,OAAO;gBACpB,mBAAmB,EAAE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,eAAe,KAAI,GAAG;aAC3D,CAAA;YAED,OAAO;gBACL,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;gBACpD,OAAO,EAAE,EAAE,eAAe,kCAAO,eAAe,KAAE,aAAa,GAAE,EAAE;aACpE,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AA3CD,sDA2CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-accounting",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.745",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
"test": "DEBUG=things-factory:* NODE_ENV=development npx mocha -r ts-node/register ./test/**/*spec.ts"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/apptool-ui": "^4.3.
|
|
28
|
-
"@things-factory/auth-ui": "^4.3.
|
|
29
|
-
"@things-factory/biz-base": "^4.3.
|
|
30
|
-
"@things-factory/code-ui": "^4.3.
|
|
31
|
-
"@things-factory/context-ui": "^4.3.
|
|
32
|
-
"@things-factory/grist-ui": "^4.3.
|
|
33
|
-
"@things-factory/i18n-base": "^4.3.
|
|
34
|
-
"@things-factory/integration-ui": "^4.3.
|
|
35
|
-
"@things-factory/more-ui": "^4.3.
|
|
36
|
-
"@things-factory/product-base": "^4.3.
|
|
37
|
-
"@things-factory/resource-ui": "^4.3.
|
|
38
|
-
"@things-factory/setting-ui": "^4.3.
|
|
39
|
-
"@things-factory/system-ui": "^4.3.
|
|
27
|
+
"@things-factory/apptool-ui": "^4.3.743",
|
|
28
|
+
"@things-factory/auth-ui": "^4.3.743",
|
|
29
|
+
"@things-factory/biz-base": "^4.3.745",
|
|
30
|
+
"@things-factory/code-ui": "^4.3.743",
|
|
31
|
+
"@things-factory/context-ui": "^4.3.743",
|
|
32
|
+
"@things-factory/grist-ui": "^4.3.743",
|
|
33
|
+
"@things-factory/i18n-base": "^4.3.743",
|
|
34
|
+
"@things-factory/integration-ui": "^4.3.743",
|
|
35
|
+
"@things-factory/more-ui": "^4.3.743",
|
|
36
|
+
"@things-factory/product-base": "^4.3.745",
|
|
37
|
+
"@things-factory/resource-ui": "^4.3.743",
|
|
38
|
+
"@things-factory/setting-ui": "^4.3.743",
|
|
39
|
+
"@things-factory/system-ui": "^4.3.743",
|
|
40
40
|
"debug": "^4.1.1",
|
|
41
41
|
"node-fetch": "^2.6.0"
|
|
42
42
|
},
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"nock": "^13.0.2",
|
|
51
51
|
"should": "^13.2.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "89c8b3c8c7ac589d4f547a984c1027a6f509671f"
|
|
54
54
|
}
|
|
@@ -2,6 +2,7 @@ import Debug from 'debug'
|
|
|
2
2
|
const debug = Debug('things-factory:integration-accounting:accounting-api-decorator')
|
|
3
3
|
|
|
4
4
|
import { Account } from '../../entities'
|
|
5
|
+
import { createPayloadLog, PayloadType } from '@things-factory/integration-base'
|
|
5
6
|
|
|
6
7
|
const NOOP = v => v
|
|
7
8
|
|
|
@@ -31,16 +32,51 @@ export const api = (target: Object, property: string, descriptor: TypedPropertyD
|
|
|
31
32
|
var denormalized = await denormalize(request || {}, { accounting })
|
|
32
33
|
debug('request', denormalized)
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
])
|
|
35
|
+
const fullPath = `${accounting.platform}${path}`
|
|
36
|
+
const requestPayload = JSON.stringify(denormalized.payload || denormalized)
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
try {
|
|
39
|
+
var response = await action.apply(this, [
|
|
40
|
+
{ accounting, method: httpMethod, path, request: denormalized, platformAction }
|
|
41
|
+
])
|
|
42
|
+
|
|
43
|
+
debug('response', response)
|
|
44
|
+
|
|
45
|
+
const responsePayload = typeof response === 'string' ? response : JSON.stringify(response)
|
|
46
|
+
|
|
47
|
+
// Log payload if context is available
|
|
48
|
+
if (request?.context) {
|
|
49
|
+
createPayloadLog(
|
|
50
|
+
`${accounting.platform}-${method.name}`,
|
|
51
|
+
fullPath,
|
|
52
|
+
requestPayload,
|
|
53
|
+
responsePayload,
|
|
54
|
+
request.context,
|
|
55
|
+
PayloadType.EGESTION,
|
|
56
|
+
accounting.platform
|
|
57
|
+
)
|
|
58
|
+
}
|
|
42
59
|
|
|
43
|
-
|
|
60
|
+
return await normalize(response, { accounting })
|
|
61
|
+
} catch (error) {
|
|
62
|
+
const errorMessage = error?.message || String(error)
|
|
63
|
+
const errorPayload = typeof errorMessage === 'string' ? errorMessage : JSON.stringify(errorMessage)
|
|
64
|
+
|
|
65
|
+
// Log error payload if context is available
|
|
66
|
+
if (request?.context) {
|
|
67
|
+
createPayloadLog(
|
|
68
|
+
`${accounting.platform}-${method.name}`,
|
|
69
|
+
fullPath,
|
|
70
|
+
requestPayload,
|
|
71
|
+
errorPayload,
|
|
72
|
+
request.context,
|
|
73
|
+
PayloadType.EGESTION,
|
|
74
|
+
accounting.platform
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
throw error
|
|
79
|
+
}
|
|
44
80
|
}
|
|
45
81
|
|
|
46
82
|
return descriptor
|