@wishknish/knishio-client-ts 0.7.6 → 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 +68 -0
- package/dist/index.cjs +305 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -27
- package/dist/index.d.ts +75 -27
- package/dist/index.iife.js +307 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +304 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/KnishIOClient.ts +194 -5
- package/src/core/Molecule.ts +36 -13
- package/src/index.ts +7 -0
- package/src/libraries/GraphQLClient.ts +15 -0
- package/src/query/QueryEmbeddingStatus.ts +130 -0
- package/src/response/ResponseEmbeddingStatus.ts +107 -0
- package/src/response/ResponseProposeMolecule.ts +47 -0
package/dist/index.js
CHANGED
|
@@ -4803,6 +4803,7 @@ var Molecule = class _Molecule {
|
|
|
4803
4803
|
remainderWallet;
|
|
4804
4804
|
atoms;
|
|
4805
4805
|
version;
|
|
4806
|
+
continuIdPosition;
|
|
4806
4807
|
parentHashes;
|
|
4807
4808
|
local;
|
|
4808
4809
|
/**
|
|
@@ -4815,7 +4816,8 @@ var Molecule = class _Molecule {
|
|
|
4815
4816
|
sourceWallet = null,
|
|
4816
4817
|
remainderWallet = null,
|
|
4817
4818
|
cellSlug = null,
|
|
4818
|
-
version = null
|
|
4819
|
+
version = null,
|
|
4820
|
+
continuIdPosition = null
|
|
4819
4821
|
} = {}) {
|
|
4820
4822
|
this.status = null;
|
|
4821
4823
|
this.molecularHash = null;
|
|
@@ -4824,6 +4826,7 @@ var Molecule = class _Molecule {
|
|
|
4824
4826
|
this.secret = secret;
|
|
4825
4827
|
this.bundle = bundle;
|
|
4826
4828
|
this.sourceWallet = sourceWallet;
|
|
4829
|
+
this.continuIdPosition = continuIdPosition;
|
|
4827
4830
|
this.atoms = [];
|
|
4828
4831
|
this.parentHashes = [];
|
|
4829
4832
|
const versionRegistry = versions_default;
|
|
@@ -4901,7 +4904,9 @@ var Molecule = class _Molecule {
|
|
|
4901
4904
|
});
|
|
4902
4905
|
}
|
|
4903
4906
|
const continuIdMeta = {};
|
|
4904
|
-
if (this.
|
|
4907
|
+
if (this.continuIdPosition) {
|
|
4908
|
+
continuIdMeta.previousPosition = this.continuIdPosition;
|
|
4909
|
+
} else if (this.sourceWallet && this.sourceWallet.position) {
|
|
4905
4910
|
continuIdMeta.previousPosition = this.sourceWallet.position;
|
|
4906
4911
|
}
|
|
4907
4912
|
if (this.remainderWallet.pubkey) {
|
|
@@ -4930,13 +4935,8 @@ var Molecule = class _Molecule {
|
|
|
4930
4935
|
}) {
|
|
4931
4936
|
const atomMeta = new AtomMeta(meta);
|
|
4932
4937
|
atomMeta.addPolicy(policy);
|
|
4933
|
-
const wallet = Wallet.create({
|
|
4934
|
-
secret: this.secret,
|
|
4935
|
-
bundle: this.sourceWallet.bundle,
|
|
4936
|
-
token: "USER"
|
|
4937
|
-
});
|
|
4938
4938
|
this.addAtom(Atom.create({
|
|
4939
|
-
wallet,
|
|
4939
|
+
wallet: this.sourceWallet,
|
|
4940
4940
|
isotope: "R",
|
|
4941
4941
|
metaType,
|
|
4942
4942
|
metaId,
|
|
@@ -5245,10 +5245,21 @@ var Molecule = class _Molecule {
|
|
|
5245
5245
|
if (Number(this.sourceWallet.balance) - amount < 0) {
|
|
5246
5246
|
throw new BalanceInsufficientException();
|
|
5247
5247
|
}
|
|
5248
|
+
const burnWallet = new Wallet({
|
|
5249
|
+
bundle: "0000000000000000000000000000000000000000000000000000000000000000",
|
|
5250
|
+
token: this.sourceWallet.token
|
|
5251
|
+
});
|
|
5248
5252
|
this.addAtom(Atom.create({
|
|
5249
5253
|
isotope: "V",
|
|
5250
5254
|
wallet: this.sourceWallet,
|
|
5251
|
-
value: -
|
|
5255
|
+
value: -Number(this.sourceWallet.balance)
|
|
5256
|
+
}));
|
|
5257
|
+
this.addAtom(Atom.create({
|
|
5258
|
+
isotope: "V",
|
|
5259
|
+
wallet: burnWallet,
|
|
5260
|
+
value: amount,
|
|
5261
|
+
metaType: "walletBundle",
|
|
5262
|
+
metaId: burnWallet.bundle
|
|
5252
5263
|
}));
|
|
5253
5264
|
this.addAtom(Atom.create({
|
|
5254
5265
|
isotope: "V",
|
|
@@ -5910,6 +5921,20 @@ var GraphQLClient = class {
|
|
|
5910
5921
|
encrypt: this.cipherLink
|
|
5911
5922
|
});
|
|
5912
5923
|
}
|
|
5924
|
+
/**
|
|
5925
|
+
* F-8a (cross-SDK parity, 2026-06-03): re-point the GraphQL-subscription WebSocket
|
|
5926
|
+
* without changing the HTTP endpoint. `setUri` only updates `serverUri`, leaving the
|
|
5927
|
+
* subscription socket pinned to whatever was passed at construction; this lets a
|
|
5928
|
+
* caller re-derive the socket when the endpoint changes.
|
|
5929
|
+
*/
|
|
5930
|
+
setSocketUri(socketUri) {
|
|
5931
|
+
this.socketUri = socketUri;
|
|
5932
|
+
this.$__client = this.createUrqlClient({
|
|
5933
|
+
serverUri: this.serverUri,
|
|
5934
|
+
socket: { socketUri },
|
|
5935
|
+
encrypt: this.cipherLink
|
|
5936
|
+
});
|
|
5937
|
+
}
|
|
5913
5938
|
socketDisconnect() {
|
|
5914
5939
|
if (this.socketUri) {
|
|
5915
5940
|
this.unsubscribeAll();
|
|
@@ -8810,9 +8835,91 @@ var QueryMetaTypeViaMolecule = class extends Query {
|
|
|
8810
8835
|
}
|
|
8811
8836
|
};
|
|
8812
8837
|
|
|
8838
|
+
// src/response/ResponseEmbeddingStatus.ts
|
|
8839
|
+
init_Response();
|
|
8840
|
+
var ResponseEmbeddingStatus = class extends Response {
|
|
8841
|
+
/**
|
|
8842
|
+
* Class constructor
|
|
8843
|
+
*/
|
|
8844
|
+
constructor({
|
|
8845
|
+
query,
|
|
8846
|
+
json
|
|
8847
|
+
}) {
|
|
8848
|
+
super({
|
|
8849
|
+
query,
|
|
8850
|
+
json,
|
|
8851
|
+
dataKey: "data.embeddingStatus"
|
|
8852
|
+
});
|
|
8853
|
+
}
|
|
8854
|
+
/**
|
|
8855
|
+
* Returns the array of embedding status items, or null if empty.
|
|
8856
|
+
*/
|
|
8857
|
+
payload() {
|
|
8858
|
+
const items = this.data();
|
|
8859
|
+
if (!items || !Array.isArray(items) || items.length === 0) {
|
|
8860
|
+
return null;
|
|
8861
|
+
}
|
|
8862
|
+
return items;
|
|
8863
|
+
}
|
|
8864
|
+
};
|
|
8865
|
+
var QueryEmbeddingStatus = class extends Query {
|
|
8866
|
+
/**
|
|
8867
|
+
* Create new QueryEmbeddingStatus instance
|
|
8868
|
+
*/
|
|
8869
|
+
constructor(graphQLClient, knishIOClient) {
|
|
8870
|
+
super(graphQLClient, knishIOClient);
|
|
8871
|
+
this.$__query = gql`query( $metaType: String, $metaId: String, $instances: [EmbeddingStatusInput!] ) {
|
|
8872
|
+
embeddingStatus( metaType: $metaType, metaId: $metaId, instances: $instances ) {
|
|
8873
|
+
metaType,
|
|
8874
|
+
metaId,
|
|
8875
|
+
state,
|
|
8876
|
+
totalMetas,
|
|
8877
|
+
embeddedCount,
|
|
8878
|
+
embeddedAt,
|
|
8879
|
+
model
|
|
8880
|
+
}
|
|
8881
|
+
}`;
|
|
8882
|
+
}
|
|
8883
|
+
/**
|
|
8884
|
+
* Builds a GraphQL-friendly variables object for embedding status queries.
|
|
8885
|
+
*
|
|
8886
|
+
* Single mode: createVariables({ metaType: 'product', metaId: 'SKU-001' })
|
|
8887
|
+
* Bulk mode: createVariables({ instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] })
|
|
8888
|
+
*/
|
|
8889
|
+
static createVariables({
|
|
8890
|
+
metaType = null,
|
|
8891
|
+
metaId = null,
|
|
8892
|
+
instances = null
|
|
8893
|
+
} = {}) {
|
|
8894
|
+
const variables = {};
|
|
8895
|
+
if (instances && instances.length > 0) {
|
|
8896
|
+
variables.instances = instances;
|
|
8897
|
+
}
|
|
8898
|
+
if (metaType) {
|
|
8899
|
+
variables.metaType = metaType;
|
|
8900
|
+
}
|
|
8901
|
+
if (metaId) {
|
|
8902
|
+
variables.metaId = metaId;
|
|
8903
|
+
}
|
|
8904
|
+
return variables;
|
|
8905
|
+
}
|
|
8906
|
+
/**
|
|
8907
|
+
* Returns a Response object
|
|
8908
|
+
*/
|
|
8909
|
+
createResponse(json) {
|
|
8910
|
+
return new ResponseEmbeddingStatus({
|
|
8911
|
+
query: this,
|
|
8912
|
+
json
|
|
8913
|
+
});
|
|
8914
|
+
}
|
|
8915
|
+
};
|
|
8916
|
+
|
|
8813
8917
|
// src/response/ResponseProposeMolecule.ts
|
|
8814
8918
|
init_Response();
|
|
8815
8919
|
init_Dot();
|
|
8920
|
+
init_MolecularHashMismatchException();
|
|
8921
|
+
init_SignatureMismatchException();
|
|
8922
|
+
init_AtomIndexException();
|
|
8816
8923
|
var ResponseProposeMolecule = class extends Response {
|
|
8817
8924
|
$__clientMolecule;
|
|
8818
8925
|
/**
|
|
@@ -8884,6 +8991,47 @@ var ResponseProposeMolecule = class extends Response {
|
|
|
8884
8991
|
reason() {
|
|
8885
8992
|
return Dot.get(this.data(), "reason", "Invalid response from server");
|
|
8886
8993
|
}
|
|
8994
|
+
/**
|
|
8995
|
+
* Map this rejection to a typed SDK exception when the failure mode is one
|
|
8996
|
+
* we know about. Returns null on success or for rejections we don't have a
|
|
8997
|
+
* typed class for.
|
|
8998
|
+
*
|
|
8999
|
+
* This is the single place pattern-matching against validator reason strings
|
|
9000
|
+
* lives — consumers (KnishIOClient cache invalidation, callers needing to
|
|
9001
|
+
* branch on failure mode) can `instanceof`-switch on the result instead.
|
|
9002
|
+
* Future validator versions can rephrase reasons (or populate a structured
|
|
9003
|
+
* field in the response payload) without breaking callers.
|
|
9004
|
+
*/
|
|
9005
|
+
toException() {
|
|
9006
|
+
if (this.success()) return null;
|
|
9007
|
+
const reason = this.reason();
|
|
9008
|
+
const lc = reason.toLowerCase();
|
|
9009
|
+
if (/molecularhashmismatch|hash.*mismatch/.test(lc)) {
|
|
9010
|
+
return new MolecularHashMismatchException(reason, {
|
|
9011
|
+
details: { reason },
|
|
9012
|
+
code: "HASH_MISMATCH"
|
|
9013
|
+
});
|
|
9014
|
+
}
|
|
9015
|
+
if (/ots.*position.*reuse|position.*already.*used|ots.*verification/.test(lc)) {
|
|
9016
|
+
return new SignatureMismatchException(reason, {
|
|
9017
|
+
details: { reason },
|
|
9018
|
+
code: "OTS_VERIFICATION_FAILED"
|
|
9019
|
+
});
|
|
9020
|
+
}
|
|
9021
|
+
if (/continuid.*chain|previousposition|chain.*violation/.test(lc)) {
|
|
9022
|
+
return new AtomIndexException(reason, {
|
|
9023
|
+
details: { reason },
|
|
9024
|
+
code: "INDEX_CONFLICT"
|
|
9025
|
+
});
|
|
9026
|
+
}
|
|
9027
|
+
if (/signature.*verification|signature.*invalid/.test(lc)) {
|
|
9028
|
+
return new SignatureMismatchException(reason, {
|
|
9029
|
+
details: { reason },
|
|
9030
|
+
code: "VERIFICATION_FAILED"
|
|
9031
|
+
});
|
|
9032
|
+
}
|
|
9033
|
+
return null;
|
|
9034
|
+
}
|
|
8887
9035
|
/**
|
|
8888
9036
|
* Returns payload object
|
|
8889
9037
|
* Matches JavaScript SDK payload method exactly
|
|
@@ -9921,6 +10069,13 @@ var KnishIOClient = class {
|
|
|
9921
10069
|
$__remainderWallet = null;
|
|
9922
10070
|
lastMoleculeQuery = null;
|
|
9923
10071
|
abortControllers = /* @__PURE__ */ new Map();
|
|
10072
|
+
$__capabilityCache = {};
|
|
10073
|
+
// Promise-chain mutex serializing MutationProposeMolecule submissions on this
|
|
10074
|
+
// client. Without it, concurrent createMolecule() calls both query the same
|
|
10075
|
+
// ContinuID position and both sign with it — the second is rejected with
|
|
10076
|
+
// OTS position reuse. Auth-token flow (MutationRequestAuthorization) inherits
|
|
10077
|
+
// from MutationProposeMolecule so it's covered by the same lock.
|
|
10078
|
+
$__moleculeChain = Promise.resolve();
|
|
9924
10079
|
/**
|
|
9925
10080
|
* Enhanced constructor with standardized configuration validation (Phase 2 Enhancement)
|
|
9926
10081
|
*/
|
|
@@ -10045,6 +10200,7 @@ var KnishIOClient = class {
|
|
|
10045
10200
|
this.$__authToken = null;
|
|
10046
10201
|
this.$__remainderWallet = null;
|
|
10047
10202
|
this.lastMoleculeQuery = null;
|
|
10203
|
+
this.$__capabilityCache = {};
|
|
10048
10204
|
}
|
|
10049
10205
|
/**
|
|
10050
10206
|
* Get the GraphQL client
|
|
@@ -10065,6 +10221,19 @@ var KnishIOClient = class {
|
|
|
10065
10221
|
this.$__client.setUri(this.getRandomUri());
|
|
10066
10222
|
}
|
|
10067
10223
|
}
|
|
10224
|
+
/**
|
|
10225
|
+
* Sets the WebSocket (subscription) endpoint for this session.
|
|
10226
|
+
*
|
|
10227
|
+
* F-8a (cross-SDK parity, 2026-06-03): `setUri` only updates the HTTP endpoint; the
|
|
10228
|
+
* subscription socket is built once from the `socket.socketUri` passed at
|
|
10229
|
+
* construction. This lets a caller re-point the socket when the endpoint changes
|
|
10230
|
+
* (mirrors the JS SDK's `setSocketUri`).
|
|
10231
|
+
*/
|
|
10232
|
+
setSocketUri(socketUri) {
|
|
10233
|
+
if (this.$__client && "setSocketUri" in this.$__client) {
|
|
10234
|
+
this.$__client.setSocketUri(socketUri);
|
|
10235
|
+
}
|
|
10236
|
+
}
|
|
10068
10237
|
/**
|
|
10069
10238
|
* Gets the Knish.IO server URIs
|
|
10070
10239
|
*/
|
|
@@ -10138,6 +10307,17 @@ var KnishIOClient = class {
|
|
|
10138
10307
|
this.log("info", "KnishIOClient::createMolecule() - Creating a new molecule...");
|
|
10139
10308
|
secret = secret || this.getSecret();
|
|
10140
10309
|
bundle = bundle || this.getBundle();
|
|
10310
|
+
let continuIdPosition = null;
|
|
10311
|
+
if (sourceWallet && sourceWallet.token !== "USER") {
|
|
10312
|
+
if (this.lastMoleculeQuery && this.getRemainderWallet() && this.getRemainderWallet()?.token === "USER" && this.lastMoleculeQuery.response() && this.lastMoleculeQuery.response()?.success()) {
|
|
10313
|
+
continuIdPosition = this.getRemainderWallet()?.position || null;
|
|
10314
|
+
this.log("info", `KnishIOClient::createMolecule() - Captured USER ContinuID position ${continuIdPosition?.substring(0, 16)}... for non-USER source wallet`);
|
|
10315
|
+
} else {
|
|
10316
|
+
const userWallet = await this.getSourceWallet();
|
|
10317
|
+
continuIdPosition = userWallet?.position || null;
|
|
10318
|
+
this.log("info", `KnishIOClient::createMolecule() - Queried USER ContinuID position ${continuIdPosition?.substring(0, 16)}... for non-USER source wallet`);
|
|
10319
|
+
}
|
|
10320
|
+
}
|
|
10141
10321
|
if (!sourceWallet && this.lastMoleculeQuery && this.getRemainderWallet()?.token === "USER" && this.lastMoleculeQuery.response() && this.lastMoleculeQuery.response()?.success()) {
|
|
10142
10322
|
sourceWallet = this.getRemainderWallet();
|
|
10143
10323
|
this.log("info", `KnishIOClient::createMolecule() - Using carry-forward remainder wallet at position ${sourceWallet?.position?.substring(0, 16)}...`);
|
|
@@ -10157,7 +10337,8 @@ var KnishIOClient = class {
|
|
|
10157
10337
|
sourceWallet,
|
|
10158
10338
|
remainderWallet: this.getRemainderWallet(),
|
|
10159
10339
|
cellSlug: this.getCellSlug(),
|
|
10160
|
-
version: this.getServerSdkVersion()
|
|
10340
|
+
version: this.getServerSdkVersion(),
|
|
10341
|
+
continuIdPosition
|
|
10161
10342
|
});
|
|
10162
10343
|
}
|
|
10163
10344
|
/**
|
|
@@ -10176,6 +10357,23 @@ var KnishIOClient = class {
|
|
|
10176
10357
|
this.lastMoleculeQuery = mutation;
|
|
10177
10358
|
return mutation;
|
|
10178
10359
|
}
|
|
10360
|
+
/**
|
|
10361
|
+
* Serializes the given async work behind a per-client promise chain. Used to
|
|
10362
|
+
* guarantee that at most one MutationProposeMolecule submission runs at a
|
|
10363
|
+
* time on this client — query position, sign, submit, observe response must
|
|
10364
|
+
* complete before the next one starts, or two callers race for the same OTS
|
|
10365
|
+
* position and the second gets rejected.
|
|
10366
|
+
*
|
|
10367
|
+
* `.then(fn, fn)` runs fn whether the previous holder resolved or rejected;
|
|
10368
|
+
* the queue's `.catch` swallows the rejection so a single failure doesn't
|
|
10369
|
+
* poison every subsequent caller, while the rejection still propagates to
|
|
10370
|
+
* the caller whose fn threw.
|
|
10371
|
+
*/
|
|
10372
|
+
withMoleculeLock(fn) {
|
|
10373
|
+
const result = this.$__moleculeChain.then(fn, fn);
|
|
10374
|
+
this.$__moleculeChain = result.catch(() => void 0);
|
|
10375
|
+
return result;
|
|
10376
|
+
}
|
|
10179
10377
|
/**
|
|
10180
10378
|
* Executes a query or mutation
|
|
10181
10379
|
*/
|
|
@@ -10188,8 +10386,34 @@ var KnishIOClient = class {
|
|
|
10188
10386
|
encrypt: this.$__encrypt
|
|
10189
10387
|
});
|
|
10190
10388
|
}
|
|
10389
|
+
if (query instanceof MutationProposeMolecule) {
|
|
10390
|
+
return await this.withMoleculeLock(async () => {
|
|
10391
|
+
const response = await query.execute({ variables: variables || {} });
|
|
10392
|
+
this.handlePositionDrift(response);
|
|
10393
|
+
return response;
|
|
10394
|
+
});
|
|
10395
|
+
}
|
|
10191
10396
|
return await query.execute({ variables: variables || {} });
|
|
10192
10397
|
}
|
|
10398
|
+
/**
|
|
10399
|
+
* When a ProposeMolecule submission is rejected for a position-related
|
|
10400
|
+
* reason (OTS reuse, ContinuID chain violation, molecular hash mismatch),
|
|
10401
|
+
* the cached remainder wallet and lastMoleculeQuery are stale — the
|
|
10402
|
+
* validator's chain has advanced past what we know. Clear them so the next
|
|
10403
|
+
* createMolecule call re-queries queryContinuId for the authoritative
|
|
10404
|
+
* position. Other failure modes (network, malformed meta, bad signature
|
|
10405
|
+
* bytes) don't imply drift; leave cached state alone.
|
|
10406
|
+
*/
|
|
10407
|
+
handlePositionDrift(response) {
|
|
10408
|
+
if (!(response instanceof ResponseProposeMolecule)) return;
|
|
10409
|
+
const exc = response.toException();
|
|
10410
|
+
if (!exc) return;
|
|
10411
|
+
if (exc instanceof MolecularHashMismatchException || exc instanceof AtomIndexException || exc instanceof SignatureMismatchException && exc.code === "OTS_VERIFICATION_FAILED") {
|
|
10412
|
+
this.$__remainderWallet = null;
|
|
10413
|
+
this.lastMoleculeQuery = null;
|
|
10414
|
+
this.log("warn", `KnishIOClient::executeQuery() - position drift detected (${exc.name}/${exc.code}); cleared cached remainder wallet`);
|
|
10415
|
+
}
|
|
10416
|
+
}
|
|
10193
10417
|
/**
|
|
10194
10418
|
* Sets the secret for this session
|
|
10195
10419
|
*/
|
|
@@ -10569,6 +10793,63 @@ var KnishIOClient = class {
|
|
|
10569
10793
|
}
|
|
10570
10794
|
return response;
|
|
10571
10795
|
}
|
|
10796
|
+
/**
|
|
10797
|
+
* Probes the connected server to check whether it supports a named root query field.
|
|
10798
|
+
* Result is cached per URI so the network round-trip happens at most once per URI.
|
|
10799
|
+
*
|
|
10800
|
+
* Uses GraphQL introspection which is universally supported by spec-compliant servers.
|
|
10801
|
+
*
|
|
10802
|
+
* @param fieldName - The root Query field name to check (e.g. 'embeddingStatus')
|
|
10803
|
+
* @returns true if the server schema includes the field, false otherwise
|
|
10804
|
+
*/
|
|
10805
|
+
async hasQueryField(fieldName) {
|
|
10806
|
+
const uri = this.$__client.getUri();
|
|
10807
|
+
const cacheKey = `${uri}::${fieldName}`;
|
|
10808
|
+
if (typeof this.$__capabilityCache[cacheKey] === "boolean") {
|
|
10809
|
+
return this.$__capabilityCache[cacheKey];
|
|
10810
|
+
}
|
|
10811
|
+
try {
|
|
10812
|
+
const result = await this.$__client.query({
|
|
10813
|
+
query: "{ __schema { queryType { fields { name } } } }",
|
|
10814
|
+
variables: {}
|
|
10815
|
+
});
|
|
10816
|
+
const data = result?.data;
|
|
10817
|
+
const fields = data?.__schema?.queryType?.fields || [];
|
|
10818
|
+
const supported = fields.some((f) => f.name === fieldName);
|
|
10819
|
+
this.$__capabilityCache[cacheKey] = supported;
|
|
10820
|
+
return supported;
|
|
10821
|
+
} catch (err) {
|
|
10822
|
+
this.log("warn", `KnishIOClient::hasQueryField() - Capability probe for '${fieldName}' failed: ${err.message}`);
|
|
10823
|
+
this.$__capabilityCache[cacheKey] = false;
|
|
10824
|
+
return false;
|
|
10825
|
+
}
|
|
10826
|
+
}
|
|
10827
|
+
/**
|
|
10828
|
+
* Queries embedding status for one or more meta instances (DataBraid observability).
|
|
10829
|
+
*
|
|
10830
|
+
* If the connected server does not support the embeddingStatus query,
|
|
10831
|
+
* returns null without throwing an error (graceful degradation).
|
|
10832
|
+
*
|
|
10833
|
+
* Single mode: queryEmbeddingStatus({ metaType: 'product', metaId: 'SKU-001' })
|
|
10834
|
+
* Bulk mode: queryEmbeddingStatus({ instances: [{ metaType: 'product', metaId: 'SKU-001' }, ...] })
|
|
10835
|
+
*
|
|
10836
|
+
* @returns Response with payload(), or null if the server does not support this query
|
|
10837
|
+
*/
|
|
10838
|
+
async queryEmbeddingStatus({
|
|
10839
|
+
metaType = null,
|
|
10840
|
+
metaId = null,
|
|
10841
|
+
instances = null
|
|
10842
|
+
}) {
|
|
10843
|
+
this.log("info", `KnishIOClient::queryEmbeddingStatus() - Checking embedding status for metaType: ${metaType || "(bulk)"}...`);
|
|
10844
|
+
const supported = await this.hasQueryField("embeddingStatus");
|
|
10845
|
+
if (!supported) {
|
|
10846
|
+
this.log("warn", "KnishIOClient::queryEmbeddingStatus() - Server does not support embeddingStatus query. Returning null.");
|
|
10847
|
+
return null;
|
|
10848
|
+
}
|
|
10849
|
+
const query = this.createQuery(QueryEmbeddingStatus);
|
|
10850
|
+
const variables = QueryEmbeddingStatus.createVariables({ metaType, metaId, instances });
|
|
10851
|
+
return this.executeQuery(query, variables);
|
|
10852
|
+
}
|
|
10572
10853
|
/**
|
|
10573
10854
|
* Query cascading meta instances for batchId
|
|
10574
10855
|
*/
|
|
@@ -10888,8 +11169,10 @@ var KnishIOClient = class {
|
|
|
10888
11169
|
amount: amount || 0
|
|
10889
11170
|
});
|
|
10890
11171
|
}
|
|
11172
|
+
const remainderWallet = sourceWallet.createRemainder(this.getSecret());
|
|
10891
11173
|
const molecule = await this.createMolecule({
|
|
10892
|
-
sourceWallet
|
|
11174
|
+
sourceWallet,
|
|
11175
|
+
remainderWallet
|
|
10893
11176
|
});
|
|
10894
11177
|
const mutation = await this.createMoleculeMutation({
|
|
10895
11178
|
mutationClass: MutationTransferTokens,
|
|
@@ -11185,7 +11468,15 @@ var KnishIOClient = class {
|
|
|
11185
11468
|
amount
|
|
11186
11469
|
});
|
|
11187
11470
|
}
|
|
11188
|
-
const
|
|
11471
|
+
const remainderWallet = sourceWallet.createRemainder(this.getSecret());
|
|
11472
|
+
const molecule = await this.createMolecule({
|
|
11473
|
+
sourceWallet,
|
|
11474
|
+
remainderWallet
|
|
11475
|
+
});
|
|
11476
|
+
const mutation = await this.createMoleculeMutation({
|
|
11477
|
+
mutationClass: MutationDepositBufferToken,
|
|
11478
|
+
molecule
|
|
11479
|
+
});
|
|
11189
11480
|
await mutation.fillMolecule({
|
|
11190
11481
|
amount: typeof amount === "string" ? Number(amount) : amount,
|
|
11191
11482
|
tradeRates
|
|
@@ -11521,6 +11812,6 @@ var KnishIO = {
|
|
|
11521
11812
|
SDK_INFO
|
|
11522
11813
|
};
|
|
11523
11814
|
|
|
11524
|
-
export { Atom, AtomIndexException, AtomMeta, AtomsMissingException, AuthToken, BaseException, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, CheckMolecule, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, ExceptionFactory, GraphQLClient, InvalidResponseException, KnishIO, KnishIOClient, Meta, MolecularHashMismatchException, Molecule, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryMetaType, QueryMetaTypeViaAtom, QueryWalletBundle, QueryWalletList, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, SDK_INFO, SDK_NAME, SDK_VERSION, SignatureMismatchException, TokenUnit, TransferBalanceException, Wallet, WalletCredentialException, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, convertToBase17, createBundleHash, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition2 as isPosition, isWalletAddress2 as isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature };
|
|
11815
|
+
export { Atom, AtomIndexException, AtomMeta, AtomsMissingException, AuthToken, BaseException, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, CheckMolecule, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, ExceptionFactory, GraphQLClient, InvalidResponseException, KnishIO, KnishIOClient, Meta, MolecularHashMismatchException, Molecule, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryEmbeddingStatus, QueryMetaType, QueryMetaTypeViaAtom, QueryWalletBundle, QueryWalletList, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseEmbeddingStatus, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, SDK_INFO, SDK_NAME, SDK_VERSION, SignatureMismatchException, TokenUnit, TransferBalanceException, Wallet, WalletCredentialException, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, convertToBase17, createBundleHash, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition2 as isPosition, isWalletAddress2 as isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature };
|
|
11525
11816
|
//# sourceMappingURL=index.js.map
|
|
11526
11817
|
//# sourceMappingURL=index.js.map
|