@t0.labs/daxta 0.5.0 → 0.5.2

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.
@@ -43,6 +43,8 @@ exports.getEmptyViewerAssetPath = getEmptyViewerAssetPath;
43
43
  exports.readEmptyDocsHtml = readEmptyDocsHtml;
44
44
  exports.getFaviconAssetPath = getFaviconAssetPath;
45
45
  exports.getDocsBasePath = getDocsBasePath;
46
+ exports.getApiDocUrl = getApiDocUrl;
47
+ exports.getApiDocs = getApiDocs;
46
48
  const fs_1 = require("fs");
47
49
  const path = __importStar(require("path"));
48
50
  const config_1 = require("../config");
@@ -68,9 +70,9 @@ function getViewerAssetPath() {
68
70
  function getEmptyViewerAssetPath() {
69
71
  return path.join(__dirname, '..', '..', 'assets', 'empty.html');
70
72
  }
71
- const EMPTY_DOCS_FALLBACK = `<!doctype html><html lang="en"><head><meta charset="utf-8"/><title>DAxTA</title></head><body style="font:13px/1.45 system-ui;background:#fafafa;color:#111;margin:0;padding:48px 24px">
73
+ const EMPTY_DOCS_FALLBACK = `<!doctype html><html lang="en"><head><meta charset="utf-8"/><title>API Documentation</title></head><body style="font:13px/1.45 system-ui;background:#fafafa;color:#111;margin:0;padding:48px 24px">
72
74
  <p style="font:600 10px/1 ui-monospace,monospace;letter-spacing:.08em;text-transform:uppercase;color:#666">Waiting</p>
73
- <h1 style="font-size:22px;letter-spacing:-.04em">No documentation yet</h1>
75
+ <h1 style="font-size:22px;letter-spacing:-.04em">No API documentation yet</h1>
74
76
  <p>Run your integration tests, then refresh this page.</p>
75
77
  </body></html>`;
76
78
  function readEmptyDocsHtml() {
@@ -86,6 +88,19 @@ function getFaviconAssetPath() {
86
88
  return path.join(__dirname, '..', '..', 'assets', 'favicon.png');
87
89
  }
88
90
  function getDocsBasePath() {
89
- const configured = (0, config_1.getConfig)().docsPath ?? '/docs';
90
- return configured.startsWith('/') ? configured.replace(/\/$/, '') || '/docs' : `/${configured}`.replace(/\/$/, '');
91
+ const configured = (0, config_1.getConfig)().docsPath ?? '/api-docs';
92
+ return configured.startsWith('/') ? configured.replace(/\/$/, '') || '/api-docs' : `/${configured}`.replace(/\/$/, '');
93
+ }
94
+ /** App-origin URL where generated API docs are served (e.g. `http://localhost:3000/api-docs`). */
95
+ function getApiDocUrl() {
96
+ const config = (0, config_1.getConfig)();
97
+ return `${String(config.baseUrl || '').replace(/\/$/, '')}${getDocsBasePath()}`;
98
+ }
99
+ /** Paths and URL for the generated API docs artifact. */
100
+ function getApiDocs() {
101
+ return {
102
+ url: getApiDocUrl(),
103
+ specPath: getSpecJsonPath(),
104
+ htmlPath: getHtmlPath(),
105
+ };
91
106
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@t0.labs/daxta",
3
- "version": "0.5.0",
4
- "description": "DAxTA \u2014 docs from Nest integration traffic + DTO field CLI / Try-it",
3
+ "version": "0.5.2",
4
+ "description": "DAxTA — Tested behavior. Trusted API docs. Generate API documentation from observed test execution.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",