@goodandready/dsh-model-sync 0.4.4 → 0.4.5
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/lib/adapter-registry.js +12 -9
- package/package.json +1 -1
package/lib/adapter-registry.js
CHANGED
|
@@ -271,16 +271,19 @@ export function createProviderAdapterRegistry({ resolveCredential, fetchImpl = f
|
|
|
271
271
|
register,
|
|
272
272
|
select(profile, config) {
|
|
273
273
|
if (profile?.adapterId && explicit.has(profile.adapterId)) return explicit.get(profile.adapterId)
|
|
274
|
-
if (config && config.enabled !== false &&
|
|
275
|
-
if (canUseGenericAdapter(profile)) return generic
|
|
274
|
+
if (config && config.enabled !== false && config.endpoint) return declarative(profile, config)
|
|
276
275
|
const descriptor = PROVIDER_ADAPTERS[profile?.provider]
|
|
277
|
-
if (
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
276
|
+
if (descriptor) {
|
|
277
|
+
return Object.freeze({
|
|
278
|
+
id: 'provider:' + profile.provider,
|
|
279
|
+
canHandle: () => true,
|
|
280
|
+
discover: (current, options = {}) => fetchSpecific(current, { ...descriptor, modelsPath: 'data', fields: {}, capabilityMap: {} }, { resolveCredential, fetchImpl, ...options }),
|
|
281
|
+
health: (current, options = {}) => probeSpecific(current, descriptor, { resolveCredential, fetchImpl, ...options }),
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
if (config && config.enabled !== false && profile?.baseURL) return declarative(profile, config)
|
|
285
|
+
if (canUseGenericAdapter(profile)) return generic
|
|
286
|
+
return null
|
|
284
287
|
},
|
|
285
288
|
}
|
|
286
289
|
return Object.freeze(registry)
|