@golemio/energetics 1.8.1-dev.2392821527 → 1.8.1-dev.2410500032
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/integration-engine/enapo/datasources/eno/EnoDatasource.d.ts +11 -2
- package/dist/integration-engine/enapo/datasources/eno/EnoDatasource.js +32 -5
- package/dist/integration-engine/enapo/datasources/eno/EnoDatasource.js.map +1 -1
- package/dist/integration-engine/enapo/datasources/eno/EnoDatasourceFactory.js +7 -1
- package/dist/integration-engine/enapo/datasources/eno/EnoDatasourceFactory.js.map +1 -1
- package/package.json +3 -1
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import * as soap from "soap";
|
|
2
|
+
export interface IWsdlConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
isZipped?: boolean;
|
|
5
|
+
/** Directory where zip contents are extracted. Required when isZipped=true. */
|
|
6
|
+
extractDir?: string;
|
|
7
|
+
/** Filename of the main .wsdl inside the zip. Required */
|
|
8
|
+
mainFile?: string;
|
|
9
|
+
}
|
|
2
10
|
export declare class EnoDatasource {
|
|
3
|
-
protected
|
|
11
|
+
protected wsdlConfig: IWsdlConfig;
|
|
4
12
|
protected security: soap.ISecurity;
|
|
5
13
|
protected client: soap.Client | null;
|
|
6
|
-
constructor(
|
|
14
|
+
constructor(wsdlConfig: IWsdlConfig, security: soap.ISecurity);
|
|
7
15
|
getData(operation: string, action?: string, args?: object): Promise<any>;
|
|
8
16
|
protected getClient(): Promise<soap.Client>;
|
|
17
|
+
private resolveWsdl;
|
|
9
18
|
private getValidation;
|
|
10
19
|
}
|
|
@@ -22,23 +22,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.EnoDatasource = void 0;
|
|
27
30
|
const EnoBuldingInfoJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoBuldingInfoJsonSchema");
|
|
28
31
|
const EnoEJInputJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoEJInputJsonSchema");
|
|
29
32
|
const EnoGIDListInputJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoGIDListInputJsonSchema");
|
|
33
|
+
const EnoGeometryJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoGeometryJsonSchema");
|
|
30
34
|
const EnoManagerInputJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoManagerInputJsonSchema");
|
|
31
35
|
const EnoOrganizationInputJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoOrganizationInputJsonSchema");
|
|
36
|
+
const EnoStructureInfoJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoStructureInfoJsonSchema");
|
|
32
37
|
const EnoStructureTypeInputJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoStructureTypeInputJsonSchema");
|
|
33
38
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
34
39
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
40
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
35
43
|
const soap = __importStar(require("soap"));
|
|
36
44
|
const EnoOperationEnum_1 = require("./EnoOperationEnum");
|
|
37
|
-
const EnoStructureInfoJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoStructureInfoJsonSchema");
|
|
38
|
-
const EnoGeometryJsonSchema_1 = require("../../../../schema-definitions/datasources/eno/EnoGeometryJsonSchema");
|
|
39
45
|
class EnoDatasource {
|
|
40
|
-
constructor(
|
|
41
|
-
this.
|
|
46
|
+
constructor(wsdlConfig, security) {
|
|
47
|
+
this.wsdlConfig = wsdlConfig;
|
|
42
48
|
this.security = security;
|
|
43
49
|
this.client = null;
|
|
44
50
|
}
|
|
@@ -54,11 +60,32 @@ class EnoDatasource {
|
|
|
54
60
|
}
|
|
55
61
|
async getClient() {
|
|
56
62
|
if (!this.client) {
|
|
57
|
-
|
|
63
|
+
const wsdlPath = await this.resolveWsdl();
|
|
64
|
+
this.client = await soap.createClientAsync(wsdlPath);
|
|
58
65
|
this.client.setSecurity(this.security);
|
|
59
66
|
}
|
|
60
67
|
return this.client;
|
|
61
68
|
}
|
|
69
|
+
async resolveWsdl() {
|
|
70
|
+
const { url, isZipped, extractDir, mainFile } = this.wsdlConfig;
|
|
71
|
+
if (!isZipped) {
|
|
72
|
+
return url;
|
|
73
|
+
}
|
|
74
|
+
if (!extractDir) {
|
|
75
|
+
throw new golemio_errors_1.GeneralError("extractDir must be configured when isZipped=true", this.constructor.name);
|
|
76
|
+
}
|
|
77
|
+
if (!mainFile) {
|
|
78
|
+
throw new golemio_errors_1.GeneralError("mainFile must be configured when isZipped=true", this.constructor.name);
|
|
79
|
+
}
|
|
80
|
+
const response = await fetch(url);
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
throw new golemio_errors_1.GeneralError(`Failed to download WSDL zip from ${url}: ${response.status}`, this.constructor.name);
|
|
83
|
+
}
|
|
84
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
85
|
+
fs.mkdirSync(extractDir, { recursive: true });
|
|
86
|
+
new adm_zip_1.default(buffer).extractAllTo(extractDir, /* overwrite */ true);
|
|
87
|
+
return path.join(extractDir, mainFile);
|
|
88
|
+
}
|
|
62
89
|
getValidation(operation) {
|
|
63
90
|
switch (operation) {
|
|
64
91
|
case EnoOperationEnum_1.EnoOperationLookupEnum.STRUCTURE_TYPE:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnoDatasource.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/datasources/eno/EnoDatasource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnoDatasource.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/datasources/eno/EnoDatasource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sHAA+F;AAC/F,8GAAiF;AACjF,wHAA2F;AAC3F,gHAAwF;AACxF,wHAA2F;AAC3F,kIAAqG;AACrG,0HAAkG;AAClG,oIAAuG;AACvG,6EAAwE;AACxE,mFAAkF;AAClF,sDAA6B;AAC7B,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA6B;AAC7B,yDAK4B;AAW5B,MAAa,aAAa;IAKtB,YAAY,UAAuB,EAAE,QAAwB;QACzD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,SAAiB,EAAE,EAAE,OAAe,EAAE;QAC1E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YACpB,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YAChD,MAAM,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SACvC;QAED,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAES,KAAK,CAAC,SAAS;QACrB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC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,CAAC;SAC1E;IACL,CAAC;CACJ;AAxFD,sCAwFC"}
|
|
@@ -48,7 +48,13 @@ let EnoDatasourceFactory = exports.EnoDatasourceFactory = class EnoDatasourceFac
|
|
|
48
48
|
}
|
|
49
49
|
getDatasource(endpoint, source) {
|
|
50
50
|
if (!this.clients[`${endpoint}_${source}`]) {
|
|
51
|
-
|
|
51
|
+
const url = this.simpleConfig.getValue(`module.energetics.eno.${endpoint}`);
|
|
52
|
+
const isZipped = this.simpleConfig.getValue(`module.energetics.eno.${endpoint}.zipped`) === "true";
|
|
53
|
+
const extractDir = isZipped ? this.simpleConfig.getValue("module.energetics.eno.extractDir") : undefined;
|
|
54
|
+
const mainFile = isZipped
|
|
55
|
+
? this.simpleConfig.getValue(`module.energetics.eno.${endpoint}.mainFile`)
|
|
56
|
+
: undefined;
|
|
57
|
+
this.clients[`${endpoint}_${source}`] = new EnoDatasource_1.EnoDatasource({ url, isZipped, extractDir, mainFile }, this.getSecurity(source));
|
|
52
58
|
}
|
|
53
59
|
return this.clients[`${endpoint}_${source}`];
|
|
54
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnoDatasourceFactory.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/datasources/eno/EnoDatasourceFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AACrE,iEAAwE;AACxE,+BAAoD;AACpD,mDAAgD;AAEhD,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,yCAAyB,CAAA;IACzB,6CAA6B,CAAA;IAC7B,8CAA8B,CAAA;IAC9B,4CAA4B,CAAA;AAChC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,8BAAe,CAAA;IACf,8BAAe,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED,MAAM,gBAAgB;IAClB,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IACjD,UAAU,CAAC,QAAiC,IAAG,CAAC;IAChD,KAAK;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IACD,UAAU,CAAC,OAA+B;QACtC,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/C,CAAC;CACJ;AAGM,IAAM,oBAAoB,kCAA1B,MAAM,oBAAoB;IAG7B,YAA4C,YAAmC;QAA3B,iBAAY,GAAZ,YAAY,CAAe;QAFvE,YAAO,GAAkC,EAAE,CAAC;IAE8B,CAAC;IAE5E,aAAa,CAAC,QAAgB,EAAE,MAAc;QACjD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,QAAQ,IAAI,MAAM,EAAE,CAAC,EAAE;YACxC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"EnoDatasourceFactory.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/datasources/eno/EnoDatasourceFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AACrE,iEAAwE;AACxE,+BAAoD;AACpD,mDAAgD;AAEhD,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,yCAAyB,CAAA;IACzB,6CAA6B,CAAA;IAC7B,8CAA8B,CAAA;IAC9B,4CAA4B,CAAA;AAChC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,8BAAe,CAAA;IACf,8BAAe,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED,MAAM,gBAAgB;IAClB,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IACjD,UAAU,CAAC,QAAiC,IAAG,CAAC;IAChD,KAAK;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IACD,UAAU,CAAC,OAA+B;QACtC,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/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,EAAE;YAChC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAS,yBAAyB,MAAM,WAAW,CAAC,CAAC,CAAC;SAC/G;QAED,sFAAsF;QACtF,OAAO,IAAI,wBAAiB,CACxB,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAS,yBAAyB,MAAM,OAAO,CAAC,EAC1E,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAS,yBAAyB,MAAM,WAAW,CAAC,CACjF,CAAC;IACN,CAAC;CACJ,CAAA;+BApCY,oBAAoB;IADhC,IAAA,qBAAU,GAAE;IAII,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;;GAHlC,oBAAoB,CAoChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/energetics",
|
|
3
|
-
"version": "1.8.1-dev.
|
|
3
|
+
"version": "1.8.1-dev.2410500032",
|
|
4
4
|
"description": "Golemio Energetics Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@golemio/core": "3.0.3",
|
|
42
42
|
"@golemio/db-common": "1.2.2",
|
|
43
43
|
"@golemio/eslint-config": "1.1.3",
|
|
44
|
+
"@types/adm-zip": "^0.5.8",
|
|
44
45
|
"@types/chai": "^5.2.3",
|
|
45
46
|
"@types/chai-as-promised": "^8.0.2",
|
|
46
47
|
"@types/mocha": "^10.0.10",
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
"@golemio/core": "^3.0.2-dev.2249078403"
|
|
78
79
|
},
|
|
79
80
|
"dependencies": {
|
|
81
|
+
"adm-zip": "^0.5.16",
|
|
80
82
|
"basic-ftp": "^5.2.0",
|
|
81
83
|
"JSONStream": "^1.3.5",
|
|
82
84
|
"soap": "^1.6.0"
|