@wishknish/knishio-client-js 0.7.7 → 0.7.8
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 +66 -0
- package/dist/client.cjs.js +36 -26
- package/dist/client.cjs.js.map +1 -1
- package/dist/client.es.mjs +550 -407
- package/dist/client.es.mjs.map +1 -1
- package/dist/client.iife.js +36 -26
- package/dist/client.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/KnishIOClient.js +91 -1
- package/src/Molecule.js +7 -7
- package/src/index.js +4 -0
- package/src/libraries/urql/UrqlClientWrapper.js +9 -5
- package/src/query/QueryEmbeddingStatus.js +132 -0
- package/src/response/ResponseEmbeddingStatus.js +100 -0
package/README.md
CHANGED
|
@@ -251,6 +251,71 @@ This document will explain both ways.
|
|
|
251
251
|
console.log(fingerprintData);
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
+
### DataBraid: Embedding Status (Observability)
|
|
255
|
+
|
|
256
|
+
When the validator has DataBraid embeddings enabled (`EMBEDDING_ENABLED=true`), the SDK can query the embedding state of meta assets. This allows apps to render UI indicators such as spinner badges for in-progress embeddings or completion checkmarks.
|
|
257
|
+
|
|
258
|
+
The SDK automatically detects whether the connected server supports this feature. If it does not, `queryEmbeddingStatus()` returns `null` instead of throwing an error.
|
|
259
|
+
|
|
260
|
+
- Query embedding status for a **single Meta Asset**:
|
|
261
|
+
|
|
262
|
+
```javascript
|
|
263
|
+
const response = await client.queryEmbeddingStatus({
|
|
264
|
+
metaType: 'Vehicle',
|
|
265
|
+
metaId: 'VIN-12345'
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
if (response) {
|
|
269
|
+
const items = response.payload();
|
|
270
|
+
// items[0] = {
|
|
271
|
+
// metaType: 'Vehicle',
|
|
272
|
+
// metaId: 'VIN-12345',
|
|
273
|
+
// state: 'COMPLETE', // 'PENDING' | 'STALE' | 'COMPLETE'
|
|
274
|
+
// totalMetas: 5, // Total meta rows for this instance
|
|
275
|
+
// embeddedCount: 5, // Rows with embeddings
|
|
276
|
+
// embeddedAt: 1713100800, // Unix timestamp of last embedding
|
|
277
|
+
// model: 'nomic-embed-text-v1.5'
|
|
278
|
+
// }
|
|
279
|
+
} else {
|
|
280
|
+
// Server does not support embedding status
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
- **Bulk** embedding status for multiple assets in a single request:
|
|
285
|
+
|
|
286
|
+
```javascript
|
|
287
|
+
const response = await client.queryEmbeddingStatus({
|
|
288
|
+
instances: [
|
|
289
|
+
{ metaType: 'Vehicle', metaId: 'VIN-12345' },
|
|
290
|
+
{ metaType: 'Vehicle', metaId: 'VIN-67890' },
|
|
291
|
+
{ metaType: 'Profile', metaId: 'user_42' }
|
|
292
|
+
]
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
if (response) {
|
|
296
|
+
const items = response.payload();
|
|
297
|
+
// items.length === 3, one per input, in the same order
|
|
298
|
+
for (const item of items) {
|
|
299
|
+
console.log(`${item.metaType}:${item.metaId} → ${item.state}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
- **Capability detection** — check if the server supports a query field before calling it:
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
307
|
+
const supported = await client.hasQueryField('embeddingStatus');
|
|
308
|
+
// true if the server's GraphQL schema includes the field, false otherwise
|
|
309
|
+
// Result is cached per URI — no repeated network round-trips
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Embedding States:**
|
|
313
|
+
| State | Meaning | Suggested UI |
|
|
314
|
+
|-------|---------|-------------|
|
|
315
|
+
| `PENDING` | No embeddings generated yet | Spinner / gray badge |
|
|
316
|
+
| `STALE` | Embeddings exist but model has changed | Refresh indicator |
|
|
317
|
+
| `COMPLETE` | All meta rows have current-model embeddings | Green checkmark |
|
|
318
|
+
|
|
254
319
|
## Advanced Usage: Working with Molecules
|
|
255
320
|
|
|
256
321
|
For more granular control, you can work directly with Molecules:
|
|
@@ -417,6 +482,7 @@ This method involves individually building Atoms and Molecules, triggering the s
|
|
|
417
482
|
1. `QueryBalance` and `QueryContinuId` -> returns a `Wallet` instance
|
|
418
483
|
2. `QueryWalletList` -> returns a list of `Wallet` instances
|
|
419
484
|
3. `MutationProposeMolecule`, `MutationRequestAuthorization`, `MutationCreateIdentifier`, `MutationLinkIdentifier`, `MutationClaimShadowWallet`, `MutationCreateToken`, `MutationRequestTokens`, and `MutationTransferTokens` -> returns molecule metadata
|
|
485
|
+
4. `QueryEmbeddingStatus` -> returns an array of `{ metaType, metaId, state, totalMetas, embeddedCount, embeddedAt, model }` objects
|
|
420
486
|
|
|
421
487
|
## Getting Help
|
|
422
488
|
|