@goodandready/dsh-model-sync 0.4.4 → 0.4.6
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/lib/client.js +2 -2
- 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)
|
package/lib/client.js
CHANGED
|
@@ -525,7 +525,7 @@ window.__ModuleLoader__.load({
|
|
|
525
525
|
const [importErr, setImportErr] = React.useState('')
|
|
526
526
|
const [showImportBox, setShowImportBox] = React.useState(false)
|
|
527
527
|
|
|
528
|
-
const scope = React.useMemo(() => (ctx && ctx.
|
|
528
|
+
const scope = React.useMemo(() => (ctx && ctx.configForms ? ctx.configForms.get(NS) : undefined), [ctx])
|
|
529
529
|
const snapshot = React.useSyncExternalStore(
|
|
530
530
|
React.useMemo(() => (cb) => (scope ? scope.subscribe(cb) : () => {}), [scope]),
|
|
531
531
|
React.useCallback(() => (scope ? scope.getSnapshot() : { status: 'loading' }), [scope]),
|
|
@@ -1290,7 +1290,7 @@ window.__ModuleLoader__.load({
|
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
1292
|
|
|
1293
|
-
module.exports = { apply, inject: ['slots', 'locale', '
|
|
1293
|
+
module.exports = { apply, inject: ['slots', 'locale', 'configForms'], filterModelsByCapabilities }
|
|
1294
1294
|
return module.exports
|
|
1295
1295
|
},
|
|
1296
1296
|
})
|