@uniformdev/mesh-edgehancer-sdk 20.35.0 → 20.35.1-alpha.210

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.mjs CHANGED
@@ -1,3 +1,119 @@
1
+ // ../../lib/ai-sdk/src/InvocationContexts.ts
2
+ import * as z from "zod/v3";
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
+
18
+ // src/afterAIDataResourceEdit.ts
19
+ import * as z2 from "zod/v3";
20
+ var afterAIDataResourceEditResultSchema = z2.strictObject({
21
+ newValue: z2.record(z2.string(), z2.string()),
22
+ success: z2.boolean(),
23
+ summary: z2.string().optional()
24
+ });
25
+ var afterAIDataResourceEditContextSchema = z2.strictObject({
26
+ /**
27
+ * The the data type of the data resource being edited (merged with its data source)
28
+ * NOTE: this can contain secrets, API keys, etc. Do not directly expose it to the AI agent!
29
+ * NOTE: this does not include the current value's variables, if any
30
+ */
31
+ mergedDataType: z2.custom(),
32
+ /** Which data source variant is currently active (undefined = published data) */
33
+ dataSourceVariant: z2.custom().optional(),
34
+ /** The edit request details */
35
+ editRequest: z2.object({
36
+ /** The edit instruction from the AI agent */
37
+ edit: z2.string(),
38
+ /** Current value of the data resource's variables (if any) */
39
+ currentValue: z2.record(z2.string(), z2.string()).optional()
40
+ }),
41
+ /** AI invocation context */
42
+ invocationContext: invocationContextsSchema,
43
+ /** User ID making the edit */
44
+ userId: z2.string(),
45
+ /** Project ID */
46
+ projectId: z2.string(),
47
+ /** The new value generated by AI */
48
+ newValue: z2.record(z2.string(), z2.string()),
49
+ /** The result from the AI editing process */
50
+ result: z2.object({
51
+ success: z2.boolean(),
52
+ summary: z2.string().optional()
53
+ })
54
+ });
55
+
56
+ // ../../lib/ai-sdk/src/toolDefinitions/editing/createPropertyEdit.ts
57
+ import * as z3 from "zod/v3";
58
+ var createPropertyEdit = {
59
+ displayName: "Create Property Edit",
60
+ 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.",
61
+ inputSchema: z3.object({
62
+ edit: z3.string().describe("Describe the edit to be made to the property"),
63
+ currentValue: z3.unknown().describe("Current value of the property (if any exists)").optional(),
64
+ projectGuidance: z3.string().describe("Guidance prompt for the project (if any exists)").optional(),
65
+ componentGuidance: z3.string().describe("Guidance prompt for the parent component").optional(),
66
+ audienceGuidance: z3.string().describe(
67
+ "Guidance prompt for the target audience of a personalized variation. Omit for non-variation edits."
68
+ ).optional(),
69
+ propertyDefinition: z3.object({
70
+ id: z3.string(),
71
+ name: z3.string(),
72
+ type: z3.string(),
73
+ guidance: z3.string().describe("Guidance prompt from the property definition (if any exists)").optional(),
74
+ typeConfig: z3.unknown().optional().describe("Type-specific configuration for the property")
75
+ }),
76
+ outputLocale: z3.string().optional().describe("The locale to use when writing the edited value"),
77
+ documentContext: z3.string().describe("Content of the surrounding document the property is part of").optional()
78
+ }),
79
+ outputSchema: z3.object({
80
+ newValue: z3.string().describe(
81
+ "The new value of the property. When the action is clear or resetOverride, this should be empty."
82
+ ),
83
+ treatNewValueAsJson: z3.boolean().describe("Whether the newValue is a JSON string"),
84
+ summary: z3.string().describe(
85
+ "A completion message to the user that summarizes the action taken. This should be 1 sentence, in English."
86
+ ).optional(),
87
+ action: z3.enum(["setValue", "clearValue", "resetOverride"]).describe(
88
+ "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."
89
+ ),
90
+ success: z3.boolean().describe("Whether the edit could be completed successfully")
91
+ }),
92
+ runsAt: "server",
93
+ timeout: 100,
94
+ callable: true
95
+ };
96
+
97
+ // src/afterAIEdit.ts
98
+ import * as z4 from "zod/v3";
99
+ var afterAIEditResultSchema = z4.strictObject({
100
+ newValue: z4.unknown(),
101
+ success: z4.boolean(),
102
+ summary: z4.string().optional()
103
+ });
104
+ var afterAIEditContextSchema = z4.strictObject({
105
+ editRequest: createPropertyEdit.inputSchema,
106
+ invocationContext: invocationContextsSchema,
107
+ userId: z4.string(),
108
+ currentLocale: z4.string().optional(),
109
+ projectId: z4.string(),
110
+ newValue: z4.unknown(),
111
+ result: z4.object({
112
+ success: z4.boolean(),
113
+ summary: z4.string().optional()
114
+ })
115
+ });
116
+
1
117
  // src/batchUtils.ts
2
118
  function convertBatchResultsToEdgehancerResult({
3
119
  batch,
@@ -57,6 +173,54 @@ var COLLECTION_DEFAULT_LIMIT = 20;
57
173
  var COLLECTION_MAX_LIMIT = 50;
58
174
  var COLLECTION_DEFAULT_OFFSET = 0;
59
175
 
176
+ // src/createAIDataResourceEdit.ts
177
+ import * as z5 from "zod/v3";
178
+ var createAIDataResourceEditContextSchema = z5.strictObject({
179
+ /**
180
+ * The the data type of the data resource being edited (merged with its data source)
181
+ * NOTE: this can contain secrets, API keys, etc. Do not directly expose it to the AI agent!
182
+ * NOTE: this does not include the current value's variables, if any
183
+ */
184
+ mergedDataType: z5.custom(),
185
+ /** Which data source variant is currently active (undefined = published data) */
186
+ dataSourceVariant: z5.custom().optional(),
187
+ /** The edit request details */
188
+ editRequest: z5.object({
189
+ /** The edit instruction from the AI agent */
190
+ edit: z5.string(),
191
+ /** Current value of the data resource's variables (if any) */
192
+ currentValue: z5.record(z5.string(), z5.string()).optional()
193
+ }),
194
+ /** AI invocation context */
195
+ invocationContext: invocationContextsSchema,
196
+ /** User ID making the edit */
197
+ userId: z5.string(),
198
+ /** Project ID */
199
+ projectId: z5.string()
200
+ });
201
+ var createAIDataResourceEditResultSchema = z5.strictObject({
202
+ outputJsonSchema: z5.record(z5.string(), z5.any()).describe("JSON schema (draft-07) for the edited data resource result"),
203
+ instructions: z5.string().describe(
204
+ "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."
205
+ )
206
+ });
207
+
208
+ // src/createAIEdit.ts
209
+ import * as z6 from "zod/v3";
210
+ var createAIEditContextSchema = z6.strictObject({
211
+ editRequest: createPropertyEdit.inputSchema,
212
+ invocationContext: invocationContextsSchema,
213
+ userId: z6.string(),
214
+ currentLocale: z6.string().optional(),
215
+ projectId: z6.string()
216
+ });
217
+ var createAIEditResultSchema = z6.strictObject({
218
+ outputJsonSchema: z6.record(z6.string(), z6.any()).describe("JSON schema (draft-07) for the edited content result"),
219
+ instructions: z6.string().describe(
220
+ "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."
221
+ )
222
+ });
223
+
60
224
  // src/fetchUtils.ts
61
225
  function getDataResourceAsRequest(data) {
62
226
  var _a;
@@ -96,78 +260,80 @@ function copyKeyValuePairs(source, target) {
96
260
  }
97
261
 
98
262
  // src/preRequest.ts
99
- import * as z2 from "zod";
263
+ import * as z8 from "zod/v3";
100
264
 
101
265
  // src/shared.ts
102
266
  import { assert } from "tsafe";
103
- import * as z from "zod";
104
- var parameterDefinitionSchema = z.object({
105
- key: z.string(),
106
- value: z.string(),
107
- omitIfEmpty: z.boolean().optional()
108
- });
109
- var resolvingIssueSchema = z.union([
110
- z.string(),
111
- z.object({
112
- message: z.string(),
113
- subType: z.enum(["unpublishedData", "configuration"]).optional(),
114
- issueReference: z.string().optional(),
115
- deepLink: z.string().optional()
267
+ import * as z7 from "zod/v3";
268
+ var parameterDefinitionSchema = z7.object({
269
+ key: z7.string(),
270
+ value: z7.string(),
271
+ omitIfEmpty: z7.boolean().optional()
272
+ });
273
+ var resolvingIssueSchema = z7.union([
274
+ z7.string(),
275
+ z7.object({
276
+ message: z7.string(),
277
+ subType: z7.enum(["unpublishedData", "configuration"]).optional(),
278
+ issueReference: z7.string().optional(),
279
+ deepLink: z7.string().optional()
116
280
  })
117
281
  ]);
118
- var variableDefinitionSchema = z.object({
119
- displayName: z.string().optional(),
120
- type: z.string().optional(),
121
- default: z.string(),
122
- helpText: z.string().optional(),
123
- order: z.number().optional(),
124
- source: z.string().optional()
125
- });
126
- var customEdgehancerDefinitionSchema = z.object({
127
- preRequest: z.string().optional(),
128
- request: z.string().optional()
129
- });
130
- var dataSourceVariantSchema = z.intersection(
131
- z.object({
132
- headers: z.array(parameterDefinitionSchema).optional(),
133
- parameters: z.array(parameterDefinitionSchema).optional(),
134
- variables: z.record(variableDefinitionSchema).optional()
282
+ var variableDefinitionSchema = z7.object({
283
+ displayName: z7.string().optional(),
284
+ type: z7.string().optional(),
285
+ default: z7.string(),
286
+ helpText: z7.string().optional(),
287
+ order: z7.number().optional(),
288
+ source: z7.string().optional()
289
+ });
290
+ var customEdgehancerDefinitionSchema = z7.object({
291
+ preRequest: z7.string().optional(),
292
+ request: z7.string().optional(),
293
+ createAIDataResourceEdit: z7.string().optional(),
294
+ afterAIDataResourceEdit: z7.string().optional()
295
+ });
296
+ var dataSourceVariantSchema = z7.intersection(
297
+ z7.object({
298
+ headers: z7.array(parameterDefinitionSchema).optional(),
299
+ parameters: z7.array(parameterDefinitionSchema).optional(),
300
+ variables: z7.record(variableDefinitionSchema).optional()
135
301
  }),
136
- z.object({ url: z.string() })
302
+ z7.object({ url: z7.string() })
137
303
  );
138
- var mergedDataTypeSchema = z.object({
139
- id: z.string(),
140
- displayName: z.string(),
141
- archetype: z.string().optional(),
142
- allowedOnComponents: z.array(z.string()).optional(),
143
- badgeIconUrl: z.string().optional(),
144
- connectorType: z.string(),
145
- url: z.string(),
146
- headers: z.array(parameterDefinitionSchema).optional(),
147
- parameters: z.array(parameterDefinitionSchema).optional(),
148
- body: z.string().optional(),
149
- method: z.enum(["GET", "POST", "HEAD"]),
150
- variables: z.record(variableDefinitionSchema).optional(),
151
- custom: z.record(z.unknown()).optional(),
152
- customPublic: z.record(z.unknown()).optional(),
153
- ttl: z.number().optional(),
154
- purgeKey: z.string().optional(),
155
- localeMapping: z.record(z.string()).optional(),
304
+ var mergedDataTypeSchema = z7.object({
305
+ id: z7.string(),
306
+ displayName: z7.string(),
307
+ archetype: z7.string().optional(),
308
+ allowedOnComponents: z7.array(z7.string()).optional(),
309
+ badgeIconUrl: z7.string().optional(),
310
+ connectorType: z7.string(),
311
+ url: z7.string(),
312
+ headers: z7.array(parameterDefinitionSchema).optional(),
313
+ parameters: z7.array(parameterDefinitionSchema).optional(),
314
+ body: z7.string().optional(),
315
+ method: z7.enum(["GET", "POST", "HEAD"]),
316
+ variables: z7.record(variableDefinitionSchema).optional(),
317
+ custom: z7.record(z7.unknown()).optional(),
318
+ customPublic: z7.record(z7.unknown()).optional(),
319
+ ttl: z7.number().optional(),
320
+ purgeKey: z7.string().optional(),
321
+ localeMapping: z7.record(z7.string()).optional(),
156
322
  edgehancer: customEdgehancerDefinitionSchema.optional(),
157
- uiBadgeText: z.string().max(12).optional(),
158
- variants: z.object({
323
+ uiBadgeText: z7.string().max(12).optional(),
324
+ variants: z7.object({
159
325
  unpublished: dataSourceVariantSchema.optional()
160
326
  }).optional(),
161
- enableUnpublishedMode: z.boolean().optional()
327
+ enableUnpublishedMode: z7.boolean().optional()
162
328
  });
163
329
  assert();
164
- var dataResourceSchema = z.union([
165
- z.string(),
166
- z.object({}).catchall(z.unknown()),
167
- z.number(),
168
- z.boolean(),
169
- z.array(z.unknown()),
170
- z.undefined()
330
+ var dataResourceSchema = z7.union([
331
+ z7.string(),
332
+ z7.object({}).catchall(z7.unknown()),
333
+ z7.number(),
334
+ z7.boolean(),
335
+ z7.array(z7.unknown()),
336
+ z7.undefined()
171
337
  ]);
172
338
 
173
339
  // src/preRequest.ts
@@ -180,39 +346,47 @@ var edgehancerMergedDataTypeSchema = mergedDataTypeSchema.omit({
180
346
  purgeKey: true,
181
347
  variables: true
182
348
  });
183
- var preRequestEdgehancerDataResourceResultSchema = z2.strictObject({
184
- errors: z2.array(resolvingIssueSchema).optional(),
185
- warnings: z2.array(resolvingIssueSchema).optional(),
186
- infos: z2.array(resolvingIssueSchema).optional(),
349
+ var preRequestEdgehancerDataResourceResultSchema = z8.strictObject({
350
+ errors: z8.array(resolvingIssueSchema).optional(),
351
+ warnings: z8.array(resolvingIssueSchema).optional(),
352
+ infos: z8.array(resolvingIssueSchema).optional(),
187
353
  dataResource: edgehancerMergedDataTypeSchema
188
354
  });
189
- var preRequestEdgehancerResultSchema = z2.strictObject({
190
- dataResources: z2.array(preRequestEdgehancerDataResourceResultSchema)
355
+ var preRequestEdgehancerResultSchema = z8.strictObject({
356
+ dataResources: z8.array(preRequestEdgehancerDataResourceResultSchema)
191
357
  });
192
358
 
193
359
  // src/request.ts
194
- import * as z3 from "zod";
195
- var requestEdgehancerDataResourceResolutionResultSchema = z3.strictObject({
196
- errors: z3.array(resolvingIssueSchema).optional().describe(
360
+ import * as z9 from "zod/v3";
361
+ var requestEdgehancerDataResourceResolutionResultSchema = z9.strictObject({
362
+ errors: z9.array(resolvingIssueSchema).optional().describe(
197
363
  "Errors that occurred while running your code to return with the API response, if any. Unhandled exceptions will be captured automatically."
198
364
  ),
199
- warnings: z3.array(resolvingIssueSchema).optional().describe("Warnings that occurred while running your code to return with the API response, if any."),
200
- infos: z3.array(resolvingIssueSchema).optional().describe(
365
+ warnings: z9.array(resolvingIssueSchema).optional().describe("Warnings that occurred while running your code to return with the API response, if any."),
366
+ infos: z9.array(resolvingIssueSchema).optional().describe(
201
367
  "Informational messages that occurred while running your code to return with the API response, if any."
202
368
  ),
203
- surrogateKeys: z3.array(z3.string()).optional().describe(
369
+ surrogateKeys: z9.array(z9.string()).optional().describe(
204
370
  "Extra surrogate keys for the data that was fetched. These act as auxiliary cache keys that can allow granular purging of cached data."
205
371
  ),
206
372
  result: dataResourceSchema.describe("The result of fetching the data resource")
207
373
  });
208
- var requestEdgehancerResultSchema = z3.strictObject({
209
- results: z3.array(requestEdgehancerDataResourceResolutionResultSchema)
374
+ var requestEdgehancerResultSchema = z9.strictObject({
375
+ results: z9.array(requestEdgehancerDataResourceResolutionResultSchema)
210
376
  });
211
377
  export {
212
378
  COLLECTION_DEFAULT_LIMIT,
213
379
  COLLECTION_DEFAULT_OFFSET,
214
380
  COLLECTION_MAX_LIMIT,
381
+ afterAIDataResourceEditContextSchema,
382
+ afterAIDataResourceEditResultSchema,
383
+ afterAIEditContextSchema,
384
+ afterAIEditResultSchema,
215
385
  convertBatchResultsToEdgehancerResult,
386
+ createAIDataResourceEditContextSchema,
387
+ createAIDataResourceEditResultSchema,
388
+ createAIEditContextSchema,
389
+ createAIEditResultSchema,
216
390
  dataResourceSchema,
217
391
  edgehancerMergedDataTypeSchema,
218
392
  getDataResourceAsRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-edgehancer-sdk",
3
- "version": "20.35.0",
3
+ "version": "20.35.1-alpha.210+4fa236da76",
4
4
  "description": "Uniform Mesh Edgehancer SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -48,12 +48,12 @@
48
48
  "/dist"
49
49
  ],
50
50
  "dependencies": {
51
- "@uniformdev/canvas": "20.35.0",
51
+ "@uniformdev/canvas": "20.35.1-alpha.210+4fa236da76",
52
52
  "tsafe": "1.6.6",
53
- "zod": "3.23.8"
53
+ "zod": "3.25.76"
54
54
  },
55
55
  "devDependencies": {
56
- "next": "14.2.32"
56
+ "next": "16.0.7"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "next": ">13"
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "f228361828ef49a596ca3841e5b79768c64418cf"
64
+ "gitHead": "4fa236da76e057582eae6c2595a2fa763fda886a"
65
65
  }