@sasjs/api 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser.js +717 -18
- package/build/cjs/admin/service.js +209 -0
- package/build/cjs/authconfig/service.js +139 -0
- package/build/cjs/corpus/admin.js +101 -0
- package/build/cjs/corpus/authconfig.js +47 -0
- package/build/cjs/corpus/directory.js +31 -0
- package/build/cjs/corpus/runner.js +13 -0
- package/build/cjs/directory/service.js +116 -0
- package/build/cjs/host/dispatch.js +39 -0
- package/build/cjs/identity/memory-store.js +4 -1
- package/build/cjs/index.js +8 -2
- package/build/cjs/info/service.js +13 -8
- package/build/cjs/routes/generated.js +56 -0
- package/build/cjs/routes/overlay.js +86 -12
- package/build/esm/admin/service.d.ts +123 -0
- package/build/esm/admin/service.d.ts.map +1 -0
- package/build/esm/admin/service.js +201 -0
- package/build/esm/authconfig/service.d.ts +92 -0
- package/build/esm/authconfig/service.d.ts.map +1 -0
- package/build/esm/authconfig/service.js +134 -0
- package/build/esm/corpus/admin.d.ts +22 -0
- package/build/esm/corpus/admin.d.ts.map +1 -0
- package/build/esm/corpus/admin.js +98 -0
- package/build/esm/corpus/authconfig.d.ts +31 -0
- package/build/esm/corpus/authconfig.d.ts.map +1 -0
- package/build/esm/corpus/authconfig.js +44 -0
- package/build/esm/corpus/directory.d.ts +20 -0
- package/build/esm/corpus/directory.d.ts.map +1 -0
- package/build/esm/corpus/directory.js +28 -0
- package/build/esm/corpus/runner.d.ts.map +1 -1
- package/build/esm/corpus/runner.js +13 -0
- package/build/esm/directory/service.d.ts +71 -0
- package/build/esm/directory/service.d.ts.map +1 -0
- package/build/esm/directory/service.js +112 -0
- package/build/esm/host/dispatch.d.ts +18 -0
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/host/dispatch.js +39 -0
- package/build/esm/identity/memory-store.d.ts.map +1 -1
- package/build/esm/identity/memory-store.js +4 -1
- package/build/esm/identity/types.d.ts +5 -0
- package/build/esm/identity/types.d.ts.map +1 -1
- package/build/esm/index.d.ts +3 -0
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +3 -0
- package/build/esm/info/service.d.ts +14 -6
- package/build/esm/info/service.d.ts.map +1 -1
- package/build/esm/info/service.js +12 -7
- package/build/esm/routes/generated.d.ts.map +1 -1
- package/build/esm/routes/generated.js +56 -0
- package/build/esm/routes/overlay.d.ts.map +1 -1
- package/build/esm/routes/overlay.js +86 -12
- package/package.json +1 -1
|
@@ -194,6 +194,40 @@ const dispatch = async (services, routeId, request = {}) => {
|
|
|
194
194
|
throw new types_js_1.ApiError(501, `This host has no info service, so it cannot answer ${routeId}.`);
|
|
195
195
|
return { status: 200, body: await services.info.info() };
|
|
196
196
|
}
|
|
197
|
+
// ------------------------------------------------- a host's own reports
|
|
198
|
+
//
|
|
199
|
+
// The administrator middleware is the host's (sasjs/server mounts
|
|
200
|
+
// authenticateAccessToken and verifyAdmin ahead of all of these), which is
|
|
201
|
+
// why their 401 is marked host-only in the overlay. The package answers a
|
|
202
|
+
// body, and for a log tail the refusals that belong to the name rule.
|
|
203
|
+
case 'GET /SASjsApi/admin/diagnostics': {
|
|
204
|
+
if (!services.admin)
|
|
205
|
+
throw new types_js_1.ApiError(501, `This host has no admin service, so it cannot answer ${routeId}.`);
|
|
206
|
+
return { status: 200, body: await services.admin.diagnostics() };
|
|
207
|
+
}
|
|
208
|
+
case 'GET /SASjsApi/admin/logs': {
|
|
209
|
+
if (!services.admin)
|
|
210
|
+
throw new types_js_1.ApiError(501, `This host has no admin service, so it cannot answer ${routeId}.`);
|
|
211
|
+
return { status: 200, body: { files: await services.admin.logs() } };
|
|
212
|
+
}
|
|
213
|
+
case 'GET /SASjsApi/admin/logs/{fileName}': {
|
|
214
|
+
if (!services.admin)
|
|
215
|
+
throw new types_js_1.ApiError(501, `This host has no admin service, so it cannot answer ${routeId}.`);
|
|
216
|
+
return {
|
|
217
|
+
status: 200,
|
|
218
|
+
body: await services.admin.logTail(String(params.fileName ?? ''), query.lines)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
case 'GET /SASjsApi/authConfig': {
|
|
222
|
+
if (!services.authConfig)
|
|
223
|
+
throw new types_js_1.ApiError(501, `This host has no auth-config service, so it cannot answer ${routeId}.`);
|
|
224
|
+
return { status: 200, body: await services.authConfig.authConfig() };
|
|
225
|
+
}
|
|
226
|
+
case 'POST /SASjsApi/authConfig/synchroniseWithLDAP': {
|
|
227
|
+
if (!services.directory)
|
|
228
|
+
throw new types_js_1.ApiError(501, `This host has no directory service, so it cannot answer ${routeId}.`);
|
|
229
|
+
return { status: 200, body: await services.directory.synchronise() };
|
|
230
|
+
}
|
|
197
231
|
case 'GET /SASjsApi/drive/file': {
|
|
198
232
|
const file = await drive.read(String(query._filePath || ''));
|
|
199
233
|
return { status: 200, contents: file.contents };
|
|
@@ -518,6 +552,11 @@ exports.dispatch = dispatch;
|
|
|
518
552
|
/** Whether a route is one `dispatch` can answer today. */
|
|
519
553
|
exports.HANDLED_ROUTES = [
|
|
520
554
|
'GET /SASjsApi/info',
|
|
555
|
+
'GET /SASjsApi/admin/diagnostics',
|
|
556
|
+
'GET /SASjsApi/admin/logs',
|
|
557
|
+
'GET /SASjsApi/admin/logs/{fileName}',
|
|
558
|
+
'GET /SASjsApi/authConfig',
|
|
559
|
+
'POST /SASjsApi/authConfig/synchroniseWithLDAP',
|
|
521
560
|
'POST /SASjsApi/drive/deploy/upload',
|
|
522
561
|
'DELETE /SASjsApi/drive/deploy',
|
|
523
562
|
'GET /SASjsApi/stp/execute',
|
|
@@ -310,7 +310,10 @@ class MemoryIdentityStore {
|
|
|
310
310
|
name: input.name,
|
|
311
311
|
description: input.description,
|
|
312
312
|
isActive: input.isActive,
|
|
313
|
-
users: []
|
|
313
|
+
users: [],
|
|
314
|
+
...(input.authProvider === undefined
|
|
315
|
+
? {}
|
|
316
|
+
: { authProvider: input.authProvider })
|
|
314
317
|
};
|
|
315
318
|
this.groupList.set(group.uid, group);
|
|
316
319
|
return group;
|
package/build/cjs/index.js
CHANGED
|
@@ -14,8 +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.
|
|
18
|
-
exports.servicesFor = exports.runCase = exports.PROVIDER_MANAGED = void 0;
|
|
17
|
+
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.DIRECTORY_CORPUS = exports.AUTH_CONFIG_CORPUS = exports.ADMIN_CORPUS = 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 = exports.ADMIN_SIGNED_IN = exports.RECORD_CORPUS = exports.unpublishAppStream = void 0;
|
|
19
19
|
/**
|
|
20
20
|
* `@sasjs/api` - the SASjs Server API described once.
|
|
21
21
|
*
|
|
@@ -72,6 +72,12 @@ var code_js_1 = require("./corpus/code.js");
|
|
|
72
72
|
Object.defineProperty(exports, "CODE_CORPUS", { enumerable: true, get: function () { return code_js_1.CODE_CORPUS; } });
|
|
73
73
|
var info_js_1 = require("./corpus/info.js");
|
|
74
74
|
Object.defineProperty(exports, "INFO_CORPUS", { enumerable: true, get: function () { return info_js_1.INFO_CORPUS; } });
|
|
75
|
+
var admin_js_1 = require("./corpus/admin.js");
|
|
76
|
+
Object.defineProperty(exports, "ADMIN_CORPUS", { enumerable: true, get: function () { return admin_js_1.ADMIN_CORPUS; } });
|
|
77
|
+
var authconfig_js_1 = require("./corpus/authconfig.js");
|
|
78
|
+
Object.defineProperty(exports, "AUTH_CONFIG_CORPUS", { enumerable: true, get: function () { return authconfig_js_1.AUTH_CONFIG_CORPUS; } });
|
|
79
|
+
var directory_js_1 = require("./corpus/directory.js");
|
|
80
|
+
Object.defineProperty(exports, "DIRECTORY_CORPUS", { enumerable: true, get: function () { return directory_js_1.DIRECTORY_CORPUS; } });
|
|
75
81
|
var service_js_3 = require("./info/service.js");
|
|
76
82
|
Object.defineProperty(exports, "BROWSER_INFO", { enumerable: true, get: function () { return service_js_3.BROWSER_INFO; } });
|
|
77
83
|
Object.defineProperty(exports, "createInfoService", { enumerable: true, get: function () { return service_js_3.createInfoService; } });
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* the response and finds an unexpected property.
|
|
26
26
|
*/
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.createInfoService = exports.normaliseInfo = exports.BROWSER_INFO = void 0;
|
|
28
|
+
exports.createInfoService = exports.normaliseInfo = exports.CORS_VALUES = exports.MODES = exports.BROWSER_INFO = void 0;
|
|
29
29
|
/**
|
|
30
30
|
* What the browser build answers, and the case the corpus runs.
|
|
31
31
|
*
|
|
@@ -60,6 +60,14 @@ const FIELDS = [
|
|
|
60
60
|
];
|
|
61
61
|
/** The properties the document makes required; `oidcProviderName` is not one. */
|
|
62
62
|
const REQUIRED_FIELDS = FIELDS.filter((field) => field !== 'oidcProviderName');
|
|
63
|
+
/**
|
|
64
|
+
* The two enums the document states for this body, from the `ModeType` and
|
|
65
|
+
* `CorsType` schemas sasjs/server publishes (v4.16.2). `spec/info.spec.ts`
|
|
66
|
+
* reads them back out of `spec/swagger.yaml` and fails if these lists and the
|
|
67
|
+
* document disagree in either direction.
|
|
68
|
+
*/
|
|
69
|
+
exports.MODES = ['server', 'desktop'];
|
|
70
|
+
exports.CORS_VALUES = ['enable', 'disable'];
|
|
63
71
|
const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
|
|
64
72
|
/**
|
|
65
73
|
* A port the document can carry: an integer in range, or `null`.
|
|
@@ -106,14 +114,11 @@ const normaliseInfo = (config) => {
|
|
|
106
114
|
if (!Object.prototype.hasOwnProperty.call(config, key))
|
|
107
115
|
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
116
|
const mode = config.mode;
|
|
109
|
-
if (!
|
|
110
|
-
throw new Error(`The info configuration states mode as ${JSON.stringify(mode)}; the document states
|
|
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.
|
|
117
|
+
if (!exports.MODES.includes(mode))
|
|
118
|
+
throw new Error(`The info configuration states mode as ${JSON.stringify(mode)}; the document states the ModeType enum - ${exports.MODES.map((value) => `\`${value}\``).join(' or ')}.`);
|
|
114
119
|
const cors = config.cors;
|
|
115
|
-
if (!
|
|
116
|
-
throw new Error(`The info configuration states cors as ${JSON.stringify(cors)}; the document states the
|
|
120
|
+
if (!exports.CORS_VALUES.includes(cors))
|
|
121
|
+
throw new Error(`The info configuration states cors as ${JSON.stringify(cors)}; the document states the CorsType enum - ${exports.CORS_VALUES.map((value) => `\`${value}\``).join(' or ')}.`);
|
|
117
122
|
const version = config.version;
|
|
118
123
|
if (!isNonEmptyString(version) || version.trim() === '')
|
|
119
124
|
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)\`.`);
|
|
@@ -29,6 +29,14 @@ exports.GENERATED_ROUTES = [
|
|
|
29
29
|
{
|
|
30
30
|
status: 200,
|
|
31
31
|
description: 'Ok'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
status: 401,
|
|
35
|
+
description: 'Unauthorized, or an administrator account is required. The mount point in routes/api/index.ts applies both checks before this handler runs.'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
status: 500,
|
|
39
|
+
description: 'The diagnostics could not be read'
|
|
32
40
|
}
|
|
33
41
|
]
|
|
34
42
|
},
|
|
@@ -44,6 +52,14 @@ exports.GENERATED_ROUTES = [
|
|
|
44
52
|
{
|
|
45
53
|
status: 200,
|
|
46
54
|
description: 'Ok'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
status: 401,
|
|
58
|
+
description: 'Unauthorized, or an administrator account is required. The mount point in routes/api/index.ts applies both checks before this handler runs.'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
status: 500,
|
|
62
|
+
description: 'The log folder could not be listed'
|
|
47
63
|
}
|
|
48
64
|
]
|
|
49
65
|
},
|
|
@@ -72,6 +88,22 @@ exports.GENERATED_ROUTES = [
|
|
|
72
88
|
{
|
|
73
89
|
status: 200,
|
|
74
90
|
description: 'Ok'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
status: 400,
|
|
94
|
+
description: 'Invalid log file name.'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
status: 401,
|
|
98
|
+
description: 'Unauthorized, or an administrator account is required. The mount point in routes/api/index.ts applies both checks before this handler runs.'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
status: 404,
|
|
102
|
+
description: 'Log file not found.'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
status: 500,
|
|
106
|
+
description: 'The log file could not be read'
|
|
75
107
|
}
|
|
76
108
|
]
|
|
77
109
|
},
|
|
@@ -209,6 +241,18 @@ exports.GENERATED_ROUTES = [
|
|
|
209
241
|
{
|
|
210
242
|
status: 200,
|
|
211
243
|
description: 'Ok'
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
status: 401,
|
|
247
|
+
description: 'Unauthorized, or an administrator account is required. The mount point in routes/api/index.ts applies both checks before this handler runs.'
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
status: 403,
|
|
251
|
+
description: 'Not Allowed while in Desktop Mode.'
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
status: 500,
|
|
255
|
+
description: 'The provider configuration could not be read'
|
|
212
256
|
}
|
|
213
257
|
]
|
|
214
258
|
},
|
|
@@ -224,6 +268,18 @@ exports.GENERATED_ROUTES = [
|
|
|
224
268
|
{
|
|
225
269
|
status: 200,
|
|
226
270
|
description: 'Ok'
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
status: 401,
|
|
274
|
+
description: 'Unauthorized, or an administrator account is required. The mount point in routes/api/index.ts applies both checks before this handler runs.'
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
status: 403,
|
|
278
|
+
description: 'Not Allowed while in Desktop Mode.'
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
status: 500,
|
|
282
|
+
description: 'The directory could not be synchronised'
|
|
227
283
|
}
|
|
228
284
|
]
|
|
229
285
|
},
|
|
@@ -25,9 +25,6 @@ exports.TAG_CAPABILITIES = {
|
|
|
25
25
|
* operation waits on, and thirty copies of the same sentence would say the same
|
|
26
26
|
* thing thirty times.
|
|
27
27
|
*/
|
|
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 provider configuration - the directory URL, bind DN and which secrets are set - which a mock states for itself and this package cannot know.";
|
|
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
28
|
const WEB_BUNDLE = 'The host serves its own web bundle; there is no API decision here for this package to answer.';
|
|
32
29
|
const success = { status: 'success' };
|
|
33
30
|
const user = {
|
|
@@ -56,12 +53,71 @@ exports.OVERLAY = {
|
|
|
56
53
|
hostResponses: [500],
|
|
57
54
|
responses: { 200: 'OK!' }
|
|
58
55
|
},
|
|
59
|
-
// Admin - the host's own process and files
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
// Admin - the host's own process and files, over the reports it supplies.
|
|
57
|
+
// The administrator check is the host's mount point (sasjs/server puts
|
|
58
|
+
// authenticateAccessToken and verifyAdmin in front of all three), so its 401
|
|
59
|
+
// - and the 500 a genuine failure answers - are host-only statuses.
|
|
60
|
+
'GET /SASjsApi/admin/diagnostics': {
|
|
61
|
+
implemented: true,
|
|
62
|
+
hostResponses: [401, 500],
|
|
63
|
+
responses: {
|
|
64
|
+
200: {
|
|
65
|
+
build: { version: '', gitHash: '', buildDate: null },
|
|
66
|
+
server: {
|
|
67
|
+
mode: 'desktop',
|
|
68
|
+
uptimeSeconds: 0,
|
|
69
|
+
startedAt: '',
|
|
70
|
+
pid: 0,
|
|
71
|
+
nodeVersion: '',
|
|
72
|
+
platform: '',
|
|
73
|
+
arch: '',
|
|
74
|
+
cpuCount: 0,
|
|
75
|
+
cpuModel: '',
|
|
76
|
+
loadAverage: [],
|
|
77
|
+
runTimes: [],
|
|
78
|
+
sasjsRoot: ''
|
|
79
|
+
},
|
|
80
|
+
memory: {
|
|
81
|
+
rssBytes: 0,
|
|
82
|
+
heapTotalBytes: 0,
|
|
83
|
+
heapUsedBytes: 0,
|
|
84
|
+
externalBytes: 0,
|
|
85
|
+
systemTotalBytes: 0,
|
|
86
|
+
systemFreeBytes: 0
|
|
87
|
+
},
|
|
88
|
+
filesystem: null,
|
|
89
|
+
folders: [],
|
|
90
|
+
logs: {
|
|
91
|
+
folder: '',
|
|
92
|
+
fileCount: 0,
|
|
93
|
+
totalBytes: 0,
|
|
94
|
+
newestFile: null,
|
|
95
|
+
newestModified: null
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
'GET /SASjsApi/admin/logs': {
|
|
101
|
+
implemented: true,
|
|
102
|
+
hostResponses: [401, 500],
|
|
103
|
+
responses: { 200: { files: [] } }
|
|
104
|
+
},
|
|
62
105
|
'GET /SASjsApi/admin/logs/{fileName}': {
|
|
63
|
-
implemented:
|
|
64
|
-
|
|
106
|
+
implemented: true,
|
|
107
|
+
// 400 and 404 are the name rule's, and this package answers them before the
|
|
108
|
+
// host is asked for anything
|
|
109
|
+
hostResponses: [401, 500],
|
|
110
|
+
responses: {
|
|
111
|
+
200: {
|
|
112
|
+
fileName: '',
|
|
113
|
+
lines: 0,
|
|
114
|
+
bytesRead: 0,
|
|
115
|
+
truncated: false,
|
|
116
|
+
content: ''
|
|
117
|
+
},
|
|
118
|
+
400: 'Invalid log file name.',
|
|
119
|
+
404: 'Log file not found.'
|
|
120
|
+
}
|
|
65
121
|
},
|
|
66
122
|
// Auth - the token flow, plus a password change the identity store cannot write
|
|
67
123
|
'POST /SASjsApi/auth/token': {
|
|
@@ -79,11 +135,29 @@ exports.OVERLAY = {
|
|
|
79
135
|
// has gone, which a host's store can see and this package cannot.
|
|
80
136
|
hostResponses: [404]
|
|
81
137
|
},
|
|
82
|
-
// Auth Config - the providers a host was started with, and an LDAP import
|
|
83
|
-
|
|
138
|
+
// Auth Config - the providers a host was started with, and an LDAP import.
|
|
139
|
+
// Both are administrator routes at the host's mount point, so 401 and the
|
|
140
|
+
// host's own 500 are host-only statuses; the package answers the body, and
|
|
141
|
+
// refuses a secret that a host tries to hand it.
|
|
142
|
+
'GET /SASjsApi/authConfig': {
|
|
143
|
+
implemented: true,
|
|
144
|
+
hostResponses: [401, 403, 500],
|
|
145
|
+
responses: {
|
|
146
|
+
200: {
|
|
147
|
+
ldap: {
|
|
148
|
+
LDAP_URL: '',
|
|
149
|
+
LDAP_BIND_DN: '',
|
|
150
|
+
LDAP_USERS_BASE_DN: '',
|
|
151
|
+
LDAP_GROUPS_BASE_DN: '',
|
|
152
|
+
LDAP_BIND_PASSWORD_SET: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
84
157
|
'POST /SASjsApi/authConfig/synchroniseWithLDAP': {
|
|
85
|
-
implemented:
|
|
86
|
-
|
|
158
|
+
implemented: true,
|
|
159
|
+
hostResponses: [401, 403, 500],
|
|
160
|
+
responses: { 200: { userCount: 0, groupCount: 0 } }
|
|
87
161
|
},
|
|
88
162
|
// Client - the OAuth clients the identity store already holds for sign-in
|
|
89
163
|
'GET /SASjsApi/client': { implemented: true },
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** What produced the build, from the host's build stamp. */
|
|
2
|
+
export interface BuildInfo {
|
|
3
|
+
version: string;
|
|
4
|
+
gitHash: string;
|
|
5
|
+
buildDate: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface ServerDetails {
|
|
8
|
+
mode: string;
|
|
9
|
+
uptimeSeconds: number;
|
|
10
|
+
startedAt: string;
|
|
11
|
+
pid: number;
|
|
12
|
+
nodeVersion: string;
|
|
13
|
+
platform: string;
|
|
14
|
+
arch: string;
|
|
15
|
+
cpuCount: number;
|
|
16
|
+
cpuModel: string;
|
|
17
|
+
loadAverage: number[];
|
|
18
|
+
runTimes: string[];
|
|
19
|
+
sasjsRoot: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MemoryDetails {
|
|
22
|
+
rssBytes: number;
|
|
23
|
+
heapTotalBytes: number;
|
|
24
|
+
heapUsedBytes: number;
|
|
25
|
+
externalBytes: number;
|
|
26
|
+
systemTotalBytes: number;
|
|
27
|
+
systemFreeBytes: number;
|
|
28
|
+
}
|
|
29
|
+
export interface FilesystemUsage {
|
|
30
|
+
path: string;
|
|
31
|
+
totalBytes: number;
|
|
32
|
+
freeBytes: number;
|
|
33
|
+
usedBytes: number;
|
|
34
|
+
usedPercent: number;
|
|
35
|
+
}
|
|
36
|
+
export interface FolderUsage {
|
|
37
|
+
label: string;
|
|
38
|
+
path: string;
|
|
39
|
+
exists: boolean;
|
|
40
|
+
bytes: number;
|
|
41
|
+
files: number;
|
|
42
|
+
truncated: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface LogFolderSummary {
|
|
45
|
+
folder: string;
|
|
46
|
+
fileCount: number;
|
|
47
|
+
totalBytes: number;
|
|
48
|
+
newestFile: string | null;
|
|
49
|
+
newestModified: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface DiagnosticsResponse {
|
|
52
|
+
build: BuildInfo;
|
|
53
|
+
server: ServerDetails;
|
|
54
|
+
memory: MemoryDetails;
|
|
55
|
+
/** `null` when the filesystem holding the root cannot be read. */
|
|
56
|
+
filesystem: FilesystemUsage | null;
|
|
57
|
+
folders: FolderUsage[];
|
|
58
|
+
logs: LogFolderSummary;
|
|
59
|
+
}
|
|
60
|
+
export interface LogFileInfo {
|
|
61
|
+
name: string;
|
|
62
|
+
sizeBytes: number;
|
|
63
|
+
modified: string;
|
|
64
|
+
}
|
|
65
|
+
export interface LogTail {
|
|
66
|
+
fileName: string;
|
|
67
|
+
lines: number;
|
|
68
|
+
bytesRead: number;
|
|
69
|
+
truncated: boolean;
|
|
70
|
+
content: string;
|
|
71
|
+
}
|
|
72
|
+
/** The host's own reports. Absent a report, the route answers 501. */
|
|
73
|
+
export interface AdminReports {
|
|
74
|
+
diagnostics(): Promise<DiagnosticsResponse>;
|
|
75
|
+
/** The access logs this host has written, newest first. */
|
|
76
|
+
logs(): Promise<LogFileInfo[]>;
|
|
77
|
+
/** The tail of one log file, or `undefined` when the folder has no such file. */
|
|
78
|
+
logTail(fileName: string, lines: number): Promise<LogTail | undefined>;
|
|
79
|
+
}
|
|
80
|
+
export interface AdminService {
|
|
81
|
+
diagnostics(): Promise<DiagnosticsResponse>;
|
|
82
|
+
logs(): Promise<LogFileInfo[]>;
|
|
83
|
+
logTail(fileName: string, lines?: number): Promise<LogTail>;
|
|
84
|
+
}
|
|
85
|
+
/** The documented defaults on the route's `lines` parameter. */
|
|
86
|
+
export declare const DEFAULT_LOG_LINES = 200;
|
|
87
|
+
export declare const MAX_LOG_LINES = 5000;
|
|
88
|
+
/**
|
|
89
|
+
* The diagnostics body, checked field by field.
|
|
90
|
+
*
|
|
91
|
+
* A host that cannot read its filesystem states `filesystem: null`, which the
|
|
92
|
+
* document allows; a host that cannot read anything at all should refuse the
|
|
93
|
+
* request itself, because an empty object here renders as a page of zeroes.
|
|
94
|
+
*/
|
|
95
|
+
export declare const normaliseDiagnostics: (report: DiagnosticsResponse) => DiagnosticsResponse;
|
|
96
|
+
/** The log listing, checked entry by entry. */
|
|
97
|
+
export declare const normaliseLogFiles: (files: LogFileInfo[]) => LogFileInfo[];
|
|
98
|
+
/**
|
|
99
|
+
* A log file name the route will hand to a host.
|
|
100
|
+
*
|
|
101
|
+
* The rule is sasjs/server's, applied before the filesystem: a bare name ending
|
|
102
|
+
* in `.log`. `.` and `..` are refused by the basename check, because both have a
|
|
103
|
+
* basename equal to themselves and neither ends in `.log`.
|
|
104
|
+
*/
|
|
105
|
+
export declare const checkLogFileName: (fileName: string) => string;
|
|
106
|
+
/**
|
|
107
|
+
* How many trailing lines to return.
|
|
108
|
+
*
|
|
109
|
+
* A caller's `lines` is text on the wire, so an absent or unusable value is the
|
|
110
|
+
* documented default rather than a refusal - the parameter is a preference, not
|
|
111
|
+
* a requirement. The ceiling is the document's maximum, so a host is never asked
|
|
112
|
+
* to read more than it stated it would.
|
|
113
|
+
*/
|
|
114
|
+
export declare const logLines: (lines?: number | string) => number;
|
|
115
|
+
/**
|
|
116
|
+
* The admin service, over the host's reports.
|
|
117
|
+
*
|
|
118
|
+
* The name rule and the line clamp run here, before the host is asked for
|
|
119
|
+
* anything: a host that resolves an unchecked name is a host that can be talked
|
|
120
|
+
* into reading outside its log folder.
|
|
121
|
+
*/
|
|
122
|
+
export declare const createAdminService: (reports: AdminReports) => AdminService;
|
|
123
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/admin/service.ts"],"names":[],"mappings":"AA4BA,4DAA4D;AAC5D,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,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