@sasjs/cli 6.13.3 → 6.14.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.
@@ -399,6 +399,14 @@ var EXECUTABLE_TYPES = [
399
399
  var patchIndexHtml = function (html, version) {
400
400
  var warnings = [];
401
401
  var patched = html;
402
+ // States where this page's API comes from, for anything in the page that
403
+ // wants to say so: the server's own interface reads it to describe the host
404
+ // it is running on, and a browser host is a different thing to explain than a
405
+ // server process. Absence means the server answered the page.
406
+ if (!/<meta\s+name=["']sasjs-host["']/i.test(patched))
407
+ patched = patched.replace(/<head(\s[^>]*)?>/i, function (head) {
408
+ return "".concat(head, "\n <meta name=\"sasjs-host\" content=\"browser\" />");
409
+ });
402
410
  if (/<sasjs[^>]*>/i.test(patched)) {
403
411
  patched = patched.replace(/(<sasjs[^>]*?)\sserverurl="[^"]*"/i, '$1 serverurl=""');
404
412
  patched = patched.replace(/(<sasjs[^>]*?)\sloginmechanism="[^"]*"/i, '$1 loginmechanism="Default"');
@@ -367,6 +367,23 @@ describe('browser-hosted build', function () {
367
367
  }
368
368
  });
369
369
  }); });
370
+ it('states in the page that the API is answered here', function () { return __awaiter(void 0, void 0, void 0, function () {
371
+ var html;
372
+ return __generator(this, function (_a) {
373
+ switch (_a.label) {
374
+ case 0: return [4 /*yield*/, (0, mockSite_1.buildMockSite)(target())];
375
+ case 1:
376
+ _a.sent();
377
+ html = fs_1.default.readFileSync(path_1.default.join(out(), 'index.html'), 'utf8');
378
+ // The interface reads this to tell a browser host from a server: the API
379
+ // cannot, because a browser host answers the same routes and the same
380
+ // /SASjsApi/info shape. Only the host knows, so the host says.
381
+ expect(html).toContain('<meta name="sasjs-host" content="browser" />');
382
+ expect(html.indexOf('sasjs-host')).toBeLessThan(html.indexOf('</head>'));
383
+ return [2 /*return*/];
384
+ }
385
+ });
386
+ }); });
370
387
  it('replays every script tag a page loads, not just a bundled entry point', function () { return __awaiter(void 0, void 0, void 0, function () {
371
388
  var html, tag, specs;
372
389
  return __generator(this, function (_a) {
package/package.json CHANGED
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@sasjs/adapter": "5.1.3",
74
- "@sasjs/api": "0.17.5",
74
+ "@sasjs/api": "0.23.0",
75
75
  "@sasjs/core": "6.1.1",
76
76
  "@sasjs/lint": "5.0.1",
77
77
  "@sasjs/utils": "4.9.0",
@@ -124,5 +124,5 @@
124
124
  "ws": "8.21.0",
125
125
  "nanoid": "3.3.18"
126
126
  },
127
- "version": "6.13.3"
127
+ "version": "6.14.0"
128
128
  }