@sasjs/cli 3.23.6 → 3.23.7
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/build/commands/fs/fsCommand.js +2 -3
- package/build/commands/fs/spec/fsCommand.spec.js +3 -10
- package/package.json +2 -2
- package/build/commands/fs/internal/extractHashArray.d.ts +0 -1
- package/build/commands/fs/internal/extractHashArray.js +0 -20
- package/build/commands/fs/spec/extractHashArray.spec.d.ts +0 -1
- package/build/commands/fs/spec/extractHashArray.spec.js +0 -14
|
@@ -108,7 +108,6 @@ var utils_1 = require("../../utils");
|
|
|
108
108
|
var path_1 = __importDefault(require("path"));
|
|
109
109
|
var utils_2 = require("@sasjs/utils");
|
|
110
110
|
var executeCode_1 = require("./internal/executeCode");
|
|
111
|
-
var extractHashArray_1 = require("./internal/extractHashArray");
|
|
112
111
|
var FsSubCommand;
|
|
113
112
|
(function (FsSubCommand) {
|
|
114
113
|
FsSubCommand["Compile"] = "compile";
|
|
@@ -319,7 +318,7 @@ var FSCommand = /** @class */ (function (_super) {
|
|
|
319
318
|
case 6:
|
|
320
319
|
_v.sent();
|
|
321
320
|
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.info('extracting hashes from log');
|
|
322
|
-
remoteHashes = (0,
|
|
321
|
+
remoteHashes = (0, utils_2.extractHashArray)(log);
|
|
323
322
|
return [4 /*yield*/, createHashFile(JSON.stringify(remoteHashes, null, 2), path_1.default.join(outputFolder, 'hashesBeforeSync.json'))];
|
|
324
323
|
case 7:
|
|
325
324
|
_v.sent();
|
|
@@ -357,7 +356,7 @@ var FSCommand = /** @class */ (function (_super) {
|
|
|
357
356
|
return [4 /*yield*/, (0, utils_1.saveLog)(syncLog, path_1.default.join(outputFolder, 'sync.log'), '', false)];
|
|
358
357
|
case 13:
|
|
359
358
|
_v.sent();
|
|
360
|
-
syncedHash = (0,
|
|
359
|
+
syncedHash = (0, utils_2.extractHashArray)(syncLog);
|
|
361
360
|
return [4 /*yield*/, createHashFile(JSON.stringify(syncedHash, null, 2), path_1.default.join(outputFolder, 'hashesAfterSync.json'))];
|
|
362
361
|
case 14:
|
|
363
362
|
_v.sent();
|
|
@@ -88,7 +88,6 @@ var FSModule = __importStar(require("@sasjs/utils/fs"));
|
|
|
88
88
|
var FileModule = __importStar(require("@sasjs/utils/file"));
|
|
89
89
|
var configUtils = __importStar(require("../../../utils/config"));
|
|
90
90
|
var executeCodeModule = __importStar(require("../internal/executeCode"));
|
|
91
|
-
var extractHashArrayModule = __importStar(require("../internal/extractHashArray"));
|
|
92
91
|
var defaultArgs = ['node', 'sasjs', 'fs'];
|
|
93
92
|
var target = new utils_1.Target({
|
|
94
93
|
name: 'test',
|
|
@@ -197,17 +196,13 @@ describe('FSCommand', function () {
|
|
|
197
196
|
return __generator(this, function (_a) {
|
|
198
197
|
switch (_a.label) {
|
|
199
198
|
case 0:
|
|
200
|
-
jest
|
|
201
|
-
.spyOn(extractHashArrayModule, 'extractHashArray')
|
|
202
|
-
.mockImplementationOnce(function () { return [
|
|
199
|
+
jest.spyOn(FSModule, 'extractHashArray').mockImplementationOnce(function () { return [
|
|
203
200
|
{
|
|
204
201
|
FILE_PATH: 'mocked-file',
|
|
205
202
|
FILE_HASH: 'hashOfMockedFile'
|
|
206
203
|
}
|
|
207
204
|
]; });
|
|
208
|
-
jest
|
|
209
|
-
.spyOn(extractHashArrayModule, 'extractHashArray')
|
|
210
|
-
.mockImplementationOnce(function () { return [
|
|
205
|
+
jest.spyOn(FSModule, 'extractHashArray').mockImplementationOnce(function () { return [
|
|
211
206
|
{
|
|
212
207
|
FILE_PATH: 'synced-file',
|
|
213
208
|
FILE_HASH: 'hashOfSyncedFile'
|
|
@@ -239,9 +234,7 @@ describe('FSCommand', function () {
|
|
|
239
234
|
return __generator(this, function (_a) {
|
|
240
235
|
switch (_a.label) {
|
|
241
236
|
case 0:
|
|
242
|
-
jest
|
|
243
|
-
.spyOn(extractHashArrayModule, 'extractHashArray')
|
|
244
|
-
.mockImplementation(function () { return [
|
|
237
|
+
jest.spyOn(FSModule, 'extractHashArray').mockImplementation(function () { return [
|
|
245
238
|
{
|
|
246
239
|
FILE_PATH: 'mocked-file',
|
|
247
240
|
FILE_HASH: 'hashOfMockedFile'
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@sasjs/adapter": "4.1.0",
|
|
54
54
|
"@sasjs/core": "4.45.4",
|
|
55
55
|
"@sasjs/lint": "2.0.1",
|
|
56
|
-
"@sasjs/utils": "2.51.
|
|
56
|
+
"@sasjs/utils": "2.51.5",
|
|
57
57
|
"adm-zip": "0.5.9",
|
|
58
58
|
"chalk": "4.1.2",
|
|
59
59
|
"csv-stringify": "5.6.5",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"typescript": "4.5.4",
|
|
102
102
|
"util": "0.12.4"
|
|
103
103
|
},
|
|
104
|
-
"version": "3.23.
|
|
104
|
+
"version": "3.23.7"
|
|
105
105
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const extractHashArray: (log: string) => any;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractHashArray = void 0;
|
|
4
|
-
var utils_1 = require("../../../utils");
|
|
5
|
-
var extractHashArray = function (log) {
|
|
6
|
-
if (log.includes('>>weboutBEGIN<<')) {
|
|
7
|
-
try {
|
|
8
|
-
var webout = log
|
|
9
|
-
.split(/>>weboutBEGIN<<\n/)[1]
|
|
10
|
-
.split(/>>weboutEND<<\n/)[0];
|
|
11
|
-
var jsonWebout = JSON.parse(webout);
|
|
12
|
-
return jsonWebout.hashes;
|
|
13
|
-
}
|
|
14
|
-
catch (err) {
|
|
15
|
-
(0, utils_1.displayError)(err, 'An error occurred while extracting hashes array from webout.');
|
|
16
|
-
throw new Error('An error occurred while extracting hashes array from webout.');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.extractHashArray = extractHashArray;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var extractHashArray_1 = require("../internal/extractHashArray");
|
|
4
|
-
var log = "\n>>weboutBEGIN<<\n{\n \"hashes\": [{\n \"FILE_HASH\": \"someCharacters\",\n \"FILE_PATH\": \"path/to/folder/file\"\n }]\n}\n>>weboutEND<<\n";
|
|
5
|
-
var logWithInvalidJsonInWebout = "\n>>weboutBEGIN<<\n{\n \"invalid Json\"\n}\n>>weboutEND<<\n";
|
|
6
|
-
describe('extractHashArray', function () {
|
|
7
|
-
it('should extract hashed array from webout', function () {
|
|
8
|
-
var hashes = (0, extractHashArray_1.extractHashArray)(log);
|
|
9
|
-
expect(hashes).toBeArrayOfSize(1);
|
|
10
|
-
});
|
|
11
|
-
it('should throw error when log does not contain webout', function () {
|
|
12
|
-
expect(function () { return (0, extractHashArray_1.extractHashArray)(logWithInvalidJsonInWebout); }).toThrow('An error occurred while extracting hashes array from webout.');
|
|
13
|
-
});
|
|
14
|
-
});
|