@specverse/engine-registry 4.0.2 → 4.0.4
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/package.json +1 -1
- package/dist/cache/cache-manager.d.ts +0 -132
- package/dist/cache/cache-manager.d.ts.map +0 -1
- package/dist/cache/cache-manager.js +0 -218
- package/dist/cache/cache-manager.js.map +0 -1
- package/dist/client/registry-client.d.ts +0 -129
- package/dist/client/registry-client.d.ts.map +0 -1
- package/dist/client/registry-client.js +0 -317
- package/dist/client/registry-client.js.map +0 -1
- package/dist/formatters/error-formatter.d.ts +0 -100
- package/dist/formatters/error-formatter.d.ts.map +0 -1
- package/dist/formatters/error-formatter.js +0 -290
- package/dist/formatters/error-formatter.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -8
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -7
- package/dist/formatters/index.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/offline/offline-handler.d.ts +0 -150
- package/dist/offline/offline-handler.d.ts.map +0 -1
- package/dist/offline/offline-handler.js +0 -290
- package/dist/offline/offline-handler.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -11
- package/dist/types/index.js.map +0 -1
- package/dist/types/registry.d.ts +0 -220
- package/dist/types/registry.d.ts.map +0 -1
- package/dist/types/registry.js +0 -55
- package/dist/types/registry.js.map +0 -1
- package/dist/types/validation.d.ts +0 -197
- package/dist/types/validation.d.ts.map +0 -1
- package/dist/types/validation.js +0 -140
- package/dist/types/validation.js.map +0 -1
- package/dist/utils/manifest-adapter.d.ts +0 -42
- package/dist/utils/manifest-adapter.js +0 -182
- package/dist/utils/manifest-adapter.js.map +0 -1
- package/dist/validators/index.d.ts +0 -12
- package/dist/validators/index.d.ts.map +0 -1
- package/dist/validators/index.js +0 -9
- package/dist/validators/index.js.map +0 -1
- package/dist/validators/installation-validator.d.ts +0 -75
- package/dist/validators/installation-validator.d.ts.map +0 -1
- package/dist/validators/installation-validator.js +0 -142
- package/dist/validators/installation-validator.js.map +0 -1
- package/dist/validators/manifest-validator.d.ts +0 -82
- package/dist/validators/manifest-validator.d.ts.map +0 -1
- package/dist/validators/manifest-validator.js +0 -213
- package/dist/validators/manifest-validator.js.map +0 -1
- package/dist/validators/validator.d.ts +0 -113
- package/dist/validators/validator.d.ts.map +0 -1
- package/dist/validators/validator.js +0 -165
- package/dist/validators/validator.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry Cache Manager
|
|
3
|
-
*
|
|
4
|
-
* Manages local caching of registry metadata with TTL and staleness handling.
|
|
5
|
-
* Uses filesystem-based JSON cache with atomic writes.
|
|
6
|
-
*
|
|
7
|
-
* @module registry/cache/cache-manager
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
import type { RegistryResponse } from '../types/index.js';
|
|
11
|
-
/**
|
|
12
|
-
* Cache metadata
|
|
13
|
-
*/
|
|
14
|
-
export interface CacheMetadata {
|
|
15
|
-
/** When the cache was created */
|
|
16
|
-
createdAt: string;
|
|
17
|
-
/** When the cache expires (TTL) */
|
|
18
|
-
expiresAt: string;
|
|
19
|
-
/** Cache version for compatibility checks */
|
|
20
|
-
version: string;
|
|
21
|
-
/** Registry endpoint this cache came from */
|
|
22
|
-
endpoint: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Cached registry data
|
|
26
|
-
*/
|
|
27
|
-
export interface CachedData {
|
|
28
|
-
/** Cache metadata */
|
|
29
|
-
metadata: CacheMetadata;
|
|
30
|
-
/** Cached registry response */
|
|
31
|
-
data: RegistryResponse;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Cache manager configuration
|
|
35
|
-
*/
|
|
36
|
-
export interface CacheConfig {
|
|
37
|
-
/** Cache directory (default: ~/.specverse/cache) */
|
|
38
|
-
cacheDir?: string;
|
|
39
|
-
/** TTL in milliseconds (default: 24 hours) */
|
|
40
|
-
ttl?: number;
|
|
41
|
-
/** Cache version */
|
|
42
|
-
version?: string;
|
|
43
|
-
/** Enable cache (default: true) */
|
|
44
|
-
enabled?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Registry Cache Manager
|
|
48
|
-
*
|
|
49
|
-
* Provides filesystem-based caching for registry metadata.
|
|
50
|
-
*/
|
|
51
|
-
export declare class CacheManager {
|
|
52
|
-
private config;
|
|
53
|
-
private cacheFile;
|
|
54
|
-
constructor(config?: CacheConfig);
|
|
55
|
-
/**
|
|
56
|
-
* Read cache from disk
|
|
57
|
-
*
|
|
58
|
-
* @returns Cached data or null if not found/expired
|
|
59
|
-
*/
|
|
60
|
-
read(): Promise<CachedData | null>;
|
|
61
|
-
/**
|
|
62
|
-
* Write cache to disk
|
|
63
|
-
*
|
|
64
|
-
* @param data - Registry data to cache
|
|
65
|
-
* @param endpoint - Registry endpoint URL
|
|
66
|
-
*/
|
|
67
|
-
write(data: RegistryResponse, endpoint: string): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Check if cache is valid (not expired)
|
|
70
|
-
*
|
|
71
|
-
* @param cached - Cached data to check
|
|
72
|
-
* @returns True if cache is still valid
|
|
73
|
-
*/
|
|
74
|
-
isValid(cached: CachedData): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Check if cache is stale (expired but still usable as fallback)
|
|
77
|
-
*
|
|
78
|
-
* @param cached - Cached data to check
|
|
79
|
-
* @returns True if cache is expired
|
|
80
|
-
*/
|
|
81
|
-
isStale(cached: CachedData): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Get cache age in milliseconds
|
|
84
|
-
*
|
|
85
|
-
* @param cached - Cached data to check
|
|
86
|
-
* @returns Age in milliseconds
|
|
87
|
-
*/
|
|
88
|
-
getAge(cached: CachedData): number;
|
|
89
|
-
/**
|
|
90
|
-
* Get time until expiration in milliseconds
|
|
91
|
-
*
|
|
92
|
-
* @param cached - Cached data to check
|
|
93
|
-
* @returns Time until expiration (negative if expired)
|
|
94
|
-
*/
|
|
95
|
-
getTimeToExpiration(cached: CachedData): number;
|
|
96
|
-
/**
|
|
97
|
-
* Clear cache
|
|
98
|
-
*/
|
|
99
|
-
clear(): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Check if cache exists
|
|
102
|
-
*
|
|
103
|
-
* @returns True if cache file exists
|
|
104
|
-
*/
|
|
105
|
-
exists(): Promise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* Get cache file path
|
|
108
|
-
*
|
|
109
|
-
* @returns Absolute path to cache file
|
|
110
|
-
*/
|
|
111
|
-
getCacheFile(): string;
|
|
112
|
-
/**
|
|
113
|
-
* Get cache configuration
|
|
114
|
-
*
|
|
115
|
-
* @returns Current cache configuration
|
|
116
|
-
*/
|
|
117
|
-
getConfig(): Required<CacheConfig>;
|
|
118
|
-
/**
|
|
119
|
-
* Update cache configuration
|
|
120
|
-
*
|
|
121
|
-
* @param config - Partial configuration to merge
|
|
122
|
-
*/
|
|
123
|
-
updateConfig(config: Partial<CacheConfig>): void;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Cache error class
|
|
127
|
-
*/
|
|
128
|
-
export declare class CacheError extends Error {
|
|
129
|
-
cause?: any | undefined;
|
|
130
|
-
constructor(message: string, cause?: any | undefined);
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=cache-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../src/cache/cache-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,mBAAmB,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAA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H,YAAY,IAAI,MAAM;IAItB;;;;OAIG;IACH,SAAS,IAAI,QAAQ,CAAC,WAAW,CAAC;IAIlC;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;CAQjD;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAG1B,KAAK,CAAC,EAAE,GAAG;gBADlB,OAAO,EAAE,MAAM,EACR,KAAK,CAAC,EAAE,GAAG,YAAA;CASrB"}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry Cache Manager
|
|
3
|
-
*
|
|
4
|
-
* Manages local caching of registry metadata with TTL and staleness handling.
|
|
5
|
-
* Uses filesystem-based JSON cache with atomic writes.
|
|
6
|
-
*
|
|
7
|
-
* @module registry/cache/cache-manager
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
import { promises as fs } from 'fs';
|
|
11
|
-
import { join } from 'path';
|
|
12
|
-
import { homedir } from 'os';
|
|
13
|
-
/**
|
|
14
|
-
* Default configuration
|
|
15
|
-
*/
|
|
16
|
-
const DEFAULT_CONFIG = {
|
|
17
|
-
cacheDir: join(homedir(), '.specverse', 'cache'),
|
|
18
|
-
ttl: 24 * 60 * 60 * 1000, // 24 hours
|
|
19
|
-
version: '2.0.0',
|
|
20
|
-
enabled: true
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Registry Cache Manager
|
|
24
|
-
*
|
|
25
|
-
* Provides filesystem-based caching for registry metadata.
|
|
26
|
-
*/
|
|
27
|
-
export class CacheManager {
|
|
28
|
-
config;
|
|
29
|
-
cacheFile;
|
|
30
|
-
constructor(config) {
|
|
31
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
32
|
-
this.cacheFile = join(this.config.cacheDir, 'registry-metadata.json');
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Read cache from disk
|
|
36
|
-
*
|
|
37
|
-
* @returns Cached data or null if not found/expired
|
|
38
|
-
*/
|
|
39
|
-
async read() {
|
|
40
|
-
if (!this.config.enabled) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
const content = await fs.readFile(this.cacheFile, 'utf8');
|
|
45
|
-
const cached = JSON.parse(content);
|
|
46
|
-
// Validate cache structure
|
|
47
|
-
if (!cached.metadata || !cached.data) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
// Check version compatibility
|
|
51
|
-
if (cached.metadata.version !== this.config.version) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return cached;
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
if (error.code === 'ENOENT') {
|
|
58
|
-
// Cache file doesn't exist
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
// Other errors (permission, invalid JSON, etc.)
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Write cache to disk
|
|
67
|
-
*
|
|
68
|
-
* @param data - Registry data to cache
|
|
69
|
-
* @param endpoint - Registry endpoint URL
|
|
70
|
-
*/
|
|
71
|
-
async write(data, endpoint) {
|
|
72
|
-
if (!this.config.enabled) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
// Ensure cache directory exists
|
|
77
|
-
await fs.mkdir(this.config.cacheDir, { recursive: true });
|
|
78
|
-
const now = new Date();
|
|
79
|
-
const expiresAt = new Date(now.getTime() + this.config.ttl);
|
|
80
|
-
const cached = {
|
|
81
|
-
metadata: {
|
|
82
|
-
createdAt: now.toISOString(),
|
|
83
|
-
expiresAt: expiresAt.toISOString(),
|
|
84
|
-
version: this.config.version,
|
|
85
|
-
endpoint
|
|
86
|
-
},
|
|
87
|
-
data
|
|
88
|
-
};
|
|
89
|
-
// Atomic write with tmp file + rename
|
|
90
|
-
const tmpFile = `${this.cacheFile}.tmp`;
|
|
91
|
-
await fs.writeFile(tmpFile, JSON.stringify(cached, null, 2), 'utf8');
|
|
92
|
-
await fs.rename(tmpFile, this.cacheFile);
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
// Silently fail on cache write errors
|
|
96
|
-
// Cache is optional, don't break the application
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Check if cache is valid (not expired)
|
|
101
|
-
*
|
|
102
|
-
* @param cached - Cached data to check
|
|
103
|
-
* @returns True if cache is still valid
|
|
104
|
-
*/
|
|
105
|
-
isValid(cached) {
|
|
106
|
-
const now = new Date();
|
|
107
|
-
const expiresAt = new Date(cached.metadata.expiresAt);
|
|
108
|
-
return now < expiresAt;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Check if cache is stale (expired but still usable as fallback)
|
|
112
|
-
*
|
|
113
|
-
* @param cached - Cached data to check
|
|
114
|
-
* @returns True if cache is expired
|
|
115
|
-
*/
|
|
116
|
-
isStale(cached) {
|
|
117
|
-
return !this.isValid(cached);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Get cache age in milliseconds
|
|
121
|
-
*
|
|
122
|
-
* @param cached - Cached data to check
|
|
123
|
-
* @returns Age in milliseconds
|
|
124
|
-
*/
|
|
125
|
-
getAge(cached) {
|
|
126
|
-
const now = new Date();
|
|
127
|
-
const createdAt = new Date(cached.metadata.createdAt);
|
|
128
|
-
return now.getTime() - createdAt.getTime();
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get time until expiration in milliseconds
|
|
132
|
-
*
|
|
133
|
-
* @param cached - Cached data to check
|
|
134
|
-
* @returns Time until expiration (negative if expired)
|
|
135
|
-
*/
|
|
136
|
-
getTimeToExpiration(cached) {
|
|
137
|
-
const now = new Date();
|
|
138
|
-
const expiresAt = new Date(cached.metadata.expiresAt);
|
|
139
|
-
return expiresAt.getTime() - now.getTime();
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Clear cache
|
|
143
|
-
*/
|
|
144
|
-
async clear() {
|
|
145
|
-
if (!this.config.enabled) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
await fs.unlink(this.cacheFile);
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
if (error.code !== 'ENOENT') {
|
|
153
|
-
// Only throw if error is not "file not found"
|
|
154
|
-
throw error;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Check if cache exists
|
|
160
|
-
*
|
|
161
|
-
* @returns True if cache file exists
|
|
162
|
-
*/
|
|
163
|
-
async exists() {
|
|
164
|
-
if (!this.config.enabled) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
await fs.access(this.cacheFile);
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Get cache file path
|
|
177
|
-
*
|
|
178
|
-
* @returns Absolute path to cache file
|
|
179
|
-
*/
|
|
180
|
-
getCacheFile() {
|
|
181
|
-
return this.cacheFile;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Get cache configuration
|
|
185
|
-
*
|
|
186
|
-
* @returns Current cache configuration
|
|
187
|
-
*/
|
|
188
|
-
getConfig() {
|
|
189
|
-
return { ...this.config };
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Update cache configuration
|
|
193
|
-
*
|
|
194
|
-
* @param config - Partial configuration to merge
|
|
195
|
-
*/
|
|
196
|
-
updateConfig(config) {
|
|
197
|
-
this.config = { ...this.config, ...config };
|
|
198
|
-
// Update cache file path if directory changed
|
|
199
|
-
if (config.cacheDir) {
|
|
200
|
-
this.cacheFile = join(config.cacheDir, 'registry-metadata.json');
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Cache error class
|
|
206
|
-
*/
|
|
207
|
-
export class CacheError extends Error {
|
|
208
|
-
cause;
|
|
209
|
-
constructor(message, cause) {
|
|
210
|
-
super(message);
|
|
211
|
-
this.cause = cause;
|
|
212
|
-
this.name = 'CacheError';
|
|
213
|
-
if (Error.captureStackTrace) {
|
|
214
|
-
Error.captureStackTrace(this, CacheError);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=cache-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-manager.js","sourceRoot":"","sources":["../../src/cache/cache-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAW,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAgD7B;;GAEG;AACH,MAAM,cAAc,GAA0B;IAC5C,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC;IAChD,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,WAAW;IACrC,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,IAAI;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,CAAwB;IAC9B,SAAS,CAAS;IAE1B,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC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;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAG1B;IAFT,YACE,OAAe,EACR,KAAW;QAElB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,UAAK,GAAL,KAAK,CAAM;QAGlB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QAEzB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry HTTP Client
|
|
3
|
-
*
|
|
4
|
-
* Fetches instance factory metadata from the SpecVerse Registry API.
|
|
5
|
-
* Uses Node.js 18+ built-in fetch with retry logic and timeout handling.
|
|
6
|
-
*
|
|
7
|
-
* @module registry/client/registry-client
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
import type { RegistryResponse, RegistryFactoryMetadata, SearchResponse, CapabilitiesResponse, FetchFactoriesOptions, SearchFactoriesOptions } from '../types/registry.js';
|
|
11
|
-
/**
|
|
12
|
-
* Registry client configuration
|
|
13
|
-
*/
|
|
14
|
-
export interface RegistryClientConfig {
|
|
15
|
-
/** Registry API endpoint */
|
|
16
|
-
endpoint: string;
|
|
17
|
-
/** Request timeout in milliseconds */
|
|
18
|
-
timeout: number;
|
|
19
|
-
/** Number of retry attempts */
|
|
20
|
-
retries: number;
|
|
21
|
-
/** User agent string */
|
|
22
|
-
userAgent?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Registry HTTP Client
|
|
26
|
-
*
|
|
27
|
-
* Handles communication with the SpecVerse Registry API to fetch
|
|
28
|
-
* instance factory metadata.
|
|
29
|
-
*/
|
|
30
|
-
export declare class RegistryClient {
|
|
31
|
-
private config;
|
|
32
|
-
constructor(config?: Partial<RegistryClientConfig>);
|
|
33
|
-
/**
|
|
34
|
-
* Fetch all instance factory metadata
|
|
35
|
-
*
|
|
36
|
-
* @param options - Query options for filtering
|
|
37
|
-
* @returns Registry response with factory metadata
|
|
38
|
-
*/
|
|
39
|
-
fetchFactories(options?: FetchFactoriesOptions): Promise<RegistryResponse>;
|
|
40
|
-
/**
|
|
41
|
-
* Get specific factory metadata by name
|
|
42
|
-
*
|
|
43
|
-
* @param name - Factory name (e.g., "PrismaPostgres")
|
|
44
|
-
* @returns Factory metadata or null if not found
|
|
45
|
-
*/
|
|
46
|
-
getFactory(name: string): Promise<RegistryFactoryMetadata | null>;
|
|
47
|
-
/**
|
|
48
|
-
* Search factories with fuzzy matching
|
|
49
|
-
*
|
|
50
|
-
* @param query - Search query string
|
|
51
|
-
* @param options - Search options
|
|
52
|
-
* @returns Search results with scores
|
|
53
|
-
*/
|
|
54
|
-
search(query: string, options?: SearchFactoriesOptions): Promise<SearchResponse>;
|
|
55
|
-
/**
|
|
56
|
-
* Get all capabilities with factory counts
|
|
57
|
-
*
|
|
58
|
-
* @returns Capabilities response
|
|
59
|
-
*/
|
|
60
|
-
getCapabilities(): Promise<CapabilitiesResponse>;
|
|
61
|
-
/**
|
|
62
|
-
* Check if registry is accessible
|
|
63
|
-
*
|
|
64
|
-
* @returns True if registry is reachable
|
|
65
|
-
*/
|
|
66
|
-
checkHealth(): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* Fetch with automatic retry and exponential backoff
|
|
69
|
-
*
|
|
70
|
-
* @param url - URL to fetch
|
|
71
|
-
* @param attempt - Current attempt number
|
|
72
|
-
* @returns Response object
|
|
73
|
-
*/
|
|
74
|
-
private fetchWithRetry;
|
|
75
|
-
/**
|
|
76
|
-
* Delay helper for retry backoff
|
|
77
|
-
*
|
|
78
|
-
* @param ms - Milliseconds to delay
|
|
79
|
-
*/
|
|
80
|
-
private delay;
|
|
81
|
-
/**
|
|
82
|
-
* Transform registry API response to internal format
|
|
83
|
-
*
|
|
84
|
-
* Handles differences between registry API format and internal types.
|
|
85
|
-
*
|
|
86
|
-
* @param data - Raw API response
|
|
87
|
-
* @returns Transformed registry response
|
|
88
|
-
*/
|
|
89
|
-
private transformResponse;
|
|
90
|
-
/**
|
|
91
|
-
* Transform single factory from API format to internal format
|
|
92
|
-
*
|
|
93
|
-
* @param lib - Raw library/factory data from API
|
|
94
|
-
* @returns Transformed factory metadata
|
|
95
|
-
*/
|
|
96
|
-
private transformFactory;
|
|
97
|
-
/**
|
|
98
|
-
* Get the configured endpoint URL
|
|
99
|
-
*/
|
|
100
|
-
getEndpoint(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Update client configuration
|
|
103
|
-
*
|
|
104
|
-
* @param config - Partial config to merge
|
|
105
|
-
*/
|
|
106
|
-
updateConfig(config: Partial<RegistryClientConfig>): void;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Registry fetch error
|
|
110
|
-
*
|
|
111
|
-
* Thrown when registry API requests fail.
|
|
112
|
-
*/
|
|
113
|
-
export declare class RegistryFetchError extends Error {
|
|
114
|
-
cause?: any | undefined;
|
|
115
|
-
constructor(message: string, cause?: any | undefined);
|
|
116
|
-
/**
|
|
117
|
-
* Check if error is due to network issues
|
|
118
|
-
*/
|
|
119
|
-
isNetworkError(): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Check if error is due to timeout
|
|
122
|
-
*/
|
|
123
|
-
isTimeout(): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Get user-friendly error message
|
|
126
|
-
*/
|
|
127
|
-
getUserMessage(): string;
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=registry-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../../src/client/registry-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH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