@iqb/metadata-resolver 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -28,6 +28,68 @@ See [GETTING_STARTED.md](./GETTING_STARTED.md) for detailed usage guide.
28
28
 
29
29
  **0.1.0** - Testing phase
30
30
 
31
+ ## Development
32
+
33
+ ### Setup
34
+
35
+ ```bash
36
+ npm install
37
+ ```
38
+
39
+ ### Quality Checks
40
+
41
+ We use **ESLint** and **Prettier** to ensure code quality.
42
+
43
+ ```bash
44
+ # Run linting
45
+ npm run lint
46
+
47
+ # Run type check
48
+ npm run typecheck
49
+
50
+ # Run tests
51
+ npm run test
52
+
53
+ # Format code
54
+ npm run format
55
+ ```
56
+
57
+ ### Build
58
+
59
+ ```bash
60
+ npm run build
61
+ ```
62
+
63
+ ## Release
64
+
65
+ To publish a new version to NPM:
66
+
67
+ 1. **Update Version**:
68
+ ```bash
69
+ npm version patch # or minor, major
70
+ ```
71
+ This updates `package.json` and creates a git tag.
72
+
73
+ 2. **Push Changes**:
74
+ ```bash
75
+ git push && git push --tags
76
+ ```
77
+
78
+ 3. **Publish**:
79
+ ```bash
80
+ npm run release
81
+ ```
82
+ The `prepublishOnly` script will automatically run tests, linting, and build before publishing ensures only valid code is released.
83
+
84
+ ### Configuration
85
+
86
+ - **Registry**: Configured in `.npmrc` (default is npmjs.org).
87
+ - **Access**: defaults to `public` in `package.json`.
88
+ - **Tags**: pass flags to the release script:
89
+ ```bash
90
+ npm run release -- --tag beta
91
+ ```
92
+
31
93
  ## License
32
94
 
33
95
  MIT © IQB Berlin
package/dist/index.cjs CHANGED
@@ -13,21 +13,29 @@ var MetadataResolver = class {
13
13
  this.preferredLanguage = options?.preferredLanguage || "de";
14
14
  this.requestTimeout = options?.requestTimeout || 1e4;
15
15
  }
16
+ setCorsProxy(proxy) {
17
+ this.corsProxy = proxy;
18
+ }
16
19
  /**
17
20
  * Load a profile from a URL
18
21
  */
19
22
  async loadProfile(url) {
20
23
  const cacheKey = `profile:${url}`;
21
24
  if (this.useCache && this.cache.has(cacheKey)) return this.cache.get(cacheKey);
25
+ const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
26
+ let response;
27
+ try {
28
+ response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
29
+ } catch (error) {
30
+ throw new Error(`Error loading profile from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
31
+ }
32
+ if (!response.ok) throw new Error(`Error loading profile from ${url}: ${response.status} ${response.statusText}`);
22
33
  try {
23
- const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
24
- const response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
25
- if (!response.ok) throw new Error(`Failed to load profile: ${response.status} ${response.statusText}`);
26
34
  const profile = await response.json();
27
35
  if (this.useCache) this.cache.set(cacheKey, profile);
28
36
  return profile;
29
37
  } catch (error) {
30
- throw new Error(`Error loading profile from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
38
+ throw new Error(`Error parsing profile from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
31
39
  }
32
40
  }
33
41
  /**
@@ -36,15 +44,20 @@ var MetadataResolver = class {
36
44
  async loadMetadata(url) {
37
45
  const cacheKey = `metadata:${url}`;
38
46
  if (this.useCache && this.cache.has(cacheKey)) return this.cache.get(cacheKey);
47
+ const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
48
+ let response;
49
+ try {
50
+ response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
51
+ } catch (error) {
52
+ throw new Error(`Error loading metadata from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
53
+ }
54
+ if (!response.ok) throw new Error(`Error loading metadata from ${url}: ${response.status} ${response.statusText}`);
39
55
  try {
40
- const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
41
- const response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
42
- if (!response.ok) throw new Error(`Failed to load metadata: ${response.status} ${response.statusText}`);
43
56
  const metadata = await response.json();
44
57
  if (this.useCache) this.cache.set(cacheKey, metadata);
45
58
  return metadata;
46
59
  } catch (error) {
47
- throw new Error(`Error loading metadata from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
60
+ throw new Error(`Error parsing metadata from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
48
61
  }
49
62
  }
50
63
  /**
@@ -69,15 +82,56 @@ var MetadataResolver = class {
69
82
  async loadVocabulary(url) {
70
83
  if (this.useCache && this.vocabulariesStore.has(url)) return this.vocabulariesStore.get(url);
71
84
  try {
72
- console.log(`Loading vocabulary: ${url}`);
73
85
  const jsonLdUrl = await this.resolveJsonLdUrl(url);
74
- if (jsonLdUrl !== url) console.log(` Resolved to: ${jsonLdUrl}`);
86
+ if (jsonLdUrl !== url) {}
75
87
  const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(jsonLdUrl)}` : jsonLdUrl;
76
- if (this.corsProxy) console.log(` Using CORS proxy`);
77
- const response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
78
- if (!response.ok) throw new Error(`HTTP ${response.status}: ${response.statusText}`);
79
- const data = await response.json();
80
- if (!data.hasTopConcept || !Array.isArray(data.hasTopConcept)) throw new Error("Invalid structure: missing hasTopConcept");
88
+ if (this.corsProxy) {}
89
+ let response;
90
+ try {
91
+ response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
92
+ } catch (error) {
93
+ const errorMsg = error instanceof Error ? error.message : String(error);
94
+ console.error(` Failed to load vocabulary: ${errorMsg}`);
95
+ return {
96
+ url,
97
+ data: { hasTopConcept: [] },
98
+ dictionary: {},
99
+ error: errorMsg
100
+ };
101
+ }
102
+ if (!response.ok) {
103
+ const errorMsg = `HTTP ${response.status}: ${response.statusText}`;
104
+ console.error(` Failed to load vocabulary: ${errorMsg}`);
105
+ return {
106
+ url,
107
+ data: { hasTopConcept: [] },
108
+ dictionary: {},
109
+ error: errorMsg
110
+ };
111
+ }
112
+ let data;
113
+ try {
114
+ data = await response.json();
115
+ } catch (error) {
116
+ const errorMsg = error instanceof Error ? error.message : String(error);
117
+ console.error(` Failed to parse vocabulary JSON: ${errorMsg}`);
118
+ return {
119
+ url,
120
+ data: { hasTopConcept: [] },
121
+ dictionary: {},
122
+ error: errorMsg
123
+ };
124
+ }
125
+ if (!data.hasTopConcept || !Array.isArray(data.hasTopConcept)) {
126
+ const errorMsg = "Invalid structure: missing hasTopConcept";
127
+ console.error(` Failed to load vocabulary: ${errorMsg}`);
128
+ return {
129
+ url,
130
+ data: { hasTopConcept: [] },
131
+ dictionary: {},
132
+ error: errorMsg
133
+ };
134
+ }
81
135
  const dictionary = this.buildVocabularyDictionary(data);
82
136
  const resolved = {
83
137
  url,
@@ -85,7 +139,6 @@ var MetadataResolver = class {
85
139
  dictionary
86
140
  };
87
141
  if (this.useCache) this.vocabulariesStore.set(url, resolved);
88
- console.log(` Loaded: ${data.hasTopConcept.length} concepts, ${Object.keys(dictionary).length} entries`);
89
142
  return resolved;
90
143
  } catch (error) {
91
144
  const errorMsg = error instanceof Error ? error.message : String(error);
@@ -103,9 +156,7 @@ var MetadataResolver = class {
103
156
  */
104
157
  async loadVocabularies(profile) {
105
158
  const urls = this.extractVocabularyUrls(profile);
106
- const vocabularies = (await Promise.allSettled(urls.map((url) => this.loadVocabulary(url)))).filter((result) => result.status === "fulfilled").map((result) => result.value);
107
- console.log(`Loaded ${vocabularies.length} vocabularies (${this.vocabulariesStore.size} total in store)`);
108
- return vocabularies;
159
+ return (await Promise.allSettled(urls.map((url) => this.loadVocabulary(url)))).filter((result) => result.status === "fulfilled").map((result) => result.value);
109
160
  }
110
161
  /**
111
162
  * Build a dictionary from vocabulary data
@@ -145,10 +196,7 @@ var MetadataResolver = class {
145
196
  */
146
197
  async resolveJsonLdUrl(originalUrl) {
147
198
  try {
148
- console.log(`Resolving URL: ${originalUrl}`);
149
- console.log(` CORS proxy: ${this.corsProxy || "disabled"}`);
150
199
  const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(originalUrl)}` : originalUrl;
151
- console.log(` Fetching: ${fetchUrl}`);
152
200
  const res = await fetch(fetchUrl, {
153
201
  method: "GET",
154
202
  redirect: "follow",
@@ -164,10 +212,7 @@ var MetadataResolver = class {
164
212
  if ((await fetch(this.corsProxy ? `${this.corsProxy}${encodeURIComponent(jsonldUrl)}` : jsonldUrl, {
165
213
  method: "HEAD",
166
214
  signal: AbortSignal.timeout(this.requestTimeout)
167
- })).ok) {
168
- console.log(` Found JSON-LD: ${jsonldUrl}`);
169
- return jsonldUrl;
170
- }
215
+ })).ok) return jsonldUrl;
171
216
  } catch (err) {
172
217
  console.log(` JSON-LD not available: ${err instanceof Error ? err.message : String(err)}`);
173
218
  }
@@ -176,10 +221,7 @@ var MetadataResolver = class {
176
221
  if ((await fetch(this.corsProxy ? `${this.corsProxy}${encodeURIComponent(jsonUrl)}` : jsonUrl, {
177
222
  method: "HEAD",
178
223
  signal: AbortSignal.timeout(this.requestTimeout)
179
- })).ok) {
180
- console.log(` Found JSON: ${jsonUrl}`);
181
- return jsonUrl;
182
- }
224
+ })).ok) return jsonUrl;
183
225
  } catch (err) {
184
226
  console.log(` JSON not available: ${err instanceof Error ? err.message : String(err)}`);
185
227
  }
@@ -189,10 +231,7 @@ var MetadataResolver = class {
189
231
  if ((await fetch(this.corsProxy ? `${this.corsProxy}${encodeURIComponent(candidate)}` : candidate, {
190
232
  method: "HEAD",
191
233
  signal: AbortSignal.timeout(this.requestTimeout)
192
- })).ok) {
193
- console.log(` Found: ${candidate}`);
194
- return candidate;
195
- }
234
+ })).ok) return candidate;
196
235
  } catch (err) {
197
236
  console.log(` Not available: ${candidate} - ${err instanceof Error ? err.message : String(err)}`);
198
237
  }
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { MDProfile } from "@iqb/metadata";
2
2
 
3
3
  //#region src/types.d.ts
4
-
5
4
  /**
6
5
  * Configuration options for the MetadataResolver
7
6
  */
@@ -78,7 +77,7 @@ interface ProfileWithVocabularies {
78
77
  */
79
78
  interface MetadataWithProfile {
80
79
  profile: MDProfile;
81
- metadata: any;
80
+ metadata: unknown;
82
81
  vocabularies: ResolvedVocabulary[];
83
82
  }
84
83
  /**
@@ -105,6 +104,7 @@ declare class MetadataResolver {
105
104
  private preferredLanguage;
106
105
  private requestTimeout;
107
106
  constructor(options?: LoaderOptions);
107
+ setCorsProxy(proxy: string | undefined): void;
108
108
  /**
109
109
  * Load a profile from a URL
110
110
  */
@@ -112,7 +112,7 @@ declare class MetadataResolver {
112
112
  /**
113
113
  * Load metadata from a URL
114
114
  */
115
- loadMetadata(url: string): Promise<any>;
115
+ loadMetadata(url: string): Promise<unknown>;
116
116
  /**
117
117
  * Extract vocabulary URLs from a profile
118
118
  */
package/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { MDProfile } from "@iqb/metadata";
2
2
 
3
3
  //#region src/types.d.ts
4
-
5
4
  /**
6
5
  * Configuration options for the MetadataResolver
7
6
  */
@@ -78,7 +77,7 @@ interface ProfileWithVocabularies {
78
77
  */
79
78
  interface MetadataWithProfile {
80
79
  profile: MDProfile;
81
- metadata: any;
80
+ metadata: unknown;
82
81
  vocabularies: ResolvedVocabulary[];
83
82
  }
84
83
  /**
@@ -105,6 +104,7 @@ declare class MetadataResolver {
105
104
  private preferredLanguage;
106
105
  private requestTimeout;
107
106
  constructor(options?: LoaderOptions);
107
+ setCorsProxy(proxy: string | undefined): void;
108
108
  /**
109
109
  * Load a profile from a URL
110
110
  */
@@ -112,7 +112,7 @@ declare class MetadataResolver {
112
112
  /**
113
113
  * Load metadata from a URL
114
114
  */
115
- loadMetadata(url: string): Promise<any>;
115
+ loadMetadata(url: string): Promise<unknown>;
116
116
  /**
117
117
  * Extract vocabulary URLs from a profile
118
118
  */
package/dist/index.mjs CHANGED
@@ -12,21 +12,29 @@ var MetadataResolver = class {
12
12
  this.preferredLanguage = options?.preferredLanguage || "de";
13
13
  this.requestTimeout = options?.requestTimeout || 1e4;
14
14
  }
15
+ setCorsProxy(proxy) {
16
+ this.corsProxy = proxy;
17
+ }
15
18
  /**
16
19
  * Load a profile from a URL
17
20
  */
18
21
  async loadProfile(url) {
19
22
  const cacheKey = `profile:${url}`;
20
23
  if (this.useCache && this.cache.has(cacheKey)) return this.cache.get(cacheKey);
24
+ const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
25
+ let response;
26
+ try {
27
+ response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
28
+ } catch (error) {
29
+ throw new Error(`Error loading profile from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
30
+ }
31
+ if (!response.ok) throw new Error(`Error loading profile from ${url}: ${response.status} ${response.statusText}`);
21
32
  try {
22
- const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
23
- const response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
24
- if (!response.ok) throw new Error(`Failed to load profile: ${response.status} ${response.statusText}`);
25
33
  const profile = await response.json();
26
34
  if (this.useCache) this.cache.set(cacheKey, profile);
27
35
  return profile;
28
36
  } catch (error) {
29
- throw new Error(`Error loading profile from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
37
+ throw new Error(`Error parsing profile from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
30
38
  }
31
39
  }
32
40
  /**
@@ -35,15 +43,20 @@ var MetadataResolver = class {
35
43
  async loadMetadata(url) {
36
44
  const cacheKey = `metadata:${url}`;
37
45
  if (this.useCache && this.cache.has(cacheKey)) return this.cache.get(cacheKey);
46
+ const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
47
+ let response;
48
+ try {
49
+ response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
50
+ } catch (error) {
51
+ throw new Error(`Error loading metadata from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
52
+ }
53
+ if (!response.ok) throw new Error(`Error loading metadata from ${url}: ${response.status} ${response.statusText}`);
38
54
  try {
39
- const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(url)}` : url;
40
- const response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
41
- if (!response.ok) throw new Error(`Failed to load metadata: ${response.status} ${response.statusText}`);
42
55
  const metadata = await response.json();
43
56
  if (this.useCache) this.cache.set(cacheKey, metadata);
44
57
  return metadata;
45
58
  } catch (error) {
46
- throw new Error(`Error loading metadata from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
59
+ throw new Error(`Error parsing metadata from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`);
47
60
  }
48
61
  }
49
62
  /**
@@ -68,15 +81,56 @@ var MetadataResolver = class {
68
81
  async loadVocabulary(url) {
69
82
  if (this.useCache && this.vocabulariesStore.has(url)) return this.vocabulariesStore.get(url);
70
83
  try {
71
- console.log(`Loading vocabulary: ${url}`);
72
84
  const jsonLdUrl = await this.resolveJsonLdUrl(url);
73
- if (jsonLdUrl !== url) console.log(` Resolved to: ${jsonLdUrl}`);
85
+ if (jsonLdUrl !== url) {}
74
86
  const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(jsonLdUrl)}` : jsonLdUrl;
75
- if (this.corsProxy) console.log(` Using CORS proxy`);
76
- const response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
77
- if (!response.ok) throw new Error(`HTTP ${response.status}: ${response.statusText}`);
78
- const data = await response.json();
79
- if (!data.hasTopConcept || !Array.isArray(data.hasTopConcept)) throw new Error("Invalid structure: missing hasTopConcept");
87
+ if (this.corsProxy) {}
88
+ let response;
89
+ try {
90
+ response = await fetch(fetchUrl, { signal: AbortSignal.timeout(this.requestTimeout) });
91
+ } catch (error) {
92
+ const errorMsg = error instanceof Error ? error.message : String(error);
93
+ console.error(` Failed to load vocabulary: ${errorMsg}`);
94
+ return {
95
+ url,
96
+ data: { hasTopConcept: [] },
97
+ dictionary: {},
98
+ error: errorMsg
99
+ };
100
+ }
101
+ if (!response.ok) {
102
+ const errorMsg = `HTTP ${response.status}: ${response.statusText}`;
103
+ console.error(` Failed to load vocabulary: ${errorMsg}`);
104
+ return {
105
+ url,
106
+ data: { hasTopConcept: [] },
107
+ dictionary: {},
108
+ error: errorMsg
109
+ };
110
+ }
111
+ let data;
112
+ try {
113
+ data = await response.json();
114
+ } catch (error) {
115
+ const errorMsg = error instanceof Error ? error.message : String(error);
116
+ console.error(` Failed to parse vocabulary JSON: ${errorMsg}`);
117
+ return {
118
+ url,
119
+ data: { hasTopConcept: [] },
120
+ dictionary: {},
121
+ error: errorMsg
122
+ };
123
+ }
124
+ if (!data.hasTopConcept || !Array.isArray(data.hasTopConcept)) {
125
+ const errorMsg = "Invalid structure: missing hasTopConcept";
126
+ console.error(` Failed to load vocabulary: ${errorMsg}`);
127
+ return {
128
+ url,
129
+ data: { hasTopConcept: [] },
130
+ dictionary: {},
131
+ error: errorMsg
132
+ };
133
+ }
80
134
  const dictionary = this.buildVocabularyDictionary(data);
81
135
  const resolved = {
82
136
  url,
@@ -84,7 +138,6 @@ var MetadataResolver = class {
84
138
  dictionary
85
139
  };
86
140
  if (this.useCache) this.vocabulariesStore.set(url, resolved);
87
- console.log(` Loaded: ${data.hasTopConcept.length} concepts, ${Object.keys(dictionary).length} entries`);
88
141
  return resolved;
89
142
  } catch (error) {
90
143
  const errorMsg = error instanceof Error ? error.message : String(error);
@@ -102,9 +155,7 @@ var MetadataResolver = class {
102
155
  */
103
156
  async loadVocabularies(profile) {
104
157
  const urls = this.extractVocabularyUrls(profile);
105
- const vocabularies = (await Promise.allSettled(urls.map((url) => this.loadVocabulary(url)))).filter((result) => result.status === "fulfilled").map((result) => result.value);
106
- console.log(`Loaded ${vocabularies.length} vocabularies (${this.vocabulariesStore.size} total in store)`);
107
- return vocabularies;
158
+ return (await Promise.allSettled(urls.map((url) => this.loadVocabulary(url)))).filter((result) => result.status === "fulfilled").map((result) => result.value);
108
159
  }
109
160
  /**
110
161
  * Build a dictionary from vocabulary data
@@ -144,10 +195,7 @@ var MetadataResolver = class {
144
195
  */
145
196
  async resolveJsonLdUrl(originalUrl) {
146
197
  try {
147
- console.log(`Resolving URL: ${originalUrl}`);
148
- console.log(` CORS proxy: ${this.corsProxy || "disabled"}`);
149
198
  const fetchUrl = this.corsProxy ? `${this.corsProxy}${encodeURIComponent(originalUrl)}` : originalUrl;
150
- console.log(` Fetching: ${fetchUrl}`);
151
199
  const res = await fetch(fetchUrl, {
152
200
  method: "GET",
153
201
  redirect: "follow",
@@ -163,10 +211,7 @@ var MetadataResolver = class {
163
211
  if ((await fetch(this.corsProxy ? `${this.corsProxy}${encodeURIComponent(jsonldUrl)}` : jsonldUrl, {
164
212
  method: "HEAD",
165
213
  signal: AbortSignal.timeout(this.requestTimeout)
166
- })).ok) {
167
- console.log(` Found JSON-LD: ${jsonldUrl}`);
168
- return jsonldUrl;
169
- }
214
+ })).ok) return jsonldUrl;
170
215
  } catch (err) {
171
216
  console.log(` JSON-LD not available: ${err instanceof Error ? err.message : String(err)}`);
172
217
  }
@@ -175,10 +220,7 @@ var MetadataResolver = class {
175
220
  if ((await fetch(this.corsProxy ? `${this.corsProxy}${encodeURIComponent(jsonUrl)}` : jsonUrl, {
176
221
  method: "HEAD",
177
222
  signal: AbortSignal.timeout(this.requestTimeout)
178
- })).ok) {
179
- console.log(` Found JSON: ${jsonUrl}`);
180
- return jsonUrl;
181
- }
223
+ })).ok) return jsonUrl;
182
224
  } catch (err) {
183
225
  console.log(` JSON not available: ${err instanceof Error ? err.message : String(err)}`);
184
226
  }
@@ -188,10 +230,7 @@ var MetadataResolver = class {
188
230
  if ((await fetch(this.corsProxy ? `${this.corsProxy}${encodeURIComponent(candidate)}` : candidate, {
189
231
  method: "HEAD",
190
232
  signal: AbortSignal.timeout(this.requestTimeout)
191
- })).ok) {
192
- console.log(` Found: ${candidate}`);
193
- return candidate;
194
- }
233
+ })).ok) return candidate;
195
234
  } catch (err) {
196
235
  console.log(` Not available: ${candidate} - ${err instanceof Error ? err.message : String(err)}`);
197
236
  }
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@iqb/metadata-resolver",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Framework-agnostic metadata and vocabulary resolver for IQB metadata profiles",
5
- "main": "dist/index.js",
5
+ "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
7
+ "types": "dist/index.d.cts",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
12
  "build": "tsdown src/index.ts --format cjs,esm --dts --clean",
13
- "dev": "tsdown src/index.ts --format cjs,esm --dts --watch"
13
+ "dev": "tsdown src/index.ts --format cjs,esm --dts --watch",
14
+ "test": "vitest run",
15
+ "lint": "eslint src",
16
+ "format": "prettier --write \"src/**/*.{ts,json}\"",
17
+ "typecheck": "tsc --noEmit",
18
+ "prepublishOnly": "npm run typecheck && npm run lint && npm run test && npm run build",
19
+ "release": "npm publish"
14
20
  },
15
21
  "keywords": [
16
22
  "metadata",
@@ -24,17 +30,32 @@
24
30
  "@iqb/metadata": "^1.4.1"
25
31
  },
26
32
  "devDependencies": {
27
- "tsdown": "^0.20.0-beta.2",
28
- "typescript": "^5.3.0"
33
+ "@types/node": "^25.0.10",
34
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
35
+ "@typescript-eslint/parser": "^7.18.0",
36
+ "eslint": "^8.57.0",
37
+ "eslint-config-prettier": "^9.1.0",
38
+ "eslint-plugin-prettier": "^5.1.3",
39
+ "@iqb/eslint-config": "^2.2.0",
40
+ "prettier": "^3.8.1",
41
+ "tsdown": "^0.20.1",
42
+ "typescript": "^5.3.0",
43
+ "typescript-eslint": "^7.18.0",
44
+ "vitest": "^4.0.18"
29
45
  },
30
46
  "exports": {
31
47
  ".": {
32
- "types": "./dist/index.d.ts",
33
- "import": "./dist/index.mjs",
34
- "require": "./dist/index.js"
48
+ "import": {
49
+ "types": "./dist/index.d.mts",
50
+ "default": "./dist/index.mjs"
51
+ },
52
+ "require": {
53
+ "types": "./dist/index.d.cts",
54
+ "default": "./dist/index.cjs"
55
+ }
35
56
  }
36
57
  },
37
58
  "publishConfig": {
38
59
  "access": "public"
39
60
  }
40
- }
61
+ }