@sasjs/api 0.17.4 → 0.18.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/README.md CHANGED
@@ -112,6 +112,16 @@ Refreshing the API surface: regenerate `api/public/swagger.yaml` in `sasjs/serve
112
112
 
113
113
  Re-vendoring is a two-repository change and the server half merges first: the document is only true once the controllers it is generated from answer what it states, so a copy taken from an unmerged server branch describes a server that does not exist yet. Take the copy from a released tag of `sasjs/server` rather than from its `main`, and the document and the code a host runs cannot disagree.
114
114
 
115
+ ### The coverage ratchet
116
+
117
+ `jest.config.js` carries a floor, and a floor only moves when somebody remembers to move it - so it passes a pull request that drops two points as long as it stays above the number. The ratchet is the other half:
118
+
119
+ - `.github/workflows/coverage-baseline.yml` publishes `coverage/coverage-summary.json` for every push to `main` (90-day artifact);
120
+ - a pull request downloads the summary published for its base commit - or for the newest commit the base commit descends from, named in the comment - and `.github/scripts/coverage-ratchet.mjs` fails when any of statements / branches / functions / lines is more than 0.05pt below it;
121
+ - the same comparison is appended to the coverage comment, so "did this go backwards" is answered on the pull request rather than inferred from a total.
122
+
123
+ A deliberate drop is a change to `coverageThreshold` in `jest.config.js` in that same pull request, where a reviewer sees it. The script's own cases run with `node --test .github/scripts/coverage-ratchet.test.mjs`; prove it locally by pointing `--head` and `--base` at the same summary (exit 0) and then at a copy with its totals raised a point (exit 1).
124
+
115
125
  ## Licence
116
126
 
117
127
  MIT. See `LICENCE.md`.
package/build/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.17.4 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.18.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
2
2
  "use strict";
3
3
  var SASjsApi = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -25,6 +25,7 @@ var SASjsApi = (() => {
25
25
  ADMIN_SIGNED_IN: () => ADMIN_SIGNED_IN,
26
26
  ALWAYS_VISIBLE_ROUTES: () => ALWAYS_VISIBLE_ROUTES,
27
27
  ApiError: () => ApiError,
28
+ BROWSER_INFO: () => BROWSER_INFO,
28
29
  CODE_CORPUS: () => CODE_CORPUS,
29
30
  CODE_DEBUG: () => CODE_DEBUG,
30
31
  DEFAULT_GRANTABLE_ROUTES: () => DEFAULT_GRANTABLE_ROUTES,
@@ -39,6 +40,7 @@ var SASjsApi = (() => {
39
40
  HANDLED_ROUTES: () => HANDLED_ROUTES,
40
41
  IDENTITY_CORPUS: () => IDENTITY_CORPUS,
41
42
  IDENTITY_FORMAT: () => IDENTITY_FORMAT,
43
+ INFO_CORPUS: () => INFO_CORPUS,
42
44
  MemoryAppStreamRegistry: () => MemoryAppStreamRegistry,
43
45
  MemoryDriveStore: () => MemoryDriveStore,
44
46
  MemoryIdentityStore: () => MemoryIdentityStore,
@@ -57,6 +59,7 @@ var SASjsApi = (() => {
57
59
  checkDeployTree: () => checkDeployTree,
58
60
  createDriveService: () => createDriveService,
59
61
  createIdentityService: () => createIdentityService,
62
+ createInfoService: () => createInfoService,
60
63
  createRecordService: () => createRecordService,
61
64
  createRuntimeService: () => createRuntimeService,
62
65
  createSessionService: () => createSessionService,
@@ -72,6 +75,7 @@ var SASjsApi = (() => {
72
75
  isRouteGranted: () => isRouteGranted,
73
76
  measureDeployTree: () => measureDeployTree,
74
77
  normaliseDrivePath: () => normaliseDrivePath,
78
+ normaliseInfo: () => normaliseInfo,
75
79
  parseIdentity: () => parseIdentity,
76
80
  routeById: () => routeById,
77
81
  runCase: () => runCase,
@@ -2564,7 +2568,7 @@ var SASjsApi = (() => {
2564
2568
  Web: ["identity"]
2565
2569
  };
2566
2570
  var DIRECTORY = "Synchronising with an external auth provider needs a directory port, which this package does not have: a host decides which directory it holds accounts in, and answers this itself.";
2567
- var HOST_CONFIG = "The body is the host's own configuration - ports, run times and providers - which a mock states for itself and this package cannot know.";
2571
+ var HOST_CONFIG = "The body is the host's own provider configuration - the directory URL, bind DN and which secrets are set - which a mock states for itself and this package cannot know.";
2568
2572
  var HOST_OWNED = "The host owns this report: it describes the host's own process and files, which a browser build has no equivalent of.";
2569
2573
  var WEB_BUNDLE = "The host serves its own web bundle; there is no API decision here for this package to answer.";
2570
2574
  var success = { status: "success" };
@@ -2717,7 +2721,25 @@ var SASjsApi = (() => {
2717
2721
  "DELETE /SASjsApi/group/{groupUid}/{userUid}": { implemented: true },
2718
2722
  "DELETE /SASjsApi/group/{uid}": { implemented: true },
2719
2723
  // Info - what the host is, and what this caller may use
2720
- "GET /SASjsApi/info": { implemented: false, reason: HOST_CONFIG },
2724
+ "GET /SASjsApi/info": {
2725
+ implemented: true,
2726
+ // The values are the host's; the shape is the document's, and the service
2727
+ // refuses a configuration that adds a property it does not state (the
2728
+ // browser build used to answer `whiteList` and `protocol`) or omits one it
2729
+ // requires (`httpPort`, `httpsPort`, `localLoginEnabled`).
2730
+ responses: {
2731
+ 200: {
2732
+ mode: "server",
2733
+ cors: "disable",
2734
+ httpPort: 5e3,
2735
+ httpsPort: 443,
2736
+ runTimes: ["sas", "js"],
2737
+ authProviders: [],
2738
+ localLoginEnabled: true,
2739
+ version: "v3.2.2 (4a26a3d)"
2740
+ }
2741
+ }
2742
+ },
2721
2743
  "GET /SASjsApi/info/authorizedRoutes": {
2722
2744
  implemented: true,
2723
2745
  capabilities: ["identity"]
@@ -2839,17 +2861,17 @@ var SASjsApi = (() => {
2839
2861
  }
2840
2862
  return escape(segment);
2841
2863
  }).join("/");
2842
- return { route, keys, regex: new RegExp("^" + pattern + "/?$") };
2864
+ return { route, keys, regex: new RegExp("^" + pattern + "/?$", "i") };
2843
2865
  }
2844
2866
  );
2845
2867
  var exact = /* @__PURE__ */ new Map();
2846
2868
  for (const route of ROUTES)
2847
2869
  if (!route.path.includes("{"))
2848
- exact.set(route.method + " " + route.path, route);
2870
+ exact.set(route.method + " " + route.path.toLowerCase(), route);
2849
2871
  var findRoute = (method, path) => {
2850
2872
  const verb = method.toUpperCase();
2851
2873
  const clean = path.split("?")[0].replace(/\/+$/, "") || "/";
2852
- const hit = exact.get(verb + " " + clean);
2874
+ const hit = exact.get(verb + " " + clean.toLowerCase());
2853
2875
  if (hit) return { route: hit, params: {} };
2854
2876
  for (const candidate of compiled) {
2855
2877
  if (candidate.route.method !== verb) continue;
@@ -3020,6 +3042,16 @@ var SASjsApi = (() => {
3020
3042
  }
3021
3043
  }
3022
3044
  switch (routeId) {
3045
+ // The one answer a host states rather than derives: public, pre-auth, and
3046
+ // read by the login screen before anything else.
3047
+ case "GET /SASjsApi/info": {
3048
+ if (!services.info)
3049
+ throw new ApiError(
3050
+ 501,
3051
+ `This host has no info service, so it cannot answer ${routeId}.`
3052
+ );
3053
+ return { status: 200, body: await services.info.info() };
3054
+ }
3023
3055
  case "GET /SASjsApi/drive/file": {
3024
3056
  const file = await drive.read(String(query._filePath || ""));
3025
3057
  return { status: 200, contents: file.contents };
@@ -3381,6 +3413,7 @@ var SASjsApi = (() => {
3381
3413
  }
3382
3414
  };
3383
3415
  var HANDLED_ROUTES = [
3416
+ "GET /SASjsApi/info",
3384
3417
  "POST /SASjsApi/drive/deploy/upload",
3385
3418
  "DELETE /SASjsApi/drive/deploy",
3386
3419
  "GET /SASjsApi/stp/execute",
@@ -3990,6 +4023,142 @@ var SASjsApi = (() => {
3990
4023
  }
3991
4024
  ];
3992
4025
 
4026
+ // src/corpus/info.ts
4027
+ var INFO_CORPUS = [
4028
+ {
4029
+ id: "info-answers-the-documented-shape",
4030
+ route: "GET /SASjsApi/info",
4031
+ description: "answers the host configuration in the shape the document states, and no property it forbids",
4032
+ request: {},
4033
+ expect: {
4034
+ status: 200,
4035
+ shape: {
4036
+ required: [
4037
+ "mode",
4038
+ "cors",
4039
+ "httpPort",
4040
+ "httpsPort",
4041
+ "runTimes",
4042
+ "authProviders",
4043
+ "localLoginEnabled",
4044
+ "version"
4045
+ ],
4046
+ // present only while oidc is a configured provider
4047
+ optional: ["oidcProviderName"]
4048
+ }
4049
+ }
4050
+ }
4051
+ ];
4052
+
4053
+ // src/info/service.ts
4054
+ var BROWSER_INFO = {
4055
+ mode: "desktop",
4056
+ cors: "disable",
4057
+ httpPort: null,
4058
+ httpsPort: null,
4059
+ runTimes: ["js"],
4060
+ authProviders: [],
4061
+ localLoginEnabled: false,
4062
+ version: "dev"
4063
+ };
4064
+ var FIELDS = [
4065
+ "mode",
4066
+ "cors",
4067
+ "httpPort",
4068
+ "httpsPort",
4069
+ "runTimes",
4070
+ "authProviders",
4071
+ "oidcProviderName",
4072
+ "localLoginEnabled",
4073
+ "version"
4074
+ ];
4075
+ var REQUIRED_FIELDS = FIELDS.filter((field) => field !== "oidcProviderName");
4076
+ var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
4077
+ var portOf = (value, name) => {
4078
+ if (value === null || value === void 0) return null;
4079
+ if (typeof value !== "number" || !Number.isInteger(value))
4080
+ throw new Error(
4081
+ `The info configuration states ${name} as ${JSON.stringify(value)}; a port is an integer, or null when the listener is disabled.`
4082
+ );
4083
+ if (value < 1 || value > 65535)
4084
+ throw new Error(
4085
+ `The info configuration states ${name} as ${value}; a port is between 1 and 65535, or null when the listener is disabled.`
4086
+ );
4087
+ return value;
4088
+ };
4089
+ var namesOf = (value, name) => {
4090
+ if (!Array.isArray(value))
4091
+ throw new Error(
4092
+ `The info configuration states ${name} as ${JSON.stringify(value)}; the document states an array of strings.`
4093
+ );
4094
+ for (const entry of value)
4095
+ if (!isNonEmptyString(entry))
4096
+ throw new Error(
4097
+ `The info configuration states ${name} with an entry that is not a name: ${JSON.stringify(entry)}.`
4098
+ );
4099
+ return [...new Set(value)];
4100
+ };
4101
+ var normaliseInfo = (config) => {
4102
+ if (!config || typeof config !== "object")
4103
+ throw new Error("The info configuration is not an object.");
4104
+ for (const key of Object.keys(config))
4105
+ if (!FIELDS.includes(key))
4106
+ throw new Error(
4107
+ `The info configuration carries \`${key}\`, which the document's InfoResponse does not state. Remove it: this route is public, so anything else a host puts here is served to an anonymous caller.`
4108
+ );
4109
+ for (const key of REQUIRED_FIELDS)
4110
+ if (!Object.prototype.hasOwnProperty.call(config, key))
4111
+ throw new Error(
4112
+ `The info configuration does not state \`${key}\`, which the document requires. A client validating the response refuses an answer that omits it.`
4113
+ );
4114
+ const mode = config.mode;
4115
+ if (!isNonEmptyString(mode) || mode.trim() === "")
4116
+ throw new Error(
4117
+ `The info configuration states mode as ${JSON.stringify(mode)}; the document states which mode the host runs in.`
4118
+ );
4119
+ const cors = config.cors;
4120
+ if (!isNonEmptyString(cors) || cors.trim() === "")
4121
+ throw new Error(
4122
+ `The info configuration states cors as ${JSON.stringify(cors)}; the document states the host's CORS setting.`
4123
+ );
4124
+ const version = config.version;
4125
+ if (!isNonEmptyString(version) || version.trim() === "")
4126
+ throw new Error(
4127
+ `The info configuration states version as ${JSON.stringify(version)}; the document states the release that produced the build, such as \`v3.2.2 (4a26a3d)\`.`
4128
+ );
4129
+ const authProviders = namesOf(config.authProviders, "authProviders");
4130
+ const runTimes = namesOf(config.runTimes, "runTimes");
4131
+ const rawName = config.oidcProviderName;
4132
+ if (rawName !== void 0 && !isNonEmptyString(rawName))
4133
+ throw new Error(
4134
+ `The info configuration states oidcProviderName as ${JSON.stringify(rawName)}; the document states the sign-on button's label, or omits it.`
4135
+ );
4136
+ if (typeof config.localLoginEnabled !== "boolean")
4137
+ throw new Error(
4138
+ `The info configuration states localLoginEnabled as ${JSON.stringify(config.localLoginEnabled)}; the document states a boolean.`
4139
+ );
4140
+ const oidcProviderName = rawName !== void 0 && authProviders.includes("oidc") ? rawName : void 0;
4141
+ return {
4142
+ mode,
4143
+ cors,
4144
+ httpPort: portOf(config.httpPort, "httpPort"),
4145
+ httpsPort: portOf(config.httpsPort, "httpsPort"),
4146
+ runTimes,
4147
+ authProviders,
4148
+ ...oidcProviderName === void 0 ? {} : { oidcProviderName },
4149
+ localLoginEnabled: config.localLoginEnabled,
4150
+ version
4151
+ };
4152
+ };
4153
+ var createInfoService = (config) => {
4154
+ const read = () => typeof config === "function" ? config() : config;
4155
+ return {
4156
+ async info() {
4157
+ return normaliseInfo(read());
4158
+ }
4159
+ };
4160
+ };
4161
+
3993
4162
  // src/identity/fixture.ts
3994
4163
  var IDENTITY_FORMAT = 1;
3995
4164
  var SECONDS_IN_A_DAY2 = 86400;
@@ -7173,6 +7342,7 @@ var SASjsApi = (() => {
7173
7342
  drive: createDriveService(
7174
7343
  testCase.unwritable ? new RefusingDriveStore(testCase.seed || {}) : new MemoryDriveStore(testCase.seed || {})
7175
7344
  ),
7345
+ info: createInfoService(BROWSER_INFO),
7176
7346
  identity: createIdentityService(identity),
7177
7347
  records: createRecordService(identity),
7178
7348
  registry: new MemoryAppStreamRegistry(),
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INFO_CORPUS = void 0;
4
+ /**
5
+ * The info corpus: the answer the login screen reads before it has a caller.
6
+ *
7
+ * The case pins the shape rather than the values, because the values belong to
8
+ * the host: sasjs/server answers its mode, its real ports and its own build
9
+ * version, and a browser build answers `null` ports and `js`. The members this
10
+ * package ships are pinned in `spec/info.spec`, which drives a configuration;
11
+ * what has to hold on every host is that the eight required properties are
12
+ * present, `oidcProviderName` is there only when a provider is configured, and
13
+ * nothing the document does not state travels with them - the browser build's
14
+ * `whiteList` and `protocol` were exactly that, on a public route.
15
+ */
16
+ exports.INFO_CORPUS = [
17
+ {
18
+ id: 'info-answers-the-documented-shape',
19
+ route: 'GET /SASjsApi/info',
20
+ description: 'answers the host configuration in the shape the document states, and no property it forbids',
21
+ request: {},
22
+ expect: {
23
+ status: 200,
24
+ shape: {
25
+ required: [
26
+ 'mode',
27
+ 'cors',
28
+ 'httpPort',
29
+ 'httpsPort',
30
+ 'runTimes',
31
+ 'authProviders',
32
+ 'localLoginEnabled',
33
+ 'version'
34
+ ],
35
+ // present only while oidc is a configured provider
36
+ optional: ['oidcProviderName']
37
+ }
38
+ }
39
+ }
40
+ ];
@@ -10,6 +10,7 @@ const records_js_1 = require("../identity/records.js");
10
10
  const service_js_3 = require("../session/service.js");
11
11
  const service_js_4 = require("../runtime/service.js");
12
12
  const memory_runner_js_1 = require("../runtime/memory-runner.js");
13
+ const service_js_5 = require("../info/service.js");
13
14
  const memory_store_js_2 = require("../identity/memory-store.js");
14
15
  const fixture_js_1 = require("../identity/fixture.js");
15
16
  const types_js_1 = require("../types.js");
@@ -37,6 +38,7 @@ const servicesFor = (testCase) => {
37
38
  drive: (0, service_js_1.createDriveService)(testCase.unwritable
38
39
  ? new RefusingDriveStore(testCase.seed || {})
39
40
  : new memory_store_js_1.MemoryDriveStore(testCase.seed || {})),
41
+ info: (0, service_js_5.createInfoService)(service_js_5.BROWSER_INFO),
40
42
  identity: (0, service_js_2.createIdentityService)(identity),
41
43
  records: (0, records_js_1.createRecordService)(identity),
42
44
  registry: new registry_js_1.MemoryAppStreamRegistry(),
@@ -187,6 +187,13 @@ const dispatch = async (services, routeId, request = {}) => {
187
187
  }
188
188
  }
189
189
  switch (routeId) {
190
+ // The one answer a host states rather than derives: public, pre-auth, and
191
+ // read by the login screen before anything else.
192
+ case 'GET /SASjsApi/info': {
193
+ if (!services.info)
194
+ throw new types_js_1.ApiError(501, `This host has no info service, so it cannot answer ${routeId}.`);
195
+ return { status: 200, body: await services.info.info() };
196
+ }
190
197
  case 'GET /SASjsApi/drive/file': {
191
198
  const file = await drive.read(String(query._filePath || ''));
192
199
  return { status: 200, contents: file.contents };
@@ -510,6 +517,7 @@ const dispatch = async (services, routeId, request = {}) => {
510
517
  exports.dispatch = dispatch;
511
518
  /** Whether a route is one `dispatch` can answer today. */
512
519
  exports.HANDLED_ROUTES = [
520
+ 'GET /SASjsApi/info',
513
521
  'POST /SASjsApi/drive/deploy/upload',
514
522
  'DELETE /SASjsApi/drive/deploy',
515
523
  'GET /SASjsApi/stp/execute',
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.servicesFor = exports.runCase = exports.PROVIDER_MANAGED = exports.ADMIN_SIGNED_IN = exports.RECORD_CORPUS = exports.unpublishAppStream = exports.MemoryAppStreamRegistry = exports.RUNTIME_CORPUS = exports.MemorySessionRunner = exports.createRuntimeService = exports.DOCUMENTED_RUN_TIMES = exports.CODE_DEBUG = exports.MemorySessionHost = exports.DEFAULT_SESSIONS = exports.createSessionService = exports.SESSION_CORPUS = exports.DEPLOY_CORPUS = exports.IDENTITY_CORPUS = exports.DRIVE_CORPUS = exports.parseIdentity = exports.IDENTITY_FORMAT = exports.DEFAULT_IDENTITY = exports.MemoryIdentityStore = exports.CODE_CORPUS = exports.sanitiseDisplayName = exports.createRecordService = exports.createIdentityService = exports.HANDLED_ROUTES = exports.dispatch = exports.TAG_CAPABILITIES = exports.OVERLAY = exports.findRoute = exports.routeById = exports.ROUTES = exports.MemoryDriveStore = exports.measureDeployTree = exports.isDeployTree = exports.deployTree = exports.decodeBase64 = exports.checkDeployTree = exports.DEPLOY_SUCCESS = exports.DEPLOY_PAYLOAD_BYTES = exports.DEPLOY_LIMITS = exports.createDriveService = exports.isRoot = exports.basename = exports.dirname = exports.hasBlockedExtension = exports.normaliseDrivePath = void 0;
17
+ exports.ADMIN_SIGNED_IN = exports.RECORD_CORPUS = exports.unpublishAppStream = exports.MemoryAppStreamRegistry = exports.RUNTIME_CORPUS = exports.MemorySessionRunner = exports.createRuntimeService = exports.DOCUMENTED_RUN_TIMES = exports.CODE_DEBUG = exports.MemorySessionHost = exports.DEFAULT_SESSIONS = exports.createSessionService = exports.SESSION_CORPUS = exports.DEPLOY_CORPUS = exports.IDENTITY_CORPUS = exports.DRIVE_CORPUS = exports.parseIdentity = exports.IDENTITY_FORMAT = exports.DEFAULT_IDENTITY = exports.MemoryIdentityStore = exports.normaliseInfo = exports.createInfoService = exports.BROWSER_INFO = exports.INFO_CORPUS = exports.CODE_CORPUS = exports.sanitiseDisplayName = exports.createRecordService = exports.createIdentityService = exports.HANDLED_ROUTES = exports.dispatch = exports.TAG_CAPABILITIES = exports.OVERLAY = exports.findRoute = exports.routeById = exports.ROUTES = exports.MemoryDriveStore = exports.measureDeployTree = exports.isDeployTree = exports.deployTree = exports.decodeBase64 = exports.checkDeployTree = exports.DEPLOY_SUCCESS = exports.DEPLOY_PAYLOAD_BYTES = exports.DEPLOY_LIMITS = exports.createDriveService = exports.isRoot = exports.basename = exports.dirname = exports.hasBlockedExtension = exports.normaliseDrivePath = void 0;
18
+ exports.servicesFor = exports.runCase = exports.PROVIDER_MANAGED = void 0;
18
19
  /**
19
20
  * `@sasjs/api` - the SASjs Server API described once.
20
21
  *
@@ -69,6 +70,12 @@ Object.defineProperty(exports, "createRecordService", { enumerable: true, get: f
69
70
  Object.defineProperty(exports, "sanitiseDisplayName", { enumerable: true, get: function () { return records_js_1.sanitiseDisplayName; } });
70
71
  var code_js_1 = require("./corpus/code.js");
71
72
  Object.defineProperty(exports, "CODE_CORPUS", { enumerable: true, get: function () { return code_js_1.CODE_CORPUS; } });
73
+ var info_js_1 = require("./corpus/info.js");
74
+ Object.defineProperty(exports, "INFO_CORPUS", { enumerable: true, get: function () { return info_js_1.INFO_CORPUS; } });
75
+ var service_js_3 = require("./info/service.js");
76
+ Object.defineProperty(exports, "BROWSER_INFO", { enumerable: true, get: function () { return service_js_3.BROWSER_INFO; } });
77
+ Object.defineProperty(exports, "createInfoService", { enumerable: true, get: function () { return service_js_3.createInfoService; } });
78
+ Object.defineProperty(exports, "normaliseInfo", { enumerable: true, get: function () { return service_js_3.normaliseInfo; } });
72
79
  var memory_store_js_2 = require("./identity/memory-store.js");
73
80
  Object.defineProperty(exports, "MemoryIdentityStore", { enumerable: true, get: function () { return memory_store_js_2.MemoryIdentityStore; } });
74
81
  var fixture_js_1 = require("./identity/fixture.js");
@@ -83,15 +90,15 @@ var deploy_js_2 = require("./corpus/deploy.js");
83
90
  Object.defineProperty(exports, "DEPLOY_CORPUS", { enumerable: true, get: function () { return deploy_js_2.DEPLOY_CORPUS; } });
84
91
  var session_js_1 = require("./corpus/session.js");
85
92
  Object.defineProperty(exports, "SESSION_CORPUS", { enumerable: true, get: function () { return session_js_1.SESSION_CORPUS; } });
86
- var service_js_3 = require("./session/service.js");
87
- Object.defineProperty(exports, "createSessionService", { enumerable: true, get: function () { return service_js_3.createSessionService; } });
93
+ var service_js_4 = require("./session/service.js");
94
+ Object.defineProperty(exports, "createSessionService", { enumerable: true, get: function () { return service_js_4.createSessionService; } });
88
95
  var memory_host_js_1 = require("./session/memory-host.js");
89
96
  Object.defineProperty(exports, "DEFAULT_SESSIONS", { enumerable: true, get: function () { return memory_host_js_1.DEFAULT_SESSIONS; } });
90
97
  Object.defineProperty(exports, "MemorySessionHost", { enumerable: true, get: function () { return memory_host_js_1.MemorySessionHost; } });
91
- var service_js_4 = require("./runtime/service.js");
92
- Object.defineProperty(exports, "CODE_DEBUG", { enumerable: true, get: function () { return service_js_4.CODE_DEBUG; } });
93
- Object.defineProperty(exports, "DOCUMENTED_RUN_TIMES", { enumerable: true, get: function () { return service_js_4.DOCUMENTED_RUN_TIMES; } });
94
- Object.defineProperty(exports, "createRuntimeService", { enumerable: true, get: function () { return service_js_4.createRuntimeService; } });
98
+ var service_js_5 = require("./runtime/service.js");
99
+ Object.defineProperty(exports, "CODE_DEBUG", { enumerable: true, get: function () { return service_js_5.CODE_DEBUG; } });
100
+ Object.defineProperty(exports, "DOCUMENTED_RUN_TIMES", { enumerable: true, get: function () { return service_js_5.DOCUMENTED_RUN_TIMES; } });
101
+ Object.defineProperty(exports, "createRuntimeService", { enumerable: true, get: function () { return service_js_5.createRuntimeService; } });
95
102
  var memory_runner_js_1 = require("./runtime/memory-runner.js");
96
103
  Object.defineProperty(exports, "MemorySessionRunner", { enumerable: true, get: function () { return memory_runner_js_1.MemorySessionRunner; } });
97
104
  var runtime_js_1 = require("./corpus/runtime.js");
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ /**
3
+ * What a host is, answered once.
4
+ *
5
+ * `GET /SASjsApi/info` is public and pre-auth: the login screen reads it to
6
+ * decide whether to offer a password form and a single sign-on button, so an
7
+ * answer that omits `localLoginEnabled` locks a user out of a form the server
8
+ * would have accepted. It is also the route both hosts answered differently:
9
+ * sasjs/server sends `mode, cors, httpPort, httpsPort, runTimes, authProviders,
10
+ * oidcProviderName?, localLoginEnabled, version`, while the browser build's service
11
+ * worker sent `mode, cors, whiteList, protocol, runTimes` - missing four
12
+ * fields the document requires and carrying two it forbids. A client written
13
+ * against the document could read neither answer portably.
14
+ *
15
+ * The values are the host's - a port, a mode, the run times it installed - and
16
+ * this file cannot know them. What it owns is the shape: the fields the
17
+ * document states, in one order, with the two derivations the server performs -
18
+ * `oidcProviderName` only while `oidc` is a configured provider, and a disabled
19
+ * listener stated as `null` rather than `0`.
20
+ *
21
+ * A host states its configuration once (or as a getter, when a listener or a
22
+ * run time can change without a restart) and answers the route with
23
+ * `createInfoService(...)`. A host configuration the document cannot describe
24
+ * is refused by name at the call rather than served to a client that validates
25
+ * the response and finds an unexpected property.
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.createInfoService = exports.normaliseInfo = exports.BROWSER_INFO = void 0;
29
+ /**
30
+ * What the browser build answers, and the case the corpus runs.
31
+ *
32
+ * A service worker is a static origin with no listener of its own, no accounts
33
+ * to sign in with, and one run time - the JavaScript one that compiles SAS. The
34
+ * answer says so rather than leaving the login screen to guess: `cors` is
35
+ * `disable` because every request is same-origin, `localLoginEnabled` is false
36
+ * because there is nothing to sign in to, and both ports are `null` because the
37
+ * site is served by whoever serves the site.
38
+ */
39
+ exports.BROWSER_INFO = {
40
+ mode: 'desktop',
41
+ cors: 'disable',
42
+ httpPort: null,
43
+ httpsPort: null,
44
+ runTimes: ['js'],
45
+ authProviders: [],
46
+ localLoginEnabled: false,
47
+ version: 'dev'
48
+ };
49
+ /** The properties the document gives `InfoResponse`, and no others. */
50
+ const FIELDS = [
51
+ 'mode',
52
+ 'cors',
53
+ 'httpPort',
54
+ 'httpsPort',
55
+ 'runTimes',
56
+ 'authProviders',
57
+ 'oidcProviderName',
58
+ 'localLoginEnabled',
59
+ 'version'
60
+ ];
61
+ /** The properties the document makes required; `oidcProviderName` is not one. */
62
+ const REQUIRED_FIELDS = FIELDS.filter((field) => field !== 'oidcProviderName');
63
+ const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
64
+ /**
65
+ * A port the document can carry: an integer in range, or `null`.
66
+ *
67
+ * `0` is refused rather than read as "disabled": the server answers `null` for
68
+ * a listener it did not start, so a host that states `0` has a different bug
69
+ * from one that states nothing, and collapsing the two is how a client ends up
70
+ * printing port 0.
71
+ */
72
+ const portOf = (value, name) => {
73
+ if (value === null || value === undefined)
74
+ return null;
75
+ if (typeof value !== 'number' || !Number.isInteger(value))
76
+ throw new Error(`The info configuration states ${name} as ${JSON.stringify(value)}; a port is an integer, or null when the listener is disabled.`);
77
+ if (value < 1 || value > 65535)
78
+ throw new Error(`The info configuration states ${name} as ${value}; a port is between 1 and 65535, or null when the listener is disabled.`);
79
+ return value;
80
+ };
81
+ /** A list of names, with a repeated entry dropped rather than served twice. */
82
+ const namesOf = (value, name) => {
83
+ if (!Array.isArray(value))
84
+ throw new Error(`The info configuration states ${name} as ${JSON.stringify(value)}; the document states an array of strings.`);
85
+ for (const entry of value)
86
+ if (!isNonEmptyString(entry))
87
+ throw new Error(`The info configuration states ${name} with an entry that is not a name: ${JSON.stringify(entry)}.`);
88
+ return [...new Set(value)];
89
+ };
90
+ /**
91
+ * The configuration, checked and put in the document's order.
92
+ *
93
+ * Refusals are `Error` rather than `ApiError`: a host that states an
94
+ * impossible configuration is a broken deployment, not a request the API
95
+ * refused, and answering `500` with a message about its own config would blame
96
+ * the caller for it. The messages name the property, because a host developer
97
+ * reading a stack trace wants the line rather than the type.
98
+ */
99
+ const normaliseInfo = (config) => {
100
+ if (!config || typeof config !== 'object')
101
+ throw new Error('The info configuration is not an object.');
102
+ for (const key of Object.keys(config))
103
+ if (!FIELDS.includes(key))
104
+ throw new Error(`The info configuration carries \`${key}\`, which the document's InfoResponse does not state. Remove it: this route is public, so anything else a host puts here is served to an anonymous caller.`);
105
+ for (const key of REQUIRED_FIELDS)
106
+ if (!Object.prototype.hasOwnProperty.call(config, key))
107
+ throw new Error(`The info configuration does not state \`${key}\`, which the document requires. A client validating the response refuses an answer that omits it.`);
108
+ const mode = config.mode;
109
+ if (!isNonEmptyString(mode) || mode.trim() === '')
110
+ throw new Error(`The info configuration states mode as ${JSON.stringify(mode)}; the document states which mode the host runs in.`);
111
+ // the document states `cors` as a string and the server passes `CORS` through
112
+ // verbatim, so any word is accepted here. sasjs/server#593 types both as
113
+ // enums; the refusal tightens with the release that publishes them.
114
+ const cors = config.cors;
115
+ if (!isNonEmptyString(cors) || cors.trim() === '')
116
+ throw new Error(`The info configuration states cors as ${JSON.stringify(cors)}; the document states the host's CORS setting.`);
117
+ const version = config.version;
118
+ if (!isNonEmptyString(version) || version.trim() === '')
119
+ throw new Error(`The info configuration states version as ${JSON.stringify(version)}; the document states the release that produced the build, such as \`v3.2.2 (4a26a3d)\`.`);
120
+ const authProviders = namesOf(config.authProviders, 'authProviders');
121
+ const runTimes = namesOf(config.runTimes, 'runTimes');
122
+ const rawName = config.oidcProviderName;
123
+ if (rawName !== undefined && !isNonEmptyString(rawName))
124
+ throw new Error(`The info configuration states oidcProviderName as ${JSON.stringify(rawName)}; the document states the sign-on button's label, or omits it.`);
125
+ if (typeof config.localLoginEnabled !== 'boolean')
126
+ throw new Error(`The info configuration states localLoginEnabled as ${JSON.stringify(config.localLoginEnabled)}; the document states a boolean.`);
127
+ // the server includes the label only while the provider is configured, and a
128
+ // login screen that offers a button for a provider the server does not have
129
+ // sends the user to a refusal - so the name follows the provider, not the
130
+ // environment variable that set it
131
+ const oidcProviderName = rawName !== undefined && authProviders.includes('oidc')
132
+ ? rawName
133
+ : undefined;
134
+ return {
135
+ mode,
136
+ cors,
137
+ httpPort: portOf(config.httpPort, 'httpPort'),
138
+ httpsPort: portOf(config.httpsPort, 'httpsPort'),
139
+ runTimes,
140
+ authProviders,
141
+ ...(oidcProviderName === undefined ? {} : { oidcProviderName }),
142
+ localLoginEnabled: config.localLoginEnabled,
143
+ version
144
+ };
145
+ };
146
+ exports.normaliseInfo = normaliseInfo;
147
+ /**
148
+ * The info service, over the host's own configuration.
149
+ *
150
+ * A function is accepted because the answer can change while the process runs -
151
+ * sasjs/server reads `process.runTimes`, which a desktop install can extend -
152
+ * and reading it per request is what keeps a started host's answer true.
153
+ */
154
+ const createInfoService = (config) => {
155
+ const read = () => (typeof config === 'function' ? config() : config);
156
+ return {
157
+ async info() {
158
+ return (0, exports.normaliseInfo)(read());
159
+ }
160
+ };
161
+ };
162
+ exports.createInfoService = createInfoService;
@@ -69,6 +69,17 @@ const escape = (segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
69
69
  * Compiles a documented path into a matcher. The table is static, so this runs
70
70
  * once at import; `findRoute` then tests exact paths first (most of the API is
71
71
  * static) and only falls through to the templates for `{uid}`-style paths.
72
+ *
73
+ * Both matchers ignore case in the path's static segments, because the host
74
+ * does: express's `case sensitive routing` is off unless a server turns it on,
75
+ * and `sasjs/server` does not, so `/SASjsApi/drive/fileTree` reaches the
76
+ * handler documented as `filetree`. A matcher that compared the strings would
77
+ * answer 404 for a request the server serves - and did: the server's own front
78
+ * end calls the route with a capital T.
79
+ *
80
+ * The `i` flag applies to the static segments and to the parameter pattern; a
81
+ * captured value keeps the case it was sent with, which is what a host needs to
82
+ * look a user or a file up.
72
83
  */
73
84
  const compiled = exports.ROUTES.filter((route) => route.path.includes('{')).map((route) => {
74
85
  const keys = [];
@@ -82,12 +93,12 @@ const compiled = exports.ROUTES.filter((route) => route.path.includes('{')).map(
82
93
  return escape(segment);
83
94
  })
84
95
  .join('/');
85
- return { route, keys, regex: new RegExp('^' + pattern + '/?$') };
96
+ return { route, keys, regex: new RegExp('^' + pattern + '/?$', 'i') };
86
97
  });
87
98
  const exact = new Map();
88
99
  for (const route of exports.ROUTES)
89
100
  if (!route.path.includes('{'))
90
- exact.set(route.method + ' ' + route.path, route);
101
+ exact.set(route.method + ' ' + route.path.toLowerCase(), route);
91
102
  /**
92
103
  * The route a request names, or undefined when the API has no such operation.
93
104
  *
@@ -98,7 +109,7 @@ for (const route of exports.ROUTES)
98
109
  const findRoute = (method, path) => {
99
110
  const verb = method.toUpperCase();
100
111
  const clean = path.split('?')[0].replace(/\/+$/, '') || '/';
101
- const hit = exact.get(verb + ' ' + clean);
112
+ const hit = exact.get(verb + ' ' + clean.toLowerCase());
102
113
  if (hit)
103
114
  return { route: hit, params: {} };
104
115
  for (const candidate of compiled) {
@@ -26,7 +26,7 @@ exports.TAG_CAPABILITIES = {
26
26
  * thing thirty times.
27
27
  */
28
28
  const DIRECTORY = 'Synchronising with an external auth provider needs a directory port, which this package does not have: a host decides which directory it holds accounts in, and answers this itself.';
29
- const HOST_CONFIG = "The body is the host's own configuration - ports, run times and providers - which a mock states for itself and this package cannot know.";
29
+ const HOST_CONFIG = "The body is the host's own provider configuration - the directory URL, bind DN and which secrets are set - which a mock states for itself and this package cannot know.";
30
30
  const HOST_OWNED = "The host owns this report: it describes the host's own process and files, which a browser build has no equivalent of.";
31
31
  const WEB_BUNDLE = 'The host serves its own web bundle; there is no API decision here for this package to answer.';
32
32
  const success = { status: 'success' };
@@ -179,7 +179,25 @@ exports.OVERLAY = {
179
179
  'DELETE /SASjsApi/group/{groupUid}/{userUid}': { implemented: true },
180
180
  'DELETE /SASjsApi/group/{uid}': { implemented: true },
181
181
  // Info - what the host is, and what this caller may use
182
- 'GET /SASjsApi/info': { implemented: false, reason: HOST_CONFIG },
182
+ 'GET /SASjsApi/info': {
183
+ implemented: true,
184
+ // The values are the host's; the shape is the document's, and the service
185
+ // refuses a configuration that adds a property it does not state (the
186
+ // browser build used to answer `whiteList` and `protocol`) or omits one it
187
+ // requires (`httpPort`, `httpsPort`, `localLoginEnabled`).
188
+ responses: {
189
+ 200: {
190
+ mode: 'server',
191
+ cors: 'disable',
192
+ httpPort: 5000,
193
+ httpsPort: 443,
194
+ runTimes: ['sas', 'js'],
195
+ authProviders: [],
196
+ localLoginEnabled: true,
197
+ version: 'v3.2.2 (4a26a3d)'
198
+ }
199
+ }
200
+ },
183
201
  'GET /SASjsApi/info/authorizedRoutes': {
184
202
  implemented: true,
185
203
  capabilities: ['identity']
@@ -60,6 +60,20 @@ export interface CorpusCase {
60
60
  * minted token is not a value a case can state.
61
61
  */
62
62
  keys?: string[];
63
+ /**
64
+ * The body's shape, where every value is the host's.
65
+ *
66
+ * `required` must all be present and every property the body carries must be
67
+ * named in `required` or `optional` - the document's `additionalProperties:
68
+ * false` stated as an assertion. A case that pins `body` or `keys` on such a
69
+ * route pins one host's values into the contract, which the live server then
70
+ * fails: `GET /SASjsApi/info` answers a mode, ports and a version that differ
71
+ * per host while every host answers the same shape.
72
+ */
73
+ shape?: {
74
+ required: string[];
75
+ optional?: string[];
76
+ };
63
77
  /**
64
78
  * How the body travels, where a string could be either. `json` is a JSON
65
79
  * string on the wire - what tsoa emits for `Promise<string>` and what the
@@ -1 +1 @@
1
- {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/corpus/drive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAAA;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,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IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACnE,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,UAAU,CAAA;IACnB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;QAC9B,yDAAyD;QACzD,KAAK,CAAC,EAAE,MAAM,CAAA;QACd;;;;WAIG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACjC;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;QACf;;;;;;;;;WASG;QACH,KAAK,CAAC,EAAE;YACN,QAAQ,EAAE,MAAM,EAAE,CAAA;YAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;SACpB,CAAA;QACD;;;;;;;WAOG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAC3B,CAAA;CACF;AAmBD,eAAO,MAAM,YAAY,EAAE,UAAU,EAqapC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { CorpusCase } from './drive.js';
2
+ /**
3
+ * The info corpus: the answer the login screen reads before it has a caller.
4
+ *
5
+ * The case pins the shape rather than the values, because the values belong to
6
+ * the host: sasjs/server answers its mode, its real ports and its own build
7
+ * version, and a browser build answers `null` ports and `js`. The members this
8
+ * package ships are pinned in `spec/info.spec`, which drives a configuration;
9
+ * what has to hold on every host is that the eight required properties are
10
+ * present, `oidcProviderName` is there only when a provider is configured, and
11
+ * nothing the document does not state travels with them - the browser build's
12
+ * `whiteList` and `protocol` were exactly that, on a public route.
13
+ */
14
+ export declare const INFO_CORPUS: CorpusCase[];
15
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/corpus/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,EAAE,UAAU,EAyBnC,CAAA"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The info corpus: the answer the login screen reads before it has a caller.
3
+ *
4
+ * The case pins the shape rather than the values, because the values belong to
5
+ * the host: sasjs/server answers its mode, its real ports and its own build
6
+ * version, and a browser build answers `null` ports and `js`. The members this
7
+ * package ships are pinned in `spec/info.spec`, which drives a configuration;
8
+ * what has to hold on every host is that the eight required properties are
9
+ * present, `oidcProviderName` is there only when a provider is configured, and
10
+ * nothing the document does not state travels with them - the browser build's
11
+ * `whiteList` and `protocol` were exactly that, on a public route.
12
+ */
13
+ export const INFO_CORPUS = [
14
+ {
15
+ id: 'info-answers-the-documented-shape',
16
+ route: 'GET /SASjsApi/info',
17
+ description: 'answers the host configuration in the shape the document states, and no property it forbids',
18
+ request: {},
19
+ expect: {
20
+ status: 200,
21
+ shape: {
22
+ required: [
23
+ 'mode',
24
+ 'cors',
25
+ 'httpPort',
26
+ 'httpsPort',
27
+ 'runTimes',
28
+ 'authProviders',
29
+ 'localLoginEnabled',
30
+ 'version'
31
+ ],
32
+ // present only while oidc is a configured provider
33
+ optional: ['oidcProviderName']
34
+ }
35
+ }
36
+ }
37
+ ];
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/corpus/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAanD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,UAAU,KAAG,QAgClD,CAAA;AA2BD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,UAAU,EACpB,WAAU,QAAgC,KACzC,OAAO,CAAC,UAAU,CAepB,CAAA"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/corpus/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAcnD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,UAAU,KAAG,QAiClD,CAAA;AA2BD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,UAAU,EACpB,WAAU,QAAgC,KACzC,OAAO,CAAC,UAAU,CAepB,CAAA"}
@@ -7,6 +7,7 @@ import { createRecordService } from '../identity/records.js';
7
7
  import { createSessionService } from '../session/service.js';
8
8
  import { createRuntimeService } from '../runtime/service.js';
9
9
  import { MemorySessionRunner } from '../runtime/memory-runner.js';
10
+ import { BROWSER_INFO, createInfoService } from '../info/service.js';
10
11
  import { MemoryIdentityStore } from '../identity/memory-store.js';
11
12
  import { DEFAULT_IDENTITY } from '../identity/fixture.js';
12
13
  import { isApiError } from '../types.js';
@@ -34,6 +35,7 @@ export const servicesFor = (testCase) => {
34
35
  drive: createDriveService(testCase.unwritable
35
36
  ? new RefusingDriveStore(testCase.seed || {})
36
37
  : new MemoryDriveStore(testCase.seed || {})),
38
+ info: createInfoService(BROWSER_INFO),
37
39
  identity: createIdentityService(identity),
38
40
  records: createRecordService(identity),
39
41
  registry: new MemoryAppStreamRegistry(),
@@ -5,6 +5,7 @@ import type { SessionService } from '../session/service.js';
5
5
  import type { RuntimeService } from '../runtime/service.js';
6
6
  import type { AppStreamRegistry } from '../drive/registry.js';
7
7
  import type { CodeService } from '../code/service.js';
8
+ import type { InfoService } from '../info/service.js';
8
9
  import type { Subject } from '../identity/types.js';
9
10
  export interface ApiRequest {
10
11
  query?: Record<string, string | undefined>;
@@ -48,6 +49,12 @@ export interface ApiResponse {
48
49
  export interface Services {
49
50
  /** The editor routes, where the host supplies a linter. */
50
51
  code?: CodeService;
52
+ /**
53
+ * What this host is - mode, listeners, run times, providers. Absent, `GET
54
+ * /SASjsApi/info` answers 501: the package knows the shape of the answer and
55
+ * the host is the only one that knows its values.
56
+ */
57
+ info?: InfoService;
51
58
  drive: DriveService;
52
59
  /**
53
60
  * Users, clients and tokens. A host without one answers 501 for the identity
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/host/dispatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oB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AE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAC,CAAA;IAC9D;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,mBAAmB;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CAC/B;AAED,MAAM,WAAW,QAAQ;IACvB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,YAAY,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,yFAAyF;IACzF,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC7B;AA2CD,eAAO,MAAM,QAAQ,GACnB,UAAU,QAAQ,EAClB,SAAS,MAAM,EACf,UAAS,UAAe,KACvB,OAAO,CAAC,WAAW,CA0kBrB,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,cAAc,EAAE,MAAM,EAwDlC,CAAA"}
@@ -184,6 +184,13 @@ export const dispatch = async (services, routeId, request = {}) => {
184
184
  }
185
185
  }
186
186
  switch (routeId) {
187
+ // The one answer a host states rather than derives: public, pre-auth, and
188
+ // read by the login screen before anything else.
189
+ case 'GET /SASjsApi/info': {
190
+ if (!services.info)
191
+ throw new ApiError(501, `This host has no info service, so it cannot answer ${routeId}.`);
192
+ return { status: 200, body: await services.info.info() };
193
+ }
187
194
  case 'GET /SASjsApi/drive/file': {
188
195
  const file = await drive.read(String(query._filePath || ''));
189
196
  return { status: 200, contents: file.contents };
@@ -506,6 +513,7 @@ export const dispatch = async (services, routeId, request = {}) => {
506
513
  };
507
514
  /** Whether a route is one `dispatch` can answer today. */
508
515
  export const HANDLED_ROUTES = [
516
+ 'GET /SASjsApi/info',
509
517
  'POST /SASjsApi/drive/deploy/upload',
510
518
  'DELETE /SASjsApi/drive/deploy',
511
519
  'GET /SASjsApi/stp/execute',
@@ -30,6 +30,9 @@ export type { ApiRequest, ApiResponse, Services } from './host/dispatch.js';
30
30
  export { createIdentityService } from './identity/service.js';
31
31
  export { createRecordService, sanitiseDisplayName } from './identity/records.js';
32
32
  export { CODE_CORPUS } from './corpus/code.js';
33
+ export { INFO_CORPUS } from './corpus/info.js';
34
+ export { BROWSER_INFO, createInfoService, normaliseInfo } from './info/service.js';
35
+ export type { InfoResponse, InfoService } from './info/service.js';
33
36
  export type { AuthorizedRoutesResponse, GroupDetailsResponse, GroupResponse, PermissionResponse, RecordServiceOptions, RecordService, UserDetailsResponse, UserResponse } from './identity/records.js';
34
37
  export type { IdentityService, LoginResult, SessionResult } from './identity/service.js';
35
38
  export { MemoryIdentityStore } from './identity/memory-store.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACR,MAAM,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,E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AE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,YAAY,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC9E,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC3E,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA"}
@@ -26,6 +26,8 @@ export * from './identity/routeAccess.js';
26
26
  export { createIdentityService } from './identity/service.js';
27
27
  export { createRecordService, sanitiseDisplayName } from './identity/records.js';
28
28
  export { CODE_CORPUS } from './corpus/code.js';
29
+ export { INFO_CORPUS } from './corpus/info.js';
30
+ export { BROWSER_INFO, createInfoService, normaliseInfo } from './info/service.js';
29
31
  export { MemoryIdentityStore } from './identity/memory-store.js';
30
32
  export { DEFAULT_IDENTITY, IDENTITY_FORMAT, parseIdentity } from './identity/fixture.js';
31
33
  export { DRIVE_CORPUS } from './corpus/drive.js';
@@ -0,0 +1,102 @@
1
+ /**
2
+ * What a host is, answered once.
3
+ *
4
+ * `GET /SASjsApi/info` is public and pre-auth: the login screen reads it to
5
+ * decide whether to offer a password form and a single sign-on button, so an
6
+ * answer that omits `localLoginEnabled` locks a user out of a form the server
7
+ * would have accepted. It is also the route both hosts answered differently:
8
+ * sasjs/server sends `mode, cors, httpPort, httpsPort, runTimes, authProviders,
9
+ * oidcProviderName?, localLoginEnabled, version`, while the browser build's service
10
+ * worker sent `mode, cors, whiteList, protocol, runTimes` - missing four
11
+ * fields the document requires and carrying two it forbids. A client written
12
+ * against the document could read neither answer portably.
13
+ *
14
+ * The values are the host's - a port, a mode, the run times it installed - and
15
+ * this file cannot know them. What it owns is the shape: the fields the
16
+ * document states, in one order, with the two derivations the server performs -
17
+ * `oidcProviderName` only while `oidc` is a configured provider, and a disabled
18
+ * listener stated as `null` rather than `0`.
19
+ *
20
+ * A host states its configuration once (or as a getter, when a listener or a
21
+ * run time can change without a restart) and answers the route with
22
+ * `createInfoService(...)`. A host configuration the document cannot describe
23
+ * is refused by name at the call rather than served to a client that validates
24
+ * the response and finds an unexpected property.
25
+ */
26
+ /**
27
+ * The document's `InfoResponse`, field for field.
28
+ *
29
+ * `additionalProperties: false` is why the type is closed: a host that adds
30
+ * `whiteList` - the CORS whitelist, which sasjs/server deliberately keeps out
31
+ * of a public answer - would be served to every anonymous caller.
32
+ */
33
+ export interface InfoResponse {
34
+ /**
35
+ * Which mode the host runs in, from `MODE` - `server` or `desktop` on
36
+ * sasjs/server. Typed as a string because that is what the published document
37
+ * states: sasjs/server#593 types it as the enum so tsoa publishes one, and the
38
+ * refusal below tightens to the two words when that release is vendored here.
39
+ */
40
+ mode: string;
41
+ /**
42
+ * The host's CORS setting, from `CORS`. The server passes the variable
43
+ * through, so it is read as a string until sasjs/server#593 states the enum.
44
+ */
45
+ cors: string;
46
+ /** The plain HTTP listener's port, or `null` when it is disabled. */
47
+ httpPort: number | null;
48
+ /** The TLS listener's port, or `null` when it is disabled. */
49
+ httpsPort: number | null;
50
+ /** The run times this host installed, as the execute routes name them. */
51
+ runTimes: string[];
52
+ /** External providers that are configured: `ldap`, `oidc`. */
53
+ authProviders: string[];
54
+ /** The sign-on button's label; absent unless `oidc` is configured. */
55
+ oidcProviderName?: string;
56
+ /** Whether password sign-in for local accounts is switched on. */
57
+ localLoginEnabled: boolean;
58
+ /**
59
+ * What produced the running build, as `v3.2.2 (4a26a3d)`.
60
+ *
61
+ * The browser build's answer names whatever built the site; this package's
62
+ * own fixture says `dev`, the same fallback `sasjs/server` uses when it has no
63
+ * build stamp. Not optional: the document requires it, and a client that
64
+ * stamps the version in a corner of every screen - the login screen included -
65
+ * reads it before anyone has signed in.
66
+ */
67
+ version: string;
68
+ }
69
+ export interface InfoService {
70
+ /** The answer `GET /SASjsApi/info` sends. */
71
+ info(): Promise<InfoResponse>;
72
+ }
73
+ /**
74
+ * What the browser build answers, and the case the corpus runs.
75
+ *
76
+ * A service worker is a static origin with no listener of its own, no accounts
77
+ * to sign in with, and one run time - the JavaScript one that compiles SAS. The
78
+ * answer says so rather than leaving the login screen to guess: `cors` is
79
+ * `disable` because every request is same-origin, `localLoginEnabled` is false
80
+ * because there is nothing to sign in to, and both ports are `null` because the
81
+ * site is served by whoever serves the site.
82
+ */
83
+ export declare const BROWSER_INFO: InfoResponse;
84
+ /**
85
+ * The configuration, checked and put in the document's order.
86
+ *
87
+ * Refusals are `Error` rather than `ApiError`: a host that states an
88
+ * impossible configuration is a broken deployment, not a request the API
89
+ * refused, and answering `500` with a message about its own config would blame
90
+ * the caller for it. The messages name the property, because a host developer
91
+ * reading a stack trace wants the line rather than the type.
92
+ */
93
+ export declare const normaliseInfo: (config: InfoResponse) => InfoResponse;
94
+ /**
95
+ * The info service, over the host's own configuration.
96
+ *
97
+ * A function is accepted because the answer can change while the process runs -
98
+ * sasjs/server reads `process.runTimes`, which a desktop install can extend -
99
+ * and reading it per request is what keeps a started host's answer true.
100
+ */
101
+ export declare const createInfoService: (config: InfoResponse | (() => InfoResponse)) => InfoService;
102
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/info/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,8DAA8D;IAC9D,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kEAAkE;IAClE,iBAAiB,EAAE,OAAO,CAAA;IAC1B;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,CAAA;CAC9B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,YAS1B,CAAA;AA6DD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,YAAY,KAAG,YAuEpD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,KAC1C,WAQF,CAAA"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * What a host is, answered once.
3
+ *
4
+ * `GET /SASjsApi/info` is public and pre-auth: the login screen reads it to
5
+ * decide whether to offer a password form and a single sign-on button, so an
6
+ * answer that omits `localLoginEnabled` locks a user out of a form the server
7
+ * would have accepted. It is also the route both hosts answered differently:
8
+ * sasjs/server sends `mode, cors, httpPort, httpsPort, runTimes, authProviders,
9
+ * oidcProviderName?, localLoginEnabled, version`, while the browser build's service
10
+ * worker sent `mode, cors, whiteList, protocol, runTimes` - missing four
11
+ * fields the document requires and carrying two it forbids. A client written
12
+ * against the document could read neither answer portably.
13
+ *
14
+ * The values are the host's - a port, a mode, the run times it installed - and
15
+ * this file cannot know them. What it owns is the shape: the fields the
16
+ * document states, in one order, with the two derivations the server performs -
17
+ * `oidcProviderName` only while `oidc` is a configured provider, and a disabled
18
+ * listener stated as `null` rather than `0`.
19
+ *
20
+ * A host states its configuration once (or as a getter, when a listener or a
21
+ * run time can change without a restart) and answers the route with
22
+ * `createInfoService(...)`. A host configuration the document cannot describe
23
+ * is refused by name at the call rather than served to a client that validates
24
+ * the response and finds an unexpected property.
25
+ */
26
+ /**
27
+ * What the browser build answers, and the case the corpus runs.
28
+ *
29
+ * A service worker is a static origin with no listener of its own, no accounts
30
+ * to sign in with, and one run time - the JavaScript one that compiles SAS. The
31
+ * answer says so rather than leaving the login screen to guess: `cors` is
32
+ * `disable` because every request is same-origin, `localLoginEnabled` is false
33
+ * because there is nothing to sign in to, and both ports are `null` because the
34
+ * site is served by whoever serves the site.
35
+ */
36
+ export const BROWSER_INFO = {
37
+ mode: 'desktop',
38
+ cors: 'disable',
39
+ httpPort: null,
40
+ httpsPort: null,
41
+ runTimes: ['js'],
42
+ authProviders: [],
43
+ localLoginEnabled: false,
44
+ version: 'dev'
45
+ };
46
+ /** The properties the document gives `InfoResponse`, and no others. */
47
+ const FIELDS = [
48
+ 'mode',
49
+ 'cors',
50
+ 'httpPort',
51
+ 'httpsPort',
52
+ 'runTimes',
53
+ 'authProviders',
54
+ 'oidcProviderName',
55
+ 'localLoginEnabled',
56
+ 'version'
57
+ ];
58
+ /** The properties the document makes required; `oidcProviderName` is not one. */
59
+ const REQUIRED_FIELDS = FIELDS.filter((field) => field !== 'oidcProviderName');
60
+ const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
61
+ /**
62
+ * A port the document can carry: an integer in range, or `null`.
63
+ *
64
+ * `0` is refused rather than read as "disabled": the server answers `null` for
65
+ * a listener it did not start, so a host that states `0` has a different bug
66
+ * from one that states nothing, and collapsing the two is how a client ends up
67
+ * printing port 0.
68
+ */
69
+ const portOf = (value, name) => {
70
+ if (value === null || value === undefined)
71
+ return null;
72
+ if (typeof value !== 'number' || !Number.isInteger(value))
73
+ throw new Error(`The info configuration states ${name} as ${JSON.stringify(value)}; a port is an integer, or null when the listener is disabled.`);
74
+ if (value < 1 || value > 65535)
75
+ throw new Error(`The info configuration states ${name} as ${value}; a port is between 1 and 65535, or null when the listener is disabled.`);
76
+ return value;
77
+ };
78
+ /** A list of names, with a repeated entry dropped rather than served twice. */
79
+ const namesOf = (value, name) => {
80
+ if (!Array.isArray(value))
81
+ throw new Error(`The info configuration states ${name} as ${JSON.stringify(value)}; the document states an array of strings.`);
82
+ for (const entry of value)
83
+ if (!isNonEmptyString(entry))
84
+ throw new Error(`The info configuration states ${name} with an entry that is not a name: ${JSON.stringify(entry)}.`);
85
+ return [...new Set(value)];
86
+ };
87
+ /**
88
+ * The configuration, checked and put in the document's order.
89
+ *
90
+ * Refusals are `Error` rather than `ApiError`: a host that states an
91
+ * impossible configuration is a broken deployment, not a request the API
92
+ * refused, and answering `500` with a message about its own config would blame
93
+ * the caller for it. The messages name the property, because a host developer
94
+ * reading a stack trace wants the line rather than the type.
95
+ */
96
+ export const normaliseInfo = (config) => {
97
+ if (!config || typeof config !== 'object')
98
+ throw new Error('The info configuration is not an object.');
99
+ for (const key of Object.keys(config))
100
+ if (!FIELDS.includes(key))
101
+ throw new Error(`The info configuration carries \`${key}\`, which the document's InfoResponse does not state. Remove it: this route is public, so anything else a host puts here is served to an anonymous caller.`);
102
+ for (const key of REQUIRED_FIELDS)
103
+ if (!Object.prototype.hasOwnProperty.call(config, key))
104
+ throw new Error(`The info configuration does not state \`${key}\`, which the document requires. A client validating the response refuses an answer that omits it.`);
105
+ const mode = config.mode;
106
+ if (!isNonEmptyString(mode) || mode.trim() === '')
107
+ throw new Error(`The info configuration states mode as ${JSON.stringify(mode)}; the document states which mode the host runs in.`);
108
+ // the document states `cors` as a string and the server passes `CORS` through
109
+ // verbatim, so any word is accepted here. sasjs/server#593 types both as
110
+ // enums; the refusal tightens with the release that publishes them.
111
+ const cors = config.cors;
112
+ if (!isNonEmptyString(cors) || cors.trim() === '')
113
+ throw new Error(`The info configuration states cors as ${JSON.stringify(cors)}; the document states the host's CORS setting.`);
114
+ const version = config.version;
115
+ if (!isNonEmptyString(version) || version.trim() === '')
116
+ throw new Error(`The info configuration states version as ${JSON.stringify(version)}; the document states the release that produced the build, such as \`v3.2.2 (4a26a3d)\`.`);
117
+ const authProviders = namesOf(config.authProviders, 'authProviders');
118
+ const runTimes = namesOf(config.runTimes, 'runTimes');
119
+ const rawName = config.oidcProviderName;
120
+ if (rawName !== undefined && !isNonEmptyString(rawName))
121
+ throw new Error(`The info configuration states oidcProviderName as ${JSON.stringify(rawName)}; the document states the sign-on button's label, or omits it.`);
122
+ if (typeof config.localLoginEnabled !== 'boolean')
123
+ throw new Error(`The info configuration states localLoginEnabled as ${JSON.stringify(config.localLoginEnabled)}; the document states a boolean.`);
124
+ // the server includes the label only while the provider is configured, and a
125
+ // login screen that offers a button for a provider the server does not have
126
+ // sends the user to a refusal - so the name follows the provider, not the
127
+ // environment variable that set it
128
+ const oidcProviderName = rawName !== undefined && authProviders.includes('oidc')
129
+ ? rawName
130
+ : undefined;
131
+ return {
132
+ mode,
133
+ cors,
134
+ httpPort: portOf(config.httpPort, 'httpPort'),
135
+ httpsPort: portOf(config.httpsPort, 'httpsPort'),
136
+ runTimes,
137
+ authProviders,
138
+ ...(oidcProviderName === undefined ? {} : { oidcProviderName }),
139
+ localLoginEnabled: config.localLoginEnabled,
140
+ version
141
+ };
142
+ };
143
+ /**
144
+ * The info service, over the host's own configuration.
145
+ *
146
+ * A function is accepted because the answer can change while the process runs -
147
+ * sasjs/server reads `process.runTimes`, which a desktop install can extend -
148
+ * and reading it per request is what keeps a started host's answer true.
149
+ */
150
+ export const createInfoService = (config) => {
151
+ const read = () => (typeof config === 'function' ? config() : config);
152
+ return {
153
+ async info() {
154
+ return normaliseInfo(read());
155
+ }
156
+ };
157
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,aAAa,CAAA;AA4DvD,eAAO,MAAM,MAAM,EAAE,KAAK,EAAgC,CAAA;AAW1D,4EAA4E;AAC5E,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,KAAK,GAAG,SAAyB,CAAA;AAExE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAgCD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GACpB,QAAQ,MAAM,EACd,MAAM,MAAM,KACX,UAAU,GAAG,SAuBf,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,aAAa,CAAA;AA4DvD,eAAO,MAAM,MAAM,EAAE,KAAK,EAAgC,CAAA;AAW1D,4EAA4E;AAC5E,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,KAAK,GAAG,SAAyB,CAAA;AAExE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AA2CD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GACpB,QAAQ,MAAM,EACd,MAAM,MAAM,KACX,UAAU,GAAG,SAuBf,CAAA"}
@@ -65,6 +65,17 @@ const escape = (segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
65
65
  * Compiles a documented path into a matcher. The table is static, so this runs
66
66
  * once at import; `findRoute` then tests exact paths first (most of the API is
67
67
  * static) and only falls through to the templates for `{uid}`-style paths.
68
+ *
69
+ * Both matchers ignore case in the path's static segments, because the host
70
+ * does: express's `case sensitive routing` is off unless a server turns it on,
71
+ * and `sasjs/server` does not, so `/SASjsApi/drive/fileTree` reaches the
72
+ * handler documented as `filetree`. A matcher that compared the strings would
73
+ * answer 404 for a request the server serves - and did: the server's own front
74
+ * end calls the route with a capital T.
75
+ *
76
+ * The `i` flag applies to the static segments and to the parameter pattern; a
77
+ * captured value keeps the case it was sent with, which is what a host needs to
78
+ * look a user or a file up.
68
79
  */
69
80
  const compiled = ROUTES.filter((route) => route.path.includes('{')).map((route) => {
70
81
  const keys = [];
@@ -78,12 +89,12 @@ const compiled = ROUTES.filter((route) => route.path.includes('{')).map((route)
78
89
  return escape(segment);
79
90
  })
80
91
  .join('/');
81
- return { route, keys, regex: new RegExp('^' + pattern + '/?$') };
92
+ return { route, keys, regex: new RegExp('^' + pattern + '/?$', 'i') };
82
93
  });
83
94
  const exact = new Map();
84
95
  for (const route of ROUTES)
85
96
  if (!route.path.includes('{'))
86
- exact.set(route.method + ' ' + route.path, route);
97
+ exact.set(route.method + ' ' + route.path.toLowerCase(), route);
87
98
  /**
88
99
  * The route a request names, or undefined when the API has no such operation.
89
100
  *
@@ -94,7 +105,7 @@ for (const route of ROUTES)
94
105
  export const findRoute = (method, path) => {
95
106
  const verb = method.toUpperCase();
96
107
  const clean = path.split('?')[0].replace(/\/+$/, '') || '/';
97
- const hit = exact.get(verb + ' ' + clean);
108
+ const hit = exact.get(verb + ' ' + clean.toLowerCase());
98
109
  if (hit)
99
110
  return { route: hit, params: {} };
100
111
  for (const candidate of compiled) {
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/routes/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGzD,yDAAyD;AACzD,UAAU,aAAa;IACrB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAA;IAC3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,CAAC;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAElE,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAczD,CAAA;AA+BD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuNhD,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,OAAO,EAAE,UAAU,EAA8C,CAAA"}
1
+ {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/routes/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGzD,yDAAyD;AACzD,UAAU,aAAa;IACrB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAA;IAC3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,CAAC;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAElE,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAczD,CAAA;AA+BD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAyOhD,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,OAAO,EAAE,UAAU,EAA8C,CAAA"}
@@ -23,7 +23,7 @@ export const TAG_CAPABILITIES = {
23
23
  * thing thirty times.
24
24
  */
25
25
  const DIRECTORY = 'Synchronising with an external auth provider needs a directory port, which this package does not have: a host decides which directory it holds accounts in, and answers this itself.';
26
- const HOST_CONFIG = "The body is the host's own configuration - ports, run times and providers - which a mock states for itself and this package cannot know.";
26
+ const HOST_CONFIG = "The body is the host's own provider configuration - the directory URL, bind DN and which secrets are set - which a mock states for itself and this package cannot know.";
27
27
  const HOST_OWNED = "The host owns this report: it describes the host's own process and files, which a browser build has no equivalent of.";
28
28
  const WEB_BUNDLE = 'The host serves its own web bundle; there is no API decision here for this package to answer.';
29
29
  const success = { status: 'success' };
@@ -176,7 +176,25 @@ export const OVERLAY = {
176
176
  'DELETE /SASjsApi/group/{groupUid}/{userUid}': { implemented: true },
177
177
  'DELETE /SASjsApi/group/{uid}': { implemented: true },
178
178
  // Info - what the host is, and what this caller may use
179
- 'GET /SASjsApi/info': { implemented: false, reason: HOST_CONFIG },
179
+ 'GET /SASjsApi/info': {
180
+ implemented: true,
181
+ // The values are the host's; the shape is the document's, and the service
182
+ // refuses a configuration that adds a property it does not state (the
183
+ // browser build used to answer `whiteList` and `protocol`) or omits one it
184
+ // requires (`httpPort`, `httpsPort`, `localLoginEnabled`).
185
+ responses: {
186
+ 200: {
187
+ mode: 'server',
188
+ cors: 'disable',
189
+ httpPort: 5000,
190
+ httpsPort: 443,
191
+ runTimes: ['sas', 'js'],
192
+ authProviders: [],
193
+ localLoginEnabled: true,
194
+ version: 'v3.2.2 (4a26a3d)'
195
+ }
196
+ }
197
+ },
180
198
  'GET /SASjsApi/info/authorizedRoutes': {
181
199
  implemented: true,
182
200
  capabilities: ['identity']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.17.4",
3
+ "version": "0.18.0",
4
4
  "description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
5
5
  "license": "MIT",
6
6
  "author": "SASjs",