@uniformdev/mesh-edgehancer-sdk 20.32.0 → 20.32.1-alpha.3
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.d.mts +417 -133
- package/dist/index.d.ts +417 -133
- package/dist/index.esm.js +174 -71
- package/dist/index.js +178 -71
- package/dist/index.mjs +174 -71
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
@@ -1,3 +1,86 @@
|
|
1
|
+
// ../../lib/ai-sdk/src/InvocationContexts.ts
|
2
|
+
import { z } from "zod";
|
3
|
+
var invocationContextsSchema = z.enum([
|
4
|
+
"composition",
|
5
|
+
"compositionPattern",
|
6
|
+
"componentPattern",
|
7
|
+
"entry",
|
8
|
+
"entryPattern",
|
9
|
+
"general"
|
10
|
+
]);
|
11
|
+
var invocationContextInfoSchema = z.object({
|
12
|
+
context: invocationContextsSchema,
|
13
|
+
id: z.string(),
|
14
|
+
displayName: z.string().optional(),
|
15
|
+
icon: z.string().optional()
|
16
|
+
});
|
17
|
+
var invocationContextAnnotationSchema = z.object({
|
18
|
+
type: z.literal("invocationContext"),
|
19
|
+
value: invocationContextInfoSchema
|
20
|
+
});
|
21
|
+
|
22
|
+
// ../../lib/ai-sdk/src/toolDefinitions/editing/createPropertyEdit.ts
|
23
|
+
import { z as z2 } from "zod";
|
24
|
+
var createPropertyEdit = {
|
25
|
+
displayName: "Create Property Edit",
|
26
|
+
description: "Edits a property on a composition, entry, or pattern with AI. This is a callable tool NOT FOR AGENT USE - agents use applyPropertyEdit to broker client-side application of the edit.",
|
27
|
+
inputSchema: z2.object({
|
28
|
+
edit: z2.string().describe("Describe the edit to be made to the property"),
|
29
|
+
currentValue: z2.unknown().describe("Current value of the property (if any exists)").optional(),
|
30
|
+
projectGuidance: z2.string().describe("Guidance prompt for the project (if any exists)").optional(),
|
31
|
+
componentGuidance: z2.string().describe("Guidance prompt for the parent component").optional(),
|
32
|
+
audienceGuidance: z2.string().describe(
|
33
|
+
"Guidance prompt for the target audience of a personalized variation. Omit for non-variation edits."
|
34
|
+
).optional(),
|
35
|
+
propertyDefinition: z2.object({
|
36
|
+
id: z2.string(),
|
37
|
+
name: z2.string(),
|
38
|
+
type: z2.string(),
|
39
|
+
guidance: z2.string().describe("Guidance prompt from the property definition (if any exists)").optional(),
|
40
|
+
typeConfig: z2.unknown().optional().describe("Type-specific configuration for the property")
|
41
|
+
}),
|
42
|
+
outputLocale: z2.string().optional().describe("The locale to use when writing the edited value"),
|
43
|
+
documentContext: z2.string().describe("Content of the surrounding document the property is part of").optional()
|
44
|
+
}),
|
45
|
+
outputSchema: z2.object({
|
46
|
+
newValue: z2.string().describe(
|
47
|
+
"The new value of the property. When the action is clear or resetOverride, this should be empty."
|
48
|
+
),
|
49
|
+
treatNewValueAsJson: z2.boolean().describe("Whether the newValue is a JSON string"),
|
50
|
+
summary: z2.string().describe(
|
51
|
+
"A completion message to the user that summarizes the action taken. This should be 1 sentence, in English."
|
52
|
+
).optional(),
|
53
|
+
action: z2.enum(["setValue", "clearValue", "resetOverride"]).describe(
|
54
|
+
"setValue = update the value, clearValue = remove the value/set to empty, resetOverride = remove a pattern override and inherit the pattern value. Only use resetOverride if the prompt asks for it."
|
55
|
+
),
|
56
|
+
success: z2.boolean().describe("Whether the edit could be completed successfully")
|
57
|
+
}),
|
58
|
+
runsAt: "server",
|
59
|
+
timeout: 100,
|
60
|
+
callable: true
|
61
|
+
};
|
62
|
+
|
63
|
+
// src/afterAIEdit.ts
|
64
|
+
import { z as z3 } from "zod";
|
65
|
+
var afterAIEditResultSchema = z3.strictObject({
|
66
|
+
newValue: z3.unknown(),
|
67
|
+
success: z3.boolean(),
|
68
|
+
summary: z3.string().optional()
|
69
|
+
});
|
70
|
+
var afterAIEditContextSchema = z3.strictObject({
|
71
|
+
editRequest: createPropertyEdit.inputSchema,
|
72
|
+
invocationContext: invocationContextsSchema,
|
73
|
+
userId: z3.string(),
|
74
|
+
currentLocale: z3.string().optional(),
|
75
|
+
projectId: z3.string(),
|
76
|
+
currentValue: z3.unknown().optional(),
|
77
|
+
newValue: z3.unknown(),
|
78
|
+
result: z3.object({
|
79
|
+
success: z3.boolean(),
|
80
|
+
summary: z3.string().optional()
|
81
|
+
})
|
82
|
+
});
|
83
|
+
|
1
84
|
// src/batchUtils.ts
|
2
85
|
function convertBatchResultsToEdgehancerResult({
|
3
86
|
batch,
|
@@ -57,6 +140,22 @@ var COLLECTION_DEFAULT_LIMIT = 20;
|
|
57
140
|
var COLLECTION_MAX_LIMIT = 50;
|
58
141
|
var COLLECTION_DEFAULT_OFFSET = 0;
|
59
142
|
|
143
|
+
// src/createAIEdit.ts
|
144
|
+
import { z as z4 } from "zod";
|
145
|
+
var createAIEditContextSchema = z4.strictObject({
|
146
|
+
editRequest: createPropertyEdit.inputSchema,
|
147
|
+
invocationContext: invocationContextsSchema,
|
148
|
+
userId: z4.string(),
|
149
|
+
currentLocale: z4.string().optional(),
|
150
|
+
projectId: z4.string()
|
151
|
+
});
|
152
|
+
var createAIEditResultSchema = z4.strictObject({
|
153
|
+
outputJsonSchema: z4.record(z4.string(), z4.any()).describe("JSON schema (draft-07) for the edited content result"),
|
154
|
+
instructions: z4.string().describe(
|
155
|
+
"Instructions for the AI editor LLM to follow (e.g. conventions/rules, allowed values, etc). Just describe your value type, do not give guiding instructions. There is no need to worry about clearing or resetting values, that is automatically handled."
|
156
|
+
)
|
157
|
+
});
|
158
|
+
|
60
159
|
// src/fetchUtils.ts
|
61
160
|
function getDataResourceAsRequest(data) {
|
62
161
|
var _a;
|
@@ -96,78 +195,78 @@ function copyKeyValuePairs(source, target) {
|
|
96
195
|
}
|
97
196
|
|
98
197
|
// src/preRequest.ts
|
99
|
-
import { z as
|
198
|
+
import { z as z6 } from "zod";
|
100
199
|
|
101
200
|
// src/shared.ts
|
102
201
|
import { assert } from "tsafe";
|
103
|
-
import { z } from "zod";
|
104
|
-
var parameterDefinitionSchema =
|
105
|
-
key:
|
106
|
-
value:
|
107
|
-
omitIfEmpty:
|
202
|
+
import { z as z5 } from "zod";
|
203
|
+
var parameterDefinitionSchema = z5.object({
|
204
|
+
key: z5.string(),
|
205
|
+
value: z5.string(),
|
206
|
+
omitIfEmpty: z5.boolean().optional()
|
108
207
|
});
|
109
|
-
var resolvingIssueSchema =
|
110
|
-
|
111
|
-
|
112
|
-
message:
|
113
|
-
subType:
|
114
|
-
issueReference:
|
115
|
-
deepLink:
|
208
|
+
var resolvingIssueSchema = z5.union([
|
209
|
+
z5.string(),
|
210
|
+
z5.object({
|
211
|
+
message: z5.string(),
|
212
|
+
subType: z5.enum(["unpublishedData", "configuration"]).optional(),
|
213
|
+
issueReference: z5.string().optional(),
|
214
|
+
deepLink: z5.string().optional()
|
116
215
|
})
|
117
216
|
]);
|
118
|
-
var variableDefinitionSchema =
|
119
|
-
displayName:
|
120
|
-
type:
|
121
|
-
default:
|
122
|
-
helpText:
|
123
|
-
order:
|
124
|
-
source:
|
217
|
+
var variableDefinitionSchema = z5.object({
|
218
|
+
displayName: z5.string().optional(),
|
219
|
+
type: z5.string().optional(),
|
220
|
+
default: z5.string(),
|
221
|
+
helpText: z5.string().optional(),
|
222
|
+
order: z5.number().optional(),
|
223
|
+
source: z5.string().optional()
|
125
224
|
});
|
126
|
-
var customEdgehancerDefinitionSchema =
|
127
|
-
preRequest:
|
128
|
-
request:
|
225
|
+
var customEdgehancerDefinitionSchema = z5.object({
|
226
|
+
preRequest: z5.string().optional(),
|
227
|
+
request: z5.string().optional()
|
129
228
|
});
|
130
|
-
var dataSourceVariantSchema =
|
131
|
-
|
132
|
-
headers:
|
133
|
-
parameters:
|
134
|
-
variables:
|
229
|
+
var dataSourceVariantSchema = z5.intersection(
|
230
|
+
z5.object({
|
231
|
+
headers: z5.array(parameterDefinitionSchema).optional(),
|
232
|
+
parameters: z5.array(parameterDefinitionSchema).optional(),
|
233
|
+
variables: z5.record(variableDefinitionSchema).optional()
|
135
234
|
}),
|
136
|
-
|
235
|
+
z5.object({ url: z5.string() })
|
137
236
|
);
|
138
|
-
var mergedDataTypeSchema =
|
139
|
-
id:
|
140
|
-
displayName:
|
141
|
-
archetype:
|
142
|
-
allowedOnComponents:
|
143
|
-
badgeIconUrl:
|
144
|
-
connectorType:
|
145
|
-
url:
|
146
|
-
headers:
|
147
|
-
parameters:
|
148
|
-
body:
|
149
|
-
method:
|
150
|
-
variables:
|
151
|
-
custom:
|
152
|
-
customPublic:
|
153
|
-
ttl:
|
154
|
-
purgeKey:
|
155
|
-
localeMapping:
|
237
|
+
var mergedDataTypeSchema = z5.object({
|
238
|
+
id: z5.string(),
|
239
|
+
displayName: z5.string(),
|
240
|
+
archetype: z5.string().optional(),
|
241
|
+
allowedOnComponents: z5.array(z5.string()).optional(),
|
242
|
+
badgeIconUrl: z5.string().optional(),
|
243
|
+
connectorType: z5.string(),
|
244
|
+
url: z5.string(),
|
245
|
+
headers: z5.array(parameterDefinitionSchema).optional(),
|
246
|
+
parameters: z5.array(parameterDefinitionSchema).optional(),
|
247
|
+
body: z5.string().optional(),
|
248
|
+
method: z5.enum(["GET", "POST", "HEAD"]),
|
249
|
+
variables: z5.record(variableDefinitionSchema).optional(),
|
250
|
+
custom: z5.record(z5.unknown()).optional(),
|
251
|
+
customPublic: z5.record(z5.unknown()).optional(),
|
252
|
+
ttl: z5.number().optional(),
|
253
|
+
purgeKey: z5.string().optional(),
|
254
|
+
localeMapping: z5.record(z5.string()).optional(),
|
156
255
|
edgehancer: customEdgehancerDefinitionSchema.optional(),
|
157
|
-
uiBadgeText:
|
158
|
-
variants:
|
256
|
+
uiBadgeText: z5.string().max(12).optional(),
|
257
|
+
variants: z5.object({
|
159
258
|
unpublished: dataSourceVariantSchema.optional()
|
160
259
|
}).optional(),
|
161
|
-
enableUnpublishedMode:
|
260
|
+
enableUnpublishedMode: z5.boolean().optional()
|
162
261
|
});
|
163
262
|
assert();
|
164
|
-
var dataResourceSchema =
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
263
|
+
var dataResourceSchema = z5.union([
|
264
|
+
z5.string(),
|
265
|
+
z5.object({}).catchall(z5.unknown()),
|
266
|
+
z5.number(),
|
267
|
+
z5.boolean(),
|
268
|
+
z5.array(z5.unknown()),
|
269
|
+
z5.undefined()
|
171
270
|
]);
|
172
271
|
|
173
272
|
// src/preRequest.ts
|
@@ -180,39 +279,43 @@ var edgehancerMergedDataTypeSchema = mergedDataTypeSchema.omit({
|
|
180
279
|
purgeKey: true,
|
181
280
|
variables: true
|
182
281
|
});
|
183
|
-
var preRequestEdgehancerDataResourceResultSchema =
|
184
|
-
errors:
|
185
|
-
warnings:
|
186
|
-
infos:
|
282
|
+
var preRequestEdgehancerDataResourceResultSchema = z6.strictObject({
|
283
|
+
errors: z6.array(resolvingIssueSchema).optional(),
|
284
|
+
warnings: z6.array(resolvingIssueSchema).optional(),
|
285
|
+
infos: z6.array(resolvingIssueSchema).optional(),
|
187
286
|
dataResource: edgehancerMergedDataTypeSchema
|
188
287
|
});
|
189
|
-
var preRequestEdgehancerResultSchema =
|
190
|
-
dataResources:
|
288
|
+
var preRequestEdgehancerResultSchema = z6.strictObject({
|
289
|
+
dataResources: z6.array(preRequestEdgehancerDataResourceResultSchema)
|
191
290
|
});
|
192
291
|
|
193
292
|
// src/request.ts
|
194
|
-
import { z as
|
195
|
-
var requestEdgehancerDataResourceResolutionResultSchema =
|
196
|
-
errors:
|
293
|
+
import { z as z7 } from "zod";
|
294
|
+
var requestEdgehancerDataResourceResolutionResultSchema = z7.strictObject({
|
295
|
+
errors: z7.array(resolvingIssueSchema).optional().describe(
|
197
296
|
"Errors that occurred while running your code to return with the API response, if any. Unhandled exceptions will be captured automatically."
|
198
297
|
),
|
199
|
-
warnings:
|
200
|
-
infos:
|
298
|
+
warnings: z7.array(resolvingIssueSchema).optional().describe("Warnings that occurred while running your code to return with the API response, if any."),
|
299
|
+
infos: z7.array(resolvingIssueSchema).optional().describe(
|
201
300
|
"Informational messages that occurred while running your code to return with the API response, if any."
|
202
301
|
),
|
203
|
-
surrogateKeys:
|
302
|
+
surrogateKeys: z7.array(z7.string()).optional().describe(
|
204
303
|
"Extra surrogate keys for the data that was fetched. These act as auxiliary cache keys that can allow granular purging of cached data."
|
205
304
|
),
|
206
305
|
result: dataResourceSchema.describe("The result of fetching the data resource")
|
207
306
|
});
|
208
|
-
var requestEdgehancerResultSchema =
|
209
|
-
results:
|
307
|
+
var requestEdgehancerResultSchema = z7.strictObject({
|
308
|
+
results: z7.array(requestEdgehancerDataResourceResolutionResultSchema)
|
210
309
|
});
|
211
310
|
export {
|
212
311
|
COLLECTION_DEFAULT_LIMIT,
|
213
312
|
COLLECTION_DEFAULT_OFFSET,
|
214
313
|
COLLECTION_MAX_LIMIT,
|
314
|
+
afterAIEditContextSchema,
|
315
|
+
afterAIEditResultSchema,
|
215
316
|
convertBatchResultsToEdgehancerResult,
|
317
|
+
createAIEditContextSchema,
|
318
|
+
createAIEditResultSchema,
|
216
319
|
dataResourceSchema,
|
217
320
|
edgehancerMergedDataTypeSchema,
|
218
321
|
getDataResourceAsRequest,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/mesh-edgehancer-sdk",
|
3
|
-
"version": "20.32.
|
3
|
+
"version": "20.32.1-alpha.3+c30c2f2b0d",
|
4
4
|
"description": "Uniform Mesh Edgehancer SDK",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"/dist"
|
49
49
|
],
|
50
50
|
"dependencies": {
|
51
|
-
"@uniformdev/canvas": "20.32.
|
51
|
+
"@uniformdev/canvas": "20.32.1-alpha.3+c30c2f2b0d",
|
52
52
|
"tsafe": "1.6.6",
|
53
53
|
"zod": "3.23.8"
|
54
54
|
},
|
@@ -61,5 +61,5 @@
|
|
61
61
|
"publishConfig": {
|
62
62
|
"access": "public"
|
63
63
|
},
|
64
|
-
"gitHead": "
|
64
|
+
"gitHead": "c30c2f2b0de9d99e7c038dba9b941039f2c18a39"
|
65
65
|
}
|