@alanszp/integrations-common 7.8.3 → 7.8.4
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/IntegrationExecutionResult.d.ts +3 -3
- package/dist/IntegrationExecutionResult.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +6 -6
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/IntegrationExecutionResult.ts +4 -4
- package/src/index.ts +2 -0
- package/src/types.ts +1 -1
- package/dist/IntegrationExecutionResult.test.d.ts +0 -1
- package/dist/IntegrationExecutionResult.test.js +0 -50
- package/dist/IntegrationExecutionResult.test.js.map +0 -1
- package/src/IntegrationExecutionResult.test.ts +0 -64
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntegrationResultStatus,
|
|
1
|
+
import { IntegrationResultStatus, IntegrationStatus, IntegrationResultError } from "./types";
|
|
2
2
|
export interface ChangesStatus {
|
|
3
3
|
updated: string[];
|
|
4
4
|
created: string[];
|
|
@@ -18,8 +18,8 @@ export declare class IntegrationExecutionResult {
|
|
|
18
18
|
getContext(): Record<string, unknown> | undefined;
|
|
19
19
|
getIntegrationId(): string;
|
|
20
20
|
getOrganizationReference(): string;
|
|
21
|
-
setStatus(status:
|
|
22
|
-
getStatus():
|
|
21
|
+
setStatus(status: IntegrationStatus): void;
|
|
22
|
+
getStatus(): IntegrationStatus;
|
|
23
23
|
getExecutedBy(): string | undefined;
|
|
24
24
|
getResults(): IntegrationResultStatus;
|
|
25
25
|
private setTotals;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationExecutionResult.js","sourceRoot":"","sources":["../src/IntegrationExecutionResult.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAgB/B,MAAa,0BAA0B;IAoBrC,YACE,aAAqB,EACrB,qBAA6B,EAC7B,UAAmB;QAtBb,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IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAEM,UAAU;QACf,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,MAA6B;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAA,cAAK,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEO,UAAU,CAAC,OAA+B;QAChD,IAAI,CAAC,OAAO,GAAG,IAAA,cAAK,EAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF;AAtFD,gEAsFC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./IntegrationExecutionResult"), exports);
|
|
14
|
+
__exportStar(require("./types"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA6C;AAC7C,0CAAwB"}
|
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SyncError = exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})(
|
|
3
|
+
exports.SyncError = exports.IntegrationStatus = void 0;
|
|
4
|
+
var IntegrationStatus;
|
|
5
|
+
(function (IntegrationStatus) {
|
|
6
|
+
IntegrationStatus["SUCCESS"] = "success";
|
|
7
|
+
IntegrationStatus["ERROR"] = "error";
|
|
8
|
+
})(IntegrationStatus = exports.IntegrationStatus || (exports.IntegrationStatus = {}));
|
|
9
9
|
var SyncError;
|
|
10
10
|
(function (SyncError) {
|
|
11
11
|
SyncError["MISSING_FIELDS"] = "missing";
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,oCAAe,CAAA;AACjB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AAED,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,uCAA0B,CAAA;IAC1B,sCAAyB,CAAA;IACzB,oDAAuC,CAAA;AACzC,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alanszp/integrations-common",
|
|
3
|
-
"version": "7.8.
|
|
3
|
+
"version": "7.8.4",
|
|
4
4
|
"description": "Common logic shared between integrations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@alanszp/errors": "^7.0.0",
|
|
31
31
|
"lodash": "^4.17.21"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "05b1bdc19d6d3d2701c9ff40e2a2b929f5b600ff"
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { merge } from "lodash";
|
|
2
2
|
import {
|
|
3
3
|
IntegrationResultStatus,
|
|
4
|
-
|
|
4
|
+
IntegrationStatus,
|
|
5
5
|
IntegrationResultError,
|
|
6
6
|
} from "./types";
|
|
7
7
|
|
|
@@ -28,7 +28,7 @@ export class IntegrationExecutionResult {
|
|
|
28
28
|
|
|
29
29
|
private organizationReference: string;
|
|
30
30
|
|
|
31
|
-
private status:
|
|
31
|
+
private status: IntegrationStatus;
|
|
32
32
|
|
|
33
33
|
private executedBy: string | undefined;
|
|
34
34
|
|
|
@@ -74,11 +74,11 @@ export class IntegrationExecutionResult {
|
|
|
74
74
|
return this.organizationReference;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
public setStatus(status:
|
|
77
|
+
public setStatus(status: IntegrationStatus): void {
|
|
78
78
|
this.status = status;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
public getStatus():
|
|
81
|
+
public getStatus(): IntegrationStatus {
|
|
82
82
|
return this.status;
|
|
83
83
|
}
|
|
84
84
|
|
package/src/index.ts
ADDED
package/src/types.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const types_1 = require("./types");
|
|
4
|
-
const IntegrationExecutionResult_1 = require("./IntegrationExecutionResult");
|
|
5
|
-
const MOCK_INTEGRATION_ID = "1";
|
|
6
|
-
const MOCK_ORGANIZATION_REFERENCE = "test";
|
|
7
|
-
const MOCK_EXECUTED_BY = "1";
|
|
8
|
-
describe("IntegrationHistory", () => {
|
|
9
|
-
describe("setResults", () => {
|
|
10
|
-
it("should return value with default values", () => {
|
|
11
|
-
const i = new IntegrationExecutionResult_1.IntegrationExecutionResult(MOCK_INTEGRATION_ID, MOCK_ORGANIZATION_REFERENCE, MOCK_EXECUTED_BY);
|
|
12
|
-
const pc = {
|
|
13
|
-
created: ["1"],
|
|
14
|
-
updated: ["1"],
|
|
15
|
-
errors: [
|
|
16
|
-
{
|
|
17
|
-
type: types_1.SyncError.MISSING_FIELDS,
|
|
18
|
-
userReference: "1",
|
|
19
|
-
metadata: ["missingFieldName"],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
i.setResults(pc);
|
|
24
|
-
expect(i.getResults()).toStrictEqual({
|
|
25
|
-
totals: { added: 1, removed: 0, updated: 1, error: 1 },
|
|
26
|
-
details: {
|
|
27
|
-
added: ["1"],
|
|
28
|
-
removed: [],
|
|
29
|
-
updated: ["1"],
|
|
30
|
-
error: [
|
|
31
|
-
{
|
|
32
|
-
type: types_1.SyncError.MISSING_FIELDS,
|
|
33
|
-
userReference: "1",
|
|
34
|
-
metadata: ["missingFieldName"],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe("getters", () => {
|
|
42
|
-
it("should return correct values", () => {
|
|
43
|
-
const i = new IntegrationExecutionResult_1.IntegrationExecutionResult(MOCK_INTEGRATION_ID, MOCK_ORGANIZATION_REFERENCE, MOCK_EXECUTED_BY);
|
|
44
|
-
expect(i.getExecutedBy()).toStrictEqual(MOCK_EXECUTED_BY);
|
|
45
|
-
expect(i.getOrganizationReference()).toStrictEqual(MOCK_ORGANIZATION_REFERENCE);
|
|
46
|
-
expect(i.getExecutedBy()).toStrictEqual(MOCK_EXECUTED_BY);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=IntegrationExecutionResult.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationExecutionResult.test.js","sourceRoot":"","sources":["../src/IntegrationExecutionResult.test.ts"],"names":[],"mappings":";;AAAA,mCAAoC;AACpC,6EAGsC;AAEtC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAC3C,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,CAAC,GAAG,IAAI,uDAA0B,CACtC,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,CACjB,CAAC;YACF,MAAM,EAAE,GAAkB;gBACxB,OAAO,EAAE,CAAC,GAAG,CAAC;gBACd,OAAO,EAAE,CAAC,GAAG,CAAC;gBACd,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,iBAAS,CAAC,cAAc;wBAC9B,aAAa,EAAE,GAAG;wBAClB,QAAQ,EAAE,CAAC,kBAAkB,CAAC;qBAC/B;iBACF;aACF,CAAC;YAEF,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAEjB,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC;gBACnC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;gBACtD,OAAO,EAAE;oBACP,KAAK,EAAE,CAAC,GAAG,CAAC;oBACZ,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,GAAG,CAAC;oBACd,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,iBAAS,CAAC,cAAc;4BAC9B,aAAa,EAAE,GAAG;4BAClB,QAAQ,EAAE,CAAC,kBAAkB,CAAC;yBAC/B;qBACF;iBACF;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,CAAC,GAAG,IAAI,uDAA0B,CACtC,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,CACjB,CAAC;YACF,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;YAC1D,MAAM,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC,CAAC,aAAa,CAChD,2BAA2B,CAC5B,CAAC;YACF,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { SyncError } from "./types";
|
|
2
|
-
import {
|
|
3
|
-
ChangesStatus,
|
|
4
|
-
IntegrationExecutionResult,
|
|
5
|
-
} from "./IntegrationExecutionResult";
|
|
6
|
-
|
|
7
|
-
const MOCK_INTEGRATION_ID = "1";
|
|
8
|
-
const MOCK_ORGANIZATION_REFERENCE = "test";
|
|
9
|
-
const MOCK_EXECUTED_BY = "1";
|
|
10
|
-
|
|
11
|
-
describe("IntegrationHistory", () => {
|
|
12
|
-
describe("setResults", () => {
|
|
13
|
-
it("should return value with default values", () => {
|
|
14
|
-
const i = new IntegrationExecutionResult(
|
|
15
|
-
MOCK_INTEGRATION_ID,
|
|
16
|
-
MOCK_ORGANIZATION_REFERENCE,
|
|
17
|
-
MOCK_EXECUTED_BY
|
|
18
|
-
);
|
|
19
|
-
const pc: ChangesStatus = {
|
|
20
|
-
created: ["1"],
|
|
21
|
-
updated: ["1"],
|
|
22
|
-
errors: [
|
|
23
|
-
{
|
|
24
|
-
type: SyncError.MISSING_FIELDS,
|
|
25
|
-
userReference: "1",
|
|
26
|
-
metadata: ["missingFieldName"],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
i.setResults(pc);
|
|
32
|
-
|
|
33
|
-
expect(i.getResults()).toStrictEqual({
|
|
34
|
-
totals: { added: 1, removed: 0, updated: 1, error: 1 },
|
|
35
|
-
details: {
|
|
36
|
-
added: ["1"],
|
|
37
|
-
removed: [],
|
|
38
|
-
updated: ["1"],
|
|
39
|
-
error: [
|
|
40
|
-
{
|
|
41
|
-
type: SyncError.MISSING_FIELDS,
|
|
42
|
-
userReference: "1",
|
|
43
|
-
metadata: ["missingFieldName"],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
describe("getters", () => {
|
|
51
|
-
it("should return correct values", () => {
|
|
52
|
-
const i = new IntegrationExecutionResult(
|
|
53
|
-
MOCK_INTEGRATION_ID,
|
|
54
|
-
MOCK_ORGANIZATION_REFERENCE,
|
|
55
|
-
MOCK_EXECUTED_BY
|
|
56
|
-
);
|
|
57
|
-
expect(i.getExecutedBy()).toStrictEqual(MOCK_EXECUTED_BY);
|
|
58
|
-
expect(i.getOrganizationReference()).toStrictEqual(
|
|
59
|
-
MOCK_ORGANIZATION_REFERENCE
|
|
60
|
-
);
|
|
61
|
-
expect(i.getExecutedBy()).toStrictEqual(MOCK_EXECUTED_BY);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|