@uniformdev/mesh-edgehancer-sdk 20.36.0 → 20.36.1
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 +1028 -134
- package/dist/index.d.ts +1028 -134
- package/dist/index.esm.js +252 -74
- package/dist/index.js +257 -71
- package/dist/index.mjs +252 -74
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -33,7 +33,15 @@ __export(src_exports, {
|
|
33
33
|
COLLECTION_DEFAULT_LIMIT: () => COLLECTION_DEFAULT_LIMIT,
|
34
34
|
COLLECTION_DEFAULT_OFFSET: () => COLLECTION_DEFAULT_OFFSET,
|
35
35
|
COLLECTION_MAX_LIMIT: () => COLLECTION_MAX_LIMIT,
|
36
|
+
afterAIDataResourceEditContextSchema: () => afterAIDataResourceEditContextSchema,
|
37
|
+
afterAIDataResourceEditResultSchema: () => afterAIDataResourceEditResultSchema,
|
38
|
+
afterAIEditContextSchema: () => afterAIEditContextSchema,
|
39
|
+
afterAIEditResultSchema: () => afterAIEditResultSchema,
|
36
40
|
convertBatchResultsToEdgehancerResult: () => convertBatchResultsToEdgehancerResult,
|
41
|
+
createAIDataResourceEditContextSchema: () => createAIDataResourceEditContextSchema,
|
42
|
+
createAIDataResourceEditResultSchema: () => createAIDataResourceEditResultSchema,
|
43
|
+
createAIEditContextSchema: () => createAIEditContextSchema,
|
44
|
+
createAIEditResultSchema: () => createAIEditResultSchema,
|
37
45
|
dataResourceSchema: () => dataResourceSchema,
|
38
46
|
edgehancerMergedDataTypeSchema: () => edgehancerMergedDataTypeSchema,
|
39
47
|
getDataResourceAsRequest: () => getDataResourceAsRequest,
|
@@ -50,6 +58,126 @@ __export(src_exports, {
|
|
50
58
|
});
|
51
59
|
module.exports = __toCommonJS(src_exports);
|
52
60
|
|
61
|
+
// ../../lib/ai-sdk/src/InvocationContexts.ts
|
62
|
+
var z = __toESM(require("zod"), 1);
|
63
|
+
var invocationContextsSchema = z.enum([
|
64
|
+
"composition",
|
65
|
+
"compositionPattern",
|
66
|
+
"componentPattern",
|
67
|
+
"entry",
|
68
|
+
"entryPattern",
|
69
|
+
"general"
|
70
|
+
]);
|
71
|
+
var invocationContextInfoSchema = z.object({
|
72
|
+
context: invocationContextsSchema,
|
73
|
+
id: z.string(),
|
74
|
+
displayName: z.string().optional(),
|
75
|
+
icon: z.string().optional()
|
76
|
+
});
|
77
|
+
var invocationContextAnnotationSchema = z.object({
|
78
|
+
type: z.literal("invocationContext"),
|
79
|
+
value: invocationContextInfoSchema
|
80
|
+
});
|
81
|
+
|
82
|
+
// src/afterAIDataResourceEdit.ts
|
83
|
+
var z2 = __toESM(require("zod"));
|
84
|
+
var afterAIDataResourceEditResultSchema = z2.strictObject({
|
85
|
+
newValue: z2.record(z2.string(), z2.string()),
|
86
|
+
success: z2.boolean(),
|
87
|
+
summary: z2.string().optional()
|
88
|
+
});
|
89
|
+
var afterAIDataResourceEditContextSchema = z2.strictObject({
|
90
|
+
/**
|
91
|
+
* The the data type of the data resource being edited (merged with its data source)
|
92
|
+
* NOTE: this can contain secrets, API keys, etc. Do not directly expose it to the AI agent!
|
93
|
+
* NOTE: this does not include the current value's variables, if any
|
94
|
+
*/
|
95
|
+
mergedDataType: z2.custom(),
|
96
|
+
/** Which data source variant is currently active (undefined = published data) */
|
97
|
+
dataSourceVariant: z2.custom().optional(),
|
98
|
+
/** The edit request details */
|
99
|
+
editRequest: z2.object({
|
100
|
+
/** The edit instruction from the AI agent */
|
101
|
+
edit: z2.string(),
|
102
|
+
/** Current value of the data resource's variables (if any) */
|
103
|
+
currentValue: z2.record(z2.string(), z2.string()).optional()
|
104
|
+
}),
|
105
|
+
/** AI invocation context */
|
106
|
+
invocationContext: invocationContextsSchema,
|
107
|
+
/** User ID making the edit */
|
108
|
+
userId: z2.string(),
|
109
|
+
/** Project ID */
|
110
|
+
projectId: z2.string(),
|
111
|
+
/** The new value generated by AI */
|
112
|
+
newValue: z2.record(z2.string(), z2.string()),
|
113
|
+
/** The result from the AI editing process */
|
114
|
+
result: z2.object({
|
115
|
+
success: z2.boolean(),
|
116
|
+
summary: z2.string().optional()
|
117
|
+
})
|
118
|
+
});
|
119
|
+
|
120
|
+
// ../../lib/ai-sdk/src/toolDefinitions/editing/createPropertyEdit.ts
|
121
|
+
var z3 = __toESM(require("zod"), 1);
|
122
|
+
var createPropertyEdit = {
|
123
|
+
displayName: "Create Property Edit",
|
124
|
+
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.",
|
125
|
+
inputSchema: z3.object({
|
126
|
+
edit: z3.string().describe("Describe the edit to be made to the property"),
|
127
|
+
currentValue: z3.unknown().describe("Current value of the property (if any exists)").optional(),
|
128
|
+
projectGuidance: z3.string().describe("Guidance prompt for the project (if any exists)").optional(),
|
129
|
+
componentGuidance: z3.string().describe("Guidance prompt for the parent component").optional(),
|
130
|
+
audienceGuidance: z3.string().describe(
|
131
|
+
"Guidance prompt for the target audience of a personalized variation. Omit for non-variation edits."
|
132
|
+
).optional(),
|
133
|
+
propertyDefinition: z3.object({
|
134
|
+
id: z3.string(),
|
135
|
+
name: z3.string(),
|
136
|
+
type: z3.string(),
|
137
|
+
guidance: z3.string().describe("Guidance prompt from the property definition (if any exists)").optional(),
|
138
|
+
typeConfig: z3.unknown().optional().describe("Type-specific configuration for the property")
|
139
|
+
}),
|
140
|
+
outputLocale: z3.string().optional().describe("The locale to use when writing the edited value"),
|
141
|
+
documentContext: z3.string().describe("Content of the surrounding document the property is part of").optional()
|
142
|
+
}),
|
143
|
+
outputSchema: z3.object({
|
144
|
+
newValue: z3.string().describe(
|
145
|
+
"The new value of the property. When the action is clear or resetOverride, this should be empty."
|
146
|
+
),
|
147
|
+
treatNewValueAsJson: z3.boolean().describe("Whether the newValue is a JSON string"),
|
148
|
+
summary: z3.string().describe(
|
149
|
+
"A completion message to the user that summarizes the action taken. This should be 1 sentence, in English."
|
150
|
+
).optional(),
|
151
|
+
action: z3.enum(["setValue", "clearValue", "resetOverride"]).describe(
|
152
|
+
"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."
|
153
|
+
),
|
154
|
+
success: z3.boolean().describe("Whether the edit could be completed successfully")
|
155
|
+
}),
|
156
|
+
runsAt: "server",
|
157
|
+
timeout: 100,
|
158
|
+
callable: true
|
159
|
+
};
|
160
|
+
|
161
|
+
// src/afterAIEdit.ts
|
162
|
+
var z4 = __toESM(require("zod"));
|
163
|
+
var afterAIEditResultSchema = z4.strictObject({
|
164
|
+
newValue: z4.unknown(),
|
165
|
+
success: z4.boolean(),
|
166
|
+
summary: z4.string().optional()
|
167
|
+
});
|
168
|
+
var afterAIEditContextSchema = z4.strictObject({
|
169
|
+
editRequest: createPropertyEdit.inputSchema,
|
170
|
+
invocationContext: invocationContextsSchema,
|
171
|
+
userId: z4.string(),
|
172
|
+
currentLocale: z4.string().optional(),
|
173
|
+
projectId: z4.string(),
|
174
|
+
newValue: z4.unknown(),
|
175
|
+
result: z4.object({
|
176
|
+
success: z4.boolean(),
|
177
|
+
summary: z4.string().optional()
|
178
|
+
})
|
179
|
+
});
|
180
|
+
|
53
181
|
// src/batchUtils.ts
|
54
182
|
function convertBatchResultsToEdgehancerResult({
|
55
183
|
batch,
|
@@ -109,6 +237,54 @@ var COLLECTION_DEFAULT_LIMIT = 20;
|
|
109
237
|
var COLLECTION_MAX_LIMIT = 50;
|
110
238
|
var COLLECTION_DEFAULT_OFFSET = 0;
|
111
239
|
|
240
|
+
// src/createAIDataResourceEdit.ts
|
241
|
+
var z5 = __toESM(require("zod"));
|
242
|
+
var createAIDataResourceEditContextSchema = z5.strictObject({
|
243
|
+
/**
|
244
|
+
* The the data type of the data resource being edited (merged with its data source)
|
245
|
+
* NOTE: this can contain secrets, API keys, etc. Do not directly expose it to the AI agent!
|
246
|
+
* NOTE: this does not include the current value's variables, if any
|
247
|
+
*/
|
248
|
+
mergedDataType: z5.custom(),
|
249
|
+
/** Which data source variant is currently active (undefined = published data) */
|
250
|
+
dataSourceVariant: z5.custom().optional(),
|
251
|
+
/** The edit request details */
|
252
|
+
editRequest: z5.object({
|
253
|
+
/** The edit instruction from the AI agent */
|
254
|
+
edit: z5.string(),
|
255
|
+
/** Current value of the data resource's variables (if any) */
|
256
|
+
currentValue: z5.record(z5.string(), z5.string()).optional()
|
257
|
+
}),
|
258
|
+
/** AI invocation context */
|
259
|
+
invocationContext: invocationContextsSchema,
|
260
|
+
/** User ID making the edit */
|
261
|
+
userId: z5.string(),
|
262
|
+
/** Project ID */
|
263
|
+
projectId: z5.string()
|
264
|
+
});
|
265
|
+
var createAIDataResourceEditResultSchema = z5.strictObject({
|
266
|
+
outputJsonSchema: z5.record(z5.string(), z5.any()).describe("JSON schema (draft-07) for the edited data resource result"),
|
267
|
+
instructions: z5.string().describe(
|
268
|
+
"Instructions for the AI editor LLM to follow when editing this data resource (e.g. conventions/rules, allowed values, data format expectations, etc). Describe how to transform or edit the data resource content."
|
269
|
+
)
|
270
|
+
});
|
271
|
+
|
272
|
+
// src/createAIEdit.ts
|
273
|
+
var z6 = __toESM(require("zod"));
|
274
|
+
var createAIEditContextSchema = z6.strictObject({
|
275
|
+
editRequest: createPropertyEdit.inputSchema,
|
276
|
+
invocationContext: invocationContextsSchema,
|
277
|
+
userId: z6.string(),
|
278
|
+
currentLocale: z6.string().optional(),
|
279
|
+
projectId: z6.string()
|
280
|
+
});
|
281
|
+
var createAIEditResultSchema = z6.strictObject({
|
282
|
+
outputJsonSchema: z6.record(z6.string(), z6.any()).describe("JSON schema (draft-07) for the edited content result"),
|
283
|
+
instructions: z6.string().describe(
|
284
|
+
"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."
|
285
|
+
)
|
286
|
+
});
|
287
|
+
|
112
288
|
// src/fetchUtils.ts
|
113
289
|
function getDataResourceAsRequest(data) {
|
114
290
|
var _a;
|
@@ -148,78 +324,80 @@ function copyKeyValuePairs(source, target) {
|
|
148
324
|
}
|
149
325
|
|
150
326
|
// src/preRequest.ts
|
151
|
-
var
|
327
|
+
var z8 = __toESM(require("zod"));
|
152
328
|
|
153
329
|
// src/shared.ts
|
154
330
|
var import_tsafe = require("tsafe");
|
155
|
-
var
|
156
|
-
var parameterDefinitionSchema =
|
157
|
-
key:
|
158
|
-
value:
|
159
|
-
omitIfEmpty:
|
331
|
+
var z7 = __toESM(require("zod"));
|
332
|
+
var parameterDefinitionSchema = z7.object({
|
333
|
+
key: z7.string(),
|
334
|
+
value: z7.string(),
|
335
|
+
omitIfEmpty: z7.boolean().optional()
|
160
336
|
});
|
161
|
-
var resolvingIssueSchema =
|
162
|
-
|
163
|
-
|
164
|
-
message:
|
165
|
-
subType:
|
166
|
-
issueReference:
|
167
|
-
deepLink:
|
337
|
+
var resolvingIssueSchema = z7.union([
|
338
|
+
z7.string(),
|
339
|
+
z7.object({
|
340
|
+
message: z7.string(),
|
341
|
+
subType: z7.enum(["unpublishedData", "configuration"]).optional(),
|
342
|
+
issueReference: z7.string().optional(),
|
343
|
+
deepLink: z7.string().optional()
|
168
344
|
})
|
169
345
|
]);
|
170
|
-
var variableDefinitionSchema =
|
171
|
-
displayName:
|
172
|
-
type:
|
173
|
-
default:
|
174
|
-
helpText:
|
175
|
-
order:
|
176
|
-
source:
|
346
|
+
var variableDefinitionSchema = z7.object({
|
347
|
+
displayName: z7.string().optional(),
|
348
|
+
type: z7.string().optional(),
|
349
|
+
default: z7.string(),
|
350
|
+
helpText: z7.string().optional(),
|
351
|
+
order: z7.number().optional(),
|
352
|
+
source: z7.string().optional()
|
177
353
|
});
|
178
|
-
var customEdgehancerDefinitionSchema =
|
179
|
-
preRequest:
|
180
|
-
request:
|
354
|
+
var customEdgehancerDefinitionSchema = z7.object({
|
355
|
+
preRequest: z7.string().optional(),
|
356
|
+
request: z7.string().optional(),
|
357
|
+
createAIDataResourceEdit: z7.string().optional(),
|
358
|
+
afterAIDataResourceEdit: z7.string().optional()
|
181
359
|
});
|
182
|
-
var dataSourceVariantSchema =
|
183
|
-
|
184
|
-
headers:
|
185
|
-
parameters:
|
186
|
-
variables:
|
360
|
+
var dataSourceVariantSchema = z7.intersection(
|
361
|
+
z7.object({
|
362
|
+
headers: z7.array(parameterDefinitionSchema).optional(),
|
363
|
+
parameters: z7.array(parameterDefinitionSchema).optional(),
|
364
|
+
variables: z7.record(variableDefinitionSchema).optional()
|
187
365
|
}),
|
188
|
-
|
366
|
+
z7.object({ url: z7.string() })
|
189
367
|
);
|
190
|
-
var mergedDataTypeSchema =
|
191
|
-
id:
|
192
|
-
displayName:
|
193
|
-
archetype:
|
194
|
-
allowedOnComponents:
|
195
|
-
badgeIconUrl:
|
196
|
-
connectorType:
|
197
|
-
url:
|
198
|
-
headers:
|
199
|
-
parameters:
|
200
|
-
body:
|
201
|
-
method:
|
202
|
-
variables:
|
203
|
-
custom:
|
204
|
-
customPublic:
|
205
|
-
ttl:
|
206
|
-
purgeKey:
|
207
|
-
localeMapping:
|
368
|
+
var mergedDataTypeSchema = z7.object({
|
369
|
+
id: z7.string(),
|
370
|
+
displayName: z7.string(),
|
371
|
+
archetype: z7.string().optional(),
|
372
|
+
allowedOnComponents: z7.array(z7.string()).optional(),
|
373
|
+
badgeIconUrl: z7.string().optional(),
|
374
|
+
connectorType: z7.string(),
|
375
|
+
url: z7.string(),
|
376
|
+
headers: z7.array(parameterDefinitionSchema).optional(),
|
377
|
+
parameters: z7.array(parameterDefinitionSchema).optional(),
|
378
|
+
body: z7.string().optional(),
|
379
|
+
method: z7.enum(["GET", "POST", "HEAD"]),
|
380
|
+
variables: z7.record(variableDefinitionSchema).optional(),
|
381
|
+
custom: z7.record(z7.unknown()).optional(),
|
382
|
+
customPublic: z7.record(z7.unknown()).optional(),
|
383
|
+
ttl: z7.number().optional(),
|
384
|
+
purgeKey: z7.string().optional(),
|
385
|
+
localeMapping: z7.record(z7.string()).optional(),
|
208
386
|
edgehancer: customEdgehancerDefinitionSchema.optional(),
|
209
|
-
uiBadgeText:
|
210
|
-
variants:
|
387
|
+
uiBadgeText: z7.string().max(12).optional(),
|
388
|
+
variants: z7.object({
|
211
389
|
unpublished: dataSourceVariantSchema.optional()
|
212
390
|
}).optional(),
|
213
|
-
enableUnpublishedMode:
|
391
|
+
enableUnpublishedMode: z7.boolean().optional()
|
214
392
|
});
|
215
393
|
(0, import_tsafe.assert)();
|
216
|
-
var dataResourceSchema =
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
394
|
+
var dataResourceSchema = z7.union([
|
395
|
+
z7.string(),
|
396
|
+
z7.object({}).catchall(z7.unknown()),
|
397
|
+
z7.number(),
|
398
|
+
z7.boolean(),
|
399
|
+
z7.array(z7.unknown()),
|
400
|
+
z7.undefined()
|
223
401
|
]);
|
224
402
|
|
225
403
|
// src/preRequest.ts
|
@@ -232,40 +410,48 @@ var edgehancerMergedDataTypeSchema = mergedDataTypeSchema.omit({
|
|
232
410
|
purgeKey: true,
|
233
411
|
variables: true
|
234
412
|
});
|
235
|
-
var preRequestEdgehancerDataResourceResultSchema =
|
236
|
-
errors:
|
237
|
-
warnings:
|
238
|
-
infos:
|
413
|
+
var preRequestEdgehancerDataResourceResultSchema = z8.strictObject({
|
414
|
+
errors: z8.array(resolvingIssueSchema).optional(),
|
415
|
+
warnings: z8.array(resolvingIssueSchema).optional(),
|
416
|
+
infos: z8.array(resolvingIssueSchema).optional(),
|
239
417
|
dataResource: edgehancerMergedDataTypeSchema
|
240
418
|
});
|
241
|
-
var preRequestEdgehancerResultSchema =
|
242
|
-
dataResources:
|
419
|
+
var preRequestEdgehancerResultSchema = z8.strictObject({
|
420
|
+
dataResources: z8.array(preRequestEdgehancerDataResourceResultSchema)
|
243
421
|
});
|
244
422
|
|
245
423
|
// src/request.ts
|
246
|
-
var
|
247
|
-
var requestEdgehancerDataResourceResolutionResultSchema =
|
248
|
-
errors:
|
424
|
+
var z9 = __toESM(require("zod"));
|
425
|
+
var requestEdgehancerDataResourceResolutionResultSchema = z9.strictObject({
|
426
|
+
errors: z9.array(resolvingIssueSchema).optional().describe(
|
249
427
|
"Errors that occurred while running your code to return with the API response, if any. Unhandled exceptions will be captured automatically."
|
250
428
|
),
|
251
|
-
warnings:
|
252
|
-
infos:
|
429
|
+
warnings: z9.array(resolvingIssueSchema).optional().describe("Warnings that occurred while running your code to return with the API response, if any."),
|
430
|
+
infos: z9.array(resolvingIssueSchema).optional().describe(
|
253
431
|
"Informational messages that occurred while running your code to return with the API response, if any."
|
254
432
|
),
|
255
|
-
surrogateKeys:
|
433
|
+
surrogateKeys: z9.array(z9.string()).optional().describe(
|
256
434
|
"Extra surrogate keys for the data that was fetched. These act as auxiliary cache keys that can allow granular purging of cached data."
|
257
435
|
),
|
258
436
|
result: dataResourceSchema.describe("The result of fetching the data resource")
|
259
437
|
});
|
260
|
-
var requestEdgehancerResultSchema =
|
261
|
-
results:
|
438
|
+
var requestEdgehancerResultSchema = z9.strictObject({
|
439
|
+
results: z9.array(requestEdgehancerDataResourceResolutionResultSchema)
|
262
440
|
});
|
263
441
|
// Annotate the CommonJS export names for ESM import in node:
|
264
442
|
0 && (module.exports = {
|
265
443
|
COLLECTION_DEFAULT_LIMIT,
|
266
444
|
COLLECTION_DEFAULT_OFFSET,
|
267
445
|
COLLECTION_MAX_LIMIT,
|
446
|
+
afterAIDataResourceEditContextSchema,
|
447
|
+
afterAIDataResourceEditResultSchema,
|
448
|
+
afterAIEditContextSchema,
|
449
|
+
afterAIEditResultSchema,
|
268
450
|
convertBatchResultsToEdgehancerResult,
|
451
|
+
createAIDataResourceEditContextSchema,
|
452
|
+
createAIDataResourceEditResultSchema,
|
453
|
+
createAIEditContextSchema,
|
454
|
+
createAIEditResultSchema,
|
269
455
|
dataResourceSchema,
|
270
456
|
edgehancerMergedDataTypeSchema,
|
271
457
|
getDataResourceAsRequest,
|