@sap-ux/adp-tooling 0.5.0 → 0.5.2
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/preview/adp-preview.js +6 -51
- package/package.json +5 -5
|
@@ -8,60 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
-
var m = o[Symbol.asyncIterator], i;
|
|
14
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
-
};
|
|
18
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
13
|
};
|
|
21
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
15
|
exports.AdpPreview = void 0;
|
|
23
16
|
const express_1 = __importDefault(require("express"));
|
|
24
|
-
const
|
|
17
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
25
18
|
const system_access_1 = require("@sap-ux/system-access");
|
|
26
19
|
const routes_handler_1 = __importDefault(require("./routes-handler"));
|
|
27
|
-
/**
|
|
28
|
-
* Create a buffer based on the given zip file object.
|
|
29
|
-
*
|
|
30
|
-
* @param zip object representing a zip file
|
|
31
|
-
* @returns a buffer
|
|
32
|
-
*/
|
|
33
|
-
function createBuffer(zip) {
|
|
34
|
-
var _a, e_1, _b, _c;
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
yield new Promise((resolve) => {
|
|
37
|
-
zip.end({ forceZip64Format: false }, () => {
|
|
38
|
-
resolve();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
const chunks = [];
|
|
42
|
-
try {
|
|
43
|
-
for (var _d = true, _e = __asyncValues(zip.outputStream), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
44
|
-
_c = _f.value;
|
|
45
|
-
_d = false;
|
|
46
|
-
try {
|
|
47
|
-
const chunk = _c;
|
|
48
|
-
chunks.push(chunk);
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
_d = true;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
56
|
-
finally {
|
|
57
|
-
try {
|
|
58
|
-
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
59
|
-
}
|
|
60
|
-
finally { if (e_1) throw e_1.error; }
|
|
61
|
-
}
|
|
62
|
-
return Buffer.concat(chunks);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
20
|
/**
|
|
66
21
|
* Instance of an adaptation project handling requests and data transformation.
|
|
67
22
|
*/
|
|
@@ -122,14 +77,14 @@ class AdpPreview {
|
|
|
122
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
78
|
const provider = yield (0, system_access_1.createAbapServiceProvider)(this.config.target, { ignoreCertErrors: this.config.ignoreCertErrors }, true, this.logger);
|
|
124
79
|
const lrep = provider.getLayeredRepository();
|
|
125
|
-
const zip = new
|
|
80
|
+
const zip = new adm_zip_1.default();
|
|
126
81
|
const files = yield this.project.byGlob('**/*.*');
|
|
127
82
|
for (const file of files) {
|
|
128
|
-
zip.
|
|
83
|
+
zip.addFile(file.getPath().substring(1), yield file.getBuffer());
|
|
129
84
|
}
|
|
130
|
-
const buffer =
|
|
131
|
-
//
|
|
132
|
-
yield lrep.
|
|
85
|
+
const buffer = zip.toBuffer();
|
|
86
|
+
// fetch a merged descriptor from the backend
|
|
87
|
+
yield lrep.getCsrfToken();
|
|
133
88
|
this.mergedDescriptor = (yield lrep.mergeAppDescriptorVariant(buffer))[descriptorVariant.id];
|
|
134
89
|
return descriptorVariant.layer;
|
|
135
90
|
});
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.5.
|
|
12
|
+
"version": "0.5.2",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"mem-fs": "2.1.0",
|
|
29
29
|
"mem-fs-editor": "9.4.0",
|
|
30
30
|
"prompts": "2.4.2",
|
|
31
|
-
"
|
|
32
|
-
"@sap-ux/axios-extension": "1.
|
|
31
|
+
"adm-zip": "0.5.10",
|
|
32
|
+
"@sap-ux/axios-extension": "1.7.0",
|
|
33
33
|
"@sap-ux/logger": "0.4.0",
|
|
34
|
-
"@sap-ux/system-access": "0.3.
|
|
34
|
+
"@sap-ux/system-access": "0.3.2",
|
|
35
35
|
"@sap-ux/ui5-config": "0.20.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/mem-fs-editor": "7.0.1",
|
|
42
42
|
"@types/prompts": "2.4.4",
|
|
43
43
|
"@types/supertest": "2.0.12",
|
|
44
|
-
"@types/
|
|
44
|
+
"@types/adm-zip": "0.5.2",
|
|
45
45
|
"dotenv": "16.3.1",
|
|
46
46
|
"nock": "13.2.1",
|
|
47
47
|
"rimraf": "5.0.1",
|