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