@nsshunt/stsdevtools 1.0.85 → 1.0.86
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/dist/index.cjs +333 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +304 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +20 -18
- package/types/testHelpers.d.ts +2 -1
- package/types/testHelpers.d.ts.map +1 -1
- package/dist/stsdevtools.mjs +0 -337
- package/dist/stsdevtools.mjs.map +0 -1
- package/dist/stsdevtools.umd.js +0 -348
- package/dist/stsdevtools.umd.js.map +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let vitest = require("vitest");
|
|
25
|
+
let chalk = require("chalk");
|
|
26
|
+
chalk = __toESM(chalk);
|
|
27
|
+
let tough_cookie = require("tough-cookie");
|
|
28
|
+
tough_cookie = __toESM(tough_cookie);
|
|
29
|
+
let node_crypto = require("node:crypto");
|
|
30
|
+
node_crypto = __toESM(node_crypto);
|
|
31
|
+
let axios = require("axios");
|
|
32
|
+
axios = __toESM(axios);
|
|
33
|
+
let testcontainers = require("testcontainers");
|
|
34
|
+
let _nsshunt_stsconfig = require("@nsshunt/stsconfig");
|
|
35
|
+
let _nsshunt_stsutils = require("@nsshunt/stsutils");
|
|
36
|
+
let node_http = require("node:http");
|
|
37
|
+
node_http = __toESM(node_http);
|
|
38
|
+
let node_https = require("node:https");
|
|
39
|
+
node_https = __toESM(node_https);
|
|
40
|
+
//#region src/testHelpers.ts
|
|
41
|
+
var TestHelper = class {
|
|
42
|
+
#regexURLSafeStringComponent = /[-a-zA-Z0-9@:%._+~#=]{1,256}/;
|
|
43
|
+
#regexSTSBase64 = /SES_(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?/;
|
|
44
|
+
#regexJWT = /[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+/;
|
|
45
|
+
#network;
|
|
46
|
+
#databaseContainer;
|
|
47
|
+
#stsAuthContainer;
|
|
48
|
+
#stsRest01Container;
|
|
49
|
+
#ioRedisContainer;
|
|
50
|
+
#stsFhirContainer;
|
|
51
|
+
#ioRedisMessageProcessorUrl = "";
|
|
52
|
+
#authEndpoint = "";
|
|
53
|
+
#authPort = "";
|
|
54
|
+
#authHost = "";
|
|
55
|
+
#rest01Host = "";
|
|
56
|
+
#rest01Port = "";
|
|
57
|
+
#rest01Endpoint = "";
|
|
58
|
+
#fhirHost = "";
|
|
59
|
+
#fhirPort = "";
|
|
60
|
+
#fhirEndpoint = "";
|
|
61
|
+
constructor() {
|
|
62
|
+
this.#authEndpoint = "https://localhost:3002";
|
|
63
|
+
}
|
|
64
|
+
LogDebugMessage(message) {
|
|
65
|
+
_nsshunt_stsutils.defaultLogger.debug(message);
|
|
66
|
+
}
|
|
67
|
+
StartNetwork = async () => {
|
|
68
|
+
this.#network = await new testcontainers.Network().start();
|
|
69
|
+
};
|
|
70
|
+
StopNetwork = async () => {
|
|
71
|
+
if (this.#network) await this.#network.stop();
|
|
72
|
+
};
|
|
73
|
+
get network() {
|
|
74
|
+
return this.#network;
|
|
75
|
+
}
|
|
76
|
+
get authPort() {
|
|
77
|
+
return this.#authPort;
|
|
78
|
+
}
|
|
79
|
+
get authHost() {
|
|
80
|
+
return this.#authHost;
|
|
81
|
+
}
|
|
82
|
+
get authEndpoint() {
|
|
83
|
+
return this.#authEndpoint;
|
|
84
|
+
}
|
|
85
|
+
get rest01Port() {
|
|
86
|
+
return this.#rest01Port;
|
|
87
|
+
}
|
|
88
|
+
get rest01Host() {
|
|
89
|
+
return this.#rest01Host;
|
|
90
|
+
}
|
|
91
|
+
get rest01Endpoint() {
|
|
92
|
+
return this.#rest01Endpoint;
|
|
93
|
+
}
|
|
94
|
+
get fhirPort() {
|
|
95
|
+
return this.#fhirPort;
|
|
96
|
+
}
|
|
97
|
+
get fhirHost() {
|
|
98
|
+
return this.#fhirHost;
|
|
99
|
+
}
|
|
100
|
+
get fhirEndpoint() {
|
|
101
|
+
return this.#fhirEndpoint;
|
|
102
|
+
}
|
|
103
|
+
get ioRedisMessageProcessorUrl() {
|
|
104
|
+
return this.#ioRedisMessageProcessorUrl;
|
|
105
|
+
}
|
|
106
|
+
CreateRandomString = () => {
|
|
107
|
+
const charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
108
|
+
let random = "";
|
|
109
|
+
Array.from(node_crypto.default.getRandomValues(new Uint8Array(43))).forEach((v) => random += charset[v % 66]);
|
|
110
|
+
return random;
|
|
111
|
+
};
|
|
112
|
+
Login = async (username, password) => {
|
|
113
|
+
const client_id = process.env.CLIENT_ID;
|
|
114
|
+
const nonce = node_crypto.default.randomBytes(43).toString("base64");
|
|
115
|
+
const response_type = "code";
|
|
116
|
+
const redirect_uri = process.env.REDIRECT_URI;
|
|
117
|
+
const response_mode = "query";
|
|
118
|
+
const scope = process.env.SCOPE;
|
|
119
|
+
const state = node_crypto.default.randomBytes(43).toString("base64");
|
|
120
|
+
const code_verifier = this.CreateRandomString();
|
|
121
|
+
const authoriseOptions = {
|
|
122
|
+
email: username,
|
|
123
|
+
password,
|
|
124
|
+
client_id,
|
|
125
|
+
nonce,
|
|
126
|
+
response_type,
|
|
127
|
+
redirect_uri,
|
|
128
|
+
response_mode,
|
|
129
|
+
scope,
|
|
130
|
+
state,
|
|
131
|
+
code_challenge: node_crypto.default.createHash("sha256").update(code_verifier).digest("base64"),
|
|
132
|
+
code_challenge_method: "S256"
|
|
133
|
+
};
|
|
134
|
+
const url = `${this.#authEndpoint}${_nsshunt_stsconfig.goptions.asapiroot}/login`;
|
|
135
|
+
console.log(`Login ---------------------------------------------------------------------------`);
|
|
136
|
+
console.log(`url: [${url}]`);
|
|
137
|
+
console.log(`authoriseOptions: [${JSON.stringify(authoriseOptions)}]`);
|
|
138
|
+
const agentManager = (0, _nsshunt_stsutils.createAgentManager)({
|
|
139
|
+
httpAgentFactory(options) {
|
|
140
|
+
return new node_http.default.Agent(options);
|
|
141
|
+
},
|
|
142
|
+
httpsAgentFactory(options) {
|
|
143
|
+
return new node_https.default.Agent(options);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return await (0, axios.default)(new _nsshunt_stsutils.STSAxiosConfig(url, "post").withDefaultHeaders().withData(authoriseOptions).withAgentManager(agentManager).config);
|
|
147
|
+
};
|
|
148
|
+
StartDatabase = async () => {
|
|
149
|
+
this.#databaseContainer = await new testcontainers.GenericContainer("postgres").withExposedPorts(5432).withEnvironment({ POSTGRES_PASSWORD: "postgres" }).withNetwork(this.#network).withNetworkAliases("database").start();
|
|
150
|
+
const httpPort = this.#databaseContainer.getMappedPort(5432);
|
|
151
|
+
const host = this.#databaseContainer.getHost();
|
|
152
|
+
const networkIpAddress = this.#databaseContainer.getIpAddress(this.#network.getName());
|
|
153
|
+
process.env.DB_HOST = `${host}:${httpPort}`;
|
|
154
|
+
(0, _nsshunt_stsconfig.$ResetOptions)();
|
|
155
|
+
this.LogDebugMessage(chalk.default.green(`httpPort: [${httpPort}]`));
|
|
156
|
+
this.LogDebugMessage(chalk.default.green(`host: [${host}]`));
|
|
157
|
+
this.LogDebugMessage(chalk.default.green(`networkIpAddress: [${networkIpAddress}]`));
|
|
158
|
+
this.LogDebugMessage(chalk.default.green(`connectionString: [${_nsshunt_stsconfig.goptions.connectionString}]`));
|
|
159
|
+
this.LogDebugMessage(chalk.default.green(`defaultDatabaseConnectionString: [${_nsshunt_stsconfig.goptions.defaultDatabaseConnectionString}]`));
|
|
160
|
+
};
|
|
161
|
+
StopDatabase = async () => {
|
|
162
|
+
if (this.#databaseContainer) {
|
|
163
|
+
await this.#databaseContainer.stop();
|
|
164
|
+
this.LogDebugMessage(chalk.default.yellow(`Used the following parameters for the database during testing:`));
|
|
165
|
+
this.LogDebugMessage(chalk.default.yellow(`connectionString: [${_nsshunt_stsconfig.goptions.connectionString}]`));
|
|
166
|
+
this.LogDebugMessage(chalk.default.yellow(`defaultDatabaseConnectionString: [${_nsshunt_stsconfig.goptions.defaultDatabaseConnectionString}]`));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
InitializeDatabase = async () => {
|
|
170
|
+
const stsAuthContainerInit = await new testcontainers.GenericContainer("serza/stsauth:latest").withEnvironment({
|
|
171
|
+
DB_USER: "postgres",
|
|
172
|
+
DB_PASSWORD: "postgres",
|
|
173
|
+
DB_HOST: "database:5432",
|
|
174
|
+
POOL_SIZE: "50",
|
|
175
|
+
MAX_CPU: "2",
|
|
176
|
+
DEBUG: "proc*",
|
|
177
|
+
HTTPS_SERVER_KEY_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.key",
|
|
178
|
+
HTTPS_SERVER_CERT_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.cert",
|
|
179
|
+
AS_ENDPOINT: "https://stscore.stsmda.org"
|
|
180
|
+
}).withCommand([
|
|
181
|
+
"node",
|
|
182
|
+
"dist/app",
|
|
183
|
+
"create"
|
|
184
|
+
]).withNetwork(this.#network).withNetworkAliases("stsauthrunnerinit").withWaitStrategy(testcontainers.Wait.forLogMessage(`User registered: {"status":200,"detail":{"id":"USR_STSGlobalAdminUser@stsmda.com","name":"STSGlobalAdminUser@stsmda.com","email":"STSGlobalAdminUser@stsmda.com","roles":[]}}`)).start();
|
|
185
|
+
await (0, _nsshunt_stsutils.Sleep)(500);
|
|
186
|
+
await stsAuthContainerInit.stop();
|
|
187
|
+
};
|
|
188
|
+
StartRedis = async () => {
|
|
189
|
+
this.#ioRedisContainer = await new testcontainers.GenericContainer("redis/redis-stack-server").withEnvironment({ REDIS_ARGS: "--save \"\" --appendonly no" }).withExposedPorts(6379).withNetwork(this.#network).withNetworkAliases("redisstackserver").start();
|
|
190
|
+
this.#ioRedisMessageProcessorUrl = `redis://${this.#ioRedisContainer.getHost()}:${this.#ioRedisContainer.getMappedPort(6379)}`;
|
|
191
|
+
await (0, _nsshunt_stsutils.Sleep)(2e3);
|
|
192
|
+
this.LogDebugMessage(chalk.default.green(`redis/redis-stack-server Started. Server Details: ioRedisMessageProcessorUrl: [${this.#ioRedisMessageProcessorUrl}]`));
|
|
193
|
+
};
|
|
194
|
+
StopRedis = async () => {
|
|
195
|
+
if (this.#ioRedisContainer) {
|
|
196
|
+
await this.#ioRedisContainer.stop();
|
|
197
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
StartAuthService = async () => {
|
|
201
|
+
this.#stsAuthContainer = await new testcontainers.GenericContainer("serza/stsauth:latest").withExposedPorts(3002).withEnvironment({
|
|
202
|
+
DB_USER: "postgres",
|
|
203
|
+
DB_PASSWORD: "postgres",
|
|
204
|
+
DB_HOST: "database:5432",
|
|
205
|
+
POOL_SIZE: "50",
|
|
206
|
+
MAX_CPU: "2",
|
|
207
|
+
DEBUG: "proc*",
|
|
208
|
+
HTTPS_SERVER_KEY_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.key",
|
|
209
|
+
HTTPS_SERVER_CERT_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.cert",
|
|
210
|
+
AS_ENDPOINT: "https://stscore.stsmda.org",
|
|
211
|
+
IM_REDIS_MESSAGE_PROCESSOR_URL: "redis://redisstackserver:6379"
|
|
212
|
+
}).withNetwork(this.#network).withNetworkAliases("stsauthrunner").withWaitStrategy(testcontainers.Wait.forHttp("/stsauth/v1.0/latency", 3002).usingTls().allowInsecure()).start();
|
|
213
|
+
const httpAuthPort = this.#stsAuthContainer.getMappedPort(3002);
|
|
214
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
215
|
+
this.#authHost = "https://localhost";
|
|
216
|
+
this.#authPort = httpAuthPort;
|
|
217
|
+
this.#authEndpoint = `${this.#authHost}:${this.#authPort}`;
|
|
218
|
+
this.LogDebugMessage(chalk.default.green(`STSAuth Started. Server Details: Host: [${this.#authHost}], Port: [${this.#authPort}]`));
|
|
219
|
+
};
|
|
220
|
+
StartFhirService = async () => {
|
|
221
|
+
this.#stsFhirContainer = await new testcontainers.GenericContainer("serza/stsfhir:latest").withExposedPorts(3005).withEnvironment({
|
|
222
|
+
DB_USER: "postgres",
|
|
223
|
+
DB_PASSWORD: "postgres",
|
|
224
|
+
DB_HOST: "database:5432",
|
|
225
|
+
POOL_SIZE: "50",
|
|
226
|
+
MAX_CPU: "2",
|
|
227
|
+
DEBUG: "proc*",
|
|
228
|
+
HTTPS_SERVER_KEY_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.key",
|
|
229
|
+
HTTPS_SERVER_CERT_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.cert",
|
|
230
|
+
AS_ENDPOINT: "https://stsauthrunner",
|
|
231
|
+
AS_HOST_PORT: "3002",
|
|
232
|
+
AS_PORT: "3002",
|
|
233
|
+
IM_REDIS_MESSAGE_PROCESSOR_URL: "redis://redisstackserver:6379",
|
|
234
|
+
SOCKET_IO_REDIS_ADAPTOR_URL: "redis://redisstackserver:6379",
|
|
235
|
+
STSFHIR_PORT: "3005",
|
|
236
|
+
STSFHIR_HOST_PORT: "3005",
|
|
237
|
+
STSFHIR_ENDPOINT: "https://stsfhirserver",
|
|
238
|
+
UV_THREADPOOL_SIZE: "64",
|
|
239
|
+
FORCE_COLOR: "3"
|
|
240
|
+
}).withNetwork(this.#network).withNetworkAliases("stsfhirserver").start();
|
|
241
|
+
this.#stsFhirContainer.logs().then((stream) => {
|
|
242
|
+
stream.on("data", (line) => process.stdout.write(line.toString())).on("err", (line) => process.stderr.write(line.toString())).on("end", () => console.log("Stream ended."));
|
|
243
|
+
});
|
|
244
|
+
const httpFhirPort = this.#stsFhirContainer.getMappedPort(3005);
|
|
245
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
246
|
+
this.#fhirHost = "https://localhost";
|
|
247
|
+
this.#fhirPort = httpFhirPort;
|
|
248
|
+
this.#fhirEndpoint = `${this.#fhirHost}:${this.#fhirPort}`;
|
|
249
|
+
this.LogDebugMessage(chalk.default.green(`STSFhir Started. Server Details: Host: [${this.#fhirHost}], Port: [${this.#fhirPort}]`));
|
|
250
|
+
};
|
|
251
|
+
StopAuthService = async () => {
|
|
252
|
+
if (this.#stsAuthContainer) {
|
|
253
|
+
await this.#stsAuthContainer.stop();
|
|
254
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
StopRest01Service = async () => {
|
|
258
|
+
if (this.#stsRest01Container) {
|
|
259
|
+
await this.#stsRest01Container.stop();
|
|
260
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
StopFhirService = async () => {
|
|
264
|
+
if (this.#stsFhirContainer) {
|
|
265
|
+
await this.#stsFhirContainer.stop();
|
|
266
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
TestLoginAndVerify = async () => {
|
|
270
|
+
vitest.expect.assertions(4);
|
|
271
|
+
console.log(`TestLoginAndVerify:1`);
|
|
272
|
+
const retVal = await this.Login("user01@stsmda.com.au", "user01password");
|
|
273
|
+
(0, vitest.expect)(retVal.status).toEqual(200);
|
|
274
|
+
console.log(`TestLoginAndVerify:2`);
|
|
275
|
+
this.LogDebugMessage(chalk.default.red(`${JSON.stringify(retVal.data)}`));
|
|
276
|
+
this.LogDebugMessage(chalk.default.magenta(`${JSON.stringify(retVal.headers)}`));
|
|
277
|
+
this.LogDebugMessage(chalk.default.yellow(`${JSON.stringify(retVal.headers["set-cookie"])}`));
|
|
278
|
+
const cookies = retVal.headers["set-cookie"];
|
|
279
|
+
this.LogDebugMessage(chalk.default.yellow(`${cookies[0]}`));
|
|
280
|
+
this.LogDebugMessage(chalk.default.green(`${JSON.stringify(tough_cookie.Cookie.parse(cookies[0]))}`));
|
|
281
|
+
console.log(`TestLoginAndVerify:3`);
|
|
282
|
+
const cookie = tough_cookie.Cookie.parse(cookies[0]);
|
|
283
|
+
console.log(`TestLoginAndVerify:4`);
|
|
284
|
+
const desiredCookieResultAxios = {
|
|
285
|
+
key: "consent_cookie",
|
|
286
|
+
value: vitest.expect.stringMatching(this.#regexURLSafeStringComponent),
|
|
287
|
+
path: "/",
|
|
288
|
+
secure: true,
|
|
289
|
+
httpOnly: true,
|
|
290
|
+
sameSite: "strict"
|
|
291
|
+
};
|
|
292
|
+
(0, vitest.expect)(JSON.parse(JSON.stringify(cookie))).toMatchObject(desiredCookieResultAxios);
|
|
293
|
+
console.log(`TestLoginAndVerify:5`);
|
|
294
|
+
(0, vitest.expect)(new Date(cookie.expires).getTime()).toBeGreaterThan((/* @__PURE__ */ new Date()).getTime());
|
|
295
|
+
const consentRequired = process.env.CONSENT_REQUIRED.split(" ").sort();
|
|
296
|
+
retVal.data.detail.consentRequired = retVal.data.detail.consentRequired.sort();
|
|
297
|
+
console.log(`TestLoginAndVerify:6`);
|
|
298
|
+
const desiredResult = {
|
|
299
|
+
sessionId: vitest.expect.stringMatching(this.#regexSTSBase64),
|
|
300
|
+
id_token: vitest.expect.stringMatching(this.#regexJWT),
|
|
301
|
+
consentRequired
|
|
302
|
+
};
|
|
303
|
+
console.log(`TestLoginAndVerify:7`);
|
|
304
|
+
(0, vitest.expect)(retVal.data.detail).toMatchObject(desiredResult);
|
|
305
|
+
console.log(`TestLoginAndVerify:9`);
|
|
306
|
+
};
|
|
307
|
+
StartRest01Service = async () => {
|
|
308
|
+
this.#stsRest01Container = await new testcontainers.GenericContainer("serza/stsrest01:latest").withExposedPorts(3003).withEnvironment({
|
|
309
|
+
DB_USER: "postgres",
|
|
310
|
+
DB_PASSWORD: "postgres",
|
|
311
|
+
DB_HOST: "database:5432",
|
|
312
|
+
POOL_SIZE: "50",
|
|
313
|
+
MAX_CPU: "2",
|
|
314
|
+
DEBUG: "proc*",
|
|
315
|
+
HTTPS_SERVER_KEY_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.key",
|
|
316
|
+
HTTPS_SERVER_CERT_PATH: "/var/lib/sts/stsglobalresources/keys-tmp/server.cert",
|
|
317
|
+
AS_ENDPOINT: "https://stsauthrunner",
|
|
318
|
+
AS_HOST_PORT: "3002",
|
|
319
|
+
AS_PORT: "3002",
|
|
320
|
+
IM_REDIS_MESSAGE_PROCESSOR_URL: "redis://redisstackserver:6379"
|
|
321
|
+
}).withNetwork(this.#network).withNetworkAliases("rest01").withWaitStrategy(testcontainers.Wait.forHttp("/stsrest01/v1/latency", 3003).usingTls().allowInsecure()).start();
|
|
322
|
+
const httpRest01Port = this.#stsRest01Container.getMappedPort(3003);
|
|
323
|
+
await (0, _nsshunt_stsutils.Sleep)(200);
|
|
324
|
+
this.#rest01Host = "https://localhost";
|
|
325
|
+
this.#rest01Port = httpRest01Port;
|
|
326
|
+
this.#rest01Endpoint = `${this.#rest01Host}:${this.#rest01Port}`;
|
|
327
|
+
this.LogDebugMessage(chalk.default.green(`STSRest01 Started. Server Details: Host: [${this.rest01Host}], Port: [${this.rest01Port}]`));
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
//#endregion
|
|
331
|
+
exports.TestHelper = TestHelper;
|
|
332
|
+
|
|
333
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["#authEndpoint","#network","#authPort","#authHost","#rest01Port","#rest01Host","#rest01Endpoint","#fhirPort","#fhirHost","#fhirEndpoint","#ioRedisMessageProcessorUrl","#databaseContainer","#ioRedisContainer","#stsAuthContainer","#stsFhirContainer","#stsRest01Container","#regexURLSafeStringComponent","#regexSTSBase64","#regexJWT"],"sources":["../src/testHelpers.ts"],"sourcesContent":["/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF\n// stsdevtools\nimport { expect } from 'vitest';\n\nimport chalk from 'chalk'\n\nimport * as tough from 'tough-cookie'\n\nimport crypto from 'node:crypto'\n\nimport axios from 'axios'\n\nimport { GenericContainer, Network, Wait } from \"testcontainers\"\n\nimport { goptions, $ResetOptions } from '@nsshunt/stsconfig'\n\nimport { Sleep, defaultLogger, STSAxiosConfig, createAgentManager } from '@nsshunt/stsutils'\n\nimport http from 'node:http'\nimport https from 'node:https'\n\nexport class TestHelper {\n //#regexBase64URL = /^[A-Za-z0-9_-]+$/ // Base64URL - https://base64.guru/standards/base64url\n #regexURLSafeStringComponent = /[-a-zA-Z0-9@:%._+~#=]{1,256}/ // URL safe string component\n //#regexBase64 = /(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?/ // Base64 - https://stackoverflow.com/questions/475074/regex-to-parse-or-validate-base64-data\n #regexSTSBase64 = /SES_(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?/ // Base64\n #regexJWT = /[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+/ // JWT (Base64URL.Base64URL.Base64URL)\n #network: any;\n\n #databaseContainer: any;\n #stsAuthContainer: any;\n #stsRest01Container: any;\n #ioRedisContainer: any;\n #stsFhirContainer: any;\n\n #ioRedisMessageProcessorUrl: string = '';\n\n #authEndpoint = '';\n #authPort = '';\n #authHost = '';\n\n #rest01Host = '';\n #rest01Port = '';\n #rest01Endpoint = '';\n\n #fhirHost = '';\n #fhirPort = '';\n #fhirEndpoint = '';\n\n constructor() {\n this.#authEndpoint = 'https://localhost:3002'; //@@\n }\n\n LogDebugMessage(message: any) {\n defaultLogger.debug(message);\n }\n\n StartNetwork = async () => {\n this.#network = await new Network().start();\n }\n\n StopNetwork = async () => {\n if (this.#network) {\n await this.#network.stop();\n }\n }\n\n get network() {\n return this.#network;\n }\n\n get authPort() {\n return this.#authPort;\n }\n\n get authHost() {\n return this.#authHost;\n }\n\n get authEndpoint() {\n return this.#authEndpoint;\n }\n\n get rest01Port() {\n return this.#rest01Port;\n }\n\n get rest01Host() {\n return this.#rest01Host;\n }\n\n get rest01Endpoint() {\n return this.#rest01Endpoint;\n }\n\n get fhirPort() {\n return this.#fhirPort;\n }\n\n get fhirHost() {\n return this.#fhirHost;\n }\n\n get fhirEndpoint() {\n return this.#fhirEndpoint;\n }\n\n get ioRedisMessageProcessorUrl() {\n return this.#ioRedisMessageProcessorUrl;\n }\n\n CreateRandomString = () => {\n const charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.'; // /[0-9A-Za-z\\-_~.]/\n let random = '';\n const randomValues: number[] = Array.from(crypto.getRandomValues(new Uint8Array(43)));\n randomValues.forEach(v => (random += charset[v % charset.length]));\n return random;\n }\n\n Login = async (username: string, password: string) => {\n const client_id = process.env.CLIENT_ID as string;\n const nonce = crypto.randomBytes(43).toString('base64'); //CreateRandomString();\n const response_type = 'code';\n const redirect_uri = process.env.REDIRECT_URI as string;\n const response_mode = 'query';\n const scope = process.env.SCOPE as string;\n const state = crypto.randomBytes(43).toString('base64'); // CreateRandomString();\n const code_verifier = this.CreateRandomString();\n const code_challenge = crypto.createHash('sha256').update(code_verifier).digest('base64');\n const code_challenge_method = 'S256';\n\n const authoriseOptions: any = {\n email: username,\n password,\n client_id,\n nonce,\n response_type,\n redirect_uri,\n response_mode,\n scope,\n state,\n code_challenge,\n code_challenge_method\n }\n\n const url = `${this.#authEndpoint}${goptions.asapiroot}/login`;\n\n console.log(`Login ---------------------------------------------------------------------------`)\n console.log(`url: [${url}]`);\n console.log(`authoriseOptions: [${JSON.stringify(authoriseOptions)}]`);\n\n const agentManager = createAgentManager({\n httpAgentFactory(options) {\n return new http.Agent(options);\n },\n httpsAgentFactory(options) {\n return new https.Agent(options);\n }\n });\n\n const retVal = await axios(new STSAxiosConfig(url, 'post')\n .withDefaultHeaders()\n .withData(authoriseOptions)\n .withAgentManager(agentManager).config);\n\n //const cookieString = retVal.headers['set-cookie'];\n\n /*\n const api = request(this.#endpoint);\n const retVal: any = await (api as any)\n .post(`${goptions.asapiroot}/login`)\n .send(authoriseOptions)\n //.expect('set-cookie', /consent_cookie=.*; Max-Age=86; Path=\\/; Expires=.*; HttpOnly; Secure; SameSite=Strict/);\n\n const cookieString = retVal.header['set-cookie'];\n\n if (cookieString) {\n retVal.cookie = new Cookie(cookieString[0]);\n }\n */\n\n return retVal;\n }\n\n /*\n GetAuthServerAPITokenFromServer = async (): Promise<string> => {\n return await this.#authUtilsNode.GetAPITokenFromAuthServer(STSClientID.STSTestingService, \n \"eN9u0mHZLGWZrdnE1zit2vL6xwUFW466sTZcbkXDml5KWxlvKaZ1uiOZmA==\", \n goptions.asapiidentifier, this.#authEndpoint)\n }\n */\n\n StartDatabase = async () => {\n this.#databaseContainer = await new GenericContainer(\"postgres\")\n .withExposedPorts(5432)\n .withEnvironment({\n POSTGRES_PASSWORD: \"postgres\",\n //UV_THREADPOOL_SIZE: \"64\"\n })\n .withNetwork(this.#network)\n .withNetworkAliases(\"database\")\n .start();\n\n const httpPort = this.#databaseContainer.getMappedPort(5432);\n const host = this.#databaseContainer.getHost();\n const networkIpAddress = this.#databaseContainer.getIpAddress(this.#network.getName());\n \n process.env.DB_HOST = `${host}:${httpPort}`;\n\n $ResetOptions();\n\n this.LogDebugMessage(chalk.green(`httpPort: [${httpPort}]`));\n this.LogDebugMessage(chalk.green(`host: [${host}]`));\n this.LogDebugMessage(chalk.green(`networkIpAddress: [${networkIpAddress}]`));\n this.LogDebugMessage(chalk.green(`connectionString: [${goptions.connectionString}]`));\n this.LogDebugMessage(chalk.green(`defaultDatabaseConnectionString: [${goptions.defaultDatabaseConnectionString }]`));\n }\n\n StopDatabase = async () => {\n if (this.#databaseContainer) {\n await this.#databaseContainer.stop();\n\n this.LogDebugMessage(chalk.yellow(`Used the following parameters for the database during testing:`));\n this.LogDebugMessage(chalk.yellow(`connectionString: [${goptions.connectionString}]`));\n this.LogDebugMessage(chalk.yellow(`defaultDatabaseConnectionString: [${goptions.defaultDatabaseConnectionString }]`));\n }\n }\n\n // Note: .withCopyFilesToContainer and .withCopyContentToContainer have a defect in that Jest will not close. A file handle/stream is left open\n // within the underlying code.\n InitializeDatabase = async () => {\n const stsAuthContainerInit = await new GenericContainer(\"serza/stsauth:latest\")\n .withEnvironment({\n DB_USER: \"postgres\",\n DB_PASSWORD: \"postgres\",\n DB_HOST: \"database:5432\", // \"192.168.14.101\",\n POOL_SIZE: \"50\",\n MAX_CPU: \"2\",\n DEBUG: \"proc*\",\n HTTPS_SERVER_KEY_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.key\",\n HTTPS_SERVER_CERT_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.cert\",\n AS_ENDPOINT: \"https://stscore.stsmda.org\"\n })\n .withCommand([\"node\", \"dist/app\", \"create\"])\n .withNetwork(this.#network)\n .withNetworkAliases(\"stsauthrunnerinit\")\n .withWaitStrategy(Wait.forLogMessage(`User registered: {\"status\":200,\"detail\":{\"id\":\"USR_STSGlobalAdminUser@stsmda.com\",\"name\":\"STSGlobalAdminUser@stsmda.com\",\"email\":\"STSGlobalAdminUser@stsmda.com\",\"roles\":[]}}`))\n .start();\n\n await Sleep(500);\n\n await stsAuthContainerInit.stop();\n }\n\n StartRedis = async () => {\n this.#ioRedisContainer = await new GenericContainer(\"redis/redis-stack-server\")\n .withEnvironment({\n REDIS_ARGS: \"--save \\\"\\\" --appendonly no\",\n })\n .withExposedPorts(6379)\n .withNetwork(this.#network)\n .withNetworkAliases(\"redisstackserver\")\n //.withWaitStrategy(Wait.forLogMessage(`Ready to accept connections tcp`))\n .start();\n\n this.#ioRedisMessageProcessorUrl = `redis://${this.#ioRedisContainer.getHost()}:${this.#ioRedisContainer.getMappedPort(6379)}`; \n\n await Sleep(2000);\n //expect(goptions.imRedisMessageProcessorUrl).toEqual('redis://localhost:6379');\n // IM_REDIS_MESSAGE_PROCESSOR_URL\n\n this.LogDebugMessage(chalk.green(`redis/redis-stack-server Started. Server Details: ioRedisMessageProcessorUrl: [${this.#ioRedisMessageProcessorUrl}]`));\n }\n\n StopRedis = async () => {\n if (this.#ioRedisContainer) {\n await this.#ioRedisContainer.stop();\n await Sleep(200);\n }\n }\n\n StartAuthService = async () => {\n this.#stsAuthContainer = await new GenericContainer(\"serza/stsauth:latest\")\n .withExposedPorts(3002)\n .withEnvironment({\n DB_USER: \"postgres\",\n DB_PASSWORD: \"postgres\",\n DB_HOST: \"database:5432\", \n POOL_SIZE: \"50\",\n MAX_CPU: \"2\",\n DEBUG: \"proc*\",\n HTTPS_SERVER_KEY_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.key\",\n HTTPS_SERVER_CERT_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.cert\",\n AS_ENDPOINT: \"https://stscore.stsmda.org\",\n IM_REDIS_MESSAGE_PROCESSOR_URL: 'redis://redisstackserver:6379'\n })\n .withNetwork(this.#network)\n .withNetworkAliases(\"stsauthrunner\")\n .withWaitStrategy(Wait.forHttp(\"/stsauth/v1.0/latency\", 3002).usingTls().allowInsecure())\n .start();\n\n const httpAuthPort = this.#stsAuthContainer.getMappedPort(3002);\n\n await Sleep(200);\n this.#authHost = 'https://localhost'\n this.#authPort = httpAuthPort;\n this.#authEndpoint = `${this.#authHost}:${this.#authPort}`;\n this.LogDebugMessage(chalk.green(`STSAuth Started. Server Details: Host: [${this.#authHost}], Port: [${this.#authPort}]`));\n }\n\n StartFhirService = async () => {\n this.#stsFhirContainer = await new GenericContainer(\"serza/stsfhir:latest\")\n .withExposedPorts(3005)\n .withEnvironment({\n DB_USER: \"postgres\",\n DB_PASSWORD: \"postgres\",\n DB_HOST: \"database:5432\", \n POOL_SIZE: \"50\",\n MAX_CPU: \"2\",\n DEBUG: \"proc*\",\n HTTPS_SERVER_KEY_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.key\",\n HTTPS_SERVER_CERT_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.cert\",\n AS_ENDPOINT: 'https://stsauthrunner',\n AS_HOST_PORT: \"3002\",\n AS_PORT: \"3002\",\n IM_REDIS_MESSAGE_PROCESSOR_URL: 'redis://redisstackserver:6379',\n SOCKET_IO_REDIS_ADAPTOR_URL: 'redis://redisstackserver:6379',\n STSFHIR_PORT: \"3005\",\n STSFHIR_HOST_PORT: \"3005\",\n STSFHIR_ENDPOINT: \"https://stsfhirserver\", // \"https://stscore.stsmda.org\",\n UV_THREADPOOL_SIZE: \"64\",\n FORCE_COLOR: \"3\",\n //node dist/app usedb postgresResources\n })\n .withNetwork(this.#network)\n .withNetworkAliases(\"stsfhirserver\")\n //.withWaitStrategy(Wait.forHttp(\"/stsfhir/r5/latency\", 3005).usingTls().allowInsecure())\n .start();\n\n this.#stsFhirContainer.logs().then((stream: any) => {\n stream\n .on('data', (line: any) => process.stdout.write(line.toString()))\n .on('err', (line: any) => process.stderr.write(line.toString()))\n .on('end', () => console.log('Stream ended.'));\n });\n\n const httpFhirPort = this.#stsFhirContainer.getMappedPort(3005);\n\n await Sleep(200);\n this.#fhirHost = 'https://localhost'\n this.#fhirPort = httpFhirPort;\n this.#fhirEndpoint = `${this.#fhirHost}:${this.#fhirPort}`;\n this.LogDebugMessage(chalk.green(`STSFhir Started. Server Details: Host: [${this.#fhirHost}], Port: [${this.#fhirPort}]`));\n }\n\n StopAuthService = async () => {\n if (this.#stsAuthContainer) {\n await this.#stsAuthContainer.stop();\n await Sleep(200);\n }\n }\n\n StopRest01Service = async () => {\n if (this.#stsRest01Container) {\n await this.#stsRest01Container.stop();\n await Sleep(200);\n }\n }\n\n StopFhirService = async () => {\n if (this.#stsFhirContainer) {\n await this.#stsFhirContainer.stop();\n await Sleep(200);\n }\n }\n\n TestLoginAndVerify = async () => {\n expect.assertions(4);\n\n console.log(`TestLoginAndVerify:1`);\n\n const retVal = await this.Login('user01@stsmda.com.au', 'user01password');\n expect(retVal.status).toEqual(200);\n\n console.log(`TestLoginAndVerify:2`);\n\n this.LogDebugMessage(chalk.red(`${JSON.stringify(retVal.data)}`));\n this.LogDebugMessage(chalk.magenta(`${JSON.stringify(retVal.headers)}`));\n this.LogDebugMessage(chalk.yellow(`${JSON.stringify(retVal.headers['set-cookie'])}`));\n\n const cookies = retVal.headers['set-cookie'] as string[];\n this.LogDebugMessage(chalk.yellow(`${cookies[0]}`));\n this.LogDebugMessage(chalk.green(`${JSON.stringify(tough.Cookie.parse(cookies[0]))}`));\n\n console.log(`TestLoginAndVerify:3`);\n\n const cookie = tough.Cookie.parse(cookies[0]) as tough.Cookie;\n\n console.log(`TestLoginAndVerify:4`);\n\n const desiredCookieResultAxios = {\n key: 'consent_cookie',\n value: expect.stringMatching(this.#regexURLSafeStringComponent),\n path: '/',\n secure: true,\n httpOnly: true,\n sameSite: 'strict',\n }\n\n const cookieResult = JSON.parse(JSON.stringify(cookie));\n expect(cookieResult).toMatchObject(desiredCookieResultAxios);\n\n console.log(`TestLoginAndVerify:5`);\n\n const cookieExpireDate = new Date(cookie.expires as any);\n expect(cookieExpireDate.getTime()).toBeGreaterThan(new Date().getTime());\n\n const consentRequired = (process.env.CONSENT_REQUIRED as string).split(' ').sort();\n retVal.data.detail.consentRequired = retVal.data.detail.consentRequired.sort();\n\n console.log(`TestLoginAndVerify:6`);\n\n const desiredResult = {\n sessionId: expect.stringMatching(this.#regexSTSBase64),\n id_token: expect.stringMatching(this.#regexJWT),\n consentRequired\n }\n\n console.log(`TestLoginAndVerify:7`);\n\n expect(retVal.data.detail).toMatchObject(desiredResult);\n\n console.log(`TestLoginAndVerify:9`);\n }\n\n StartRest01Service = async () => {\n this.#stsRest01Container = await new GenericContainer(\"serza/stsrest01:latest\")\n .withExposedPorts(3003)\n .withEnvironment({\n DB_USER: \"postgres\",\n DB_PASSWORD: \"postgres\",\n DB_HOST: \"database:5432\", \n POOL_SIZE: \"50\",\n MAX_CPU: \"2\",\n DEBUG: \"proc*\",\n HTTPS_SERVER_KEY_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.key\",\n HTTPS_SERVER_CERT_PATH: \"/var/lib/sts/stsglobalresources/keys-tmp/server.cert\",\n //AS_ENDPOINT: \"https://stscore.stsmda.org\",\n AS_ENDPOINT: 'https://stsauthrunner', // this.authHost,\n //AS_ENDPOINT: 'https://localhost', // this.authHost,\n AS_HOST_PORT: '3002',\n AS_PORT: '3002',\n IM_REDIS_MESSAGE_PROCESSOR_URL: 'redis://redisstackserver:6379'\n //AS_HOST_PORT: this.authPort,\n //AS_PORT: this.authPort,\n\n //REST01_PORT: '3003',\n //REST01_HOST_PORT: '3003',\n //REST01_ENDPOINT: 'https://localhost' // 'https://stscore.stsmda.org'\n })\n .withNetwork(this.#network)\n .withNetworkAliases(\"rest01\")\n .withWaitStrategy(Wait.forHttp(\"/stsrest01/v1/latency\", 3003).usingTls().allowInsecure())\n .start();\n\n const httpRest01Port = this.#stsRest01Container.getMappedPort(3003);\n\n await Sleep(200);\n\n this.#rest01Host = 'https://localhost'\n this.#rest01Port = httpRest01Port;\n this.#rest01Endpoint = `${this.#rest01Host}:${this.#rest01Port}`;\n\n this.LogDebugMessage(chalk.green(`STSRest01 Started. Server Details: Host: [${this.rest01Host}], Port: [${this.rest01Port}]`));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,aAAb,MAAwB;CAEpB,+BAA+B;CAE/B,kBAAkB;CAClB,YAAY;CACZ;CAEA;CACA;CACA;CACA;CACA;CAEA,8BAAsC;CAEtC,gBAAgB;CAChB,YAAY;CACZ,YAAY;CAEZ,cAAc;CACd,cAAc;CACd,kBAAkB;CAElB,YAAY;CACZ,YAAY;CACZ,gBAAgB;CAEhB,cAAc;AACV,QAAA,eAAqB;;CAGzB,gBAAgB,SAAc;AAC1B,oBAAA,cAAc,MAAM,QAAQ;;CAGhC,eAAe,YAAY;AACvB,QAAA,UAAgB,MAAM,IAAI,eAAA,SAAS,CAAC,OAAO;;CAG/C,cAAc,YAAY;AACtB,MAAI,MAAA,QACA,OAAM,MAAA,QAAc,MAAM;;CAIlC,IAAI,UAAU;AACV,SAAO,MAAA;;CAGX,IAAI,WAAW;AACX,SAAO,MAAA;;CAGX,IAAI,WAAW;AACX,SAAO,MAAA;;CAGX,IAAI,eAAe;AACf,SAAO,MAAA;;CAGX,IAAI,aAAa;AACb,SAAO,MAAA;;CAGX,IAAI,aAAa;AACb,SAAO,MAAA;;CAGX,IAAI,iBAAiB;AACjB,SAAO,MAAA;;CAGX,IAAI,WAAW;AACX,SAAO,MAAA;;CAGX,IAAI,WAAW;AACX,SAAO,MAAA;;CAGX,IAAI,eAAe;AACf,SAAO,MAAA;;CAGX,IAAI,6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