@iqb/metadata-resolver 0.2.1 → 0.2.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.
- package/CHANGELOG.md +24 -0
- package/README.md +68 -30
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +19 -16
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
- With `cache: false`, the getters retain the last successfully loaded
|
|
6
|
+
vocabulary for each URL. Loads in this mode still call `fetch`.
|
|
7
|
+
- Share `@iqbspecs/metadata-profile` with consuming projects through a peer
|
|
8
|
+
dependency supporting `^0.11.1` and `^0.12.0`.
|
|
9
|
+
- Generate the generic `dist/index.d.ts` with a platform-independent Node.js
|
|
10
|
+
build step and include the changelog in the npm package.
|
|
11
|
+
- Cover cache behaviour, HTTP and JSON errors, timeouts, redirects and
|
|
12
|
+
fallbacks with automated tests. CI checks Node.js 22.18.0 and a Node.js 22.x
|
|
13
|
+
release, runs dependency audits and uses the updated lint and test tooling.
|
|
14
|
+
- Document releases from `main` and verify the remote tag before publishing to npm.
|
|
15
|
+
|
|
16
|
+
## 0.2.1 (2026-06-29)
|
|
17
|
+
|
|
18
|
+
- Add the generic `dist/index.d.ts` declaration.
|
|
19
|
+
- [Source commit recorded by npm](https://github.com/iqb-berlin/metadata-resolver/commit/4dbc8357f3c7c6fd312becce1d6cbf825ce3e246).
|
|
20
|
+
|
|
21
|
+
## 0.2.0 (2026-03-23)
|
|
22
|
+
|
|
23
|
+
- Migrate the resolver to the IQB metadata profile specification.
|
|
24
|
+
- [Source commit recorded by npm](https://github.com/iqb-berlin/metadata-resolver/commit/bccc967ceed78a2fd2a2f3d5a3e08888bd80ba07).
|
package/README.md
CHANGED
|
@@ -24,16 +24,20 @@ console.log(data.vocabularies);
|
|
|
24
24
|
|
|
25
25
|
See [GETTING_STARTED.md](./GETTING_STARTED.md) for detailed usage guide.
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Versions
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The [npm package](https://www.npmjs.com/package/@iqb/metadata-resolver) lists the
|
|
30
|
+
latest published version. The version in [package.json](./package.json) is the
|
|
31
|
+
version prepared on this branch. See the [changelog](./CHANGELOG.md) for release
|
|
32
|
+
notes and the source commits of older npm releases.
|
|
30
33
|
|
|
31
34
|
## Development
|
|
32
35
|
|
|
33
36
|
### Setup
|
|
34
37
|
|
|
35
38
|
```bash
|
|
36
|
-
|
|
39
|
+
# Use Node.js 22.18.0 or later in the Node.js 22 LTS line.
|
|
40
|
+
npm ci
|
|
37
41
|
```
|
|
38
42
|
|
|
39
43
|
### Quality Checks
|
|
@@ -50,10 +54,20 @@ npm run typecheck
|
|
|
50
54
|
# Run tests
|
|
51
55
|
npm run test
|
|
52
56
|
|
|
57
|
+
# Report dependency vulnerabilities
|
|
58
|
+
npm audit --omit=dev
|
|
59
|
+
npm audit
|
|
60
|
+
|
|
53
61
|
# Format code
|
|
54
62
|
npm run format
|
|
55
63
|
```
|
|
56
64
|
|
|
65
|
+
CI runs both audits. The scoped `minimatch` override for
|
|
66
|
+
`eslint-plugin-sonarjs` follows the [IQB ESLint dependency guidance](https://github.com/iqb-berlin/eslint-config/blob/master/docs/security.md).
|
|
67
|
+
When updating the lint stack, check whether its declared dependency range
|
|
68
|
+
includes the fixed major before removing the override. The advisory is
|
|
69
|
+
[GHSA-g3hv-75wg-m249](https://github.com/advisories/GHSA-g3hv-75wg-m249).
|
|
70
|
+
|
|
57
71
|
### Build
|
|
58
72
|
|
|
59
73
|
```bash
|
|
@@ -62,33 +76,57 @@ npm run build
|
|
|
62
76
|
|
|
63
77
|
## Release
|
|
64
78
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
Releases are cut from `main`. Before merging a release PR, update the changelog
|
|
80
|
+
and set the intended version in both npm manifests, for example with
|
|
81
|
+
`npm version patch --no-git-tag-version` when a bump is needed.
|
|
82
|
+
|
|
83
|
+
After CI passes on the merged commit, use a clean checkout of that exact commit
|
|
84
|
+
from `origin/main`. Confirm that the version has yet to be published to npm.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
(
|
|
88
|
+
set -euo pipefail
|
|
89
|
+
|
|
90
|
+
git fetch origin main
|
|
91
|
+
commit=$(git rev-parse HEAD)
|
|
92
|
+
main_commit=$(git rev-parse FETCH_HEAD)
|
|
93
|
+
working_tree=$(git status --porcelain)
|
|
94
|
+
if [[ "$commit" != "$main_commit" || -n "$working_tree" ]]; then
|
|
95
|
+
echo 'Release requires a clean checkout of origin/main.' >&2
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
npm ci --engine-strict
|
|
100
|
+
npm run typecheck
|
|
101
|
+
npm run lint
|
|
102
|
+
npm test
|
|
103
|
+
npm run build
|
|
104
|
+
npm pack --dry-run
|
|
105
|
+
|
|
106
|
+
version=$(node -p 'require("./package.json").version')
|
|
107
|
+
tag="v$version"
|
|
108
|
+
tag_ref="refs/tags/$tag"
|
|
109
|
+
if ! git show-ref --verify --quiet "$tag_ref"; then
|
|
110
|
+
git tag -a "$tag" -m "Release $tag" "$commit"
|
|
111
|
+
fi
|
|
112
|
+
test "$(git rev-parse "$tag_ref^{commit}")" = "$commit"
|
|
113
|
+
git push origin "$tag_ref"
|
|
114
|
+
|
|
115
|
+
remote_commit=$(git ls-remote --exit-code --tags origin "$tag_ref^{}" | cut -f1)
|
|
116
|
+
if [[ "$remote_commit" != "$commit" ]]; then
|
|
117
|
+
echo "Remote tag $tag does not point to $commit." >&2
|
|
118
|
+
exit 1
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
npm run release
|
|
122
|
+
test "$(npm view "@iqb/metadata-resolver@$version" gitHead)" = "$commit"
|
|
123
|
+
)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
After the registry commit check passes, create a GitHub release from the tag
|
|
127
|
+
using the corresponding changelog entry. For a prerelease, use an explicit
|
|
128
|
+
prerelease version and replace the publish command in the block with
|
|
129
|
+
`npm run release -- --tag beta`.
|
|
92
130
|
|
|
93
131
|
## License
|
|
94
132
|
|
package/dist/index.cjs
CHANGED
|
@@ -78,7 +78,7 @@ var MetadataResolver = class {
|
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Load a single vocabulary from URL
|
|
81
|
-
*
|
|
81
|
+
* Records the latest successful result and reuses it when caching is enabled
|
|
82
82
|
*/
|
|
83
83
|
async loadVocabulary(url) {
|
|
84
84
|
if (this.useCache && this.vocabulariesStore.has(url)) return this.vocabulariesStore.get(url);
|
|
@@ -140,7 +140,7 @@ var MetadataResolver = class {
|
|
|
140
140
|
data,
|
|
141
141
|
dictionary
|
|
142
142
|
};
|
|
143
|
-
|
|
143
|
+
this.vocabulariesStore.set(url, resolved);
|
|
144
144
|
console.log(` Loaded: ${data.hasTopConcept.length} concepts, ${Object.keys(dictionary).length} entries`);
|
|
145
145
|
return resolved;
|
|
146
146
|
} catch (error) {
|
package/dist/index.d.cts
CHANGED
|
@@ -82,7 +82,7 @@ declare class MetadataResolver {
|
|
|
82
82
|
extractVocabularyUrls(profile: MDProfile): string[];
|
|
83
83
|
/**
|
|
84
84
|
* Load a single vocabulary from URL
|
|
85
|
-
*
|
|
85
|
+
* Records the latest successful result and reuses it when caching is enabled
|
|
86
86
|
*/
|
|
87
87
|
loadVocabulary(url: string): Promise<ResolvedVocabulary>;
|
|
88
88
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -82,7 +82,7 @@ declare class MetadataResolver {
|
|
|
82
82
|
extractVocabularyUrls(profile: MDProfile): string[];
|
|
83
83
|
/**
|
|
84
84
|
* Load a single vocabulary from URL
|
|
85
|
-
*
|
|
85
|
+
* Records the latest successful result and reuses it when caching is enabled
|
|
86
86
|
*/
|
|
87
87
|
loadVocabulary(url: string): Promise<ResolvedVocabulary>;
|
|
88
88
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ declare class MetadataResolver {
|
|
|
82
82
|
extractVocabularyUrls(profile: MDProfile): string[];
|
|
83
83
|
/**
|
|
84
84
|
* Load a single vocabulary from URL
|
|
85
|
-
*
|
|
85
|
+
* Records the latest successful result and reuses it when caching is enabled
|
|
86
86
|
*/
|
|
87
87
|
loadVocabulary(url: string): Promise<ResolvedVocabulary>;
|
|
88
88
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -76,7 +76,7 @@ var MetadataResolver = class {
|
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Load a single vocabulary from URL
|
|
79
|
-
*
|
|
79
|
+
* Records the latest successful result and reuses it when caching is enabled
|
|
80
80
|
*/
|
|
81
81
|
async loadVocabulary(url) {
|
|
82
82
|
if (this.useCache && this.vocabulariesStore.has(url)) return this.vocabulariesStore.get(url);
|
|
@@ -138,7 +138,7 @@ var MetadataResolver = class {
|
|
|
138
138
|
data,
|
|
139
139
|
dictionary
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
this.vocabulariesStore.set(url, resolved);
|
|
142
142
|
console.log(` Loaded: ${data.hasTopConcept.length} concepts, ${Object.keys(dictionary).length} entries`);
|
|
143
143
|
return resolved;
|
|
144
144
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iqb/metadata-resolver",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Framework-agnostic metadata and vocabulary resolver for IQB metadata profiles",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
8
8
|
"files": [
|
|
9
|
-
"dist"
|
|
9
|
+
"dist",
|
|
10
|
+
"CHANGELOG.md"
|
|
10
11
|
],
|
|
11
12
|
"scripts": {
|
|
12
|
-
"build": "tsdown src/index.ts --format cjs,esm --dts --clean &&
|
|
13
|
+
"build": "tsdown src/index.ts --format cjs,esm --dts --clean && node -e \"require('node:fs').copyFileSync('dist/index.d.mts', 'dist/index.d.ts')\"",
|
|
13
14
|
"dev": "tsdown src/index.ts --format cjs,esm --dts --watch",
|
|
14
15
|
"test": "vitest run",
|
|
15
16
|
"lint": "eslint src",
|
|
@@ -26,22 +27,16 @@
|
|
|
26
27
|
],
|
|
27
28
|
"author": "IQB",
|
|
28
29
|
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@iqbspecs/metadata-profile": "^0.11.1"
|
|
31
|
-
},
|
|
32
30
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"eslint
|
|
38
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
39
|
-
"@iqb/eslint-config": "^2.2.0",
|
|
31
|
+
"@eslint/js": "^10.0.1",
|
|
32
|
+
"@iqb/eslint-config": "^3.0.0",
|
|
33
|
+
"@iqbspecs/metadata-profile": "^0.12.0",
|
|
34
|
+
"@types/node": "^22.0.0",
|
|
35
|
+
"eslint": "^10.15.0",
|
|
40
36
|
"prettier": "^3.8.1",
|
|
41
37
|
"tsdown": "^0.20.1",
|
|
42
|
-
"typescript": "
|
|
43
|
-
"
|
|
44
|
-
"vitest": "^4.0.18"
|
|
38
|
+
"typescript": "~5.9.3",
|
|
39
|
+
"vitest": "^4.1.12"
|
|
45
40
|
},
|
|
46
41
|
"exports": {
|
|
47
42
|
".": {
|
|
@@ -57,5 +52,13 @@
|
|
|
57
52
|
},
|
|
58
53
|
"publishConfig": {
|
|
59
54
|
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"overrides": {
|
|
57
|
+
"eslint-plugin-sonarjs": {
|
|
58
|
+
"minimatch": "^11.0.4"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@iqbspecs/metadata-profile": "^0.11.1 || ^0.12.0"
|
|
60
63
|
}
|
|
61
64
|
}
|