@sasjs/cli 6.15.0 → 6.17.0
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/build/internal/mockSite/assets/sw.js +300 -13
- package/build/commands/build/internal/mockSite/mockSite.d.ts +10 -0
- package/build/commands/build/internal/mockSite/mockSite.js +202 -36
- package/build/commands/build/internal/mockSite/spec/mockSite.spec.js +118 -6
- package/build/commands/build/internal/mockSite/spec/sw.spec.js +279 -88
- package/package.json +2 -1
|
@@ -35,17 +35,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
38
|
var __read = (this && this.__read) || function (o, n) {
|
|
50
39
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
40
|
if (!m) return o;
|
|
@@ -62,13 +51,26 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
62
51
|
}
|
|
63
52
|
return ar;
|
|
64
53
|
};
|
|
54
|
+
var __values = (this && this.__values) || function(o) {
|
|
55
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
56
|
+
if (m) return m.call(o);
|
|
57
|
+
if (o && typeof o.length === "number") return {
|
|
58
|
+
next: function () {
|
|
59
|
+
if (o && i >= o.length) o = void 0;
|
|
60
|
+
return { value: o && o[i++], done: !o };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
64
|
+
};
|
|
65
65
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
66
66
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
67
67
|
};
|
|
68
68
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
69
|
var path_1 = __importDefault(require("path"));
|
|
70
70
|
var api_1 = require("@sasjs/api");
|
|
71
|
+
var os_1 = __importDefault(require("os"));
|
|
71
72
|
var yazl_1 = __importDefault(require("yazl"));
|
|
73
|
+
var mockSite_1 = require("../mockSite");
|
|
72
74
|
/**
|
|
73
75
|
* The other half of the parity claim: the service worker is what turns an
|
|
74
76
|
* /SASjsApi/ request into a response, so its framing (webout body, the _debug
|
|
@@ -87,6 +89,19 @@ var drivePath = function (relative) {
|
|
|
87
89
|
var apiBrowserBuild = function () {
|
|
88
90
|
return path_1.default.join(path_1.default.dirname(require.resolve('@sasjs/api')), '..', '..', 'build', 'browser.js');
|
|
89
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* The lint bundle the site ships, built once for the suite from the installed
|
|
94
|
+
* packages - the same call `sasjs build` makes, so the worker under test answers
|
|
95
|
+
* the code routes with the code the site carries.
|
|
96
|
+
*/
|
|
97
|
+
var lintBundlePath;
|
|
98
|
+
var lintBundle = function () {
|
|
99
|
+
if (!lintBundlePath) {
|
|
100
|
+
lintBundlePath = path_1.default.join(os_1.default.tmpdir(), "sasjs-lint-".concat(process.pid, ".js"));
|
|
101
|
+
(0, mockSite_1.buildLintBundle)(lintBundlePath);
|
|
102
|
+
}
|
|
103
|
+
return lintBundlePath;
|
|
104
|
+
};
|
|
90
105
|
var loadWorker = function () {
|
|
91
106
|
jest.resetModules();
|
|
92
107
|
var handlers = {};
|
|
@@ -108,6 +123,13 @@ var loadWorker = function () {
|
|
|
108
123
|
return;
|
|
109
124
|
if (path.includes('api-browser'))
|
|
110
125
|
return require(apiBrowserBuild());
|
|
126
|
+
if (path.includes('lint-browser')) {
|
|
127
|
+
// the bundle assigns globalThis.SASjsCode, and this harness keeps the
|
|
128
|
+
// worker's `self` apart from the module global
|
|
129
|
+
require(lintBundle());
|
|
130
|
+
self.SASjsCode = global.SASjsCode;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
111
133
|
require('../assets/runtime-core.js');
|
|
112
134
|
// The corpus needs the same drive with its writes refused, without building
|
|
113
135
|
// a second site. The flag is flipped after the case has seeded, because a
|
|
@@ -133,10 +155,20 @@ var loadWorker = function () {
|
|
|
133
155
|
};
|
|
134
156
|
};
|
|
135
157
|
require('../assets/sw.js');
|
|
136
|
-
global.fetch = jest.fn(function (
|
|
158
|
+
global.fetch = jest.fn(function (input) { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
+
var target;
|
|
137
160
|
var _a;
|
|
138
161
|
return __generator(this, function (_b) {
|
|
139
|
-
|
|
162
|
+
target = typeof input === 'string' ? input : (input && input.url) || String(input);
|
|
163
|
+
// a navigation back to the site root: the static host's copy of the page
|
|
164
|
+
if (new URL(target, origin).pathname === '/')
|
|
165
|
+
return [2 /*return*/, new Response('<html><body>static page</body></html>', {
|
|
166
|
+
status: 200,
|
|
167
|
+
headers: { 'content-type': 'text/html' }
|
|
168
|
+
})];
|
|
169
|
+
if (target.includes('index.html'))
|
|
170
|
+
return [2 /*return*/, new Response('<!doctype html><html><head><title>App</title></head><body>home</body></html>', { status: 200, headers: { 'content-type': 'text/html' } })];
|
|
171
|
+
return [2 /*return*/, target.includes('vfs-seed')
|
|
140
172
|
? jsonResponse({
|
|
141
173
|
files: (_a = {},
|
|
142
174
|
_a[drivePath('services/public/getdata.js')] = '_webout = "seeded";',
|
|
@@ -699,85 +731,204 @@ describe('service worker host', function () {
|
|
|
699
731
|
}
|
|
700
732
|
});
|
|
701
733
|
}); });
|
|
702
|
-
it('answers the
|
|
703
|
-
var dispatch,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
switch (_h.label) {
|
|
734
|
+
it('answers the Admin reports from the worker activity log', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
735
|
+
var dispatch, empty, _a, afterFirst, _b, listed, lines, infoLines, diagnostics, report, logs, _c, tail, tailBody, wrongName, missing;
|
|
736
|
+
return __generator(this, function (_d) {
|
|
737
|
+
switch (_d.label) {
|
|
707
738
|
case 0:
|
|
708
739
|
dispatch = seeded().dispatch;
|
|
709
|
-
|
|
710
|
-
['GET', '/SASjsApi/admin/diagnostics', 'admin service'],
|
|
711
|
-
['GET', '/SASjsApi/admin/logs', 'admin service'],
|
|
712
|
-
['GET', '/SASjsApi/admin/logs/app.log', 'admin service'],
|
|
713
|
-
[
|
|
714
|
-
'POST',
|
|
715
|
-
'/SASjsApi/authConfig/synchroniseWithLDAP',
|
|
716
|
-
'directory service'
|
|
717
|
-
]
|
|
718
|
-
];
|
|
719
|
-
_h.label = 1;
|
|
740
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/diagnostics')];
|
|
720
741
|
case 1:
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
742
|
+
empty = _d.sent();
|
|
743
|
+
_a = expect;
|
|
744
|
+
return [4 /*yield*/, empty.json()];
|
|
724
745
|
case 2:
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
746
|
+
_a.apply(void 0, [(_d.sent()).logs]).toEqual({
|
|
747
|
+
folder: 'worker memory',
|
|
748
|
+
fileCount: 0,
|
|
749
|
+
totalBytes: 0,
|
|
750
|
+
newestFile: null,
|
|
751
|
+
newestModified: null
|
|
752
|
+
});
|
|
753
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs')];
|
|
728
754
|
case 3:
|
|
729
|
-
|
|
730
|
-
expect(response.status).toBe(501);
|
|
755
|
+
afterFirst = _d.sent();
|
|
731
756
|
_b = expect;
|
|
732
|
-
return [4 /*yield*/,
|
|
757
|
+
return [4 /*yield*/, afterFirst.json()];
|
|
733
758
|
case 4:
|
|
734
|
-
_b.apply(void 0, [(
|
|
735
|
-
|
|
759
|
+
_b.apply(void 0, [(_d.sent()).files.length]).toBe(1);
|
|
760
|
+
// the file's mtime is the last write, not the moment a report was read:
|
|
761
|
+
// /info was the request immediately before this listing
|
|
762
|
+
return [4 /*yield*/, dispatch('/SASjsApi/info')];
|
|
736
763
|
case 5:
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
764
|
+
// the file's mtime is the last write, not the moment a report was read:
|
|
765
|
+
// /info was the request immediately before this listing
|
|
766
|
+
_d.sent();
|
|
767
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs')];
|
|
768
|
+
case 6: return [4 /*yield*/, (_d.sent()).json()];
|
|
740
769
|
case 7:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
return [
|
|
744
|
-
case 8:
|
|
745
|
-
try {
|
|
746
|
-
if (cases_1_1 && !cases_1_1.done && (_f = cases_1.return)) _f.call(cases_1);
|
|
747
|
-
}
|
|
748
|
-
finally { if (e_1) throw e_1.error; }
|
|
749
|
-
return [7 /*endfinally*/];
|
|
770
|
+
listed = (_d.sent())
|
|
771
|
+
.files[0];
|
|
772
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs/app.log?lines=20')];
|
|
773
|
+
case 8: return [4 /*yield*/, (_d.sent()).json()];
|
|
750
774
|
case 9:
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
775
|
+
lines = (_d.sent()).content.split('\n');
|
|
776
|
+
infoLines = lines.filter(function (line) {
|
|
777
|
+
return line.includes('GET /SASjsApi/info 200');
|
|
778
|
+
});
|
|
779
|
+
expect(infoLines.length).toBe(1);
|
|
780
|
+
expect(infoLines[0].startsWith(listed.modified)).toBe(true);
|
|
781
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/diagnostics')];
|
|
754
782
|
case 10:
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
return [4 /*yield*/,
|
|
783
|
+
diagnostics = _d.sent();
|
|
784
|
+
expect(diagnostics.status).toBe(200);
|
|
785
|
+
return [4 /*yield*/, diagnostics.json()];
|
|
758
786
|
case 11:
|
|
759
|
-
|
|
760
|
-
expect(
|
|
761
|
-
|
|
762
|
-
|
|
787
|
+
report = _d.sent();
|
|
788
|
+
expect(report.server.mode).toBe('browser');
|
|
789
|
+
expect(report.filesystem).toBeNull();
|
|
790
|
+
expect(report.logs.fileCount).toBe(1);
|
|
791
|
+
expect(typeof report.memory.heapTotalBytes).toBe('number');
|
|
792
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs')];
|
|
763
793
|
case 12:
|
|
764
|
-
|
|
765
|
-
|
|
794
|
+
logs = _d.sent();
|
|
795
|
+
_c = expect;
|
|
796
|
+
return [4 /*yield*/, logs.json()];
|
|
766
797
|
case 13:
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
798
|
+
_c.apply(void 0, [(_d.sent()).files.map(function (file) { return file.name; })]).toEqual([
|
|
799
|
+
'app.log'
|
|
800
|
+
]);
|
|
801
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs/app.log?lines=5')];
|
|
802
|
+
case 14:
|
|
803
|
+
tail = _d.sent();
|
|
804
|
+
return [4 /*yield*/, tail.json()];
|
|
770
805
|
case 15:
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
806
|
+
tailBody = _d.sent();
|
|
807
|
+
expect(tail.status).toBe(200);
|
|
808
|
+
expect(tailBody.content).toContain('GET /SASjsApi/info 200');
|
|
809
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs/secret.txt')];
|
|
774
810
|
case 16:
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
811
|
+
wrongName = _d.sent();
|
|
812
|
+
expect(wrongName.status).toBe(400);
|
|
813
|
+
return [4 /*yield*/, dispatch('/SASjsApi/admin/logs/other.log')];
|
|
814
|
+
case 17:
|
|
815
|
+
missing = _d.sent();
|
|
816
|
+
expect(missing.status).toBe(404);
|
|
817
|
+
return [2 /*return*/];
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}); });
|
|
821
|
+
it('imports the fixture directory, and unpublishes the site itself', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
822
|
+
var dispatch, synced, _a, unpublished, _b, other;
|
|
823
|
+
return __generator(this, function (_c) {
|
|
824
|
+
switch (_c.label) {
|
|
825
|
+
case 0:
|
|
826
|
+
dispatch = seeded().dispatch;
|
|
827
|
+
return [4 /*yield*/, dispatch('/SASjsApi/authConfig/synchroniseWithLDAP', { method: 'POST' })];
|
|
828
|
+
case 1:
|
|
829
|
+
synced = _c.sent();
|
|
830
|
+
expect(synced.status).toBe(200);
|
|
831
|
+
_a = expect;
|
|
832
|
+
return [4 /*yield*/, synced.json()];
|
|
833
|
+
case 2:
|
|
834
|
+
_a.apply(void 0, [_c.sent()]).toEqual({ userCount: 0, groupCount: 0 });
|
|
835
|
+
return [4 /*yield*/, dispatch('/SASjsApi/drive/deploy', {
|
|
836
|
+
method: 'DELETE',
|
|
837
|
+
headers: { 'content-type': 'application/json' },
|
|
838
|
+
body: JSON.stringify({
|
|
839
|
+
streamServiceName: 'Test',
|
|
840
|
+
appLoc: appLoc
|
|
841
|
+
})
|
|
842
|
+
})];
|
|
843
|
+
case 3:
|
|
844
|
+
unpublished = _c.sent();
|
|
845
|
+
expect(unpublished.status).toBe(200);
|
|
846
|
+
_b = expect;
|
|
847
|
+
return [4 /*yield*/, unpublished.json()];
|
|
848
|
+
case 4:
|
|
849
|
+
_b.apply(void 0, [_c.sent()]).toEqual({ status: 'success' });
|
|
850
|
+
return [4 /*yield*/, dispatch('/SASjsApi/drive/deploy', {
|
|
851
|
+
method: 'DELETE',
|
|
852
|
+
headers: { 'content-type': 'application/json' },
|
|
853
|
+
body: JSON.stringify({
|
|
854
|
+
streamServiceName: 'Other',
|
|
855
|
+
appLoc: '/Public/app/other'
|
|
856
|
+
})
|
|
857
|
+
})];
|
|
858
|
+
case 5:
|
|
859
|
+
other = _c.sent();
|
|
860
|
+
expect(other.status).toBe(404);
|
|
861
|
+
return [2 /*return*/];
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}); });
|
|
865
|
+
it('lints and formats a buffer with the bundled linter', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
866
|
+
var dispatch, linted, diagnostics, formatted, _a;
|
|
867
|
+
return __generator(this, function (_b) {
|
|
868
|
+
switch (_b.label) {
|
|
869
|
+
case 0:
|
|
870
|
+
dispatch = seeded().dispatch;
|
|
871
|
+
return [4 /*yield*/, dispatch('/SASjsApi/code/lint', runRequest({ code: 'data a;\nrun;\n' }))];
|
|
872
|
+
case 1:
|
|
873
|
+
linted = _b.sent();
|
|
874
|
+
expect(linted.status).toBe(200);
|
|
875
|
+
return [4 /*yield*/, linted.json()];
|
|
876
|
+
case 2:
|
|
877
|
+
diagnostics = _b.sent();
|
|
878
|
+
expect(Array.isArray(diagnostics)).toBe(true);
|
|
879
|
+
expect(diagnostics.length).toBeGreaterThan(0);
|
|
880
|
+
expect(diagnostics[0].message).toContain('Doxygen');
|
|
881
|
+
return [4 /*yield*/, dispatch('/SASjsApi/code/format', runRequest({ code: 'data a;set b;run;' }))];
|
|
882
|
+
case 3:
|
|
883
|
+
formatted = _b.sent();
|
|
884
|
+
expect(formatted.status).toBe(200);
|
|
885
|
+
_a = expect;
|
|
886
|
+
return [4 /*yield*/, formatted.text()];
|
|
887
|
+
case 4:
|
|
888
|
+
_a.apply(void 0, [_b.sent()]).toContain('@brief');
|
|
889
|
+
return [2 /*return*/];
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
}); });
|
|
893
|
+
it('serves the build page at the home route, and falls back when it fails', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
894
|
+
var worker, response, _a, runtime, original, fallback, body;
|
|
895
|
+
return __generator(this, function (_b) {
|
|
896
|
+
switch (_b.label) {
|
|
897
|
+
case 0:
|
|
898
|
+
worker = seeded();
|
|
899
|
+
return [4 /*yield*/, worker.dispatch('/')];
|
|
900
|
+
case 1:
|
|
901
|
+
response = _b.sent();
|
|
902
|
+
expect(response.status).toBe(200);
|
|
903
|
+
expect(response.headers.get('content-type')).toContain('text/html');
|
|
904
|
+
_a = expect;
|
|
905
|
+
return [4 /*yield*/, response.text()];
|
|
906
|
+
case 2:
|
|
907
|
+
_a.apply(void 0, [_b.sent()]).toContain('<body>home</body>');
|
|
908
|
+
runtime = worker.self.SASjsMockRuntime;
|
|
909
|
+
original = runtime.ensureReady;
|
|
910
|
+
runtime.ensureReady = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
911
|
+
return __generator(this, function (_a) {
|
|
912
|
+
throw new Error('home route exploded');
|
|
913
|
+
});
|
|
914
|
+
}); };
|
|
915
|
+
_b.label = 3;
|
|
916
|
+
case 3:
|
|
917
|
+
_b.trys.push([3, , 6, 7]);
|
|
918
|
+
return [4 /*yield*/, worker.dispatch('/')];
|
|
919
|
+
case 4:
|
|
920
|
+
fallback = _b.sent();
|
|
921
|
+
expect(fallback.status).toBe(200);
|
|
922
|
+
return [4 /*yield*/, fallback.text()];
|
|
923
|
+
case 5:
|
|
924
|
+
body = _b.sent();
|
|
925
|
+
expect(body).toContain('static page');
|
|
926
|
+
expect(body).not.toContain('home route exploded');
|
|
927
|
+
return [3 /*break*/, 7];
|
|
928
|
+
case 6:
|
|
929
|
+
runtime.ensureReady = original;
|
|
779
930
|
return [7 /*endfinally*/];
|
|
780
|
-
case
|
|
931
|
+
case 7: return [2 /*return*/];
|
|
781
932
|
}
|
|
782
933
|
});
|
|
783
934
|
}); });
|
|
@@ -1006,6 +1157,46 @@ describe('service worker host', function () {
|
|
|
1006
1157
|
}
|
|
1007
1158
|
});
|
|
1008
1159
|
}); });
|
|
1160
|
+
it('answers the app stream as the server does, with nothing in it', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1161
|
+
var dispatch, listing, _a, root, landing, _b, app, _c;
|
|
1162
|
+
return __generator(this, function (_d) {
|
|
1163
|
+
switch (_d.label) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
dispatch = seeded().dispatch;
|
|
1166
|
+
return [4 /*yield*/, dispatch('/AppStream/apps.json')];
|
|
1167
|
+
case 1:
|
|
1168
|
+
listing = _d.sent();
|
|
1169
|
+
expect(listing.status).toBe(200);
|
|
1170
|
+
_a = expect;
|
|
1171
|
+
return [4 /*yield*/, listing.json()];
|
|
1172
|
+
case 2:
|
|
1173
|
+
_a.apply(void 0, [_d.sent()]).toEqual({ apps: [] });
|
|
1174
|
+
return [4 /*yield*/, dispatch('/AppStream')];
|
|
1175
|
+
case 3:
|
|
1176
|
+
root = _d.sent();
|
|
1177
|
+
expect(root.status).toBe(301);
|
|
1178
|
+
expect(root.headers.get('location')).toBe('/AppStream/');
|
|
1179
|
+
return [4 /*yield*/, dispatch('/AppStream/')];
|
|
1180
|
+
case 4:
|
|
1181
|
+
landing = _d.sent();
|
|
1182
|
+
expect(landing.status).toBe(200);
|
|
1183
|
+
expect(landing.headers.get('content-type')).toContain('text/html');
|
|
1184
|
+
_b = expect;
|
|
1185
|
+
return [4 /*yield*/, landing.text()];
|
|
1186
|
+
case 5:
|
|
1187
|
+
_b.apply(void 0, [_d.sent()]).toContain('serves no apps');
|
|
1188
|
+
return [4 /*yield*/, dispatch('/AppStream/Demo/')];
|
|
1189
|
+
case 6:
|
|
1190
|
+
app = _d.sent();
|
|
1191
|
+
expect(app.status).toBe(404);
|
|
1192
|
+
_c = expect;
|
|
1193
|
+
return [4 /*yield*/, app.json()];
|
|
1194
|
+
case 7:
|
|
1195
|
+
_c.apply(void 0, [(_d.sent()).message]).toContain('serves no apps');
|
|
1196
|
+
return [2 /*return*/];
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
}); });
|
|
1009
1200
|
it('leaves a request to another origin alone', function () {
|
|
1010
1201
|
var dispatch = seeded().dispatch;
|
|
1011
1202
|
expect(dispatch('https://other.example.com/SASjsApi/info')).toBeUndefined();
|
|
@@ -1856,7 +2047,7 @@ describe('service worker host', function () {
|
|
|
1856
2047
|
}); });
|
|
1857
2048
|
});
|
|
1858
2049
|
describe('conformance corpus', function () {
|
|
1859
|
-
var
|
|
2050
|
+
var e_1, _a;
|
|
1860
2051
|
/**
|
|
1861
2052
|
* The corpus is what "the same API" means: the cases @sasjs/api runs against
|
|
1862
2053
|
* its own services, and against a live sasjs/server, run here against this
|
|
@@ -1865,7 +2056,7 @@ describe('service worker host', function () {
|
|
|
1865
2056
|
* used to have - and it is a test rather than a review.
|
|
1866
2057
|
*/
|
|
1867
2058
|
var httpFor = function (testCase) {
|
|
1868
|
-
var
|
|
2059
|
+
var e_2, _a;
|
|
1869
2060
|
var _b;
|
|
1870
2061
|
var _c = __read(testCase.route.split(' '), 2), method = _c[0], routePath = _c[1];
|
|
1871
2062
|
var query = new URLSearchParams();
|
|
@@ -1876,12 +2067,12 @@ describe('service worker host', function () {
|
|
|
1876
2067
|
query.set(key, String(value));
|
|
1877
2068
|
}
|
|
1878
2069
|
}
|
|
1879
|
-
catch (
|
|
2070
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1880
2071
|
finally {
|
|
1881
2072
|
try {
|
|
1882
2073
|
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1883
2074
|
}
|
|
1884
|
-
finally { if (
|
|
2075
|
+
finally { if (e_2) throw e_2.error; }
|
|
1885
2076
|
}
|
|
1886
2077
|
var suffix = query.toString() ? "?".concat(query) : '';
|
|
1887
2078
|
var init = { method: method };
|
|
@@ -1912,8 +2103,8 @@ describe('service worker host', function () {
|
|
|
1912
2103
|
* does.
|
|
1913
2104
|
*/
|
|
1914
2105
|
var seedDrive = function (runtime, testCase) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1915
|
-
var text, _a, _b, _c, file, contents, _d, _e, _f, file, contents,
|
|
1916
|
-
var
|
|
2106
|
+
var text, _a, _b, _c, file, contents, _d, _e, _f, file, contents, e_3_1;
|
|
2107
|
+
var e_4, _g, e_3, _h;
|
|
1917
2108
|
return __generator(this, function (_j) {
|
|
1918
2109
|
switch (_j.label) {
|
|
1919
2110
|
case 0:
|
|
@@ -1925,12 +2116,12 @@ describe('service worker host', function () {
|
|
|
1925
2116
|
text["/sasjs/drive/files".concat(file)] = contents;
|
|
1926
2117
|
}
|
|
1927
2118
|
}
|
|
1928
|
-
catch (
|
|
2119
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1929
2120
|
finally {
|
|
1930
2121
|
try {
|
|
1931
2122
|
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
1932
2123
|
}
|
|
1933
|
-
finally { if (
|
|
2124
|
+
finally { if (e_4) throw e_4.error; }
|
|
1934
2125
|
}
|
|
1935
2126
|
return [4 /*yield*/, runtime.load(text)];
|
|
1936
2127
|
case 1:
|
|
@@ -1953,14 +2144,14 @@ describe('service worker host', function () {
|
|
|
1953
2144
|
return [3 /*break*/, 3];
|
|
1954
2145
|
case 6: return [3 /*break*/, 9];
|
|
1955
2146
|
case 7:
|
|
1956
|
-
|
|
1957
|
-
|
|
2147
|
+
e_3_1 = _j.sent();
|
|
2148
|
+
e_3 = { error: e_3_1 };
|
|
1958
2149
|
return [3 /*break*/, 9];
|
|
1959
2150
|
case 8:
|
|
1960
2151
|
try {
|
|
1961
2152
|
if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
|
|
1962
2153
|
}
|
|
1963
|
-
finally { if (
|
|
2154
|
+
finally { if (e_3) throw e_3.error; }
|
|
1964
2155
|
return [7 /*endfinally*/];
|
|
1965
2156
|
case 9: return [2 /*return*/];
|
|
1966
2157
|
}
|
|
@@ -2028,12 +2219,12 @@ describe('service worker host', function () {
|
|
|
2028
2219
|
_loop_1(testCase);
|
|
2029
2220
|
}
|
|
2030
2221
|
}
|
|
2031
|
-
catch (
|
|
2222
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2032
2223
|
finally {
|
|
2033
2224
|
try {
|
|
2034
2225
|
if (DRIVE_CORPUS_1_1 && !DRIVE_CORPUS_1_1.done && (_a = DRIVE_CORPUS_1.return)) _a.call(DRIVE_CORPUS_1);
|
|
2035
2226
|
}
|
|
2036
|
-
finally { if (
|
|
2227
|
+
finally { if (e_1) throw e_1.error; }
|
|
2037
2228
|
}
|
|
2038
2229
|
});
|
|
2039
2230
|
});
|
package/package.json
CHANGED
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"axios": "1.20.0",
|
|
79
79
|
"chalk": "4.1.2",
|
|
80
80
|
"dotenv": "18.0.8",
|
|
81
|
+
"esbuild": "0.28.2",
|
|
81
82
|
"js-base64": "3.9.4",
|
|
82
83
|
"jsdom": "26.0.0",
|
|
83
84
|
"lodash.uniqby": "4.7.0",
|
|
@@ -124,5 +125,5 @@
|
|
|
124
125
|
"ws": "8.21.0",
|
|
125
126
|
"nanoid": "3.3.18"
|
|
126
127
|
},
|
|
127
|
-
"version": "6.
|
|
128
|
+
"version": "6.17.0"
|
|
128
129
|
}
|