fhirsmith 0.14.0 → 0.14.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +3 -2
  3. package/config-template.json +20 -0
  4. package/library/fhir-openapi-schema.js +441 -0
  5. package/library/html-server.js +9 -3
  6. package/library/languages.js +15 -0
  7. package/library/npm-audit.js +265 -0
  8. package/library/openapi-doc.js +557 -0
  9. package/library/same-origin.js +62 -0
  10. package/library/utilities.js +21 -0
  11. package/nginx.md +17 -9
  12. package/package.json +10 -4
  13. package/packages/openapi.js +13 -0
  14. package/packages/openapi.yaml +603 -0
  15. package/packages/packages-template.html +4 -2
  16. package/packages/packages.js +286 -81
  17. package/packages/readme.md +120 -0
  18. package/publisher/publisher-template.html +1 -0
  19. package/publisher/publisher.js +95 -42
  20. package/registry/api.js +117 -41
  21. package/registry/crawler.js +24 -0
  22. package/registry/fhirsmith-releases.js +170 -0
  23. package/registry/model.js +10 -0
  24. package/registry/openapi.js +13 -0
  25. package/registry/openapi.yaml +311 -0
  26. package/registry/readme.md +107 -208
  27. package/registry/registry-template.html +4 -1
  28. package/registry/registry.js +183 -20
  29. package/server.js +25 -6
  30. package/testing/openapi-schemas.config.js +58 -0
  31. package/testing/openapi-schemas.json +1920 -0
  32. package/testing/openapi.js +15 -0
  33. package/testing/openapi.yaml +273 -0
  34. package/testing/readme.md +75 -1
  35. package/testing/render.js +270 -29
  36. package/testing/search.js +1 -1
  37. package/testing/store.js +152 -8
  38. package/testing/testing-template.html +2 -0
  39. package/testing/testing.js +307 -9
  40. package/translations/Messages.properties +1 -0
  41. package/tx/README.md +58 -0
  42. package/tx/cm/cm-database.js +10 -1
  43. package/tx/cm/cm-package.js +8 -1
  44. package/tx/cs/cs-rxnorm.js +23 -6
  45. package/tx/cs/cs-snomed.js +3 -72
  46. package/tx/html/tx-template.html +2 -0
  47. package/tx/library/canonical-resource.js +50 -1
  48. package/tx/library/codesystem.js +1 -0
  49. package/tx/library/conceptmap.js +1 -0
  50. package/tx/library/valueset.js +16 -0
  51. package/tx/library.js +17 -2
  52. package/tx/openapi-operations.js +363 -0
  53. package/tx/openapi-schemas.config.js +118 -0
  54. package/tx/openapi-schemas.json +7903 -0
  55. package/tx/openapi.js +289 -0
  56. package/tx/openapi.yaml +151 -0
  57. package/tx/operation-context.js +15 -0
  58. package/tx/params.js +3 -12
  59. package/tx/provider.js +10 -1
  60. package/tx/sct/editions.js +70 -0
  61. package/tx/tx-html.js +6 -0
  62. package/tx/tx.js +55 -0
  63. package/tx/vs/vs-database.js +14 -5
  64. package/tx/vs/vs-package.js +10 -0
  65. package/tx/workers/expand.js +37 -18
  66. package/tx/workers/metadata.js +0 -13
  67. package/tx/workers/translate.js +25 -1
  68. package/tx/workers/validate.js +74 -24
  69. package/tx/workers/worker.js +32 -43
  70. package/utilities/extract-schema-json.js +167 -0
  71. package/utilities/generate-openapi-schemas.js +49 -0
  72. package/utilities/submit-test-report.js +1 -1
  73. package/xig/xig.js +2 -4
package/nginx.md CHANGED
@@ -13,13 +13,13 @@ public servers (tx.fhir.org, packages.fhir.org and so on) use.
13
13
 
14
14
  ### Headers to pass to the server
15
15
 
16
- FHIRsmith runs Express with `trust proxy` enabled (`server.trustProxy` in config.json,
17
- default `true`). That means it takes the client address, scheme and host from the
18
- `X-Forwarded-*` headers, so nginx has to set them:
16
+ FHIRsmith runs Express with `trust proxy` enabled (`server.trustProxy` in config.json; by
17
+ default it trusts proxies on the same host or a private network). That means it takes the
18
+ client address, scheme and host from the `X-Forwarded-*` headers, so nginx has to set them:
19
19
 
20
20
  | Header | nginx value | What FHIRsmith uses it for |
21
21
  |---|---|---|
22
- | `Host` | `$host` | The base URL in the CapabilityStatement, TerminologyCapabilities and other self-references. It is taken from the host the client asked for |
22
+ | `Host` | `$host` | The base URL in the CapabilityStatement, TerminologyCapabilities and other self-references. It is taken from the host the client asked for. The publisher and testing modules also check the `Origin` of every form post against it, and refuse posts from anywhere else - so if nginx sends a different `Host` (e.g. `proxy_pass` with the default `$proxy_host`), every login and form fails with a 403 |
23
23
  | `X-Forwarded-Proto` | `$scheme` | The scheme of those same base URLs, and the `Secure` session cookie used by the publisher and token modules. If this header is missing, an HTTPS server advertises `http://` URLs and publisher login fails silently: you are sent back to the login page, still logged out |
24
24
  | `X-Forwarded-For` | `$proxy_add_x_forwarded_for` | The client IP address in audit and security logs (`req.ip`). If this header is missing, every request is logged as coming from `127.0.0.1` |
25
25
  | `X-Request-Id` | `$request_id` | Optional. FHIRsmith echoes it back on the response, so a client's report can be matched to a line in the nginx log (add `$request_id` to your `log_format`) |
@@ -49,11 +49,19 @@ them:
49
49
 
50
50
  ### Trusting the proxy
51
51
 
52
- With `trustProxy: true`, anyone who can reach the FHIRsmith port directly can forge
53
- `X-Forwarded-For`. FHIRsmith listens on all interfaces, so firewall the port so that only
54
- nginx can reach it. You can also set `server.trustProxy` to `"loopback"`, or to the proxy's
55
- address; any value that Express's `trust proxy` setting accepts will work. If you run
56
- FHIRsmith without a proxy, set it to `false`.
52
+ By default FHIRsmith believes the `X-Forwarded-*` headers only when the request comes from
53
+ a loopback, link-local or private address (`"loopback, linklocal, uniquelocal"`) - nginx on
54
+ the same machine, or on the same docker or private network. A request straight from the
55
+ internet can't set its own client address, so it can't get round the rate limits on logins,
56
+ report submission and the publisher's task actions.
57
+
58
+ If your proxy is somewhere else (a cloud load balancer with a public address, say), set
59
+ `server.trustProxy` to its address, or to the number of proxy hops; any value Express's
60
+ `trust proxy` setting accepts will work. If you run FHIRsmith without a proxy, set it to
61
+ `false`. Avoid `true`: it believes any `X-Forwarded-For`, so anyone who can reach the
62
+ FHIRsmith port directly can name their own IP address, and express-rate-limit logs
63
+ `ERR_ERL_PERMISSIVE_TRUST_PROXY` to say so. Either way, firewalling the port so that only
64
+ nginx can reach it is still a good idea.
57
65
 
58
66
  ### Upstream connections
59
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhirsmith",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "txVersion": "1.9.5-SNAPSHOT",
5
5
  "description": "A Node.js server that provides a collection of tools to serve the FHIR ecosystem",
6
6
  "main": "server.js",
@@ -41,7 +41,7 @@
41
41
  "cli-progress": "^3.12.0",
42
42
  "commander": "^14.0.3",
43
43
  "commonmark": "^0.31.2",
44
- "connect-sqlite3": "^0.9.16",
44
+ "connect-sqlite3": "^0.9.18",
45
45
  "cors": "^2.8.6",
46
46
  "express": "^5.2.1",
47
47
  "express-rate-limit": "^7.4.1",
@@ -64,7 +64,7 @@
64
64
  "properties-file": "^3.6.4",
65
65
  "re2js": "^2.8.0",
66
66
  "rimraf": "^5.0.10",
67
- "sqlite3": "^5.1.7",
67
+ "sqlite3": "^6.0.1",
68
68
  "tar": "^7.5.7",
69
69
  "winston": "^3.19.0",
70
70
  "winston-daily-rotate-file": "^4.7.1",
@@ -74,6 +74,7 @@
74
74
  "@types/jest": "^29.5.8",
75
75
  "@typescript-eslint/eslint-plugin": "^8.54.0",
76
76
  "@typescript-eslint/parser": "^8.54.0",
77
+ "ajv": "^8.20.0",
77
78
  "eslint": "^8.57.1",
78
79
  "eslint-plugin-promise": "^7.2.1",
79
80
  "jest": "^29.7.0",
@@ -111,7 +112,12 @@
111
112
  "inquirer": {
112
113
  "lodash": "4.18.1"
113
114
  },
114
- "brace-expansion": "^5.0.8"
115
+ "brace-expansion": "^5.0.8",
116
+ "csv-parse": "^7.0.3",
117
+ "uuid": "^11.1.1",
118
+ "connect-sqlite3": {
119
+ "sqlite3": "$sqlite3"
120
+ }
115
121
  },
116
122
  "bin": {
117
123
  "tx-import": "./tx/importers/tx-import.js",
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2026, Health Intersections Pty Ltd (http://www.healthintersections.com.au)
3
+ //
4
+ // Licensed under BSD-3: https://opensource.org/license/bsd-3-clause
5
+ //
6
+
7
+ // The package server's OpenAPI description. openapi.yaml is the source of truth; see the
8
+ // comment at its top.
9
+
10
+ const path = require('path');
11
+ const { createOpenApiDoc } = require('../library/openapi-doc');
12
+
13
+ module.exports = createOpenApiDoc(path.join(__dirname, 'openapi.yaml'), '/packages');