@agentforge/tools 0.16.33 → 0.16.34
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/dist/index.cjs +30 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -64
- package/dist/index.d.ts +67 -64
- package/dist/index.js +28 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1914,31 +1914,34 @@ function createXmlTools(config = {}) {
|
|
|
1914
1914
|
createJsonToXmlTool(defaultRootName, defaultFormat)
|
|
1915
1915
|
];
|
|
1916
1916
|
}
|
|
1917
|
+
var transformerValueSchema = zod.z.unknown().describe("Transformer value");
|
|
1918
|
+
var transformerArraySchema = zod.z.array(transformerValueSchema).describe("Array to transform");
|
|
1919
|
+
var transformerObjectSchema = zod.z.record(zod.z.string(), transformerValueSchema).describe("Source object");
|
|
1917
1920
|
var arrayFilterSchema = zod.z.object({
|
|
1918
|
-
array:
|
|
1921
|
+
array: transformerArraySchema.describe("Array to filter"),
|
|
1919
1922
|
property: zod.z.string().describe("Property name to filter by (use dot notation for nested properties)"),
|
|
1920
1923
|
operator: zod.z.enum(["equals", "not-equals", "greater-than", "less-than", "contains", "starts-with", "ends-with"]).describe("Comparison operator"),
|
|
1921
|
-
value:
|
|
1924
|
+
value: transformerValueSchema.describe("Value to compare against")
|
|
1922
1925
|
});
|
|
1923
1926
|
var arrayMapSchema = zod.z.object({
|
|
1924
|
-
array:
|
|
1927
|
+
array: transformerArraySchema.describe("Array to map"),
|
|
1925
1928
|
properties: zod.z.array(zod.z.string().describe("String value")).describe("List of property names to extract from each object")
|
|
1926
1929
|
});
|
|
1927
1930
|
var arraySortSchema = zod.z.object({
|
|
1928
|
-
array:
|
|
1931
|
+
array: transformerArraySchema.describe("Array to sort"),
|
|
1929
1932
|
property: zod.z.string().describe("Property name to sort by (use dot notation for nested properties)"),
|
|
1930
1933
|
order: zod.z.enum(["asc", "desc"]).default("asc").describe("Sort order: ascending or descending")
|
|
1931
1934
|
});
|
|
1932
1935
|
var arrayGroupBySchema = zod.z.object({
|
|
1933
|
-
array:
|
|
1936
|
+
array: transformerArraySchema.describe("Array to group"),
|
|
1934
1937
|
property: zod.z.string().describe("Property name to group by")
|
|
1935
1938
|
});
|
|
1936
1939
|
var objectPickSchema = zod.z.object({
|
|
1937
|
-
object:
|
|
1940
|
+
object: transformerObjectSchema,
|
|
1938
1941
|
properties: zod.z.array(zod.z.string().describe("String value")).describe("List of property names to pick")
|
|
1939
1942
|
});
|
|
1940
1943
|
var objectOmitSchema = zod.z.object({
|
|
1941
|
-
object:
|
|
1944
|
+
object: transformerObjectSchema,
|
|
1942
1945
|
properties: zod.z.array(zod.z.string().describe("String value")).describe("List of property names to omit")
|
|
1943
1946
|
});
|
|
1944
1947
|
|
|
@@ -2020,8 +2023,12 @@ function createArrayMapTool() {
|
|
|
2020
2023
|
const mapped = input.array.map((item) => {
|
|
2021
2024
|
const result = {};
|
|
2022
2025
|
for (const prop of input.properties) {
|
|
2023
|
-
|
|
2024
|
-
|
|
2026
|
+
Object.defineProperty(result, prop, {
|
|
2027
|
+
value: getNestedValue(item, prop),
|
|
2028
|
+
enumerable: true,
|
|
2029
|
+
configurable: true,
|
|
2030
|
+
writable: true
|
|
2031
|
+
});
|
|
2025
2032
|
}
|
|
2026
2033
|
return result;
|
|
2027
2034
|
});
|
|
@@ -2052,9 +2059,17 @@ function createArrayGroupByTool() {
|
|
|
2052
2059
|
return core.toolBuilder().name("array-group-by").description("Group an array of objects by a property value. Returns an object with groups as keys.").category(core.ToolCategory.UTILITY).tags(["array", "group", "data", "transform"]).schema(arrayGroupBySchema).implement(async (input) => {
|
|
2053
2060
|
const groups = {};
|
|
2054
2061
|
for (const item of input.array) {
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2062
|
+
if (item == null) {
|
|
2063
|
+
throw new TypeError(`Cannot read properties of ${item} (reading '${input.property}')`);
|
|
2064
|
+
}
|
|
2065
|
+
const key = String(Reflect.get(Object(item), input.property));
|
|
2066
|
+
if (!Object.hasOwn(groups, key)) {
|
|
2067
|
+
Object.defineProperty(groups, key, {
|
|
2068
|
+
value: [],
|
|
2069
|
+
enumerable: true,
|
|
2070
|
+
configurable: true,
|
|
2071
|
+
writable: true
|
|
2072
|
+
});
|
|
2058
2073
|
}
|
|
2059
2074
|
groups[key].push(item);
|
|
2060
2075
|
}
|
|
@@ -10584,7 +10599,10 @@ exports.stringSplit = stringSplit;
|
|
|
10584
10599
|
exports.stringSubstring = stringSubstring;
|
|
10585
10600
|
exports.stringTrim = stringTrim;
|
|
10586
10601
|
exports.stringUtilityTools = stringUtilityTools;
|
|
10602
|
+
exports.transformerArraySchema = transformerArraySchema;
|
|
10603
|
+
exports.transformerObjectSchema = transformerObjectSchema;
|
|
10587
10604
|
exports.transformerTools = transformerTools;
|
|
10605
|
+
exports.transformerValueSchema = transformerValueSchema;
|
|
10588
10606
|
exports.updateConfluencePage = updateConfluencePage;
|
|
10589
10607
|
exports.urlBuilder = urlBuilder;
|
|
10590
10608
|
exports.urlBuilderSchema = urlBuilderSchema;
|