@ldo/test-solid-server 1.0.0-alpha.36 → 1.0.0-alpha.43

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.
Files changed (41) hide show
  1. package/Readme.md +1 -1
  2. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +2 -9
  3. package/dist/authFetch.cjs +14 -21
  4. package/dist/{authFetch.js → authFetch.mjs} +8 -15
  5. package/dist/authFetch.mjs.map +1 -0
  6. package/dist/createServer.cjs +10 -12
  7. package/dist/createServer.d.cts +0 -2
  8. package/dist/createServer.d.cts.map +1 -1
  9. package/dist/{createServer.d.ts → createServer.d.mts} +2 -4
  10. package/dist/createServer.d.mts.map +1 -0
  11. package/dist/{createServer.js → createServer.mjs} +3 -5
  12. package/dist/createServer.mjs.map +1 -0
  13. package/dist/index.cjs +8 -8
  14. package/dist/index.d.mts +4 -0
  15. package/dist/index.mjs +4 -0
  16. package/dist/resourceUtils.cjs +1 -3
  17. package/dist/resourceUtils.d.cts.map +1 -1
  18. package/dist/{resourceUtils.d.ts → resourceUtils.d.mts} +2 -2
  19. package/dist/resourceUtils.d.mts.map +1 -0
  20. package/dist/{resourceUtils.js → resourceUtils.mjs} +2 -2
  21. package/dist/resourceUtils.mjs.map +1 -0
  22. package/dist/setupTestServer.cjs +17 -17
  23. package/dist/setupTestServer.d.cts +0 -2
  24. package/dist/setupTestServer.d.cts.map +1 -1
  25. package/dist/{setupTestServer.d.ts → setupTestServer.d.mts} +3 -5
  26. package/dist/setupTestServer.d.mts.map +1 -0
  27. package/dist/{setupTestServer.js → setupTestServer.mjs} +6 -7
  28. package/dist/setupTestServer.mjs.map +1 -0
  29. package/package.json +8 -7
  30. package/src/configs/server-config-without-websocket.json +1 -1
  31. package/src/configs/server-config.json +1 -1
  32. package/src/configs/solid-css-seed.json +2 -4
  33. package/dist/authFetch.js.map +0 -1
  34. package/dist/createServer.d.ts.map +0 -1
  35. package/dist/createServer.js.map +0 -1
  36. package/dist/index.d.ts +0 -4
  37. package/dist/index.js +0 -5
  38. package/dist/resourceUtils.d.ts.map +0 -1
  39. package/dist/resourceUtils.js.map +0 -1
  40. package/dist/setupTestServer.d.ts.map +0 -1
  41. package/dist/setupTestServer.js.map +0 -1
package/Readme.md CHANGED
@@ -14,4 +14,4 @@ Use the following to run your tests
14
14
 
15
15
  ```
16
16
  "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
17
- ```
17
+ ```
@@ -1,4 +1,4 @@
1
- //#region rolldown:runtime
1
+ //#region \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,12 +19,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
19
  value: mod,
20
20
  enumerable: true
21
21
  }) : target, mod));
22
-
23
22
  //#endregion
24
-
25
- Object.defineProperty(exports, '__toESM', {
26
- enumerable: true,
27
- get: function () {
28
- return __toESM;
29
- }
30
- });
23
+ exports.__toESM = __toESM;
@@ -1,7 +1,7 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const __inrupt_solid_client_authn_core = require_rolldown_runtime.__toESM(require("@inrupt/solid-client-authn-core"));
3
- const cross_fetch = require_rolldown_runtime.__toESM(require("cross-fetch"));
4
-
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ let _inrupt_solid_client_authn_core = require("@inrupt/solid-client-authn-core");
3
+ let cross_fetch = require("cross-fetch");
4
+ cross_fetch = require_runtime.__toESM(cross_fetch);
5
5
  //#region src/authFetch.ts
6
6
  const config = {
7
7
  podName: "example",
@@ -12,8 +12,7 @@ async function reportError(response) {
12
12
  if (response.status >= 400) console.error(await response.text());
13
13
  }
14
14
  async function getAuthorization(port) {
15
- const indexResponse = await (0, cross_fetch.default)(`http://localhost:${port}/.account/`);
16
- const { controls } = await indexResponse.json();
15
+ const { controls } = await (await (0, cross_fetch.default)(`http://localhost:${port}/.account/`)).json();
17
16
  const response = await (0, cross_fetch.default)(controls.password.login, {
18
17
  method: "POST",
19
18
  headers: { "content-type": "application/json" },
@@ -23,12 +22,10 @@ async function getAuthorization(port) {
23
22
  })
24
23
  });
25
24
  await reportError(response);
26
- const result = await response.json();
27
- return result.authorization;
25
+ return (await response.json()).authorization;
28
26
  }
29
27
  async function getSecret(port, authorization) {
30
- const indexResponse = await (0, cross_fetch.default)(`http://localhost:${port}/.account/`, { headers: { authorization: `CSS-Account-Token ${authorization}` } });
31
- const { controls } = await indexResponse.json();
28
+ const { controls } = await (await (0, cross_fetch.default)(`http://localhost:${port}/.account/`, { headers: { authorization: `CSS-Account-Token ${authorization}` } })).json();
32
29
  const response = await (0, cross_fetch.default)(controls.account.clientCredentials, {
33
30
  method: "POST",
34
31
  headers: {
@@ -41,12 +38,11 @@ async function getSecret(port, authorization) {
41
38
  })
42
39
  });
43
40
  await reportError(response);
44
- const response2 = await response.json();
45
- return response2;
41
+ return await response.json();
46
42
  }
47
43
  async function getAccessToken(port, id, secret) {
48
44
  try {
49
- const dpopKey = await (0, __inrupt_solid_client_authn_core.generateDpopKeyPair)();
45
+ const dpopKey = await (0, _inrupt_solid_client_authn_core.generateDpopKeyPair)();
50
46
  const authString = `${encodeURIComponent(id)}:${encodeURIComponent(secret)}`;
51
47
  const tokenUrl = `http://localhost:${port}/.oidc/token`;
52
48
  const response = await (0, cross_fetch.default)(tokenUrl, {
@@ -54,14 +50,13 @@ async function getAccessToken(port, id, secret) {
54
50
  headers: {
55
51
  authorization: `Basic ${Buffer.from(authString).toString("base64")}`,
56
52
  "content-type": "application/x-www-form-urlencoded",
57
- dpop: await (0, __inrupt_solid_client_authn_core.createDpopHeader)(tokenUrl, "POST", dpopKey)
53
+ dpop: await (0, _inrupt_solid_client_authn_core.createDpopHeader)(tokenUrl, "POST", dpopKey)
58
54
  },
59
55
  body: "grant_type=client_credentials&scope=webid"
60
56
  });
61
57
  await reportError(response);
62
- const response2 = await response.json();
63
58
  return {
64
- accessToken: response2.access_token,
59
+ accessToken: (await response.json()).access_token,
65
60
  dpopKey
66
61
  };
67
62
  } catch (err) {
@@ -70,11 +65,9 @@ async function getAccessToken(port, id, secret) {
70
65
  }
71
66
  }
72
67
  async function generateAuthFetch(port) {
73
- const authorization = await getAuthorization(port);
74
- const { id, secret } = await getSecret(port, authorization);
68
+ const { id, secret } = await getSecret(port, await getAuthorization(port));
75
69
  const { accessToken, dpopKey } = await getAccessToken(port, id, secret);
76
- return await (0, __inrupt_solid_client_authn_core.buildAuthenticatedFetch)(accessToken, { dpopKey });
70
+ return await (0, _inrupt_solid_client_authn_core.buildAuthenticatedFetch)(accessToken, { dpopKey });
77
71
  }
78
-
79
72
  //#endregion
80
- exports.generateAuthFetch = generateAuthFetch;
73
+ exports.generateAuthFetch = generateAuthFetch;
@@ -1,6 +1,5 @@
1
1
  import { buildAuthenticatedFetch, createDpopHeader, generateDpopKeyPair } from "@inrupt/solid-client-authn-core";
2
2
  import fetch from "cross-fetch";
3
-
4
3
  //#region src/authFetch.ts
5
4
  const config = {
6
5
  podName: "example",
@@ -11,8 +10,7 @@ async function reportError(response) {
11
10
  if (response.status >= 400) console.error(await response.text());
12
11
  }
13
12
  async function getAuthorization(port) {
14
- const indexResponse = await fetch(`http://localhost:${port}/.account/`);
15
- const { controls } = await indexResponse.json();
13
+ const { controls } = await (await fetch(`http://localhost:${port}/.account/`)).json();
16
14
  const response = await fetch(controls.password.login, {
17
15
  method: "POST",
18
16
  headers: { "content-type": "application/json" },
@@ -22,12 +20,10 @@ async function getAuthorization(port) {
22
20
  })
23
21
  });
24
22
  await reportError(response);
25
- const result = await response.json();
26
- return result.authorization;
23
+ return (await response.json()).authorization;
27
24
  }
28
25
  async function getSecret(port, authorization) {
29
- const indexResponse = await fetch(`http://localhost:${port}/.account/`, { headers: { authorization: `CSS-Account-Token ${authorization}` } });
30
- const { controls } = await indexResponse.json();
26
+ const { controls } = await (await fetch(`http://localhost:${port}/.account/`, { headers: { authorization: `CSS-Account-Token ${authorization}` } })).json();
31
27
  const response = await fetch(controls.account.clientCredentials, {
32
28
  method: "POST",
33
29
  headers: {
@@ -40,8 +36,7 @@ async function getSecret(port, authorization) {
40
36
  })
41
37
  });
42
38
  await reportError(response);
43
- const response2 = await response.json();
44
- return response2;
39
+ return await response.json();
45
40
  }
46
41
  async function getAccessToken(port, id, secret) {
47
42
  try {
@@ -58,9 +53,8 @@ async function getAccessToken(port, id, secret) {
58
53
  body: "grant_type=client_credentials&scope=webid"
59
54
  });
60
55
  await reportError(response);
61
- const response2 = await response.json();
62
56
  return {
63
- accessToken: response2.access_token,
57
+ accessToken: (await response.json()).access_token,
64
58
  dpopKey
65
59
  };
66
60
  } catch (err) {
@@ -69,12 +63,11 @@ async function getAccessToken(port, id, secret) {
69
63
  }
70
64
  }
71
65
  async function generateAuthFetch(port) {
72
- const authorization = await getAuthorization(port);
73
- const { id, secret } = await getSecret(port, authorization);
66
+ const { id, secret } = await getSecret(port, await getAuthorization(port));
74
67
  const { accessToken, dpopKey } = await getAccessToken(port, id, secret);
75
68
  return await buildAuthenticatedFetch(accessToken, { dpopKey });
76
69
  }
77
-
78
70
  //#endregion
79
71
  export { generateAuthFetch };
80
- //# sourceMappingURL=authFetch.js.map
72
+
73
+ //# sourceMappingURL=authFetch.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authFetch.mjs","names":[],"sources":["../src/authFetch.ts"],"sourcesContent":["import type { KeyPair } from \"@inrupt/solid-client-authn-core\";\nimport {\n buildAuthenticatedFetch,\n createDpopHeader,\n generateDpopKeyPair,\n} from \"@inrupt/solid-client-authn-core\";\nimport fetch from \"cross-fetch\";\n\nconst config = {\n podName: \"example\",\n email: \"hello@example.com\",\n password: \"abc123\",\n};\n\nasync function reportError(response: Response) {\n if (response.status >= 400) {\n console.error(await response.text());\n }\n}\n\nasync function getAuthorization(port: number): Promise<string> {\n // First we request the account API controls to find out where we can log in\n const indexResponse = await fetch(`http://localhost:${port}/.account/`);\n const { controls } = await indexResponse.json();\n\n // And then we log in to the account API\n const response = await fetch(controls.password.login, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n email: config.email,\n password: config.password,\n }),\n });\n // This authorization value will be used to authenticate in the next step\n await reportError(response);\n const result = await response.json();\n return result.authorization;\n}\n\nasync function getSecret(\n port: number,\n authorization: string,\n): Promise<{ id: string; secret: string; resource: string }> {\n // Now that we are logged in, we need to request the updated controls from the server.\n // These will now have more values than in the previous example.\n const indexResponse = await fetch(`http://localhost:${port}/.account/`, {\n headers: { authorization: `CSS-Account-Token ${authorization}` },\n });\n const { controls } = await indexResponse.json();\n\n // Here we request the server to generate a token on our account\n const response = await fetch(controls.account.clientCredentials, {\n method: \"POST\",\n headers: {\n authorization: `CSS-Account-Token ${authorization}`,\n \"content-type\": \"application/json\",\n },\n // The name field will be used when generating the ID of your token.\n // The WebID field determines which WebID you will identify as when using the token.\n // Only WebIDs linked to your account can be used.\n body: JSON.stringify({\n name: \"my-token\",\n webId: `http://localhost:${port}/${config.podName}/profile/card#me`,\n }),\n });\n await reportError(response);\n // These are the identifier and secret of your token.\n // Store the secret somewhere safe as there is no way to request it again from the server!\n // The `resource` value can be used to delete the token at a later point in time.\n const response2 = await response.json();\n return response2;\n}\n\nasync function getAccessToken(\n port: number,\n id: string,\n secret: string,\n): Promise<{ accessToken: string; dpopKey: KeyPair }> {\n try {\n // A key pair is needed for encryption.\n // This function from `solid-client-authn` generates such a pair for you.\n const dpopKey = await generateDpopKeyPair();\n\n // These are the ID and secret generated in the previous step.\n // Both the ID and the secret need to be form-encoded.\n const authString = `${encodeURIComponent(id)}:${encodeURIComponent(\n secret,\n )}`;\n // This URL can be found by looking at the \"token_endpoint\" field at\n // http://localhost:PORT/.well-known/openid-configuration\n // if your server is hosted at http://localhost:3000/.\n const tokenUrl = `http://localhost:${port}/.oidc/token`;\n const response = await fetch(tokenUrl, {\n method: \"POST\",\n headers: {\n // The header needs to be in base64 encoding.\n authorization: `Basic ${Buffer.from(authString).toString(\"base64\")}`,\n \"content-type\": \"application/x-www-form-urlencoded\",\n dpop: await createDpopHeader(tokenUrl, \"POST\", dpopKey),\n },\n body: \"grant_type=client_credentials&scope=webid\",\n });\n await reportError(response);\n // This is the Access token that will be used to do an authenticated request to the server.\n // The JSON also contains an \"expires_in\" field in seconds,\n // which you can use to know when you need request a new Access token.\n const response2 = await response.json();\n return { accessToken: response2.access_token, dpopKey };\n } catch (err) {\n console.error(err);\n throw err;\n }\n}\n\nexport async function generateAuthFetch(port: number) {\n const authorization = await getAuthorization(port);\n const { id, secret } = await getSecret(port, authorization);\n const { accessToken, dpopKey } = await getAccessToken(port, id, secret);\n return await buildAuthenticatedFetch(accessToken, { dpopKey });\n}\n"],"mappings":";;;AAQA,MAAM,SAAS;CACb,SAAS;CACT,OAAO;CACP,UAAU;CACX;AAED,eAAe,YAAY,UAAoB;AAC7C,KAAI,SAAS,UAAU,IACrB,SAAQ,MAAM,MAAM,SAAS,MAAM,CAAC;;AAIxC,eAAe,iBAAiB,MAA+B;CAG7D,MAAM,EAAE,aAAa,OADC,MAAM,MAAM,oBAAoB,KAAK,YAAY,EAC9B,MAAM;CAG/C,MAAM,WAAW,MAAM,MAAM,SAAS,SAAS,OAAO;EACpD,QAAQ;EACR,SAAS,EAAE,gBAAgB,oBAAoB;EAC/C,MAAM,KAAK,UAAU;GACnB,OAAO,OAAO;GACd,UAAU,OAAO;GAClB,CAAC;EACH,CAAC;AAEF,OAAM,YAAY,SAAS;AAE3B,SADe,MAAM,SAAS,MAAM,EACtB;;AAGhB,eAAe,UACb,MACA,eAC2D;CAM3D,MAAM,EAAE,aAAa,OAHC,MAAM,MAAM,oBAAoB,KAAK,aAAa,EACtE,SAAS,EAAE,eAAe,qBAAqB,iBAAiB,EACjE,CAAC,EACuC,MAAM;CAG/C,MAAM,WAAW,MAAM,MAAM,SAAS,QAAQ,mBAAmB;EAC/D,QAAQ;EACR,SAAS;GACP,eAAe,qBAAqB;GACpC,gBAAgB;GACjB;EAID,MAAM,KAAK,UAAU;GACnB,MAAM;GACN,OAAO,oBAAoB,KAAK,GAAG,OAAO,QAAQ;GACnD,CAAC;EACH,CAAC;AACF,OAAM,YAAY,SAAS;AAK3B,QADkB,MAAM,SAAS,MAAM;;AAIzC,eAAe,eACb,MACA,IACA,QACoD;AACpD,KAAI;EAGF,MAAM,UAAU,MAAM,qBAAqB;EAI3C,MAAM,aAAa,GAAG,mBAAmB,GAAG,CAAC,GAAG,mBAC9C,OACD;EAID,MAAM,WAAW,oBAAoB,KAAK;EAC1C,MAAM,WAAW,MAAM,MAAM,UAAU;GACrC,QAAQ;GACR,SAAS;IAEP,eAAe,SAAS,OAAO,KAAK,WAAW,CAAC,SAAS,SAAS;IAClE,gBAAgB;IAChB,MAAM,MAAM,iBAAiB,UAAU,QAAQ,QAAQ;IACxD;GACD,MAAM;GACP,CAAC;AACF,QAAM,YAAY,SAAS;AAK3B,SAAO;GAAE,cADS,MAAM,SAAS,MAAM,EACP;GAAc;GAAS;UAChD,KAAK;AACZ,UAAQ,MAAM,IAAI;AAClB,QAAM;;;AAIV,eAAsB,kBAAkB,MAAc;CAEpD,MAAM,EAAE,IAAI,WAAW,MAAM,UAAU,MADjB,MAAM,iBAAiB,KAAK,CACS;CAC3D,MAAM,EAAE,aAAa,YAAY,MAAM,eAAe,MAAM,IAAI,OAAO;AACvE,QAAO,MAAM,wBAAwB,aAAa,EAAE,SAAS,CAAC"}
@@ -1,9 +1,9 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const path = require_rolldown_runtime.__toESM(require("path"));
3
- const __solid_community_server = require_rolldown_runtime.__toESM(require("@solid/community-server"));
4
- const node_path = require_rolldown_runtime.__toESM(require("node:path"));
5
- const node_url = require_rolldown_runtime.__toESM(require("node:url"));
6
-
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ let path = require("path");
3
+ path = require_runtime.__toESM(path);
4
+ let _solid_community_server = require("@solid/community-server");
5
+ let node_path = require("node:path");
6
+ let node_url = require("node:url");
7
7
  //#region src/createServer.ts
8
8
  const __dirname$1 = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
9
9
  async function createApp(port, customConfigPath) {
@@ -11,13 +11,12 @@ async function createApp(port, customConfigPath) {
11
11
  start: () => {},
12
12
  stop: () => {}
13
13
  };
14
- const appRunner = new __solid_community_server.AppRunner();
15
- return appRunner.create({
14
+ return new _solid_community_server.AppRunner().create({
16
15
  loaderProperties: {
17
- mainModulePath: (0, __solid_community_server.resolveModulePath)(""),
16
+ mainModulePath: (0, _solid_community_server.resolveModulePath)(""),
18
17
  typeChecking: false
19
18
  },
20
- config: customConfigPath ?? (0, __solid_community_server.resolveModulePath)("config/file-root.json"),
19
+ config: customConfigPath ?? (0, _solid_community_server.resolveModulePath)("config/file-root.json"),
21
20
  variableBindings: {},
22
21
  shorthand: {
23
22
  port,
@@ -27,6 +26,5 @@ async function createApp(port, customConfigPath) {
27
26
  }
28
27
  });
29
28
  }
30
-
31
29
  //#endregion
32
- exports.createApp = createApp;
30
+ exports.createApp = createApp;
@@ -2,8 +2,6 @@ import { App } from "@solid/community-server";
2
2
 
3
3
  //#region src/createServer.d.ts
4
4
  declare function createApp(port: number, customConfigPath?: string): Promise<App>;
5
- //# sourceMappingURL=createServer.d.ts.map
6
-
7
5
  //#endregion
8
6
  export { createApp };
9
7
  //# sourceMappingURL=createServer.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createServer.d.cts","names":[],"sources":["../../src/createServer.ts"],"sourcesContent":[],"mappings":";;;iBAYsB,SAAA,2CAGnB,QAAQ"}
1
+ {"version":3,"file":"createServer.d.cts","names":[],"sources":["../src/createServer.ts"],"mappings":";;;iBAYsB,SAAA,CACpB,IAAA,UACA,gBAAA,YACC,OAAA,CAAQ,GAAA"}
@@ -2,8 +2,6 @@ import { App } from "@solid/community-server";
2
2
 
3
3
  //#region src/createServer.d.ts
4
4
  declare function createApp(port: number, customConfigPath?: string): Promise<App>;
5
- //# sourceMappingURL=createServer.d.ts.map
6
-
7
5
  //#endregion
8
- export { createApp as createApp$1 };
9
- //# sourceMappingURL=createServer.d.ts.map
6
+ export { createApp };
7
+ //# sourceMappingURL=createServer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createServer.d.mts","names":[],"sources":["../src/createServer.ts"],"mappings":";;;iBAYsB,SAAA,CACpB,IAAA,UACA,gBAAA,YACC,OAAA,CAAQ,GAAA"}
@@ -2,7 +2,6 @@ import * as path$1 from "path";
2
2
  import { AppRunner, resolveModulePath } from "@solid/community-server";
3
3
  import { dirname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
-
6
5
  //#region src/createServer.ts
7
6
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
7
  async function createApp(port, customConfigPath) {
@@ -10,8 +9,7 @@ async function createApp(port, customConfigPath) {
10
9
  start: () => {},
11
10
  stop: () => {}
12
11
  };
13
- const appRunner = new AppRunner();
14
- return appRunner.create({
12
+ return new AppRunner().create({
15
13
  loaderProperties: {
16
14
  mainModulePath: resolveModulePath(""),
17
15
  typeChecking: false
@@ -26,7 +24,7 @@ async function createApp(port, customConfigPath) {
26
24
  }
27
25
  });
28
26
  }
29
-
30
27
  //#endregion
31
28
  export { createApp };
32
- //# sourceMappingURL=createServer.js.map
29
+
30
+ //# sourceMappingURL=createServer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createServer.mjs","names":["path"],"sources":["../src/createServer.ts"],"sourcesContent":["// Taken from https://github.com/comunica/comunica/blob/b237be4265c353a62a876187d9e21e3bc05123a3/engines/query-sparql/test/QuerySparql-solid-test.ts#L9\n\nimport * as path from \"path\";\nimport type { App } from \"@solid/community-server\";\nimport { AppRunner, resolveModulePath } from \"@solid/community-server\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async function createApp(\n port: number,\n customConfigPath?: string,\n): Promise<App> {\n if (process.env.SERVER) {\n return {\n start: () => {},\n stop: () => {},\n } as App;\n }\n const appRunner = new AppRunner();\n\n return appRunner.create({\n loaderProperties: {\n mainModulePath: resolveModulePath(\"\"),\n typeChecking: false,\n },\n config: customConfigPath ?? resolveModulePath(\"config/file-root.json\"),\n variableBindings: {},\n shorthand: {\n port: port,\n loggingLevel: \"off\",\n seedConfig: path.join(__dirname, \"configs\", \"solid-css-seed.json\"),\n rootFilePath: path.join(__dirname, `./data${port}`),\n },\n });\n}\n"],"mappings":";;;;;AAUA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,eAAsB,UACpB,MACA,kBACc;AACd,KAAI,QAAQ,IAAI,OACd,QAAO;EACL,aAAa;EACb,YAAY;EACb;AAIH,QAFkB,IAAI,WAAW,CAEhB,OAAO;EACtB,kBAAkB;GAChB,gBAAgB,kBAAkB,GAAG;GACrC,cAAc;GACf;EACD,QAAQ,oBAAoB,kBAAkB,wBAAwB;EACtE,kBAAkB,EAAE;EACpB,WAAW;GACH;GACN,cAAc;GACd,YAAYA,OAAK,KAAK,WAAW,WAAW,sBAAsB;GAClE,cAAcA,OAAK,KAAK,WAAW,SAAS,OAAO;GACpD;EACF,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- const require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_createServer = require('./createServer.cjs');
2
- const require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_resourceUtils = require('./resourceUtils.cjs');
3
- const require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_setupTestServer = require('./setupTestServer.cjs');
4
-
5
- exports.cleanResources = require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_resourceUtils.cleanResources;
6
- exports.createApp = require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_createServer.createApp;
7
- exports.initResources = require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_resourceUtils.initResources;
8
- exports.setupServer = require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_setupTestServer.setupServer;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_createServer = require("./createServer.cjs");
3
+ const require_resourceUtils = require("./resourceUtils.cjs");
4
+ const require_setupTestServer = require("./setupTestServer.cjs");
5
+ exports.cleanResources = require_resourceUtils.cleanResources;
6
+ exports.createApp = require_createServer.createApp;
7
+ exports.initResources = require_resourceUtils.initResources;
8
+ exports.setupServer = require_setupTestServer.setupServer;
@@ -0,0 +1,4 @@
1
+ import { createApp } from "./createServer.mjs";
2
+ import { ResourceInfo, cleanResources, initResources } from "./resourceUtils.mjs";
3
+ import { setupServer } from "./setupTestServer.mjs";
4
+ export { ResourceInfo, cleanResources, createApp, initResources, setupServer };
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { createApp } from "./createServer.mjs";
2
+ import { cleanResources, initResources } from "./resourceUtils.mjs";
3
+ import { setupServer } from "./setupTestServer.mjs";
4
+ export { cleanResources, createApp, initResources, setupServer };
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/resourceUtils.ts
3
2
  async function initResources(rootUri, resourceInfo, authFetch) {
4
3
  if (resourceInfo?.shouldNotInit) return;
@@ -23,7 +22,6 @@ async function cleanResources(rootUri, resourceInfo, authFetch) {
23
22
  await authFetch(`${rootUri}${resourceInfo.slug}`, { method: "DELETE" });
24
23
  } else await authFetch(`${rootUri}${resourceInfo.slug}`, { method: "DELETE" });
25
24
  }
26
-
27
25
  //#endregion
28
26
  exports.cleanResources = cleanResources;
29
- exports.initResources = initResources;
27
+ exports.initResources = initResources;
@@ -1 +1 @@
1
- {"version":3,"file":"resourceUtils.d.cts","names":[],"sources":["../../src/resourceUtils.ts"],"sourcesContent":[],"mappings":";KAAY,YAAA,GAAe,gBAAgB;AAA3C,UAEU,aAAA,CAFc;EAAA,IAAA,EAAA,MAAA;EAAA,WAAG,EAAA,IAAA;EAAa,aAAG,CAAA,EAAA,OAAA;EAAQ,QAAA,EAAA,CAMtC,aANsC,GAMtB,QANsB,CAAA,EAAA;AAAC;UAS1C,QAAA,CAPa;EAAA,IAIV,EAAA,MAAA;EAAa,WAAG,EAAA,KAAA;EAAQ,IAAA,EAAA,MAAA;EAG3B,aAAQ,CAAA,EAAA,OAAA;EAQI,QAAA,EAAA,MAAa;;AAEnB,iBAFM,aAAA,CAEN,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,YAAA,EAAA,SAAA,EAAA,OACI,KADJ,CAAA,EAEb,OAFa,CAAA,IAAA,CAAA;AACI,iBA+BE,cAAA,CA/BF,OAAA,EAAA,MAAA,EAAA,YAAA,EAiCJ,YAjCI,EAAA,SAAA,EAAA,OAkCA,KAlCA,CAAA,EAmCjB,OAnCiB,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"resourceUtils.d.cts","names":[],"sources":["../src/resourceUtils.ts"],"mappings":";KAAY,YAAA,GAAe,aAAA,GAAgB,QAAA;AAAA,UAEjC,aAAA;EACR,IAAA;EACA,WAAA;EACA,aAAA;EACA,QAAA,GAAW,aAAA,GAAgB,QAAA;AAAA;AAAA,UAGnB,QAAA;EACR,IAAA;EACA,WAAA;EACA,IAAA;EACA,aAAA;EACA,QAAA;AAAA;AAAA,iBAGoB,aAAA,CACpB,OAAA,UACA,YAAA,EAAc,YAAA,EACd,SAAA,SAAkB,KAAA,GACjB,OAAA;AAAA,iBA8BmB,cAAA,CACpB,OAAA,UACA,YAAA,EAAc,YAAA,EACd,SAAA,SAAkB,KAAA,GACjB,OAAA"}
@@ -16,5 +16,5 @@ interface LeafInfo {
16
16
  declare function initResources(rootUri: string, resourceInfo: ResourceInfo, authFetch: typeof fetch): Promise<void>;
17
17
  declare function cleanResources(rootUri: string, resourceInfo: ResourceInfo, authFetch: typeof fetch): Promise<void>;
18
18
  //#endregion
19
- export { ResourceInfo, cleanResources as cleanResources$1, initResources as initResources$1 };
20
- //# sourceMappingURL=resourceUtils.d.ts.map
19
+ export { ResourceInfo, cleanResources, initResources };
20
+ //# sourceMappingURL=resourceUtils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceUtils.d.mts","names":[],"sources":["../src/resourceUtils.ts"],"mappings":";KAAY,YAAA,GAAe,aAAA,GAAgB,QAAA;AAAA,UAEjC,aAAA;EACR,IAAA;EACA,WAAA;EACA,aAAA;EACA,QAAA,GAAW,aAAA,GAAgB,QAAA;AAAA;AAAA,UAGnB,QAAA;EACR,IAAA;EACA,WAAA;EACA,IAAA;EACA,aAAA;EACA,QAAA;AAAA;AAAA,iBAGoB,aAAA,CACpB,OAAA,UACA,YAAA,EAAc,YAAA,EACd,SAAA,SAAkB,KAAA,GACjB,OAAA;AAAA,iBA8BmB,cAAA,CACpB,OAAA,UACA,YAAA,EAAc,YAAA,EACd,SAAA,SAAkB,KAAA,GACjB,OAAA"}
@@ -22,7 +22,7 @@ async function cleanResources(rootUri, resourceInfo, authFetch) {
22
22
  await authFetch(`${rootUri}${resourceInfo.slug}`, { method: "DELETE" });
23
23
  } else await authFetch(`${rootUri}${resourceInfo.slug}`, { method: "DELETE" });
24
24
  }
25
-
26
25
  //#endregion
27
26
  export { cleanResources, initResources };
28
- //# sourceMappingURL=resourceUtils.js.map
27
+
28
+ //# sourceMappingURL=resourceUtils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceUtils.mjs","names":[],"sources":["../src/resourceUtils.ts"],"sourcesContent":["export type ResourceInfo = ContainerInfo | LeafInfo;\n\ninterface ContainerInfo {\n slug: string;\n isContainer: true;\n shouldNotInit?: boolean;\n contains: (ContainerInfo | LeafInfo)[];\n}\n\ninterface LeafInfo {\n slug: string;\n isContainer: false;\n data: string;\n shouldNotInit?: boolean;\n mimeType: string;\n}\n\nexport async function initResources(\n rootUri: string,\n resourceInfo: ResourceInfo,\n authFetch: typeof fetch,\n): Promise<void> {\n if (resourceInfo?.shouldNotInit) return;\n if (resourceInfo.isContainer) {\n await authFetch(rootUri, {\n method: \"POST\",\n headers: {\n link: '<http://www.w3.org/ns/ldp#Container>; rel=\"type\"',\n slug: resourceInfo.slug,\n },\n });\n await Promise.all(\n resourceInfo.contains.map((subResourceInfo) =>\n initResources(\n `${rootUri}${resourceInfo.slug}`,\n subResourceInfo,\n authFetch,\n ),\n ),\n );\n } else {\n await authFetch(`${rootUri}${resourceInfo.slug}`, {\n method: \"PUT\",\n headers: {\n \"content-type\": resourceInfo.mimeType,\n },\n body: resourceInfo.data,\n });\n }\n}\n\nexport async function cleanResources(\n rootUri: string,\n resourceInfo: ResourceInfo,\n authFetch: typeof fetch,\n): Promise<void> {\n if (resourceInfo.isContainer) {\n await Promise.all(\n resourceInfo.contains.map((subResourceInfo) =>\n cleanResources(\n `${rootUri}${resourceInfo.slug}`,\n subResourceInfo,\n authFetch,\n ),\n ),\n );\n await authFetch(`${rootUri}${resourceInfo.slug}`, {\n method: \"DELETE\",\n });\n } else {\n await authFetch(`${rootUri}${resourceInfo.slug}`, {\n method: \"DELETE\",\n });\n }\n}\n"],"mappings":";AAiBA,eAAsB,cACpB,SACA,cACA,WACe;AACf,KAAI,cAAc,cAAe;AACjC,KAAI,aAAa,aAAa;AAC5B,QAAM,UAAU,SAAS;GACvB,QAAQ;GACR,SAAS;IACP,MAAM;IACN,MAAM,aAAa;IACpB;GACF,CAAC;AACF,QAAM,QAAQ,IACZ,aAAa,SAAS,KAAK,oBACzB,cACE,GAAG,UAAU,aAAa,QAC1B,iBACA,UACD,CACF,CACF;OAED,OAAM,UAAU,GAAG,UAAU,aAAa,QAAQ;EAChD,QAAQ;EACR,SAAS,EACP,gBAAgB,aAAa,UAC9B;EACD,MAAM,aAAa;EACpB,CAAC;;AAIN,eAAsB,eACpB,SACA,cACA,WACe;AACf,KAAI,aAAa,aAAa;AAC5B,QAAM,QAAQ,IACZ,aAAa,SAAS,KAAK,oBACzB,eACE,GAAG,UAAU,aAAa,QAC1B,iBACA,UACD,CACF,CACF;AACD,QAAM,UAAU,GAAG,UAAU,aAAa,QAAQ,EAChD,QAAQ,UACT,CAAC;OAEF,OAAM,UAAU,GAAG,UAAU,aAAa,QAAQ,EAChD,QAAQ,UACT,CAAC"}
@@ -1,13 +1,14 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_createServer = require('./createServer.cjs');
3
- const require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_resourceUtils = require('./resourceUtils.cjs');
4
- const require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_authFetch = require('./authFetch.cjs');
5
- const path = require_rolldown_runtime.__toESM(require("path"));
6
- const node_path = require_rolldown_runtime.__toESM(require("node:path"));
7
- const node_url = require_rolldown_runtime.__toESM(require("node:url"));
8
- const fs_promises = require_rolldown_runtime.__toESM(require("fs/promises"));
9
- const vitest = require_rolldown_runtime.__toESM(require("vitest"));
10
-
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ const require_createServer = require("./createServer.cjs");
3
+ const require_resourceUtils = require("./resourceUtils.cjs");
4
+ const require_authFetch = require("./authFetch.cjs");
5
+ let path = require("path");
6
+ path = require_runtime.__toESM(path);
7
+ let node_path = require("node:path");
8
+ let node_url = require("node:url");
9
+ let fs_promises = require("fs/promises");
10
+ fs_promises = require_runtime.__toESM(fs_promises);
11
+ let vitest = require("vitest");
11
12
  //#region src/setupTestServer.ts
12
13
  const __dirname$1 = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
13
14
  vitest.vi.setConfig({
@@ -20,13 +21,13 @@ function setupServer(port, resourceInfo, customConfigPath, skipAuthentication) {
20
21
  let previousNodeEnv;
21
22
  (0, vitest.beforeAll)(async () => {
22
23
  process.env.NODE_ENV = "other_test";
23
- data.app = await require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_createServer.createApp(port, customConfigPath);
24
+ data.app = await require_createServer.createApp(port, customConfigPath);
24
25
  await data.app.start();
25
- data.authFetch = skipAuthentication ? fetch : await require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_authFetch.generateAuthFetch(port);
26
+ data.authFetch = skipAuthentication ? fetch : await require_authFetch.generateAuthFetch(port);
26
27
  });
27
28
  (0, vitest.afterAll)(async () => {
28
29
  try {
29
- await Promise.race([data.app.stop?.(), new Promise((_, reject) => setTimeout(() => reject(new Error("Shutdown timeout")), 1e4))]);
30
+ await Promise.race([data.app.stop?.(), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("Shutdown timeout")), 1e4))]);
30
31
  } catch (err) {
31
32
  console.warn("⚠️ Ignoring shutdown error in CI:", err.message);
32
33
  }
@@ -44,13 +45,12 @@ function setupServer(port, resourceInfo, customConfigPath, skipAuthentication) {
44
45
  });
45
46
  (0, vitest.beforeEach)(async () => {
46
47
  data.fetchMock = vitest.vi.fn(data.authFetch);
47
- await require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_resourceUtils.initResources(data.rootUri, resourceInfo, data.authFetch);
48
+ await require_resourceUtils.initResources(data.rootUri, resourceInfo, data.authFetch);
48
49
  });
49
50
  (0, vitest.afterEach)(async () => {
50
- await require__Users_jacksonmorgan_O_ldo_packages_test_solid_server_src_resourceUtils.cleanResources(data.rootUri, resourceInfo, data.authFetch);
51
+ await require_resourceUtils.cleanResources(data.rootUri, resourceInfo, data.authFetch);
51
52
  });
52
53
  return data;
53
54
  }
54
-
55
55
  //#endregion
56
- exports.setupServer = setupServer;
56
+ exports.setupServer = setupServer;
@@ -9,8 +9,6 @@ declare function setupServer(port: number, resourceInfo: ResourceInfo, customCon
9
9
  authFetch: typeof fetch;
10
10
  rootUri: string;
11
11
  };
12
- //# sourceMappingURL=setupTestServer.d.ts.map
13
-
14
12
  //#endregion
15
13
  export { setupServer };
16
14
  //# sourceMappingURL=setupTestServer.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setupTestServer.d.cts","names":[],"sources":["../../src/setupTestServer.ts"],"sourcesContent":[],"mappings":";;;;;iBA0BgB,WAAA,6BAEA;OAKP;EAPO,SAAA,EAQD,cARY,CAAA,CAAA,KAAA,EAUZ,WAVY,GAUE,GAVF,EAAA,IAAA,CAAA,EAWZ,WAXY,GAAA,SAAA,EAAA,GAYhB,OAZgB,CAYR,QAZQ,CAAA,CAAA;EAAA,SAAA,EAAA,OAcL,KAdK;EAAA,OAEX,EAAA,MAAA;CAAY"}
1
+ {"version":3,"file":"setupTestServer.d.cts","names":[],"sources":["../src/setupTestServer.ts"],"mappings":";;;;;iBA0BgB,WAAA,CACd,IAAA,UACA,YAAA,EAAc,YAAA,EACd,gBAAA,WACA,kBAAA;OAGO,GAAA;aACM,cAAA,EAEP,KAAA,EAAO,WAAA,GAAc,GAAA,EACrB,IAAA,GAAO,WAAA,iBACJ,OAAA,CAAQ,QAAA;oBAEG,KAAA"}
@@ -1,4 +1,4 @@
1
- import { ResourceInfo } from "./resourceUtils.js";
1
+ import { ResourceInfo } from "./resourceUtils.mjs";
2
2
  import { App } from "@solid/community-server";
3
3
  import { MockedFunction } from "vitest";
4
4
 
@@ -9,8 +9,6 @@ declare function setupServer(port: number, resourceInfo: ResourceInfo, customCon
9
9
  authFetch: typeof fetch;
10
10
  rootUri: string;
11
11
  };
12
- //# sourceMappingURL=setupTestServer.d.ts.map
13
-
14
12
  //#endregion
15
- export { setupServer as setupServer$1 };
16
- //# sourceMappingURL=setupTestServer.d.ts.map
13
+ export { setupServer };
14
+ //# sourceMappingURL=setupTestServer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupTestServer.d.mts","names":[],"sources":["../src/setupTestServer.ts"],"mappings":";;;;;iBA0BgB,WAAA,CACd,IAAA,UACA,YAAA,EAAc,YAAA,EACd,gBAAA,WACA,kBAAA;OAGO,GAAA;aACM,cAAA,EAEP,KAAA,EAAO,WAAA,GAAc,GAAA,EACrB,IAAA,GAAO,WAAA,iBACJ,OAAA,CAAQ,QAAA;oBAEG,KAAA"}
@@ -1,12 +1,11 @@
1
- import { createApp } from "./createServer.js";
2
- import { cleanResources, initResources } from "./resourceUtils.js";
3
- import { generateAuthFetch } from "./authFetch.js";
1
+ import { createApp } from "./createServer.mjs";
2
+ import { cleanResources, initResources } from "./resourceUtils.mjs";
3
+ import { generateAuthFetch } from "./authFetch.mjs";
4
4
  import path from "path";
5
5
  import { dirname } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import fs from "fs/promises";
8
8
  import { afterAll, afterEach, beforeAll, beforeEach, vi } from "vitest";
9
-
10
9
  //#region src/setupTestServer.ts
11
10
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
11
  vi.setConfig({
@@ -25,7 +24,7 @@ function setupServer(port, resourceInfo, customConfigPath, skipAuthentication) {
25
24
  });
26
25
  afterAll(async () => {
27
26
  try {
28
- await Promise.race([data.app.stop?.(), new Promise((_, reject) => setTimeout(() => reject(new Error("Shutdown timeout")), 1e4))]);
27
+ await Promise.race([data.app.stop?.(), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("Shutdown timeout")), 1e4))]);
29
28
  } catch (err) {
30
29
  console.warn("⚠️ Ignoring shutdown error in CI:", err.message);
31
30
  }
@@ -50,7 +49,7 @@ function setupServer(port, resourceInfo, customConfigPath, skipAuthentication) {
50
49
  });
51
50
  return data;
52
51
  }
53
-
54
52
  //#endregion
55
53
  export { setupServer };
56
- //# sourceMappingURL=setupTestServer.js.map
54
+
55
+ //# sourceMappingURL=setupTestServer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupTestServer.mjs","names":[],"sources":["../src/setupTestServer.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { App } from \"@solid/community-server\";\nimport { createApp } from \"./createServer\";\nimport path from \"path\";\nimport type { ResourceInfo } from \"./resourceUtils\";\nimport { cleanResources, initResources } from \"./resourceUtils\";\nimport { generateAuthFetch } from \"./authFetch\";\nimport fs from \"fs/promises\";\nimport {\n beforeAll,\n afterAll,\n beforeEach,\n afterEach,\n vi,\n type MockedFunction,\n} from \"vitest\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n// Use an increased timeout, since the CSS server takes too much setup time.\nvi.setConfig({ testTimeout: 40_000, hookTimeout: 40_000 });\n\nexport function setupServer(\n port: number,\n resourceInfo: ResourceInfo,\n customConfigPath?: string,\n skipAuthentication?: boolean,\n) {\n const data: {\n app: App;\n fetchMock: MockedFunction<\n (\n input: RequestInfo | URL,\n init?: RequestInit | undefined,\n ) => Promise<Response>\n >;\n authFetch: typeof fetch;\n rootUri: string;\n } = {\n rootUri: `http://localhost:${port}/`,\n } as any;\n\n let previousJestId: string | undefined;\n let previousNodeEnv: string | undefined;\n beforeAll(async () => {\n // Remove Jest ID so that community solid server doesn't use the Jest Import\n process.env.NODE_ENV = \"other_test\";\n // Start up the server\n data.app = await createApp(port, customConfigPath);\n await data.app.start();\n data.authFetch = skipAuthentication ? fetch : await generateAuthFetch(port);\n });\n\n afterAll(async () => {\n // We're potentially ignoring data clean up and server shutdown because\n // sometimes this doesn't work in CI.\n try {\n await Promise.race([\n data.app.stop?.(),\n new Promise((_, reject) =>\n setTimeout(() => reject(new Error(\"Shutdown timeout\")), 10000),\n ),\n ]);\n } catch (err) {\n console.warn(\"⚠️ Ignoring shutdown error in CI:\", (err as Error).message);\n }\n\n try {\n const testDataPath = path.join(__dirname, `./data${port}`);\n await fs.rm(testDataPath, { recursive: true, force: true });\n } catch (err) {\n console.warn(\n \"⚠️ Ignoring data cleanup error in CI:\",\n (err as Error).message,\n );\n }\n\n process.env.JEST_WORKER_ID = previousJestId;\n process.env.NODE_ENV = previousNodeEnv;\n });\n\n beforeEach(async () => {\n data.fetchMock = vi.fn(data.authFetch);\n // Create a new document called sample.ttl\n await initResources(data.rootUri, resourceInfo, data.authFetch);\n });\n\n afterEach(async () => {\n await cleanResources(data.rootUri, resourceInfo, data.authFetch);\n });\n\n return data;\n}\n"],"mappings":";;;;;;;;;AAqBA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAGzD,GAAG,UAAU;CAAE,aAAa;CAAQ,aAAa;CAAQ,CAAC;AAE1D,SAAgB,YACd,MACA,cACA,kBACA,oBACA;CACA,MAAM,OAUF,EACF,SAAS,oBAAoB,KAAK,IACnC;CAED,IAAI;CACJ,IAAI;AACJ,WAAU,YAAY;AAEpB,UAAQ,IAAI,WAAW;AAEvB,OAAK,MAAM,MAAM,UAAU,MAAM,iBAAiB;AAClD,QAAM,KAAK,IAAI,OAAO;AACtB,OAAK,YAAY,qBAAqB,QAAQ,MAAM,kBAAkB,KAAK;GAC3E;AAEF,UAAS,YAAY;AAGnB,MAAI;AACF,SAAM,QAAQ,KAAK,CACjB,KAAK,IAAI,QAAQ,EACjB,IAAI,SAAS,GAAG,WACd,iBAAiB,uBAAO,IAAI,MAAM,mBAAmB,CAAC,EAAE,IAAM,CAC/D,CACF,CAAC;WACK,KAAK;AACZ,WAAQ,KAAK,qCAAsC,IAAc,QAAQ;;AAG3E,MAAI;GACF,MAAM,eAAe,KAAK,KAAK,WAAW,SAAS,OAAO;AAC1D,SAAM,GAAG,GAAG,cAAc;IAAE,WAAW;IAAM,OAAO;IAAM,CAAC;WACpD,KAAK;AACZ,WAAQ,KACN,yCACC,IAAc,QAChB;;AAGH,UAAQ,IAAI,iBAAiB;AAC7B,UAAQ,IAAI,WAAW;GACvB;AAEF,YAAW,YAAY;AACrB,OAAK,YAAY,GAAG,GAAG,KAAK,UAAU;AAEtC,QAAM,cAAc,KAAK,SAAS,cAAc,KAAK,UAAU;GAC/D;AAEF,WAAU,YAAY;AACpB,QAAM,eAAe,KAAK,SAAS,cAAc,KAAK,UAAU;GAChE;AAEF,QAAO"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@ldo/test-solid-server",
3
- "version": "1.0.0-alpha.36",
3
+ "version": "1.0.0-alpha.43",
4
4
  "description": "A solid server to be used in jest tests",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.mts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
14
14
  },
15
15
  "require": {
16
16
  "types": "./dist/index.d.cts",
@@ -23,7 +23,8 @@
23
23
  "build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 tsdown",
24
24
  "prepublishOnly": "npm run build",
25
25
  "copy-configs": "cp -r src/configs dist/cjs/configs && cp -r src/configs dist/esm/configs",
26
- "lint": "eslint src/** --fix --no-error-on-unmatched-pattern",
26
+ "lint:check": "eslint src/** --no-error-on-unmatched-pattern",
27
+ "lint": "npm run lint:check -- --fix",
27
28
  "remove-dist": "rimraf dist/"
28
29
  },
29
30
  "repository": {
@@ -48,5 +49,5 @@
48
49
  "publishConfig": {
49
50
  "access": "public"
50
51
  },
51
- "gitHead": "e97a0f8b5fa7f609e5070e472b1b63ff8a9502a8"
52
+ "gitHead": "474cff455e7e3993747d8ecdd40d12e9b20b74f5"
52
53
  }
@@ -41,4 +41,4 @@
41
41
  ]
42
42
  }
43
43
  ]
44
- }
44
+ }
@@ -40,4 +40,4 @@
40
40
  "comment": "A Solid server that stores its resources on disk and uses WAC for authorization."
41
41
  }
42
42
  ]
43
- }
43
+ }
@@ -2,8 +2,6 @@
2
2
  {
3
3
  "email": "hello@example.com",
4
4
  "password": "abc123",
5
- "pods": [
6
- { "name": "example" }
7
- ]
5
+ "pods": [{ "name": "example" }]
8
6
  }
9
- ]
7
+ ]
@@ -1 +0,0 @@
1
- {"version":3,"file":"authFetch.js","names":["response: Response","port: number","authorization: string","id: string","secret: string"],"sources":["../src/authFetch.ts"],"sourcesContent":["import type { KeyPair } from \"@inrupt/solid-client-authn-core\";\nimport {\n buildAuthenticatedFetch,\n createDpopHeader,\n generateDpopKeyPair,\n} from \"@inrupt/solid-client-authn-core\";\nimport fetch from \"cross-fetch\";\n\nconst config = {\n podName: \"example\",\n email: \"hello@example.com\",\n password: \"abc123\",\n};\n\nasync function reportError(response: Response) {\n if (response.status >= 400) {\n console.error(await response.text());\n }\n}\n\nasync function getAuthorization(port: number): Promise<string> {\n // First we request the account API controls to find out where we can log in\n const indexResponse = await fetch(`http://localhost:${port}/.account/`);\n const { controls } = await indexResponse.json();\n\n // And then we log in to the account API\n const response = await fetch(controls.password.login, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n email: config.email,\n password: config.password,\n }),\n });\n // This authorization value will be used to authenticate in the next step\n await reportError(response);\n const result = await response.json();\n return result.authorization;\n}\n\nasync function getSecret(\n port: number,\n authorization: string,\n): Promise<{ id: string; secret: string; resource: string }> {\n // Now that we are logged in, we need to request the updated controls from the server.\n // These will now have more values than in the previous example.\n const indexResponse = await fetch(`http://localhost:${port}/.account/`, {\n headers: { authorization: `CSS-Account-Token ${authorization}` },\n });\n const { controls } = await indexResponse.json();\n\n // Here we request the server to generate a token on our account\n const response = await fetch(controls.account.clientCredentials, {\n method: \"POST\",\n headers: {\n authorization: `CSS-Account-Token ${authorization}`,\n \"content-type\": \"application/json\",\n },\n // The name field will be used when generating the ID of your token.\n // The WebID field determines which WebID you will identify as when using the token.\n // Only WebIDs linked to your account can be used.\n body: JSON.stringify({\n name: \"my-token\",\n webId: `http://localhost:${port}/${config.podName}/profile/card#me`,\n }),\n });\n await reportError(response);\n // These are the identifier and secret of your token.\n // Store the secret somewhere safe as there is no way to request it again from the server!\n // The `resource` value can be used to delete the token at a later point in time.\n const response2 = await response.json();\n return response2;\n}\n\nasync function getAccessToken(\n port: number,\n id: string,\n secret: string,\n): Promise<{ accessToken: string; dpopKey: KeyPair }> {\n try {\n // A key pair is needed for encryption.\n // This function from `solid-client-authn` generates such a pair for you.\n const dpopKey = await generateDpopKeyPair();\n\n // These are the ID and secret generated in the previous step.\n // Both the ID and the secret need to be form-encoded.\n const authString = `${encodeURIComponent(id)}:${encodeURIComponent(\n secret,\n )}`;\n // This URL can be found by looking at the \"token_endpoint\" field at\n // http://localhost:PORT/.well-known/openid-configuration\n // if your server is hosted at http://localhost:3000/.\n const tokenUrl = `http://localhost:${port}/.oidc/token`;\n const response = await fetch(tokenUrl, {\n method: \"POST\",\n headers: {\n // The header needs to be in base64 encoding.\n authorization: `Basic ${Buffer.from(authString).toString(\"base64\")}`,\n \"content-type\": \"application/x-www-form-urlencoded\",\n dpop: await createDpopHeader(tokenUrl, \"POST\", dpopKey),\n },\n body: \"grant_type=client_credentials&scope=webid\",\n });\n await reportError(response);\n // This is the Access token that will be used to do an authenticated request to the server.\n // The JSON also contains an \"expires_in\" field in seconds,\n // which you can use to know when you need request a new Access token.\n const response2 = await response.json();\n return { accessToken: response2.access_token, dpopKey };\n } catch (err) {\n console.error(err);\n throw err;\n }\n}\n\nexport async function generateAuthFetch(port: number) {\n const authorization = await getAuthorization(port);\n const { id, secret } = await getSecret(port, authorization);\n const { accessToken, dpopKey } = await getAccessToken(port, id, secret);\n return await buildAuthenticatedFetch(accessToken, { dpopKey });\n}\n"],"mappings":";;;;AAQA,MAAM,SAAS;CACb,SAAS;CACT,OAAO;CACP,UAAU;AACX;AAED,eAAe,YAAYA,UAAoB;AAC7C,KAAI,SAAS,UAAU,IACrB,SAAQ,MAAM,MAAM,SAAS,MAAM,CAAC;AAEvC;AAED,eAAe,iBAAiBC,MAA+B;CAE7D,MAAM,gBAAgB,MAAM,OAAO,mBAAmB,KAAK,YAAY;CACvE,MAAM,EAAE,UAAU,GAAG,MAAM,cAAc,MAAM;CAG/C,MAAM,WAAW,MAAM,MAAM,SAAS,SAAS,OAAO;EACpD,QAAQ;EACR,SAAS,EAAE,gBAAgB,mBAAoB;EAC/C,MAAM,KAAK,UAAU;GACnB,OAAO,OAAO;GACd,UAAU,OAAO;EAClB,EAAC;CACH,EAAC;AAEF,OAAM,YAAY,SAAS;CAC3B,MAAM,SAAS,MAAM,SAAS,MAAM;AACpC,QAAO,OAAO;AACf;AAED,eAAe,UACbA,MACAC,eAC2D;CAG3D,MAAM,gBAAgB,MAAM,OAAO,mBAAmB,KAAK,aAAa,EACtE,SAAS,EAAE,gBAAgB,oBAAoB,cAAc,EAAG,EACjE,EAAC;CACF,MAAM,EAAE,UAAU,GAAG,MAAM,cAAc,MAAM;CAG/C,MAAM,WAAW,MAAM,MAAM,SAAS,QAAQ,mBAAmB;EAC/D,QAAQ;EACR,SAAS;GACP,gBAAgB,oBAAoB,cAAc;GAClD,gBAAgB;EACjB;EAID,MAAM,KAAK,UAAU;GACnB,MAAM;GACN,QAAQ,mBAAmB,KAAK,GAAG,OAAO,QAAQ;EACnD,EAAC;CACH,EAAC;AACF,OAAM,YAAY,SAAS;CAI3B,MAAM,YAAY,MAAM,SAAS,MAAM;AACvC,QAAO;AACR;AAED,eAAe,eACbD,MACAE,IACAC,QACoD;AACpD,KAAI;EAGF,MAAM,UAAU,MAAM,qBAAqB;EAI3C,MAAM,cAAc,EAAE,mBAAmB,GAAG,CAAC,GAAG,mBAC9C,OACD,CAAC;EAIF,MAAM,YAAY,mBAAmB,KAAK;EAC1C,MAAM,WAAW,MAAM,MAAM,UAAU;GACrC,QAAQ;GACR,SAAS;IAEP,gBAAgB,QAAQ,OAAO,KAAK,WAAW,CAAC,SAAS,SAAS,CAAC;IACnE,gBAAgB;IAChB,MAAM,MAAM,iBAAiB,UAAU,QAAQ,QAAQ;GACxD;GACD,MAAM;EACP,EAAC;AACF,QAAM,YAAY,SAAS;EAI3B,MAAM,YAAY,MAAM,SAAS,MAAM;AACvC,SAAO;GAAE,aAAa,UAAU;GAAc;EAAS;CACxD,SAAQ,KAAK;AACZ,UAAQ,MAAM,IAAI;AAClB,QAAM;CACP;AACF;AAED,eAAsB,kBAAkBH,MAAc;CACpD,MAAM,gBAAgB,MAAM,iBAAiB,KAAK;CAClD,MAAM,EAAE,IAAI,QAAQ,GAAG,MAAM,UAAU,MAAM,cAAc;CAC3D,MAAM,EAAE,aAAa,SAAS,GAAG,MAAM,eAAe,MAAM,IAAI,OAAO;AACvE,QAAO,MAAM,wBAAwB,aAAa,EAAE,QAAS,EAAC;AAC/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createServer.d.ts","names":[],"sources":["../../src/createServer.ts"],"sourcesContent":[],"mappings":";;;iBAYsB,SAAA,2CAGnB,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createServer.js","names":["port: number","customConfigPath?: string"],"sources":["../src/createServer.ts"],"sourcesContent":["// Taken from https://github.com/comunica/comunica/blob/b237be4265c353a62a876187d9e21e3bc05123a3/engines/query-sparql/test/QuerySparql-solid-test.ts#L9\n\nimport * as path from \"path\";\nimport type { App } from \"@solid/community-server\";\nimport { AppRunner, resolveModulePath } from \"@solid/community-server\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async function createApp(\n port: number,\n customConfigPath?: string,\n): Promise<App> {\n if (process.env.SERVER) {\n return {\n start: () => {},\n stop: () => {},\n } as App;\n }\n const appRunner = new AppRunner();\n\n return appRunner.create({\n loaderProperties: {\n mainModulePath: resolveModulePath(\"\"),\n typeChecking: false,\n },\n config: customConfigPath ?? resolveModulePath(\"config/file-root.json\"),\n variableBindings: {},\n shorthand: {\n port: port,\n loggingLevel: \"off\",\n seedConfig: path.join(__dirname, \"configs\", \"solid-css-seed.json\"),\n rootFilePath: path.join(__dirname, `./data${port}`),\n },\n });\n}\n"],"mappings":";;;;;;AAUA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,eAAsB,UACpBA,MACAC,kBACc;AACd,KAAI,QAAQ,IAAI,OACd,QAAO;EACL,OAAO,MAAM,CAAE;EACf,MAAM,MAAM,CAAE;CACf;CAEH,MAAM,YAAY,IAAI;AAEtB,QAAO,UAAU,OAAO;EACtB,kBAAkB;GAChB,gBAAgB,kBAAkB,GAAG;GACrC,cAAc;EACf;EACD,QAAQ,oBAAoB,kBAAkB,wBAAwB;EACtE,kBAAkB,CAAE;EACpB,WAAW;GACH;GACN,cAAc;GACd,YAAY,OAAK,KAAK,WAAW,WAAW,sBAAsB;GAClE,cAAc,OAAK,KAAK,YAAY,QAAQ,KAAK,EAAE;EACpD;CACF,EAAC;AACH"}
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { createApp$1 as createApp } from "./createServer.js";
2
- import { ResourceInfo, cleanResources$1 as cleanResources, initResources$1 as initResources } from "./resourceUtils.js";
3
- import { setupServer$1 as setupServer } from "./setupTestServer.js";
4
- export { ResourceInfo, cleanResources, createApp, initResources, setupServer };
package/dist/index.js DELETED
@@ -1,5 +0,0 @@
1
- import { createApp } from "./createServer.js";
2
- import { cleanResources, initResources } from "./resourceUtils.js";
3
- import { setupServer } from "./setupTestServer.js";
4
-
5
- export { cleanResources, createApp, initResources, setupServer };
@@ -1 +0,0 @@
1
- {"version":3,"file":"resourceUtils.d.ts","names":[],"sources":["../../src/resourceUtils.ts"],"sourcesContent":[],"mappings":";KAAY,YAAA,GAAe,gBAAgB;AAA3C,UAEU,aAAA,CAFc;EAAA,IAAA,EAAA,MAAA;EAAA,WAAG,EAAA,IAAA;EAAa,aAAG,CAAA,EAAA,OAAA;EAAQ,QAAA,EAAA,CAMtC,aANsC,GAMtB,QANsB,CAAA,EAAA;AAAC;UAS1C,QAAA,CAPa;EAAA,IAIV,EAAA,MAAA;EAAa,WAAG,EAAA,KAAA;EAAQ,IAAA,EAAA,MAAA;EAG3B,aAAQ,CAAA,EAAA,OAAA;EAQI,QAAA,EAAA,MAAa;;AAEnB,iBAFM,aAAA,CAEN,OAAA,EAAA,MAAA,EAAA,YAAA,EAAA,YAAA,EAAA,SAAA,EAAA,OACI,KADJ,CAAA,EAEb,OAFa,CAAA,IAAA,CAAA;AACI,iBA+BE,cAAA,CA/BF,OAAA,EAAA,MAAA,EAAA,YAAA,EAiCJ,YAjCI,EAAA,SAAA,EAAA,OAkCA,KAlCA,CAAA,EAmCjB,OAnCiB,CAAA,IAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"resourceUtils.js","names":["rootUri: string","resourceInfo: ResourceInfo","authFetch: typeof fetch"],"sources":["../src/resourceUtils.ts"],"sourcesContent":["export type ResourceInfo = ContainerInfo | LeafInfo;\n\ninterface ContainerInfo {\n slug: string;\n isContainer: true;\n shouldNotInit?: boolean;\n contains: (ContainerInfo | LeafInfo)[];\n}\n\ninterface LeafInfo {\n slug: string;\n isContainer: false;\n data: string;\n shouldNotInit?: boolean;\n mimeType: string;\n}\n\nexport async function initResources(\n rootUri: string,\n resourceInfo: ResourceInfo,\n authFetch: typeof fetch,\n): Promise<void> {\n if (resourceInfo?.shouldNotInit) return;\n if (resourceInfo.isContainer) {\n await authFetch(rootUri, {\n method: \"POST\",\n headers: {\n link: '<http://www.w3.org/ns/ldp#Container>; rel=\"type\"',\n slug: resourceInfo.slug,\n },\n });\n await Promise.all(\n resourceInfo.contains.map((subResourceInfo) =>\n initResources(\n `${rootUri}${resourceInfo.slug}`,\n subResourceInfo,\n authFetch,\n ),\n ),\n );\n } else {\n await authFetch(`${rootUri}${resourceInfo.slug}`, {\n method: \"PUT\",\n headers: {\n \"content-type\": resourceInfo.mimeType,\n },\n body: resourceInfo.data,\n });\n }\n}\n\nexport async function cleanResources(\n rootUri: string,\n resourceInfo: ResourceInfo,\n authFetch: typeof fetch,\n): Promise<void> {\n if (resourceInfo.isContainer) {\n await Promise.all(\n resourceInfo.contains.map((subResourceInfo) =>\n cleanResources(\n `${rootUri}${resourceInfo.slug}`,\n subResourceInfo,\n authFetch,\n ),\n ),\n );\n await authFetch(`${rootUri}${resourceInfo.slug}`, {\n method: \"DELETE\",\n });\n } else {\n await authFetch(`${rootUri}${resourceInfo.slug}`, {\n method: \"DELETE\",\n });\n }\n}\n"],"mappings":";AAiBA,eAAsB,cACpBA,SACAC,cACAC,WACe;AACf,KAAI,cAAc,cAAe;AACjC,KAAI,aAAa,aAAa;AAC5B,QAAM,UAAU,SAAS;GACvB,QAAQ;GACR,SAAS;IACP,MAAM;IACN,MAAM,aAAa;GACpB;EACF,EAAC;AACF,QAAM,QAAQ,IACZ,aAAa,SAAS,IAAI,CAAC,oBACzB,eACG,EAAE,QAAQ,EAAE,aAAa,KAAK,GAC/B,iBACA,UACD,CACF,CACF;CACF,MACC,OAAM,WAAW,EAAE,QAAQ,EAAE,aAAa,KAAK,GAAG;EAChD,QAAQ;EACR,SAAS,EACP,gBAAgB,aAAa,SAC9B;EACD,MAAM,aAAa;CACpB,EAAC;AAEL;AAED,eAAsB,eACpBF,SACAC,cACAC,WACe;AACf,KAAI,aAAa,aAAa;AAC5B,QAAM,QAAQ,IACZ,aAAa,SAAS,IAAI,CAAC,oBACzB,gBACG,EAAE,QAAQ,EAAE,aAAa,KAAK,GAC/B,iBACA,UACD,CACF,CACF;AACD,QAAM,WAAW,EAAE,QAAQ,EAAE,aAAa,KAAK,GAAG,EAChD,QAAQ,SACT,EAAC;CACH,MACC,OAAM,WAAW,EAAE,QAAQ,EAAE,aAAa,KAAK,GAAG,EAChD,QAAQ,SACT,EAAC;AAEL"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupTestServer.d.ts","names":[],"sources":["../../src/setupTestServer.ts"],"sourcesContent":[],"mappings":";;;;;iBA0BgB,WAAA,6BAEA;OAKP;EAPO,SAAA,EAQD,cARY,CAAA,CAAA,KAAA,EAUZ,WAVY,GAUE,GAVF,EAAA,IAAA,CAAA,EAWZ,WAXY,GAAA,SAAA,EAAA,GAYhB,OAZgB,CAYR,QAZQ,CAAA,CAAA;EAAA,SAAA,EAAA,OAcL,KAdK;EAAA,OAEX,EAAA,MAAA;CAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupTestServer.js","names":["port: number","resourceInfo: ResourceInfo","customConfigPath?: string","skipAuthentication?: boolean","data: {\n app: App;\n fetchMock: MockedFunction<\n (\n input: RequestInfo | URL,\n init?: RequestInit | undefined,\n ) => Promise<Response>\n >;\n authFetch: typeof fetch;\n rootUri: string;\n }","previousJestId: string | undefined","previousNodeEnv: string | undefined"],"sources":["../src/setupTestServer.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { App } from \"@solid/community-server\";\nimport { createApp } from \"./createServer\";\nimport path from \"path\";\nimport type { ResourceInfo } from \"./resourceUtils\";\nimport { cleanResources, initResources } from \"./resourceUtils\";\nimport { generateAuthFetch } from \"./authFetch\";\nimport fs from \"fs/promises\";\nimport {\n beforeAll,\n afterAll,\n beforeEach,\n afterEach,\n vi,\n type MockedFunction,\n} from \"vitest\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n// Use an increased timeout, since the CSS server takes too much setup time.\nvi.setConfig({ testTimeout: 40_000, hookTimeout: 40_000 });\n\nexport function setupServer(\n port: number,\n resourceInfo: ResourceInfo,\n customConfigPath?: string,\n skipAuthentication?: boolean,\n) {\n const data: {\n app: App;\n fetchMock: MockedFunction<\n (\n input: RequestInfo | URL,\n init?: RequestInit | undefined,\n ) => Promise<Response>\n >;\n authFetch: typeof fetch;\n rootUri: string;\n } = {\n rootUri: `http://localhost:${port}/`,\n } as any;\n\n let previousJestId: string | undefined;\n let previousNodeEnv: string | undefined;\n beforeAll(async () => {\n // Remove Jest ID so that community solid server doesn't use the Jest Import\n process.env.NODE_ENV = \"other_test\";\n // Start up the server\n data.app = await createApp(port, customConfigPath);\n await data.app.start();\n data.authFetch = skipAuthentication ? fetch : await generateAuthFetch(port);\n });\n\n afterAll(async () => {\n // We're potentially ignoring data clean up and server shutdown because\n // sometimes this doesn't work in CI.\n try {\n await Promise.race([\n data.app.stop?.(),\n new Promise((_, reject) =>\n setTimeout(() => reject(new Error(\"Shutdown timeout\")), 10000),\n ),\n ]);\n } catch (err) {\n console.warn(\"⚠️ Ignoring shutdown error in CI:\", (err as Error).message);\n }\n\n try {\n const testDataPath = path.join(__dirname, `./data${port}`);\n await fs.rm(testDataPath, { recursive: true, force: true });\n } catch (err) {\n console.warn(\n \"⚠️ Ignoring data cleanup error in CI:\",\n (err as Error).message,\n );\n }\n\n process.env.JEST_WORKER_ID = previousJestId;\n process.env.NODE_ENV = previousNodeEnv;\n });\n\n beforeEach(async () => {\n data.fetchMock = vi.fn(data.authFetch);\n // Create a new document called sample.ttl\n await initResources(data.rootUri, resourceInfo, data.authFetch);\n });\n\n afterEach(async () => {\n await cleanResources(data.rootUri, resourceInfo, data.authFetch);\n });\n\n return data;\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAGzD,GAAG,UAAU;CAAE,aAAa;CAAQ,aAAa;AAAQ,EAAC;AAE1D,SAAgB,YACdA,MACAC,cACAC,kBACAC,oBACA;CACA,MAAMC,OAUF,EACF,UAAU,mBAAmB,KAAK,GACnC;CAED,IAAIC;CACJ,IAAIC;AACJ,WAAU,YAAY;AAEpB,UAAQ,IAAI,WAAW;AAEvB,OAAK,MAAM,MAAM,UAAU,MAAM,iBAAiB;AAClD,QAAM,KAAK,IAAI,OAAO;AACtB,OAAK,YAAY,qBAAqB,QAAQ,MAAM,kBAAkB,KAAK;CAC5E,EAAC;AAEF,UAAS,YAAY;AAGnB,MAAI;AACF,SAAM,QAAQ,KAAK,CACjB,KAAK,IAAI,QAAQ,EACjB,IAAI,QAAQ,CAAC,GAAG,WACd,WAAW,MAAM,OAAO,IAAI,MAAM,oBAAoB,EAAE,IAAM,CAEjE,EAAC;EACH,SAAQ,KAAK;AACZ,WAAQ,KAAK,qCAAsC,IAAc,QAAQ;EAC1E;AAED,MAAI;GACF,MAAM,eAAe,KAAK,KAAK,YAAY,QAAQ,KAAK,EAAE;AAC1D,SAAM,GAAG,GAAG,cAAc;IAAE,WAAW;IAAM,OAAO;GAAM,EAAC;EAC5D,SAAQ,KAAK;AACZ,WAAQ,KACN,yCACC,IAAc,QAChB;EACF;AAED,UAAQ,IAAI,iBAAiB;AAC7B,UAAQ,IAAI,WAAW;CACxB,EAAC;AAEF,YAAW,YAAY;AACrB,OAAK,YAAY,GAAG,GAAG,KAAK,UAAU;AAEtC,QAAM,cAAc,KAAK,SAAS,cAAc,KAAK,UAAU;CAChE,EAAC;AAEF,WAAU,YAAY;AACpB,QAAM,eAAe,KAAK,SAAS,cAAc,KAAK,UAAU;CACjE,EAAC;AAEF,QAAO;AACR"}