@copilotkit/shared 1.80.0 → 1.82.0

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.
Files changed (133) hide show
  1. package/dist/a2ui-envelope.cjs +154 -0
  2. package/dist/a2ui-envelope.cjs.map +1 -0
  3. package/dist/a2ui-envelope.d.cts +101 -0
  4. package/dist/a2ui-envelope.d.cts.map +1 -0
  5. package/dist/a2ui-envelope.d.mts +101 -0
  6. package/dist/a2ui-envelope.d.mts.map +1 -0
  7. package/dist/a2ui-envelope.mjs +151 -0
  8. package/dist/a2ui-envelope.mjs.map +1 -0
  9. package/dist/a2ui-prompts.cjs +139 -0
  10. package/dist/a2ui-prompts.cjs.map +1 -1
  11. package/dist/a2ui-prompts.d.cts +60 -1
  12. package/dist/a2ui-prompts.d.cts.map +1 -1
  13. package/dist/a2ui-prompts.d.mts +60 -1
  14. package/dist/a2ui-prompts.d.mts.map +1 -1
  15. package/dist/a2ui-prompts.mjs +134 -1
  16. package/dist/a2ui-prompts.mjs.map +1 -1
  17. package/dist/generative-ui/basic-functions.cjs +177 -0
  18. package/dist/generative-ui/basic-functions.cjs.map +1 -0
  19. package/dist/generative-ui/basic-functions.d.cts +108 -0
  20. package/dist/generative-ui/basic-functions.d.cts.map +1 -0
  21. package/dist/generative-ui/basic-functions.d.mts +108 -0
  22. package/dist/generative-ui/basic-functions.d.mts.map +1 -0
  23. package/dist/generative-ui/basic-functions.mjs +167 -0
  24. package/dist/generative-ui/basic-functions.mjs.map +1 -0
  25. package/dist/generative-ui/child-refs.cjs +161 -0
  26. package/dist/generative-ui/child-refs.cjs.map +1 -0
  27. package/dist/generative-ui/child-refs.d.cts +68 -0
  28. package/dist/generative-ui/child-refs.d.cts.map +1 -0
  29. package/dist/generative-ui/child-refs.d.mts +68 -0
  30. package/dist/generative-ui/child-refs.d.mts.map +1 -0
  31. package/dist/generative-ui/child-refs.mjs +152 -0
  32. package/dist/generative-ui/child-refs.mjs.map +1 -0
  33. package/dist/generative-ui/is-record.cjs +10 -0
  34. package/dist/generative-ui/is-record.cjs.map +1 -0
  35. package/dist/generative-ui/is-record.mjs +9 -0
  36. package/dist/generative-ui/is-record.mjs.map +1 -0
  37. package/dist/generative-ui/prompt.cjs +91 -0
  38. package/dist/generative-ui/prompt.cjs.map +1 -0
  39. package/dist/generative-ui/prompt.d.cts +13 -0
  40. package/dist/generative-ui/prompt.d.cts.map +1 -0
  41. package/dist/generative-ui/prompt.d.mts +13 -0
  42. package/dist/generative-ui/prompt.d.mts.map +1 -0
  43. package/dist/generative-ui/prompt.mjs +90 -0
  44. package/dist/generative-ui/prompt.mjs.map +1 -0
  45. package/dist/generative-ui/render-ui-args.cjs +160 -0
  46. package/dist/generative-ui/render-ui-args.cjs.map +1 -0
  47. package/dist/generative-ui/render-ui-args.d.cts +40 -0
  48. package/dist/generative-ui/render-ui-args.d.cts.map +1 -0
  49. package/dist/generative-ui/render-ui-args.d.mts +40 -0
  50. package/dist/generative-ui/render-ui-args.d.mts.map +1 -0
  51. package/dist/generative-ui/render-ui-args.mjs +159 -0
  52. package/dist/generative-ui/render-ui-args.mjs.map +1 -0
  53. package/dist/generative-ui/types.cjs +101 -0
  54. package/dist/generative-ui/types.cjs.map +1 -0
  55. package/dist/generative-ui/types.d.cts +270 -0
  56. package/dist/generative-ui/types.d.cts.map +1 -0
  57. package/dist/generative-ui/types.d.mts +270 -0
  58. package/dist/generative-ui/types.d.mts.map +1 -0
  59. package/dist/generative-ui/types.mjs +86 -0
  60. package/dist/generative-ui/types.mjs.map +1 -0
  61. package/dist/generative-ui/validate-operation.cjs +405 -0
  62. package/dist/generative-ui/validate-operation.cjs.map +1 -0
  63. package/dist/generative-ui/validate-operation.d.cts +86 -0
  64. package/dist/generative-ui/validate-operation.d.cts.map +1 -0
  65. package/dist/generative-ui/validate-operation.d.mts +86 -0
  66. package/dist/generative-ui/validate-operation.d.mts.map +1 -0
  67. package/dist/generative-ui/validate-operation.mjs +399 -0
  68. package/dist/generative-ui/validate-operation.mjs.map +1 -0
  69. package/dist/index.cjs +63 -0
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +9 -2
  72. package/dist/index.d.cts.map +1 -1
  73. package/dist/index.d.mts +9 -2
  74. package/dist/index.d.mts.map +1 -1
  75. package/dist/index.mjs +9 -2
  76. package/dist/index.mjs.map +1 -1
  77. package/dist/index.umd.js +1421 -20
  78. package/dist/index.umd.js.map +1 -1
  79. package/dist/package.cjs +1 -1
  80. package/dist/package.mjs +1 -1
  81. package/dist/telemetry/telemetry-client.cjs +1 -1
  82. package/dist/telemetry/telemetry-client.cjs.map +1 -1
  83. package/dist/telemetry/telemetry-client.d.cts.map +1 -1
  84. package/dist/telemetry/telemetry-client.d.mts.map +1 -1
  85. package/dist/telemetry/telemetry-client.mjs +1 -1
  86. package/dist/telemetry/telemetry-client.mjs.map +1 -1
  87. package/dist/utils/dashboard-url.cjs +19 -0
  88. package/dist/utils/dashboard-url.cjs.map +1 -0
  89. package/dist/utils/dashboard-url.mjs +18 -0
  90. package/dist/utils/dashboard-url.mjs.map +1 -0
  91. package/dist/utils/index.cjs +2 -1
  92. package/dist/utils/index.cjs.map +1 -1
  93. package/dist/utils/index.d.cts.map +1 -1
  94. package/dist/utils/index.d.mts.map +1 -1
  95. package/dist/utils/index.mjs +2 -1
  96. package/dist/utils/index.mjs.map +1 -1
  97. package/dist/utils/inspector-learning.cjs +10 -7
  98. package/dist/utils/inspector-learning.cjs.map +1 -1
  99. package/dist/utils/inspector-learning.d.cts.map +1 -1
  100. package/dist/utils/inspector-learning.d.mts.map +1 -1
  101. package/dist/utils/inspector-learning.mjs +11 -7
  102. package/dist/utils/inspector-learning.mjs.map +1 -1
  103. package/dist/utils/inspector-metadata.cjs +2 -3
  104. package/dist/utils/inspector-metadata.cjs.map +1 -1
  105. package/dist/utils/inspector-metadata.d.cts.map +1 -1
  106. package/dist/utils/inspector-metadata.d.mts.map +1 -1
  107. package/dist/utils/inspector-metadata.mjs +3 -3
  108. package/dist/utils/inspector-metadata.mjs.map +1 -1
  109. package/package.json +1 -1
  110. package/src/__tests__/a2ui-envelope.test.ts +434 -0
  111. package/src/__tests__/a2ui-prompts.test.ts +362 -0
  112. package/src/a2ui-envelope.ts +309 -0
  113. package/src/a2ui-prompts.ts +207 -0
  114. package/src/generative-ui/__tests__/render-ui-args.test.ts +175 -0
  115. package/src/generative-ui/__tests__/validate-operation.test.ts +977 -0
  116. package/src/generative-ui/basic-functions.ts +282 -0
  117. package/src/generative-ui/child-refs.ts +210 -0
  118. package/src/generative-ui/index.ts +6 -0
  119. package/src/generative-ui/is-record.ts +4 -0
  120. package/src/generative-ui/prompt.ts +174 -0
  121. package/src/generative-ui/render-ui-args.ts +199 -0
  122. package/src/generative-ui/types.ts +314 -0
  123. package/src/generative-ui/validate-operation.ts +723 -0
  124. package/src/index.ts +15 -0
  125. package/src/telemetry/telemetry-client.test.ts +18 -0
  126. package/src/telemetry/telemetry-client.ts +3 -1
  127. package/src/utils/dashboard-url.ts +17 -0
  128. package/src/utils/index.ts +7 -1
  129. package/src/utils/inspector-learning.test.ts +58 -0
  130. package/src/utils/inspector-learning.ts +26 -5
  131. package/src/utils/inspector-metadata.test.ts +2 -1
  132. package/src/utils/inspector-metadata.ts +3 -13
  133. package/src/utils.test.ts +71 -0
@@ -0,0 +1,434 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { envelopeToManifest, readCopilotKitUIEnvelope } from "../a2ui-envelope";
3
+ import type { CopilotKitUIEnvelope } from "../a2ui-envelope";
4
+
5
+ type InlineCatalog = NonNullable<
6
+ CopilotKitUIEnvelope["v1.0"]["inlineCatalogs"]
7
+ >[number];
8
+ type Extensions = CopilotKitUIEnvelope["metadata"]["extensions"];
9
+
10
+ const productGrid = {
11
+ description: "A grid of products.",
12
+ props: {
13
+ type: "object",
14
+ properties: { title: { type: "string" } },
15
+ required: ["title"],
16
+ },
17
+ events: { onSelect: { parameters: { type: "object" } } },
18
+ slots: { children: "multiple" as const },
19
+ };
20
+ const addToCart = { description: "Add.", parameters: { type: "object" } };
21
+ const targets: Extensions["copilotkit_targets"] = [
22
+ { id: "chat", kind: "chat" },
23
+ {
24
+ id: "sidebar",
25
+ kind: "inline",
26
+ description: "Right column.",
27
+ components: ["ProductGrid"],
28
+ },
29
+ ];
30
+ const surfaces: Extensions["copilotkit_surfaces"] = {
31
+ cart: { target: "sidebar" },
32
+ form: {
33
+ target: "chat",
34
+ dataModel: { "/form/email": "me@x.io" },
35
+ rejected: ["operation 2: unknown component Foo"],
36
+ },
37
+ };
38
+
39
+ function createCatalog(overrides?: Partial<InlineCatalog>): InlineCatalog {
40
+ return {
41
+ catalogId: "acme/app@1",
42
+ protocolVersion: "1.0",
43
+ components: { ProductGrid: productGrid },
44
+ functions: { addToCart },
45
+ instructions: "Write fences.",
46
+ ...overrides,
47
+ };
48
+ }
49
+
50
+ function createEnvelope(options?: {
51
+ catalog?: Partial<InlineCatalog>;
52
+ extensions?: Partial<Extensions>;
53
+ }): CopilotKitUIEnvelope {
54
+ return {
55
+ "v1.0": {
56
+ supportedCatalogIds: ["acme/app@1"],
57
+ inlineCatalogs: [createCatalog(options?.catalog)],
58
+ },
59
+ metadata: {
60
+ extensions: {
61
+ copilotkit_format: 3,
62
+ copilotkit_transport: "markdown",
63
+ copilotkit_targets: targets,
64
+ copilotkit_surfaces: surfaces,
65
+ copilotkit_contextSent: true,
66
+ ...options?.extensions,
67
+ },
68
+ },
69
+ };
70
+ }
71
+
72
+ /** Reads `ui` from `forwardedProps.copilotkit.ui`. */
73
+ const readUI = (ui: unknown) =>
74
+ readCopilotKitUIEnvelope({ copilotkit: { ui }, other: 1 });
75
+
76
+ /** An envelope with one key of the inline catalog replaced by any value. */
77
+ const withCatalogField = (key: string, value: unknown) => {
78
+ const envelope = createEnvelope();
79
+ return {
80
+ ...envelope,
81
+ "v1.0": {
82
+ ...envelope["v1.0"],
83
+ inlineCatalogs: [{ ...createCatalog(), [key]: value }],
84
+ },
85
+ };
86
+ };
87
+
88
+ /** An envelope with one key of the capabilities replaced by any value. */
89
+ const withCapability = (key: string, value: unknown) => {
90
+ const envelope = createEnvelope();
91
+ return { ...envelope, "v1.0": { ...envelope["v1.0"], [key]: value } };
92
+ };
93
+
94
+ /** An envelope with one CopilotKit extension replaced by any value. */
95
+ const withExtension = (key: string, value: unknown) => {
96
+ const envelope = createEnvelope();
97
+ return {
98
+ ...envelope,
99
+ metadata: {
100
+ extensions: { ...envelope.metadata.extensions, [key]: value },
101
+ },
102
+ };
103
+ };
104
+
105
+ describe("readCopilotKitUIEnvelope", () => {
106
+ it("reads a markdown envelope from forwardedProps.copilotkit.ui", () => {
107
+ const envelope = createEnvelope();
108
+ expect(readUI(envelope)).toEqual(envelope);
109
+ });
110
+
111
+ it("reads a tool envelope without instructions and without components", () => {
112
+ const envelope: CopilotKitUIEnvelope = {
113
+ "v1.0": {
114
+ supportedCatalogIds: ["acme/app@1"],
115
+ inlineCatalogs: [
116
+ { catalogId: "acme/app@1", protocolVersion: "1.0", functions: {} },
117
+ ],
118
+ },
119
+ metadata: {
120
+ extensions: {
121
+ copilotkit_format: 3,
122
+ copilotkit_transport: "tool",
123
+ copilotkit_targets: [],
124
+ copilotkit_surfaces: {},
125
+ copilotkit_contextSent: false,
126
+ },
127
+ },
128
+ };
129
+ expect(readUI(envelope)).toEqual(envelope);
130
+ });
131
+
132
+ it("reads an envelope without inline catalogs", () => {
133
+ const envelope: CopilotKitUIEnvelope = {
134
+ ...createEnvelope(),
135
+ "v1.0": { supportedCatalogIds: ["acme/app@1"] },
136
+ };
137
+ expect(readUI(envelope)).toEqual(envelope);
138
+ });
139
+
140
+ it("reads an envelope that carries other extensions too", () => {
141
+ const envelope = withExtension("a2ui_trace", { id: "t1" });
142
+ expect(readUI(envelope)).toEqual(envelope);
143
+ });
144
+
145
+ it("reads a target with 100 component names", () => {
146
+ const envelope = createEnvelope({
147
+ extensions: {
148
+ copilotkit_targets: [
149
+ { id: "x", kind: "inline", components: Array(100).fill("Card") },
150
+ ],
151
+ },
152
+ });
153
+ expect(readUI(envelope)).toEqual(envelope);
154
+ });
155
+
156
+ it("reads a surface with 20 rejections of 500 characters", () => {
157
+ const envelope = createEnvelope({
158
+ extensions: {
159
+ copilotkit_surfaces: {
160
+ cart: { target: "chat", rejected: Array(20).fill("x".repeat(500)) },
161
+ },
162
+ },
163
+ });
164
+ expect(readUI(envelope)).toEqual(envelope);
165
+ });
166
+
167
+ it("reads a deleted surface and a surface whose create failed", () => {
168
+ const envelope = createEnvelope({
169
+ extensions: {
170
+ copilotkit_surfaces: {
171
+ old: { target: "chat", status: "deleted" },
172
+ bad: { target: "chat", status: "failed", rejected: ["operation 0"] },
173
+ },
174
+ },
175
+ });
176
+ expect(readUI(envelope)).toEqual(envelope);
177
+ });
178
+
179
+ it("returns undefined when there is no envelope", () => {
180
+ expect(readCopilotKitUIEnvelope(undefined)).toBeUndefined();
181
+ expect(readCopilotKitUIEnvelope("copilotkit")).toBeUndefined();
182
+ expect(readCopilotKitUIEnvelope({})).toBeUndefined();
183
+ expect(readCopilotKitUIEnvelope({ copilotkit: null })).toBeUndefined();
184
+ expect(readCopilotKitUIEnvelope({ copilotkit: {} })).toBeUndefined();
185
+ });
186
+
187
+ it.each([
188
+ [
189
+ "the format 2 envelope",
190
+ {
191
+ method: "a2ui",
192
+ version: "v0.9",
193
+ format: 2,
194
+ transport: "tool",
195
+ catalog: { id: "acme/app", version: "1" },
196
+ functions: {},
197
+ targets: [],
198
+ surfaces: {},
199
+ contextSent: false,
200
+ },
201
+ ],
202
+ ["format 2 in the extensions", withExtension("copilotkit_format", 2)],
203
+ ["an unknown transport", withExtension("copilotkit_transport", "fence")],
204
+ ["no capabilities", { ...createEnvelope(), "v1.0": undefined }],
205
+ ["no metadata", { ...createEnvelope(), metadata: undefined }],
206
+ ["no extensions", { ...createEnvelope(), metadata: {} }],
207
+ ["no catalog id", withCapability("supportedCatalogIds", [])],
208
+ ["an empty catalog id", withCapability("supportedCatalogIds", [""])],
209
+ [
210
+ "inline catalogs that are not a list",
211
+ withCapability("inlineCatalogs", {}),
212
+ ],
213
+ [
214
+ "an inline catalog without an id",
215
+ withCatalogField("catalogId", undefined),
216
+ ],
217
+ [
218
+ "an inline catalog of protocol 0.9",
219
+ withCatalogField("protocolVersion", "0.9"),
220
+ ],
221
+ [
222
+ "a component without a props schema",
223
+ withCatalogField("components", { Card: { description: "x" } }),
224
+ ],
225
+ [
226
+ "a component whose required list is not strings",
227
+ withCatalogField("components", {
228
+ Card: { props: { type: "object", required: 5 } },
229
+ }),
230
+ ],
231
+ [
232
+ "an unknown slot kind",
233
+ withCatalogField("components", {
234
+ Card: { props: {}, slots: { body: "many" } },
235
+ }),
236
+ ],
237
+ [
238
+ "an event without parameters",
239
+ withCatalogField("components", {
240
+ Card: { props: {}, events: { onClick: {} } },
241
+ }),
242
+ ],
243
+ [
244
+ "a function without parameters",
245
+ withCatalogField("functions", { add: {} }),
246
+ ],
247
+ [
248
+ "an inline catalog without functions",
249
+ withCatalogField("functions", undefined),
250
+ ],
251
+ ["instructions that are not text", withCatalogField("instructions", ["a"])],
252
+ [
253
+ "targets that are not a list",
254
+ withExtension("copilotkit_targets", { chat: "chat" }),
255
+ ],
256
+ [
257
+ "a target with an unknown kind",
258
+ withExtension("copilotkit_targets", [{ id: "x", kind: "modal" }]),
259
+ ],
260
+ [
261
+ "a surface without a target",
262
+ withExtension("copilotkit_surfaces", { cart: {} }),
263
+ ],
264
+ [
265
+ "a surface data model that is not an object",
266
+ withExtension("copilotkit_surfaces", {
267
+ cart: { target: "chat", dataModel: ["a"] },
268
+ }),
269
+ ],
270
+ [
271
+ "surface rejections that are not strings",
272
+ withExtension("copilotkit_surfaces", {
273
+ cart: { target: "chat", rejected: [1] },
274
+ }),
275
+ ],
276
+ [
277
+ "more than 20 surface rejections",
278
+ withExtension("copilotkit_surfaces", {
279
+ cart: { target: "chat", rejected: Array(21).fill("operation 0: x") },
280
+ }),
281
+ ],
282
+ [
283
+ "an unknown surface status",
284
+ withExtension("copilotkit_surfaces", {
285
+ cart: { target: "chat", status: "closed" },
286
+ }),
287
+ ],
288
+ [
289
+ "a surface rejection longer than 500 characters",
290
+ withExtension("copilotkit_surfaces", {
291
+ cart: { target: "chat", rejected: ["x".repeat(501)] },
292
+ }),
293
+ ],
294
+ [
295
+ "target components that are not a list",
296
+ withExtension("copilotkit_targets", [
297
+ { id: "x", kind: "inline", components: "ProductGrid" },
298
+ ]),
299
+ ],
300
+ [
301
+ "a target component name that is empty",
302
+ withExtension("copilotkit_targets", [
303
+ { id: "x", kind: "inline", components: ["ProductGrid", ""] },
304
+ ]),
305
+ ],
306
+ [
307
+ "more than 100 target component names",
308
+ withExtension("copilotkit_targets", [
309
+ { id: "x", kind: "inline", components: Array(101).fill("ProductGrid") },
310
+ ]),
311
+ ],
312
+ ["no contextSent flag", withExtension("copilotkit_contextSent", undefined)],
313
+ ])("returns undefined for %s", (_case, ui) => {
314
+ expect(readUI(ui)).toBeUndefined();
315
+ });
316
+ });
317
+
318
+ describe("envelopeToManifest", () => {
319
+ it("returns the manifest, the transport, the context flag, and the instructions", () => {
320
+ expect(envelopeToManifest(createEnvelope())).toEqual({
321
+ catalogId: "acme/app@1",
322
+ catalogIds: ["acme/app@1"],
323
+ components: { ProductGrid: productGrid },
324
+ functions: { addToCart },
325
+ targets,
326
+ surfaces,
327
+ transport: "markdown",
328
+ contextSent: true,
329
+ instructions: "Write fences.",
330
+ hasComponents: true,
331
+ });
332
+ });
333
+
334
+ it("gives the action of the user event that started the run", () => {
335
+ const action = {
336
+ version: "v1.0" as const,
337
+ action: {
338
+ name: "buy",
339
+ surfaceId: "s1",
340
+ sourceComponentId: "button",
341
+ timestamp: "2026-10-20T10:00:00.000Z",
342
+ userMessage: "Buy now",
343
+ context: { sku: "a" },
344
+ },
345
+ };
346
+ const envelope = createEnvelope({
347
+ extensions: { copilotkit_action: action },
348
+ });
349
+ expect(readCopilotKitUIEnvelope({ copilotkit: { ui: envelope } })).toEqual(
350
+ envelope,
351
+ );
352
+ expect(envelopeToManifest(envelope).action).toEqual(action);
353
+ });
354
+
355
+ it("reports no components when the client left them out", () => {
356
+ const manifest = envelopeToManifest(
357
+ createEnvelope({
358
+ catalog: { components: undefined, instructions: undefined },
359
+ extensions: { copilotkit_transport: "tool" },
360
+ }),
361
+ );
362
+ expect(manifest).toMatchObject({
363
+ components: {},
364
+ functions: { addToCart },
365
+ transport: "tool",
366
+ hasComponents: false,
367
+ });
368
+ expect(manifest.instructions).toBeUndefined();
369
+ });
370
+
371
+ it("lists every supported catalog id, the first one as the catalog of the run", () => {
372
+ const envelope: CopilotKitUIEnvelope = {
373
+ ...createEnvelope(),
374
+ "v1.0": {
375
+ supportedCatalogIds: ["acme/app@1", "copilotkit/standard@1"],
376
+ inlineCatalogs: [createCatalog()],
377
+ },
378
+ };
379
+ expect(envelopeToManifest(envelope)).toMatchObject({
380
+ catalogId: "acme/app@1",
381
+ catalogIds: ["acme/app@1", "copilotkit/standard@1"],
382
+ components: { ProductGrid: productGrid },
383
+ });
384
+ });
385
+
386
+ it("uses only the inline catalog of the first supported catalog id", () => {
387
+ const envelope: CopilotKitUIEnvelope = {
388
+ ...createEnvelope(),
389
+ "v1.0": {
390
+ supportedCatalogIds: ["acme/app@1"],
391
+ inlineCatalogs: [createCatalog({ catalogId: "other/catalog" })],
392
+ },
393
+ };
394
+ expect(envelopeToManifest(envelope)).toMatchObject({
395
+ catalogId: "acme/app@1",
396
+ components: {},
397
+ functions: {},
398
+ hasComponents: false,
399
+ });
400
+ });
401
+ });
402
+
403
+ describe("component parameter order", () => {
404
+ it("preserves ordering through the capability envelope", () => {
405
+ const component = {
406
+ ...productGrid,
407
+ parameterOrder: ["children", "onSelect", "title"],
408
+ };
409
+ const envelope = createEnvelope({
410
+ catalog: { components: { ProductGrid: component } },
411
+ });
412
+ const parsed = readUI(JSON.parse(JSON.stringify(envelope)))!;
413
+ expect(
414
+ envelopeToManifest(parsed).components.ProductGrid.parameterOrder,
415
+ ).toEqual(component.parameterOrder);
416
+ });
417
+ it.each(["title", ["title", "title"], ["unknown"], [42], ["__proto__"]])(
418
+ "rejects invalid metadata %j",
419
+ (parameterOrder) => {
420
+ const envelope = createEnvelope();
421
+ const catalog = envelope["v1.0"].inlineCatalogs![0];
422
+ const invalid = {
423
+ ...catalog,
424
+ components: { ProductGrid: { ...productGrid, parameterOrder } },
425
+ };
426
+ expect(
427
+ readUI({
428
+ ...envelope,
429
+ "v1.0": { ...envelope["v1.0"], inlineCatalogs: [invalid] },
430
+ }),
431
+ ).toBeUndefined();
432
+ },
433
+ );
434
+ });