agent-swarm-kit 1.0.59 → 1.0.60
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/build/index.cjs +48 -48
- package/build/index.mjs +48 -48
- package/package.json +1 -1
- package/types.d.ts +37 -6
package/build/index.cjs
CHANGED
|
@@ -5922,22 +5922,22 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5922
5922
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
5923
5923
|
* @template T
|
|
5924
5924
|
*/
|
|
5925
|
-
this.take = function (
|
|
5925
|
+
this.take = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
5926
5926
|
return __generator(this, function (_a) {
|
|
5927
5927
|
switch (_a.label) {
|
|
5928
5928
|
case 0:
|
|
5929
5929
|
swarm.loggerService.log("StorageStatic take", {
|
|
5930
|
-
search: search,
|
|
5931
|
-
total: total,
|
|
5932
|
-
clientId: clientId,
|
|
5933
|
-
storageName: storageName,
|
|
5934
|
-
score: score,
|
|
5930
|
+
search: payload.search,
|
|
5931
|
+
total: payload.total,
|
|
5932
|
+
clientId: payload.clientId,
|
|
5933
|
+
storageName: payload.storageName,
|
|
5934
|
+
score: payload.score,
|
|
5935
5935
|
});
|
|
5936
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5937
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5938
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (take)"));
|
|
5936
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
5937
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
5938
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
5939
5939
|
}
|
|
5940
|
-
return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName, score)];
|
|
5940
|
+
return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, payload.clientId, payload.storageName, payload.score)];
|
|
5941
5941
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
5942
5942
|
}
|
|
5943
5943
|
});
|
|
@@ -5951,20 +5951,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5951
5951
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
5952
5952
|
* @template T
|
|
5953
5953
|
*/
|
|
5954
|
-
this.upsert = function (
|
|
5954
|
+
this.upsert = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
5955
5955
|
return __generator(this, function (_a) {
|
|
5956
5956
|
switch (_a.label) {
|
|
5957
5957
|
case 0:
|
|
5958
5958
|
swarm.loggerService.log("StorageStatic upsert", {
|
|
5959
|
-
item: item,
|
|
5960
|
-
clientId: clientId,
|
|
5961
|
-
storageName: storageName,
|
|
5959
|
+
item: payload.item,
|
|
5960
|
+
clientId: payload.clientId,
|
|
5961
|
+
storageName: payload.storageName,
|
|
5962
5962
|
});
|
|
5963
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5964
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5965
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (upsert)"));
|
|
5963
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
5964
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
5965
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
5966
5966
|
}
|
|
5967
|
-
return [4 /*yield*/, swarm.storagePublicService.upsert(item, clientId, storageName)];
|
|
5967
|
+
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, payload.clientId, payload.storageName)];
|
|
5968
5968
|
case 1: return [2 /*return*/, _a.sent()];
|
|
5969
5969
|
}
|
|
5970
5970
|
});
|
|
@@ -5977,20 +5977,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5977
5977
|
* @param {StorageName} storageName - The storage name.
|
|
5978
5978
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
5979
5979
|
*/
|
|
5980
|
-
this.remove = function (
|
|
5980
|
+
this.remove = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
5981
5981
|
return __generator(this, function (_a) {
|
|
5982
5982
|
switch (_a.label) {
|
|
5983
5983
|
case 0:
|
|
5984
5984
|
swarm.loggerService.log("StorageStatic remove", {
|
|
5985
|
-
itemId: itemId,
|
|
5986
|
-
clientId: clientId,
|
|
5987
|
-
storageName: storageName,
|
|
5985
|
+
itemId: payload.itemId,
|
|
5986
|
+
clientId: payload.clientId,
|
|
5987
|
+
storageName: payload.storageName,
|
|
5988
5988
|
});
|
|
5989
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5990
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5991
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (remove)"));
|
|
5989
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
5990
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
5991
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
5992
5992
|
}
|
|
5993
|
-
return [4 /*yield*/, swarm.storagePublicService.remove(itemId, clientId, storageName)];
|
|
5993
|
+
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, payload.clientId, payload.storageName)];
|
|
5994
5994
|
case 1: return [2 /*return*/, _a.sent()];
|
|
5995
5995
|
}
|
|
5996
5996
|
});
|
|
@@ -6004,20 +6004,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
6004
6004
|
* @returns {Promise<T | null>} - A promise that resolves to the item or null if not found.
|
|
6005
6005
|
* @template T
|
|
6006
6006
|
*/
|
|
6007
|
-
this.get = function (
|
|
6007
|
+
this.get = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
6008
6008
|
return __generator(this, function (_a) {
|
|
6009
6009
|
switch (_a.label) {
|
|
6010
6010
|
case 0:
|
|
6011
6011
|
swarm.loggerService.log("StorageStatic get", {
|
|
6012
|
-
itemId: itemId,
|
|
6013
|
-
clientId: clientId,
|
|
6014
|
-
storageName: storageName,
|
|
6012
|
+
itemId: payload.itemId,
|
|
6013
|
+
clientId: payload.clientId,
|
|
6014
|
+
storageName: payload.storageName,
|
|
6015
6015
|
});
|
|
6016
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
6017
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
6018
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (get)"));
|
|
6016
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
6017
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
6018
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
6019
6019
|
}
|
|
6020
|
-
return [4 /*yield*/, swarm.storagePublicService.get(itemId, clientId, storageName)];
|
|
6020
|
+
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, payload.clientId, payload.storageName)];
|
|
6021
6021
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
6022
6022
|
}
|
|
6023
6023
|
});
|
|
@@ -6031,19 +6031,19 @@ var StorageUtils = /** @class */ (function () {
|
|
|
6031
6031
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
6032
6032
|
* @template T
|
|
6033
6033
|
*/
|
|
6034
|
-
this.list = function (
|
|
6034
|
+
this.list = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
6035
6035
|
return __generator(this, function (_a) {
|
|
6036
6036
|
switch (_a.label) {
|
|
6037
6037
|
case 0:
|
|
6038
6038
|
swarm.loggerService.log("StorageStatic list", {
|
|
6039
|
-
clientId: clientId,
|
|
6040
|
-
storageName: storageName,
|
|
6039
|
+
clientId: payload.clientId,
|
|
6040
|
+
storageName: payload.storageName,
|
|
6041
6041
|
});
|
|
6042
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
6043
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
6044
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (list)"));
|
|
6042
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
6043
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
6044
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
6045
6045
|
}
|
|
6046
|
-
return [4 /*yield*/, swarm.storagePublicService.list(clientId, storageName, filter)];
|
|
6046
|
+
return [4 /*yield*/, swarm.storagePublicService.list(payload.clientId, payload.storageName, payload.filter)];
|
|
6047
6047
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
6048
6048
|
}
|
|
6049
6049
|
});
|
|
@@ -6055,19 +6055,19 @@ var StorageUtils = /** @class */ (function () {
|
|
|
6055
6055
|
* @param {StorageName} storageName - The storage name.
|
|
6056
6056
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
6057
6057
|
*/
|
|
6058
|
-
this.clear = function (
|
|
6058
|
+
this.clear = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
6059
6059
|
return __generator(this, function (_a) {
|
|
6060
6060
|
switch (_a.label) {
|
|
6061
6061
|
case 0:
|
|
6062
6062
|
swarm.loggerService.log("StorageStatic clear", {
|
|
6063
|
-
clientId: clientId,
|
|
6064
|
-
storageName: storageName,
|
|
6063
|
+
clientId: payload.clientId,
|
|
6064
|
+
storageName: payload.storageName,
|
|
6065
6065
|
});
|
|
6066
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
6067
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
6068
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (clear)"));
|
|
6066
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
6067
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
6068
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
6069
6069
|
}
|
|
6070
|
-
return [4 /*yield*/, swarm.storagePublicService.clear(clientId, storageName)];
|
|
6070
|
+
return [4 /*yield*/, swarm.storagePublicService.clear(payload.clientId, payload.storageName)];
|
|
6071
6071
|
case 1: return [2 /*return*/, _a.sent()];
|
|
6072
6072
|
}
|
|
6073
6073
|
});
|
package/build/index.mjs
CHANGED
|
@@ -5920,22 +5920,22 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5920
5920
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
5921
5921
|
* @template T
|
|
5922
5922
|
*/
|
|
5923
|
-
this.take = function (
|
|
5923
|
+
this.take = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
5924
5924
|
return __generator(this, function (_a) {
|
|
5925
5925
|
switch (_a.label) {
|
|
5926
5926
|
case 0:
|
|
5927
5927
|
swarm.loggerService.log("StorageStatic take", {
|
|
5928
|
-
search: search,
|
|
5929
|
-
total: total,
|
|
5930
|
-
clientId: clientId,
|
|
5931
|
-
storageName: storageName,
|
|
5932
|
-
score: score,
|
|
5928
|
+
search: payload.search,
|
|
5929
|
+
total: payload.total,
|
|
5930
|
+
clientId: payload.clientId,
|
|
5931
|
+
storageName: payload.storageName,
|
|
5932
|
+
score: payload.score,
|
|
5933
5933
|
});
|
|
5934
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5935
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5936
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (take)"));
|
|
5934
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
5935
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
5936
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
5937
5937
|
}
|
|
5938
|
-
return [4 /*yield*/, swarm.storagePublicService.take(search, total, clientId, storageName, score)];
|
|
5938
|
+
return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, payload.clientId, payload.storageName, payload.score)];
|
|
5939
5939
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
5940
5940
|
}
|
|
5941
5941
|
});
|
|
@@ -5949,20 +5949,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5949
5949
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
5950
5950
|
* @template T
|
|
5951
5951
|
*/
|
|
5952
|
-
this.upsert = function (
|
|
5952
|
+
this.upsert = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
5953
5953
|
return __generator(this, function (_a) {
|
|
5954
5954
|
switch (_a.label) {
|
|
5955
5955
|
case 0:
|
|
5956
5956
|
swarm.loggerService.log("StorageStatic upsert", {
|
|
5957
|
-
item: item,
|
|
5958
|
-
clientId: clientId,
|
|
5959
|
-
storageName: storageName,
|
|
5957
|
+
item: payload.item,
|
|
5958
|
+
clientId: payload.clientId,
|
|
5959
|
+
storageName: payload.storageName,
|
|
5960
5960
|
});
|
|
5961
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5962
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5963
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (upsert)"));
|
|
5961
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
5962
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
5963
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
5964
5964
|
}
|
|
5965
|
-
return [4 /*yield*/, swarm.storagePublicService.upsert(item, clientId, storageName)];
|
|
5965
|
+
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, payload.clientId, payload.storageName)];
|
|
5966
5966
|
case 1: return [2 /*return*/, _a.sent()];
|
|
5967
5967
|
}
|
|
5968
5968
|
});
|
|
@@ -5975,20 +5975,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
5975
5975
|
* @param {StorageName} storageName - The storage name.
|
|
5976
5976
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
5977
5977
|
*/
|
|
5978
|
-
this.remove = function (
|
|
5978
|
+
this.remove = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
5979
5979
|
return __generator(this, function (_a) {
|
|
5980
5980
|
switch (_a.label) {
|
|
5981
5981
|
case 0:
|
|
5982
5982
|
swarm.loggerService.log("StorageStatic remove", {
|
|
5983
|
-
itemId: itemId,
|
|
5984
|
-
clientId: clientId,
|
|
5985
|
-
storageName: storageName,
|
|
5983
|
+
itemId: payload.itemId,
|
|
5984
|
+
clientId: payload.clientId,
|
|
5985
|
+
storageName: payload.storageName,
|
|
5986
5986
|
});
|
|
5987
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
5988
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
5989
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (remove)"));
|
|
5987
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
5988
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
5989
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
5990
5990
|
}
|
|
5991
|
-
return [4 /*yield*/, swarm.storagePublicService.remove(itemId, clientId, storageName)];
|
|
5991
|
+
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, payload.clientId, payload.storageName)];
|
|
5992
5992
|
case 1: return [2 /*return*/, _a.sent()];
|
|
5993
5993
|
}
|
|
5994
5994
|
});
|
|
@@ -6002,20 +6002,20 @@ var StorageUtils = /** @class */ (function () {
|
|
|
6002
6002
|
* @returns {Promise<T | null>} - A promise that resolves to the item or null if not found.
|
|
6003
6003
|
* @template T
|
|
6004
6004
|
*/
|
|
6005
|
-
this.get = function (
|
|
6005
|
+
this.get = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
6006
6006
|
return __generator(this, function (_a) {
|
|
6007
6007
|
switch (_a.label) {
|
|
6008
6008
|
case 0:
|
|
6009
6009
|
swarm.loggerService.log("StorageStatic get", {
|
|
6010
|
-
itemId: itemId,
|
|
6011
|
-
clientId: clientId,
|
|
6012
|
-
storageName: storageName,
|
|
6010
|
+
itemId: payload.itemId,
|
|
6011
|
+
clientId: payload.clientId,
|
|
6012
|
+
storageName: payload.storageName,
|
|
6013
6013
|
});
|
|
6014
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
6015
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
6016
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (get)"));
|
|
6014
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
6015
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
6016
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
6017
6017
|
}
|
|
6018
|
-
return [4 /*yield*/, swarm.storagePublicService.get(itemId, clientId, storageName)];
|
|
6018
|
+
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, payload.clientId, payload.storageName)];
|
|
6019
6019
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
6020
6020
|
}
|
|
6021
6021
|
});
|
|
@@ -6029,19 +6029,19 @@ var StorageUtils = /** @class */ (function () {
|
|
|
6029
6029
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
6030
6030
|
* @template T
|
|
6031
6031
|
*/
|
|
6032
|
-
this.list = function (
|
|
6032
|
+
this.list = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
6033
6033
|
return __generator(this, function (_a) {
|
|
6034
6034
|
switch (_a.label) {
|
|
6035
6035
|
case 0:
|
|
6036
6036
|
swarm.loggerService.log("StorageStatic list", {
|
|
6037
|
-
clientId: clientId,
|
|
6038
|
-
storageName: storageName,
|
|
6037
|
+
clientId: payload.clientId,
|
|
6038
|
+
storageName: payload.storageName,
|
|
6039
6039
|
});
|
|
6040
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
6041
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
6042
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (list)"));
|
|
6040
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
6041
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
6042
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
6043
6043
|
}
|
|
6044
|
-
return [4 /*yield*/, swarm.storagePublicService.list(clientId, storageName, filter)];
|
|
6044
|
+
return [4 /*yield*/, swarm.storagePublicService.list(payload.clientId, payload.storageName, payload.filter)];
|
|
6045
6045
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
6046
6046
|
}
|
|
6047
6047
|
});
|
|
@@ -6053,19 +6053,19 @@ var StorageUtils = /** @class */ (function () {
|
|
|
6053
6053
|
* @param {StorageName} storageName - The storage name.
|
|
6054
6054
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
6055
6055
|
*/
|
|
6056
|
-
this.clear = function (
|
|
6056
|
+
this.clear = function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
6057
6057
|
return __generator(this, function (_a) {
|
|
6058
6058
|
switch (_a.label) {
|
|
6059
6059
|
case 0:
|
|
6060
6060
|
swarm.loggerService.log("StorageStatic clear", {
|
|
6061
|
-
clientId: clientId,
|
|
6062
|
-
storageName: storageName,
|
|
6061
|
+
clientId: payload.clientId,
|
|
6062
|
+
storageName: payload.storageName,
|
|
6063
6063
|
});
|
|
6064
|
-
swarm.storageValidationService.validate(storageName, "StorageStatic");
|
|
6065
|
-
if (!swarm.agentValidationService.hasStorage(agentName, storageName)) {
|
|
6066
|
-
throw new Error("agent-swarm StorageUtils ".concat(storageName, " not registered in ").concat(agentName, " (clear)"));
|
|
6064
|
+
swarm.storageValidationService.validate(payload.storageName, "StorageStatic");
|
|
6065
|
+
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
6066
|
+
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
6067
6067
|
}
|
|
6068
|
-
return [4 /*yield*/, swarm.storagePublicService.clear(clientId, storageName)];
|
|
6068
|
+
return [4 /*yield*/, swarm.storagePublicService.clear(payload.clientId, payload.storageName)];
|
|
6069
6069
|
case 1: return [2 /*return*/, _a.sent()];
|
|
6070
6070
|
}
|
|
6071
6071
|
});
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -2570,7 +2570,14 @@ declare class StorageUtils implements TStorage {
|
|
|
2570
2570
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
2571
2571
|
* @template T
|
|
2572
2572
|
*/
|
|
2573
|
-
take: <T extends IStorageData = IStorageData>(
|
|
2573
|
+
take: <T extends IStorageData = IStorageData>(payload: {
|
|
2574
|
+
search: string;
|
|
2575
|
+
total: number;
|
|
2576
|
+
clientId: string;
|
|
2577
|
+
agentName: AgentName;
|
|
2578
|
+
storageName: StorageName;
|
|
2579
|
+
score?: number;
|
|
2580
|
+
}) => Promise<T[]>;
|
|
2574
2581
|
/**
|
|
2575
2582
|
* Upserts an item in the storage.
|
|
2576
2583
|
* @param {T} item - The item to upsert.
|
|
@@ -2580,7 +2587,12 @@ declare class StorageUtils implements TStorage {
|
|
|
2580
2587
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
2581
2588
|
* @template T
|
|
2582
2589
|
*/
|
|
2583
|
-
upsert: <T extends IStorageData = IStorageData>(
|
|
2590
|
+
upsert: <T extends IStorageData = IStorageData>(payload: {
|
|
2591
|
+
item: T;
|
|
2592
|
+
clientId: string;
|
|
2593
|
+
agentName: AgentName;
|
|
2594
|
+
storageName: StorageName;
|
|
2595
|
+
}) => Promise<void>;
|
|
2584
2596
|
/**
|
|
2585
2597
|
* Removes an item from the storage.
|
|
2586
2598
|
* @param {IStorageData["id"]} itemId - The ID of the item to remove.
|
|
@@ -2589,7 +2601,12 @@ declare class StorageUtils implements TStorage {
|
|
|
2589
2601
|
* @param {StorageName} storageName - The storage name.
|
|
2590
2602
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
2591
2603
|
*/
|
|
2592
|
-
remove: (
|
|
2604
|
+
remove: (payload: {
|
|
2605
|
+
itemId: IStorageData["id"];
|
|
2606
|
+
clientId: string;
|
|
2607
|
+
agentName: AgentName;
|
|
2608
|
+
storageName: StorageName;
|
|
2609
|
+
}) => Promise<void>;
|
|
2593
2610
|
/**
|
|
2594
2611
|
* Gets an item from the storage.
|
|
2595
2612
|
* @param {IStorageData["id"]} itemId - The ID of the item to get.
|
|
@@ -2599,7 +2616,12 @@ declare class StorageUtils implements TStorage {
|
|
|
2599
2616
|
* @returns {Promise<T | null>} - A promise that resolves to the item or null if not found.
|
|
2600
2617
|
* @template T
|
|
2601
2618
|
*/
|
|
2602
|
-
get: <T extends IStorageData = IStorageData>(
|
|
2619
|
+
get: <T extends IStorageData = IStorageData>(payload: {
|
|
2620
|
+
itemId: IStorageData["id"];
|
|
2621
|
+
clientId: string;
|
|
2622
|
+
agentName: AgentName;
|
|
2623
|
+
storageName: StorageName;
|
|
2624
|
+
}) => Promise<T | null>;
|
|
2603
2625
|
/**
|
|
2604
2626
|
* Lists items from the storage.
|
|
2605
2627
|
* @param {string} clientId - The client ID.
|
|
@@ -2609,7 +2631,12 @@ declare class StorageUtils implements TStorage {
|
|
|
2609
2631
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
2610
2632
|
* @template T
|
|
2611
2633
|
*/
|
|
2612
|
-
list: <T extends IStorageData = IStorageData>(
|
|
2634
|
+
list: <T extends IStorageData = IStorageData>(payload: {
|
|
2635
|
+
clientId: string;
|
|
2636
|
+
agentName: AgentName;
|
|
2637
|
+
storageName: StorageName;
|
|
2638
|
+
filter?: (item: T) => boolean;
|
|
2639
|
+
}) => Promise<T[]>;
|
|
2613
2640
|
/**
|
|
2614
2641
|
* Clears the storage.
|
|
2615
2642
|
* @param {string} clientId - The client ID.
|
|
@@ -2617,7 +2644,11 @@ declare class StorageUtils implements TStorage {
|
|
|
2617
2644
|
* @param {StorageName} storageName - The storage name.
|
|
2618
2645
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
2619
2646
|
*/
|
|
2620
|
-
clear: (
|
|
2647
|
+
clear: (payload: {
|
|
2648
|
+
clientId: string;
|
|
2649
|
+
agentName: AgentName;
|
|
2650
|
+
storageName: StorageName;
|
|
2651
|
+
}) => Promise<void>;
|
|
2621
2652
|
}
|
|
2622
2653
|
declare const Storage: StorageUtils;
|
|
2623
2654
|
|