@sasjs/cli 6.27.0 → 6.27.1
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.
|
@@ -1357,12 +1357,14 @@ const routeRequest = async (request, url) => {
|
|
|
1357
1357
|
|
|
1358
1358
|
if (!refusal) broadcast({ type: 'sasjs-host-error', path, message })
|
|
1359
1359
|
// A refusal the API decided on carries its status and, where the route
|
|
1360
|
-
// answers an envelope, the body to send. The
|
|
1361
|
-
//
|
|
1362
|
-
//
|
|
1363
|
-
//
|
|
1360
|
+
// answers an envelope, the body to send. The deploy routes state one in the
|
|
1361
|
+
// document - a refusal there is `{status: 'failure', message}` - while the
|
|
1362
|
+
// other drive routes send the message itself as plain text, which is what the
|
|
1363
|
+
// server's `res.status(code).send(err.message)` does.
|
|
1364
1364
|
if (API.isApiError(e)) {
|
|
1365
1365
|
if (e.body !== undefined) return json(e.body, e.status)
|
|
1366
|
+
if (/\/SASjsApi\/drive\/deploy(\/|$)/.test(apiPath))
|
|
1367
|
+
return json({ status: 'failure', message: e.message }, e.status)
|
|
1366
1368
|
if (apiPath.includes('/SASjsApi/drive/')) return text(e.message, e.status)
|
|
1367
1369
|
return json({ message: e.message }, e.status)
|
|
1368
1370
|
}
|
|
@@ -1266,10 +1266,17 @@ describe('service worker host', function () {
|
|
|
1266
1266
|
case 1:
|
|
1267
1267
|
empty = _c.sent();
|
|
1268
1268
|
expect(empty.status).toBe(400);
|
|
1269
|
+
// the deploy routes answer a refusal as the envelope the document states for
|
|
1270
|
+
// them, which is what the corpus pins for the same route
|
|
1269
1271
|
_a = expect;
|
|
1270
|
-
return [4 /*yield*/, empty.
|
|
1272
|
+
return [4 /*yield*/, empty.json()];
|
|
1271
1273
|
case 2:
|
|
1272
|
-
|
|
1274
|
+
// the deploy routes answer a refusal as the envelope the document states for
|
|
1275
|
+
// them, which is what the corpus pins for the same route
|
|
1276
|
+
_a.apply(void 0, [_c.sent()]).toEqual({
|
|
1277
|
+
status: 'failure',
|
|
1278
|
+
message: '"file" is not present.'
|
|
1279
|
+
});
|
|
1273
1280
|
form = new FormData();
|
|
1274
1281
|
form.set('file', new Blob([new Uint8Array([1, 2, 3])]), 'not-a-zip.zip');
|
|
1275
1282
|
return [4 /*yield*/, dispatch('/SASjsApi/drive/deploy/upload', {
|
|
@@ -1280,9 +1287,12 @@ describe('service worker host', function () {
|
|
|
1280
1287
|
notZip = _c.sent();
|
|
1281
1288
|
expect(notZip.status).toBe(400);
|
|
1282
1289
|
_b = expect;
|
|
1283
|
-
return [4 /*yield*/, notZip.
|
|
1290
|
+
return [4 /*yield*/, notZip.json()];
|
|
1284
1291
|
case 4:
|
|
1285
|
-
_b.apply(void 0, [_c.sent()]).
|
|
1292
|
+
_b.apply(void 0, [_c.sent()]).toEqual({
|
|
1293
|
+
status: 'failure',
|
|
1294
|
+
message: 'The archive is not a zip file.'
|
|
1295
|
+
});
|
|
1286
1296
|
return [2 /*return*/];
|
|
1287
1297
|
}
|
|
1288
1298
|
});
|
|
@@ -2631,7 +2641,7 @@ describe('service worker host', function () {
|
|
|
2631
2641
|
}); });
|
|
2632
2642
|
});
|
|
2633
2643
|
describe('conformance corpus', function () {
|
|
2634
|
-
var e_5, _a;
|
|
2644
|
+
var e_5, _a, e_6, _b;
|
|
2635
2645
|
/**
|
|
2636
2646
|
* The corpus is what "the same API" means: the cases @sasjs/api runs against
|
|
2637
2647
|
* its own services, and against a live sasjs/server, run here against this
|
|
@@ -2640,7 +2650,7 @@ describe('service worker host', function () {
|
|
|
2640
2650
|
* used to have - and it is a test rather than a review.
|
|
2641
2651
|
*/
|
|
2642
2652
|
var httpFor = function (testCase) {
|
|
2643
|
-
var
|
|
2653
|
+
var e_7, _a;
|
|
2644
2654
|
var _b;
|
|
2645
2655
|
var _c = __read(testCase.route.split(' '), 2), method = _c[0], routePath = _c[1];
|
|
2646
2656
|
var query = new URLSearchParams();
|
|
@@ -2651,12 +2661,12 @@ describe('service worker host', function () {
|
|
|
2651
2661
|
query.set(key, String(value));
|
|
2652
2662
|
}
|
|
2653
2663
|
}
|
|
2654
|
-
catch (
|
|
2664
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2655
2665
|
finally {
|
|
2656
2666
|
try {
|
|
2657
2667
|
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
2658
2668
|
}
|
|
2659
|
-
finally { if (
|
|
2669
|
+
finally { if (e_7) throw e_7.error; }
|
|
2660
2670
|
}
|
|
2661
2671
|
var suffix = query.toString() ? "?".concat(query) : '';
|
|
2662
2672
|
var init = { method: method };
|
|
@@ -2687,8 +2697,8 @@ describe('service worker host', function () {
|
|
|
2687
2697
|
* does.
|
|
2688
2698
|
*/
|
|
2689
2699
|
var seedDrive = function (runtime, testCase) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2690
|
-
var text, _a, _b, _c, file, contents, _d, _e, _f, file, contents,
|
|
2691
|
-
var
|
|
2700
|
+
var text, _a, _b, _c, file, contents, _d, _e, _f, file, contents, e_8_1;
|
|
2701
|
+
var e_9, _g, e_8, _h;
|
|
2692
2702
|
return __generator(this, function (_j) {
|
|
2693
2703
|
switch (_j.label) {
|
|
2694
2704
|
case 0:
|
|
@@ -2700,12 +2710,12 @@ describe('service worker host', function () {
|
|
|
2700
2710
|
text["/sasjs/drive/files".concat(file)] = contents;
|
|
2701
2711
|
}
|
|
2702
2712
|
}
|
|
2703
|
-
catch (
|
|
2713
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
2704
2714
|
finally {
|
|
2705
2715
|
try {
|
|
2706
2716
|
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
2707
2717
|
}
|
|
2708
|
-
finally { if (
|
|
2718
|
+
finally { if (e_9) throw e_9.error; }
|
|
2709
2719
|
}
|
|
2710
2720
|
return [4 /*yield*/, runtime.load(text)];
|
|
2711
2721
|
case 1:
|
|
@@ -2728,71 +2738,114 @@ describe('service worker host', function () {
|
|
|
2728
2738
|
return [3 /*break*/, 3];
|
|
2729
2739
|
case 6: return [3 /*break*/, 9];
|
|
2730
2740
|
case 7:
|
|
2731
|
-
|
|
2732
|
-
|
|
2741
|
+
e_8_1 = _j.sent();
|
|
2742
|
+
e_8 = { error: e_8_1 };
|
|
2733
2743
|
return [3 /*break*/, 9];
|
|
2734
2744
|
case 8:
|
|
2735
2745
|
try {
|
|
2736
2746
|
if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
|
|
2737
2747
|
}
|
|
2738
|
-
finally { if (
|
|
2748
|
+
finally { if (e_8) throw e_8.error; }
|
|
2739
2749
|
return [7 /*endfinally*/];
|
|
2740
2750
|
case 9: return [2 /*return*/];
|
|
2741
2751
|
}
|
|
2742
2752
|
});
|
|
2743
2753
|
}); };
|
|
2754
|
+
/**
|
|
2755
|
+
* The expectation kinds this harness asserts.
|
|
2756
|
+
*
|
|
2757
|
+
* A case that states one it does not implement fails rather than passing
|
|
2758
|
+
* unproven - `keys`, `shape` and `encoding` are asserted by the package's own
|
|
2759
|
+
* corpus run and not here, and a case that starts using them has to be told
|
|
2760
|
+
* so by this list rather than by silence.
|
|
2761
|
+
*/
|
|
2762
|
+
var ASSERTED = ['status', 'error', 'partial', 'body', 'contents'];
|
|
2763
|
+
var assertExpectations = function (response, testCase) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2764
|
+
var unasserted, bytes, _a, _b, text, _c, isJson, body;
|
|
2765
|
+
return __generator(this, function (_d) {
|
|
2766
|
+
switch (_d.label) {
|
|
2767
|
+
case 0:
|
|
2768
|
+
unasserted = Object.keys(testCase.expect).filter(function (kind) { return !ASSERTED.includes(kind); });
|
|
2769
|
+
if (unasserted.length)
|
|
2770
|
+
throw new Error("".concat(testCase.id, ": this harness does not assert ").concat(unasserted.join(', ')));
|
|
2771
|
+
expect(response.status).toBe(testCase.expect.status);
|
|
2772
|
+
if (!(testCase.expect.contents instanceof Uint8Array)) return [3 /*break*/, 2];
|
|
2773
|
+
_b = Uint8Array.bind;
|
|
2774
|
+
return [4 /*yield*/, response.arrayBuffer()];
|
|
2775
|
+
case 1:
|
|
2776
|
+
_a = new (_b.apply(Uint8Array, [void 0, _d.sent()]))();
|
|
2777
|
+
return [3 /*break*/, 3];
|
|
2778
|
+
case 2:
|
|
2779
|
+
_a = undefined;
|
|
2780
|
+
_d.label = 3;
|
|
2781
|
+
case 3:
|
|
2782
|
+
bytes = _a;
|
|
2783
|
+
if (!(bytes === undefined)) return [3 /*break*/, 5];
|
|
2784
|
+
return [4 /*yield*/, response.text()];
|
|
2785
|
+
case 4:
|
|
2786
|
+
_c = _d.sent();
|
|
2787
|
+
return [3 /*break*/, 6];
|
|
2788
|
+
case 5:
|
|
2789
|
+
_c = undefined;
|
|
2790
|
+
_d.label = 6;
|
|
2791
|
+
case 6:
|
|
2792
|
+
text = _c;
|
|
2793
|
+
isJson = (response.headers.get('content-type') || '').includes('application/json');
|
|
2794
|
+
if (testCase.expect.error !== undefined) {
|
|
2795
|
+
// the routes that answer an envelope - the two deploy routes - send
|
|
2796
|
+
// `{status, message}`; the rest send the message itself as text, which is
|
|
2797
|
+
// what the server's `res.status(code).send(err.message)` does
|
|
2798
|
+
if (isJson) {
|
|
2799
|
+
body = JSON.parse(text);
|
|
2800
|
+
expect(body.message).toBe(testCase.expect.error);
|
|
2801
|
+
// a refusal that states the envelope it expects is compared on the whole
|
|
2802
|
+
// of it, not only on the message
|
|
2803
|
+
if (testCase.expect.body !== undefined)
|
|
2804
|
+
expect(body).toEqual(testCase.expect.body);
|
|
2805
|
+
}
|
|
2806
|
+
else {
|
|
2807
|
+
// a case cannot state an envelope and be answered with text: one of the
|
|
2808
|
+
// two is wrong, and silence would hide which
|
|
2809
|
+
if (testCase.expect.body !== undefined)
|
|
2810
|
+
throw new Error("".concat(testCase.id, ": the answer is text, so its body cannot be asserted"));
|
|
2811
|
+
expect(text).toBe(testCase.expect.error);
|
|
2812
|
+
}
|
|
2813
|
+
return [2 /*return*/];
|
|
2814
|
+
}
|
|
2815
|
+
if (testCase.expect.contents !== undefined) {
|
|
2816
|
+
if (bytes !== undefined)
|
|
2817
|
+
expect(bytes).toEqual(testCase.expect.contents);
|
|
2818
|
+
else
|
|
2819
|
+
expect(text).toEqual(testCase.expect.contents);
|
|
2820
|
+
return [2 /*return*/];
|
|
2821
|
+
}
|
|
2822
|
+
if (testCase.expect.body !== undefined)
|
|
2823
|
+
expect(JSON.parse(text)).toEqual(testCase.expect.body);
|
|
2824
|
+
if (testCase.expect.partial !== undefined)
|
|
2825
|
+
expect(JSON.parse(text)).toMatchObject(testCase.expect.partial);
|
|
2826
|
+
return [2 /*return*/];
|
|
2827
|
+
}
|
|
2828
|
+
});
|
|
2829
|
+
}); };
|
|
2744
2830
|
var _loop_1 = function (testCase) {
|
|
2745
2831
|
it(testCase.id, function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2746
|
-
var worker, _a, requestPath, init, response
|
|
2747
|
-
return __generator(this, function (
|
|
2748
|
-
switch (
|
|
2832
|
+
var worker, _a, requestPath, init, response;
|
|
2833
|
+
return __generator(this, function (_b) {
|
|
2834
|
+
switch (_b.label) {
|
|
2749
2835
|
case 0:
|
|
2750
2836
|
worker = loadWorker();
|
|
2751
2837
|
return [4 /*yield*/, seedDrive(worker.runtime, testCase)];
|
|
2752
2838
|
case 1:
|
|
2753
|
-
|
|
2839
|
+
_b.sent();
|
|
2754
2840
|
worker.refuseWrites(Boolean(testCase.unwritable));
|
|
2755
2841
|
_a = httpFor(testCase), requestPath = _a.path, init = _a.init;
|
|
2756
2842
|
return [4 /*yield*/, worker.dispatch(requestPath, init)];
|
|
2757
2843
|
case 2:
|
|
2758
|
-
response =
|
|
2759
|
-
|
|
2760
|
-
if (!(testCase.expect.error !== undefined)) return [3 /*break*/, 4];
|
|
2761
|
-
return [4 /*yield*/, response.text()
|
|
2762
|
-
// the routes that answer an envelope - the two deploy routes - send
|
|
2763
|
-
// `{status, message}`; the rest send the message itself as text, which
|
|
2764
|
-
// is what the server's `res.status(code).send(err.message)` does
|
|
2765
|
-
];
|
|
2844
|
+
response = _b.sent();
|
|
2845
|
+
return [4 /*yield*/, assertExpectations(response, testCase)];
|
|
2766
2846
|
case 3:
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
// `{status, message}`; the rest send the message itself as text, which
|
|
2770
|
-
// is what the server's `res.status(code).send(err.message)` does
|
|
2771
|
-
if ((response.headers.get('content-type') || '').includes('application/json'))
|
|
2772
|
-
expect(JSON.parse(body)).toEqual({
|
|
2773
|
-
status: 'failure',
|
|
2774
|
-
message: testCase.expect.error
|
|
2775
|
-
});
|
|
2776
|
-
else
|
|
2777
|
-
expect(body).toBe(testCase.expect.error);
|
|
2778
|
-
return [3 /*break*/, 8];
|
|
2779
|
-
case 4:
|
|
2780
|
-
want = testCase.expect.contents;
|
|
2781
|
-
if (!(typeof want === 'string')) return [3 /*break*/, 6];
|
|
2782
|
-
_b = expect;
|
|
2783
|
-
return [4 /*yield*/, response.text()];
|
|
2784
|
-
case 5:
|
|
2785
|
-
_b.apply(void 0, [_e.sent()]).toBe(want);
|
|
2786
|
-
return [3 /*break*/, 8];
|
|
2787
|
-
case 6:
|
|
2788
|
-
if (!(want !== undefined)) return [3 /*break*/, 8];
|
|
2789
|
-
_c = expect;
|
|
2790
|
-
_d = Uint8Array.bind;
|
|
2791
|
-
return [4 /*yield*/, response.arrayBuffer()];
|
|
2792
|
-
case 7:
|
|
2793
|
-
_c.apply(void 0, [new (_d.apply(Uint8Array, [void 0, _e.sent()]))()]).toEqual(want);
|
|
2794
|
-
_e.label = 8;
|
|
2795
|
-
case 8: return [2 /*return*/];
|
|
2847
|
+
_b.sent();
|
|
2848
|
+
return [2 /*return*/];
|
|
2796
2849
|
}
|
|
2797
2850
|
});
|
|
2798
2851
|
}); });
|
|
@@ -2810,6 +2863,184 @@ describe('service worker host', function () {
|
|
|
2810
2863
|
}
|
|
2811
2864
|
finally { if (e_5) throw e_5.error; }
|
|
2812
2865
|
}
|
|
2866
|
+
/**
|
|
2867
|
+
* The deploy route's JSON form and its removal, which is what `sasjs deploy`
|
|
2868
|
+
* sends and what this host's transport carries unchanged.
|
|
2869
|
+
*
|
|
2870
|
+
* The upload route's cases hand over the expanded tree in place of the
|
|
2871
|
+
* archive, which is a host's transport detail rather than an answer: this
|
|
2872
|
+
* worker takes the archive and expands it, so those cases would pin the
|
|
2873
|
+
* corpus's assumption instead of this host's behaviour. The zip cases above
|
|
2874
|
+
* pin that route. The removal cases need an app to remove, so the index is
|
|
2875
|
+
* seeded with the corpus's own - the worker starts with nothing published,
|
|
2876
|
+
* which is the server's state too.
|
|
2877
|
+
*
|
|
2878
|
+
* The state a case leaves is checked too - `expectDrive` - because both deploy
|
|
2879
|
+
* answers are `200` and the difference between replacing a folder and keeping
|
|
2880
|
+
* what is there is only visible in the drive afterwards.
|
|
2881
|
+
*/
|
|
2882
|
+
/** The app a removal case names, as the corpus states it. */
|
|
2883
|
+
var CORPUS_APP = {
|
|
2884
|
+
appLoc: '/Public/myApp',
|
|
2885
|
+
streamWebFolder: 'web',
|
|
2886
|
+
publishedAt: '2026-01-01T00:00:00.000Z'
|
|
2887
|
+
};
|
|
2888
|
+
/**
|
|
2889
|
+
* A second app that no removal case names.
|
|
2890
|
+
*
|
|
2891
|
+
* Without it, a removal that ignored the id and deleted whatever was
|
|
2892
|
+
* published would pass both removal cases - the unknown-id one sees an empty
|
|
2893
|
+
* index either way. With it, the assertion after the answer is that the app
|
|
2894
|
+
* the id did *not* name is still listed.
|
|
2895
|
+
*/
|
|
2896
|
+
var BYSTANDER = {
|
|
2897
|
+
id: '0b9a1c2d-3e4f-4a5b-8c6d-7e8f9a0b1c2d',
|
|
2898
|
+
name: 'bystander',
|
|
2899
|
+
appLoc: '/Public/bystander',
|
|
2900
|
+
streamWebFolder: 'web',
|
|
2901
|
+
publishedAt: '2026-01-01T00:00:00.000Z'
|
|
2902
|
+
};
|
|
2903
|
+
/**
|
|
2904
|
+
* The index a removal case starts from - built from the id the case asks to
|
|
2905
|
+
* remove, not from the answer it expects, so a host that removed some other
|
|
2906
|
+
* app would answer a different id and fail.
|
|
2907
|
+
*/
|
|
2908
|
+
var seedIndex = function (runtime, testCase) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2909
|
+
var id, named, entries;
|
|
2910
|
+
var _a, _b, _c;
|
|
2911
|
+
return __generator(this, function (_d) {
|
|
2912
|
+
switch (_d.label) {
|
|
2913
|
+
case 0:
|
|
2914
|
+
if (testCase.route !== 'DELETE /SASjsApi/drive/deploy')
|
|
2915
|
+
return [2 /*return*/];
|
|
2916
|
+
id = (_a = testCase.request.body) === null || _a === void 0 ? void 0 : _a.id;
|
|
2917
|
+
named = (_b = testCase.expect.partial) === null || _b === void 0 ? void 0 : _b.app;
|
|
2918
|
+
entries = [BYSTANDER];
|
|
2919
|
+
// the app the case expects to remove is published only when the case names
|
|
2920
|
+
// the id it removes: the unknown-id case asks for one that is not there, and
|
|
2921
|
+
// publishing it would make that case pass by accident. It goes in *after* the
|
|
2922
|
+
// bystander, so a removal that takes the first entry rather than the named
|
|
2923
|
+
// one removes the bystander and both assertions below fail.
|
|
2924
|
+
if (id !== undefined && (named === null || named === void 0 ? void 0 : named.id) === id)
|
|
2925
|
+
entries.push(__assign({ id: id, name: (_c = named.name) !== null && _c !== void 0 ? _c : 'myApp' }, CORPUS_APP));
|
|
2926
|
+
return [4 /*yield*/, runtime.load({
|
|
2927
|
+
'/sasjs/drive/files/.sasjs/apps.json': JSON.stringify(entries)
|
|
2928
|
+
})];
|
|
2929
|
+
case 1:
|
|
2930
|
+
_d.sent();
|
|
2931
|
+
return [2 /*return*/];
|
|
2932
|
+
}
|
|
2933
|
+
});
|
|
2934
|
+
}); };
|
|
2935
|
+
var _loop_2 = function (testCase) {
|
|
2936
|
+
it(testCase.id, function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2937
|
+
var worker, _a, requestPath, init, response, listing, ids, _b, _c, path_6, file, e_10_1, _d, _e, path_7, file, e_11_1;
|
|
2938
|
+
var e_10, _f, e_11, _g;
|
|
2939
|
+
var _h, _j, _k;
|
|
2940
|
+
return __generator(this, function (_l) {
|
|
2941
|
+
switch (_l.label) {
|
|
2942
|
+
case 0:
|
|
2943
|
+
worker = loadWorker();
|
|
2944
|
+
return [4 /*yield*/, seedDrive(worker.runtime, testCase)];
|
|
2945
|
+
case 1:
|
|
2946
|
+
_l.sent();
|
|
2947
|
+
return [4 /*yield*/, seedIndex(worker.runtime, testCase)
|
|
2948
|
+
// `unwritable` is not passed on here: the case that states it is the
|
|
2949
|
+
// upload route's, which the filter above keeps out, and the deploy route's
|
|
2950
|
+
// own `500` is covered by `deploy-refused-by-store` in the drive loop.
|
|
2951
|
+
];
|
|
2952
|
+
case 2:
|
|
2953
|
+
_l.sent();
|
|
2954
|
+
_a = httpFor(testCase), requestPath = _a.path, init = _a.init;
|
|
2955
|
+
return [4 /*yield*/, worker.dispatch(requestPath, init)];
|
|
2956
|
+
case 3:
|
|
2957
|
+
response = _l.sent();
|
|
2958
|
+
return [4 /*yield*/, assertExpectations(response, testCase)
|
|
2959
|
+
// a removal takes the app the id names, and leaves the rest published
|
|
2960
|
+
];
|
|
2961
|
+
case 4:
|
|
2962
|
+
_l.sent();
|
|
2963
|
+
if (!(testCase.route === 'DELETE /SASjsApi/drive/deploy')) return [3 /*break*/, 7];
|
|
2964
|
+
return [4 /*yield*/, worker.dispatch('/app/apps.json')];
|
|
2965
|
+
case 5:
|
|
2966
|
+
listing = _l.sent();
|
|
2967
|
+
return [4 /*yield*/, listing.json()];
|
|
2968
|
+
case 6:
|
|
2969
|
+
ids = (_l.sent()).apps.map(function (app) { return app.id; });
|
|
2970
|
+
expect(ids).toContain(BYSTANDER.id);
|
|
2971
|
+
if (response.status === 200)
|
|
2972
|
+
expect(ids).not.toContain((_h = testCase.request.body) === null || _h === void 0 ? void 0 : _h.id);
|
|
2973
|
+
_l.label = 7;
|
|
2974
|
+
case 7:
|
|
2975
|
+
_l.trys.push([7, 12, 13, 14]);
|
|
2976
|
+
_b = __values(((_j = testCase.expectDrive) === null || _j === void 0 ? void 0 : _j.present) || []), _c = _b.next();
|
|
2977
|
+
_l.label = 8;
|
|
2978
|
+
case 8:
|
|
2979
|
+
if (!!_c.done) return [3 /*break*/, 11];
|
|
2980
|
+
path_6 = _c.value;
|
|
2981
|
+
return [4 /*yield*/, worker.dispatch('/SASjsApi/drive/file?_filePath=' + encodeURIComponent(path_6))];
|
|
2982
|
+
case 9:
|
|
2983
|
+
file = _l.sent();
|
|
2984
|
+
expect({ path: path_6, status: file.status }).toEqual({ path: path_6, status: 200 });
|
|
2985
|
+
_l.label = 10;
|
|
2986
|
+
case 10:
|
|
2987
|
+
_c = _b.next();
|
|
2988
|
+
return [3 /*break*/, 8];
|
|
2989
|
+
case 11: return [3 /*break*/, 14];
|
|
2990
|
+
case 12:
|
|
2991
|
+
e_10_1 = _l.sent();
|
|
2992
|
+
e_10 = { error: e_10_1 };
|
|
2993
|
+
return [3 /*break*/, 14];
|
|
2994
|
+
case 13:
|
|
2995
|
+
try {
|
|
2996
|
+
if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
|
|
2997
|
+
}
|
|
2998
|
+
finally { if (e_10) throw e_10.error; }
|
|
2999
|
+
return [7 /*endfinally*/];
|
|
3000
|
+
case 14:
|
|
3001
|
+
_l.trys.push([14, 19, 20, 21]);
|
|
3002
|
+
_d = __values(((_k = testCase.expectDrive) === null || _k === void 0 ? void 0 : _k.missing) || []), _e = _d.next();
|
|
3003
|
+
_l.label = 15;
|
|
3004
|
+
case 15:
|
|
3005
|
+
if (!!_e.done) return [3 /*break*/, 18];
|
|
3006
|
+
path_7 = _e.value;
|
|
3007
|
+
return [4 /*yield*/, worker.dispatch('/SASjsApi/drive/file?_filePath=' + encodeURIComponent(path_7))];
|
|
3008
|
+
case 16:
|
|
3009
|
+
file = _l.sent();
|
|
3010
|
+
expect({ path: path_7, status: file.status }).toEqual({ path: path_7, status: 404 });
|
|
3011
|
+
_l.label = 17;
|
|
3012
|
+
case 17:
|
|
3013
|
+
_e = _d.next();
|
|
3014
|
+
return [3 /*break*/, 15];
|
|
3015
|
+
case 18: return [3 /*break*/, 21];
|
|
3016
|
+
case 19:
|
|
3017
|
+
e_11_1 = _l.sent();
|
|
3018
|
+
e_11 = { error: e_11_1 };
|
|
3019
|
+
return [3 /*break*/, 21];
|
|
3020
|
+
case 20:
|
|
3021
|
+
try {
|
|
3022
|
+
if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
|
|
3023
|
+
}
|
|
3024
|
+
finally { if (e_11) throw e_11.error; }
|
|
3025
|
+
return [7 /*endfinally*/];
|
|
3026
|
+
case 21: return [2 /*return*/];
|
|
3027
|
+
}
|
|
3028
|
+
});
|
|
3029
|
+
}); });
|
|
3030
|
+
};
|
|
3031
|
+
try {
|
|
3032
|
+
for (var _c = __values(api_1.DEPLOY_CORPUS.filter(function (entry) { return entry.route !== 'POST /SASjsApi/drive/deploy/upload'; })), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3033
|
+
var testCase = _d.value;
|
|
3034
|
+
_loop_2(testCase);
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
3038
|
+
finally {
|
|
3039
|
+
try {
|
|
3040
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
3041
|
+
}
|
|
3042
|
+
finally { if (e_6) throw e_6.error; }
|
|
3043
|
+
}
|
|
2813
3044
|
});
|
|
2814
3045
|
/**
|
|
2815
3046
|
* The identity and record corpora, over the worker's HTTP surface.
|
|
@@ -2820,7 +3051,7 @@ describe('service worker host', function () {
|
|
|
2820
3051
|
* are the package's.
|
|
2821
3052
|
*/
|
|
2822
3053
|
describe('identity and record conformance', function () {
|
|
2823
|
-
var
|
|
3054
|
+
var e_12, _a;
|
|
2824
3055
|
/**
|
|
2825
3056
|
* Boots the worker from a fixture, the way the page does: the case's own
|
|
2826
3057
|
* identity, and `subject: null` for no implicit caller, so a case that
|
|
@@ -2853,7 +3084,7 @@ describe('service worker host', function () {
|
|
|
2853
3084
|
};
|
|
2854
3085
|
/** The request a case describes, as HTTP: path parameters filled, token sent. */
|
|
2855
3086
|
var httpForCase = function (testCase) {
|
|
2856
|
-
var
|
|
3087
|
+
var e_13, _a;
|
|
2857
3088
|
var _b = __read(testCase.route.split(' '), 2), method = _b[0], routePath = _b[1];
|
|
2858
3089
|
var filled = routePath.replace(/\{(\w+)\}/g, function (_match, name) {
|
|
2859
3090
|
return encodeURIComponent(String((testCase.request.params || {})[name]));
|
|
@@ -2866,12 +3097,12 @@ describe('service worker host', function () {
|
|
|
2866
3097
|
query.set(key, String(value));
|
|
2867
3098
|
}
|
|
2868
3099
|
}
|
|
2869
|
-
catch (
|
|
3100
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
2870
3101
|
finally {
|
|
2871
3102
|
try {
|
|
2872
3103
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
2873
3104
|
}
|
|
2874
|
-
finally { if (
|
|
3105
|
+
finally { if (e_13) throw e_13.error; }
|
|
2875
3106
|
}
|
|
2876
3107
|
var suffix = query.toString() ? "?".concat(query) : '';
|
|
2877
3108
|
var headers = {};
|
|
@@ -2965,7 +3196,7 @@ describe('service worker host', function () {
|
|
|
2965
3196
|
}
|
|
2966
3197
|
});
|
|
2967
3198
|
}); };
|
|
2968
|
-
var
|
|
3199
|
+
var _loop_3 = function (testCase) {
|
|
2969
3200
|
it("".concat(testCase.id, ": ").concat(testCase.description), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2970
3201
|
var worker, _a, requestPath, init, _b, _c;
|
|
2971
3202
|
return __generator(this, function (_d) {
|
|
@@ -2990,15 +3221,15 @@ describe('service worker host', function () {
|
|
|
2990
3221
|
try {
|
|
2991
3222
|
for (var _b = __values(__spreadArray(__spreadArray([], __read(api_1.IDENTITY_CORPUS), false), __read(api_1.RECORD_CORPUS), false)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2992
3223
|
var testCase = _c.value;
|
|
2993
|
-
|
|
3224
|
+
_loop_3(testCase);
|
|
2994
3225
|
}
|
|
2995
3226
|
}
|
|
2996
|
-
catch (
|
|
3227
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
2997
3228
|
finally {
|
|
2998
3229
|
try {
|
|
2999
3230
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3000
3231
|
}
|
|
3001
|
-
finally { if (
|
|
3232
|
+
finally { if (e_12) throw e_12.error; }
|
|
3002
3233
|
}
|
|
3003
3234
|
it('answers as the fixture administrator when no subject was chosen', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3004
3235
|
var worker, response, rules;
|
package/package.json
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@sasjs/adapter": "6.0.2",
|
|
74
|
-
"@sasjs/api": "0.27.
|
|
74
|
+
"@sasjs/api": "0.27.1",
|
|
75
75
|
"@sasjs/core": "7.1.12",
|
|
76
76
|
"@sasjs/lint": "5.1.1",
|
|
77
77
|
"@sasjs/utils": "4.11.0",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"ws": "8.21.0",
|
|
126
126
|
"nanoid": "3.3.18"
|
|
127
127
|
},
|
|
128
|
-
"version": "6.27.
|
|
128
|
+
"version": "6.27.1"
|
|
129
129
|
}
|