xmcp 0.7.0 → 0.7.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/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -3
- package/src/auth/api-key.ts +0 -120
- package/src/auth/jwt.ts +0 -52
- package/src/cli/commands/create/__tests__/create.test.ts +0 -99
- package/src/cli/commands/create/index.ts +0 -74
- package/src/cli/commands/create/templates/index.ts +0 -4
- package/src/cli/commands/create/templates/prompt.ts +0 -30
- package/src/cli/commands/create/templates/resource.ts +0 -20
- package/src/cli/commands/create/templates/tool.ts +0 -34
- package/src/cli/commands/create/templates/widget.ts +0 -33
- package/src/cli/utils/naming.ts +0 -39
- package/src/cli.ts +0 -125
- package/src/client/headers.ts +0 -61
- package/src/client/index.ts +0 -180
- package/src/client/types.ts +0 -122
- package/src/client/utils.ts +0 -133
- package/src/cloudflare.ts +0 -6
- package/src/compiler/build-telemetry.ts +0 -88
- package/src/compiler/client/component-compiler.ts +0 -250
- package/src/compiler/client/transpile.ts +0 -21
- package/src/compiler/compiler-context.ts +0 -61
- package/src/compiler/config/__tests__/config.test.ts +0 -459
- package/src/compiler/config/index.ts +0 -62
- package/src/compiler/config/injection.ts +0 -210
- package/src/compiler/config/schemas/bundler.ts +0 -12
- package/src/compiler/config/schemas/experimental/index.ts +0 -22
- package/src/compiler/config/schemas/index.ts +0 -20
- package/src/compiler/config/schemas/paths.ts +0 -35
- package/src/compiler/config/schemas/template.ts +0 -80
- package/src/compiler/config/schemas/transport/http.ts +0 -116
- package/src/compiler/config/schemas/transport/stdio.ts +0 -31
- package/src/compiler/config/schemas/typescript.ts +0 -26
- package/src/compiler/config/utils.ts +0 -168
- package/src/compiler/generate-env-code.ts +0 -5
- package/src/compiler/generate-import-code.ts +0 -187
- package/src/compiler/generate-tools-code.ts +0 -174
- package/src/compiler/get-bundler-config/get-entries.ts +0 -44
- package/src/compiler/get-bundler-config/get-externals.ts +0 -114
- package/src/compiler/get-bundler-config/get-injected-variables.ts +0 -46
- package/src/compiler/get-bundler-config/index.ts +0 -288
- package/src/compiler/get-bundler-config/plugins/index.ts +0 -140
- package/src/compiler/get-bundler-config/plugins/types/express.ts +0 -3
- package/src/compiler/get-bundler-config/plugins/types/fastify.ts +0 -4
- package/src/compiler/get-bundler-config/plugins/types/index.ts +0 -5
- package/src/compiler/get-bundler-config/plugins/types/nest.ts +0 -65
- package/src/compiler/get-bundler-config/plugins/types/next.ts +0 -52
- package/src/compiler/get-bundler-config/resolve-tsconfig-paths.ts +0 -51
- package/src/compiler/index.ts +0 -484
- package/src/compiler/on-first-build.ts +0 -54
- package/src/compiler/parse-xmcp-config.ts +0 -200
- package/src/compiler/start-http-server.ts +0 -42
- package/src/compiler/utils/__tests__/config-detection.test.ts +0 -307
- package/src/compiler/utils/__tests__/path-utils.test.ts +0 -137
- package/src/compiler/utils/config-detection.ts +0 -34
- package/src/compiler/utils/path-utils.ts +0 -22
- package/src/compiler/watcher-recovery.ts +0 -72
- package/src/host-bridge.ts +0 -36
- package/src/index.ts +0 -94
- package/src/platforms/build-cloudflare-output.ts +0 -116
- package/src/platforms/build-vercel-output.ts +0 -131
- package/src/plugins/index.ts +0 -1
- package/src/plugins/x402/index.ts +0 -24
- package/src/runtime/adapters/express/index.ts +0 -75
- package/src/runtime/adapters/fastify/__tests__/fastify.test.ts +0 -115
- package/src/runtime/adapters/fastify/index.ts +0 -78
- package/src/runtime/adapters/nestjs/index.ts +0 -16
- package/src/runtime/adapters/nestjs/xmcp.controller.ts +0 -34
- package/src/runtime/adapters/nestjs/xmcp.guard.ts +0 -101
- package/src/runtime/adapters/nestjs/xmcp.oauth.controller.ts +0 -36
- package/src/runtime/adapters/nestjs/xmcp.oauth.module.ts +0 -21
- package/src/runtime/adapters/nestjs/xmcp.oauth.service.ts +0 -36
- package/src/runtime/adapters/nestjs/xmcp.service.ts +0 -96
- package/src/runtime/adapters/nestjs/xmcp.utils.ts +0 -11
- package/src/runtime/adapters/nextjs/auth.ts +0 -265
- package/src/runtime/adapters/nextjs/handler/error-handler.ts +0 -67
- package/src/runtime/adapters/nextjs/handler/node-to-web-adapter.ts +0 -143
- package/src/runtime/adapters/nextjs/handler/request-converter.ts +0 -74
- package/src/runtime/adapters/nextjs/handler/server-lifecycle.ts +0 -69
- package/src/runtime/adapters/nextjs/index.ts +0 -121
- package/src/runtime/contexts/client-info-context.ts +0 -16
- package/src/runtime/contexts/http-request-context.ts +0 -21
- package/src/runtime/contexts/http-transport-context.ts +0 -18
- package/src/runtime/headers.ts +0 -42
- package/src/runtime/middlewares/utils.ts +0 -72
- package/src/runtime/platforms/cloudflare/cors.ts +0 -44
- package/src/runtime/platforms/cloudflare/middlewares/api-key.ts +0 -102
- package/src/runtime/platforms/cloudflare/middlewares/jwt.ts +0 -127
- package/src/runtime/platforms/cloudflare/types.ts +0 -23
- package/src/runtime/platforms/cloudflare/worker.ts +0 -270
- package/src/runtime/templates/home.ts +0 -746
- package/src/runtime/transports/http/base-streamable-http.ts +0 -46
- package/src/runtime/transports/http/cors/headers.ts +0 -58
- package/src/runtime/transports/http/cors/index.ts +0 -34
- package/src/runtime/transports/http/index.ts +0 -78
- package/src/runtime/transports/http/stateless-streamable-http.ts +0 -353
- package/src/runtime/transports/http/web-stateless-http.ts +0 -288
- package/src/runtime/transports/stdio/index.ts +0 -109
- package/src/runtime/utils/__tests__/client-info.test.ts +0 -146
- package/src/runtime/utils/__tests__/tool-extra.test.ts +0 -239
- package/src/runtime/utils/client-info.ts +0 -114
- package/src/runtime/utils/elicitation.ts +0 -396
- package/src/runtime/utils/ext-apps-registry.ts +0 -151
- package/src/runtime/utils/mcp-app-protocol.ts +0 -16
- package/src/runtime/utils/mcp-app-types.ts +0 -113
- package/src/runtime/utils/mcp-host-bridge.ts +0 -473
- package/src/runtime/utils/path-to-tool-name.ts +0 -69
- package/src/runtime/utils/prompt-loader.ts +0 -151
- package/src/runtime/utils/prompts.ts +0 -69
- package/src/runtime/utils/react/generate-html.ts +0 -69
- package/src/runtime/utils/react/index.ts +0 -6
- package/src/runtime/utils/request-tool-names.ts +0 -48
- package/src/runtime/utils/resource-loader.ts +0 -151
- package/src/runtime/utils/resources.ts +0 -331
- package/src/runtime/utils/server.ts +0 -107
- package/src/runtime/utils/tool-loader.ts +0 -149
- package/src/runtime/utils/tools.ts +0 -183
- package/src/runtime/utils/transformers/prompt.ts +0 -120
- package/src/runtime/utils/transformers/resource.ts +0 -196
- package/src/runtime/utils/transformers/tool.ts +0 -400
- package/src/runtime/utils/ui/__tests__/split-meta.test.ts +0 -803
- package/src/runtime/utils/ui/flatten-meta.ts +0 -44
- package/src/runtime/utils/ui/split-meta.ts +0 -78
- package/src/runtime/utils/utils/resource-uri-composer.ts +0 -204
- package/src/runtime/utils/validators/index.ts +0 -138
- package/src/telemetry/ci-info.ts +0 -6
- package/src/telemetry/debug.ts +0 -8
- package/src/telemetry/events/definitions.ts +0 -52
- package/src/telemetry/events/detached-flush.ts +0 -83
- package/src/telemetry/events/post-payload.ts +0 -141
- package/src/telemetry/events/tracker.ts +0 -281
- package/src/telemetry/index.ts +0 -7
- package/src/telemetry/metadata.ts +0 -49
- package/src/telemetry/project-id.ts +0 -35
- package/src/telemetry/storage.ts +0 -218
- package/src/types/adapter.d.ts +0 -5
- package/src/types/client-info.ts +0 -20
- package/src/types/declarations.ts +0 -37
- package/src/types/injected.d.ts +0 -62
- package/src/types/middleware.ts +0 -19
- package/src/types/prompt.ts +0 -6
- package/src/types/resource.ts +0 -15
- package/src/types/tool.ts +0 -192
- package/src/types/ui-meta.ts +0 -42
- package/src/utils/cli-icons.ts +0 -5
- package/src/utils/constants.ts +0 -31
- package/src/utils/context.ts +0 -105
- package/src/utils/detect-package-manager.ts +0 -46
- package/src/utils/file-watcher.ts +0 -66
- package/src/utils/fs-utils.ts +0 -16
- package/src/utils/path-validation.ts +0 -66
- package/src/utils/port-utils.ts +0 -43
- package/src/utils/spawn-process.ts +0 -49
- package/src/utils/subscribable.ts +0 -62
|
@@ -1,803 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "node:test";
|
|
2
|
-
import assert from "node:assert";
|
|
3
|
-
import {
|
|
4
|
-
splitUIMetaNested,
|
|
5
|
-
isToolMetaKeyNested,
|
|
6
|
-
isResourceMetaKeyNested,
|
|
7
|
-
type SplitMetadata,
|
|
8
|
-
} from "../split-meta";
|
|
9
|
-
|
|
10
|
-
describe("splitUIMetaNested", () => {
|
|
11
|
-
describe("Basic Functionality", () => {
|
|
12
|
-
it("should return empty toolMeta and resourceMeta for empty input", () => {
|
|
13
|
-
const result = splitUIMetaNested({});
|
|
14
|
-
|
|
15
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
16
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should handle metadata without ui key", () => {
|
|
20
|
-
const meta = {
|
|
21
|
-
someKey: "someValue",
|
|
22
|
-
anotherKey: 123,
|
|
23
|
-
};
|
|
24
|
-
const result = splitUIMetaNested(meta);
|
|
25
|
-
|
|
26
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
27
|
-
someKey: "someValue",
|
|
28
|
-
anotherKey: 123,
|
|
29
|
-
});
|
|
30
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should handle metadata with empty ui object", () => {
|
|
34
|
-
const meta = {
|
|
35
|
-
ui: {},
|
|
36
|
-
};
|
|
37
|
-
const result = splitUIMetaNested(meta);
|
|
38
|
-
|
|
39
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
40
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe("Tool Metadata Keys (ui/resourceUri)", () => {
|
|
45
|
-
it("should split ui/resourceUri to toolMeta", () => {
|
|
46
|
-
const meta = {
|
|
47
|
-
ui: {
|
|
48
|
-
"ui/resourceUri": "ui://weather-server/dashboard",
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
const result = splitUIMetaNested(meta);
|
|
52
|
-
|
|
53
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
54
|
-
ui: {
|
|
55
|
-
"ui/resourceUri": "ui://weather-server/dashboard",
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("should preserve ui/resourceUri with various URI formats", () => {
|
|
62
|
-
const testCases = [
|
|
63
|
-
"ui://weather-dashboard",
|
|
64
|
-
"ui://weather-server/dashboard-template",
|
|
65
|
-
"ui://my-app/some/nested/path",
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
for (const uri of testCases) {
|
|
69
|
-
const meta = {
|
|
70
|
-
ui: {
|
|
71
|
-
"ui/resourceUri": uri,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
const result = splitUIMetaNested(meta);
|
|
75
|
-
|
|
76
|
-
assert.deepStrictEqual(
|
|
77
|
-
result.toolMeta.ui?.["ui/resourceUri"],
|
|
78
|
-
uri,
|
|
79
|
-
`Failed for URI: ${uri}`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("should split visibility to toolMeta", () => {
|
|
85
|
-
const meta = {
|
|
86
|
-
ui: {
|
|
87
|
-
visibility: ["model", "app"],
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
const result = splitUIMetaNested(meta);
|
|
91
|
-
|
|
92
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
93
|
-
ui: {
|
|
94
|
-
visibility: ["model", "app"],
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
describe("Resource Metadata Keys (CSP and Display)", () => {
|
|
102
|
-
it("should split prefersBorder to resourceMeta", () => {
|
|
103
|
-
const meta = {
|
|
104
|
-
ui: {
|
|
105
|
-
prefersBorder: true,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
const result = splitUIMetaNested(meta);
|
|
109
|
-
|
|
110
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
111
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
112
|
-
ui: {
|
|
113
|
-
prefersBorder: true,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("should split domain to resourceMeta", () => {
|
|
119
|
-
const meta = {
|
|
120
|
-
ui: {
|
|
121
|
-
domain: "https://weather-widget.example.com",
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
const result = splitUIMetaNested(meta);
|
|
125
|
-
|
|
126
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
127
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
128
|
-
ui: {
|
|
129
|
-
domain: "https://weather-widget.example.com",
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("should split csp to resourceMeta", () => {
|
|
135
|
-
const meta = {
|
|
136
|
-
ui: {
|
|
137
|
-
csp: {
|
|
138
|
-
connectDomains: ["https://api.weather.com"],
|
|
139
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
140
|
-
frameDomains: ["https://widgets.example.com"],
|
|
141
|
-
baseUriDomains: ["https://assets.example.com"],
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
const result = splitUIMetaNested(meta);
|
|
146
|
-
|
|
147
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
148
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
149
|
-
ui: {
|
|
150
|
-
csp: {
|
|
151
|
-
connectDomains: ["https://api.weather.com"],
|
|
152
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
153
|
-
frameDomains: ["https://widgets.example.com"],
|
|
154
|
-
baseUriDomains: ["https://assets.example.com"],
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it("should split permissions to resourceMeta", () => {
|
|
161
|
-
const meta = {
|
|
162
|
-
ui: {
|
|
163
|
-
permissions: {
|
|
164
|
-
camera: {},
|
|
165
|
-
microphone: {},
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
const result = splitUIMetaNested(meta);
|
|
170
|
-
|
|
171
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
172
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
173
|
-
ui: {
|
|
174
|
-
permissions: {
|
|
175
|
-
camera: {},
|
|
176
|
-
microphone: {},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it("should split connectDomains to resourceMeta", () => {
|
|
183
|
-
const meta = {
|
|
184
|
-
ui: {
|
|
185
|
-
connectDomains: ["https://api.openweathermap.org", "wss://realtime.service.com"],
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
const result = splitUIMetaNested(meta);
|
|
189
|
-
|
|
190
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
191
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
192
|
-
ui: {
|
|
193
|
-
connectDomains: ["https://api.openweathermap.org", "wss://realtime.service.com"],
|
|
194
|
-
},
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it("should split resourceDomains to resourceMeta", () => {
|
|
199
|
-
const meta = {
|
|
200
|
-
ui: {
|
|
201
|
-
resourceDomains: ["https://cdn.jsdelivr.net", "https://*.cloudflare.com"],
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
const result = splitUIMetaNested(meta);
|
|
205
|
-
|
|
206
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
207
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
208
|
-
ui: {
|
|
209
|
-
resourceDomains: ["https://cdn.jsdelivr.net", "https://*.cloudflare.com"],
|
|
210
|
-
},
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it("should split all resource metadata keys together", () => {
|
|
215
|
-
const meta = {
|
|
216
|
-
ui: {
|
|
217
|
-
prefersBorder: true,
|
|
218
|
-
domain: "https://my-widget.example.com",
|
|
219
|
-
csp: {
|
|
220
|
-
connectDomains: ["https://api.example.com"],
|
|
221
|
-
},
|
|
222
|
-
connectDomains: ["https://backup-api.example.com"],
|
|
223
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
const result = splitUIMetaNested(meta);
|
|
227
|
-
|
|
228
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
229
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
230
|
-
ui: {
|
|
231
|
-
prefersBorder: true,
|
|
232
|
-
domain: "https://my-widget.example.com",
|
|
233
|
-
csp: {
|
|
234
|
-
connectDomains: ["https://api.example.com"],
|
|
235
|
-
},
|
|
236
|
-
connectDomains: ["https://backup-api.example.com"],
|
|
237
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
238
|
-
},
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
describe("Mixed Tool and Resource Metadata", () => {
|
|
244
|
-
it("should correctly split mixed tool and resource metadata", () => {
|
|
245
|
-
const meta = {
|
|
246
|
-
ui: {
|
|
247
|
-
"ui/resourceUri": "ui://weather-server/dashboard",
|
|
248
|
-
prefersBorder: true,
|
|
249
|
-
domain: "https://weather-widget.example.com",
|
|
250
|
-
csp: {
|
|
251
|
-
connectDomains: ["https://api.openweathermap.org"],
|
|
252
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
const result = splitUIMetaNested(meta);
|
|
257
|
-
|
|
258
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
259
|
-
ui: {
|
|
260
|
-
"ui/resourceUri": "ui://weather-server/dashboard",
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
264
|
-
ui: {
|
|
265
|
-
prefersBorder: true,
|
|
266
|
-
domain: "https://weather-widget.example.com",
|
|
267
|
-
csp: {
|
|
268
|
-
connectDomains: ["https://api.openweathermap.org"],
|
|
269
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("should handle complete SEP-1865 tool metadata example", () => {
|
|
276
|
-
// Example from SEP-1865 specification
|
|
277
|
-
const meta = {
|
|
278
|
-
ui: {
|
|
279
|
-
"ui/resourceUri": "ui://weather-server/dashboard-template",
|
|
280
|
-
},
|
|
281
|
-
};
|
|
282
|
-
const result = splitUIMetaNested(meta);
|
|
283
|
-
|
|
284
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
285
|
-
ui: {
|
|
286
|
-
"ui/resourceUri": "ui://weather-server/dashboard-template",
|
|
287
|
-
},
|
|
288
|
-
});
|
|
289
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
it("should handle complete SEP-1865 resource metadata example", () => {
|
|
293
|
-
// Example from SEP-1865 specification
|
|
294
|
-
const meta = {
|
|
295
|
-
ui: {
|
|
296
|
-
csp: {
|
|
297
|
-
connectDomains: ["https://api.openweathermap.org"],
|
|
298
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
299
|
-
},
|
|
300
|
-
prefersBorder: true,
|
|
301
|
-
},
|
|
302
|
-
};
|
|
303
|
-
const result = splitUIMetaNested(meta);
|
|
304
|
-
|
|
305
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
306
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
307
|
-
ui: {
|
|
308
|
-
csp: {
|
|
309
|
-
connectDomains: ["https://api.openweathermap.org"],
|
|
310
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
311
|
-
},
|
|
312
|
-
prefersBorder: true,
|
|
313
|
-
},
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
describe("Unknown Keys (Default to Tool Metadata)", () => {
|
|
319
|
-
it("should put unknown ui keys in toolMeta", () => {
|
|
320
|
-
const meta = {
|
|
321
|
-
ui: {
|
|
322
|
-
unknownKey: "someValue",
|
|
323
|
-
anotherUnknown: { nested: true },
|
|
324
|
-
},
|
|
325
|
-
};
|
|
326
|
-
const result = splitUIMetaNested(meta);
|
|
327
|
-
|
|
328
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
329
|
-
ui: {
|
|
330
|
-
unknownKey: "someValue",
|
|
331
|
-
anotherUnknown: { nested: true },
|
|
332
|
-
},
|
|
333
|
-
});
|
|
334
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
it("should put unknown keys alongside known tool keys", () => {
|
|
338
|
-
const meta = {
|
|
339
|
-
ui: {
|
|
340
|
-
"ui/resourceUri": "ui://my-app/widget",
|
|
341
|
-
customExtension: "customValue",
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
const result = splitUIMetaNested(meta);
|
|
345
|
-
|
|
346
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
347
|
-
ui: {
|
|
348
|
-
"ui/resourceUri": "ui://my-app/widget",
|
|
349
|
-
customExtension: "customValue",
|
|
350
|
-
},
|
|
351
|
-
});
|
|
352
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
it("should handle mixed known and unknown keys", () => {
|
|
356
|
-
const meta = {
|
|
357
|
-
ui: {
|
|
358
|
-
"ui/resourceUri": "ui://my-app/widget",
|
|
359
|
-
prefersBorder: false,
|
|
360
|
-
customToolProperty: "value",
|
|
361
|
-
},
|
|
362
|
-
};
|
|
363
|
-
const result = splitUIMetaNested(meta);
|
|
364
|
-
|
|
365
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
366
|
-
ui: {
|
|
367
|
-
"ui/resourceUri": "ui://my-app/widget",
|
|
368
|
-
customToolProperty: "value",
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
372
|
-
ui: {
|
|
373
|
-
prefersBorder: false,
|
|
374
|
-
},
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
describe("Non-UI Metadata Preservation", () => {
|
|
380
|
-
it("should preserve non-ui metadata in toolMeta", () => {
|
|
381
|
-
const meta = {
|
|
382
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
383
|
-
source: "weather-api",
|
|
384
|
-
version: "1.0.0",
|
|
385
|
-
};
|
|
386
|
-
const result = splitUIMetaNested(meta);
|
|
387
|
-
|
|
388
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
389
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
390
|
-
source: "weather-api",
|
|
391
|
-
version: "1.0.0",
|
|
392
|
-
});
|
|
393
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
it("should preserve non-ui metadata alongside ui metadata", () => {
|
|
397
|
-
const meta = {
|
|
398
|
-
ui: {
|
|
399
|
-
"ui/resourceUri": "ui://my-app/widget",
|
|
400
|
-
prefersBorder: true,
|
|
401
|
-
},
|
|
402
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
403
|
-
source: "weather-api",
|
|
404
|
-
};
|
|
405
|
-
const result = splitUIMetaNested(meta);
|
|
406
|
-
|
|
407
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
408
|
-
ui: {
|
|
409
|
-
"ui/resourceUri": "ui://my-app/widget",
|
|
410
|
-
},
|
|
411
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
412
|
-
source: "weather-api",
|
|
413
|
-
});
|
|
414
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
415
|
-
ui: {
|
|
416
|
-
prefersBorder: true,
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
it("should handle _meta pattern from SEP-1865", () => {
|
|
422
|
-
// Test the _meta pattern used in tool results
|
|
423
|
-
const _meta = {
|
|
424
|
-
ui: {
|
|
425
|
-
csp: {
|
|
426
|
-
connectDomains: ["https://api.example.com"],
|
|
427
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
428
|
-
},
|
|
429
|
-
prefersBorder: true,
|
|
430
|
-
},
|
|
431
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
432
|
-
source: "weather-api",
|
|
433
|
-
};
|
|
434
|
-
const result = splitUIMetaNested(_meta);
|
|
435
|
-
|
|
436
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
437
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
438
|
-
source: "weather-api",
|
|
439
|
-
});
|
|
440
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
441
|
-
ui: {
|
|
442
|
-
csp: {
|
|
443
|
-
connectDomains: ["https://api.example.com"],
|
|
444
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
445
|
-
},
|
|
446
|
-
prefersBorder: true,
|
|
447
|
-
},
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
describe("Edge Cases", () => {
|
|
453
|
-
it("should handle ui key that is not an object", () => {
|
|
454
|
-
const meta = {
|
|
455
|
-
ui: "not-an-object",
|
|
456
|
-
};
|
|
457
|
-
const result = splitUIMetaNested(meta as any);
|
|
458
|
-
|
|
459
|
-
// ui is not an object, so the check `typeof meta.ui === "object"` fails
|
|
460
|
-
// and the ui key is not processed. Since non-ui keys go to toolMeta
|
|
461
|
-
// via the second loop, but the second loop skips `ui` key, result is empty.
|
|
462
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
463
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
it("should handle ui key that is null", () => {
|
|
467
|
-
const meta = {
|
|
468
|
-
ui: null,
|
|
469
|
-
};
|
|
470
|
-
const result = splitUIMetaNested(meta as any);
|
|
471
|
-
|
|
472
|
-
// null passes `typeof meta.ui === "object"` but fails Object.entries iteration
|
|
473
|
-
// The second loop skips `ui` key, so result is empty
|
|
474
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
475
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
it("should handle ui key that is an array", () => {
|
|
479
|
-
const meta = {
|
|
480
|
-
ui: ["not", "an", "object"],
|
|
481
|
-
};
|
|
482
|
-
const result = splitUIMetaNested(meta as any);
|
|
483
|
-
|
|
484
|
-
// Arrays are objects in JS, but the iteration will work differently
|
|
485
|
-
assert.deepStrictEqual(result.toolMeta.ui, {
|
|
486
|
-
"0": "not",
|
|
487
|
-
"1": "an",
|
|
488
|
-
"2": "object",
|
|
489
|
-
});
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
it("should handle deeply nested values in ui metadata", () => {
|
|
493
|
-
const meta = {
|
|
494
|
-
ui: {
|
|
495
|
-
csp: {
|
|
496
|
-
connectDomains: ["https://api.example.com"],
|
|
497
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
498
|
-
nested: {
|
|
499
|
-
deeply: {
|
|
500
|
-
value: true,
|
|
501
|
-
},
|
|
502
|
-
},
|
|
503
|
-
},
|
|
504
|
-
},
|
|
505
|
-
};
|
|
506
|
-
const result = splitUIMetaNested(meta);
|
|
507
|
-
|
|
508
|
-
// csp is a resource key, so entire object goes to resourceMeta
|
|
509
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
510
|
-
ui: {
|
|
511
|
-
csp: {
|
|
512
|
-
connectDomains: ["https://api.example.com"],
|
|
513
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
514
|
-
nested: {
|
|
515
|
-
deeply: {
|
|
516
|
-
value: true,
|
|
517
|
-
},
|
|
518
|
-
},
|
|
519
|
-
},
|
|
520
|
-
},
|
|
521
|
-
});
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
it("should handle prefersBorder with false value", () => {
|
|
525
|
-
const meta = {
|
|
526
|
-
ui: {
|
|
527
|
-
prefersBorder: false,
|
|
528
|
-
},
|
|
529
|
-
};
|
|
530
|
-
const result = splitUIMetaNested(meta);
|
|
531
|
-
|
|
532
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
533
|
-
ui: {
|
|
534
|
-
prefersBorder: false,
|
|
535
|
-
},
|
|
536
|
-
});
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
it("should handle empty arrays in CSP domains", () => {
|
|
540
|
-
const meta = {
|
|
541
|
-
ui: {
|
|
542
|
-
connectDomains: [],
|
|
543
|
-
resourceDomains: [],
|
|
544
|
-
},
|
|
545
|
-
};
|
|
546
|
-
const result = splitUIMetaNested(meta);
|
|
547
|
-
|
|
548
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
549
|
-
ui: {
|
|
550
|
-
connectDomains: [],
|
|
551
|
-
resourceDomains: [],
|
|
552
|
-
},
|
|
553
|
-
});
|
|
554
|
-
});
|
|
555
|
-
});
|
|
556
|
-
|
|
557
|
-
describe("Return Type Validation", () => {
|
|
558
|
-
it("should return object conforming to SplitMetadata interface", () => {
|
|
559
|
-
const meta = {
|
|
560
|
-
ui: {
|
|
561
|
-
"ui/resourceUri": "ui://test/widget",
|
|
562
|
-
prefersBorder: true,
|
|
563
|
-
},
|
|
564
|
-
};
|
|
565
|
-
const result: SplitMetadata = splitUIMetaNested(meta);
|
|
566
|
-
|
|
567
|
-
assert.ok("toolMeta" in result);
|
|
568
|
-
assert.ok("resourceMeta" in result);
|
|
569
|
-
assert.strictEqual(typeof result.toolMeta, "object");
|
|
570
|
-
assert.strictEqual(typeof result.resourceMeta, "object");
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
describe("isToolMetaKeyNested", () => {
|
|
576
|
-
it("should return true for ui/resourceUri", () => {
|
|
577
|
-
assert.strictEqual(isToolMetaKeyNested("ui/resourceUri"), true);
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
it("should return false for resource metadata keys", () => {
|
|
581
|
-
assert.strictEqual(isToolMetaKeyNested("prefersBorder"), false);
|
|
582
|
-
assert.strictEqual(isToolMetaKeyNested("domain"), false);
|
|
583
|
-
assert.strictEqual(isToolMetaKeyNested("csp"), false);
|
|
584
|
-
assert.strictEqual(isToolMetaKeyNested("connectDomains"), false);
|
|
585
|
-
assert.strictEqual(isToolMetaKeyNested("resourceDomains"), false);
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
it("should return false for unknown keys", () => {
|
|
589
|
-
assert.strictEqual(isToolMetaKeyNested("unknownKey"), false);
|
|
590
|
-
assert.strictEqual(isToolMetaKeyNested("customProperty"), false);
|
|
591
|
-
assert.strictEqual(isToolMetaKeyNested(""), false);
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
it("should be case-sensitive", () => {
|
|
595
|
-
assert.strictEqual(isToolMetaKeyNested("ui/resourceUri"), true);
|
|
596
|
-
assert.strictEqual(isToolMetaKeyNested("UI/RESOURCEURI"), false);
|
|
597
|
-
assert.strictEqual(isToolMetaKeyNested("Ui/ResourceUri"), false);
|
|
598
|
-
});
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
describe("isResourceMetaKeyNested", () => {
|
|
602
|
-
it("should return true for prefersBorder", () => {
|
|
603
|
-
assert.strictEqual(isResourceMetaKeyNested("prefersBorder"), true);
|
|
604
|
-
});
|
|
605
|
-
|
|
606
|
-
it("should return true for domain", () => {
|
|
607
|
-
assert.strictEqual(isResourceMetaKeyNested("domain"), true);
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
it("should return true for csp", () => {
|
|
611
|
-
assert.strictEqual(isResourceMetaKeyNested("csp"), true);
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
it("should return true for connectDomains", () => {
|
|
615
|
-
assert.strictEqual(isResourceMetaKeyNested("connectDomains"), true);
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
it("should return true for resourceDomains", () => {
|
|
619
|
-
assert.strictEqual(isResourceMetaKeyNested("resourceDomains"), true);
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
it("should return false for tool metadata keys", () => {
|
|
623
|
-
assert.strictEqual(isResourceMetaKeyNested("ui/resourceUri"), false);
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
it("should return false for unknown keys", () => {
|
|
627
|
-
assert.strictEqual(isResourceMetaKeyNested("unknownKey"), false);
|
|
628
|
-
assert.strictEqual(isResourceMetaKeyNested("customProperty"), false);
|
|
629
|
-
assert.strictEqual(isResourceMetaKeyNested(""), false);
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
it("should be case-sensitive", () => {
|
|
633
|
-
assert.strictEqual(isResourceMetaKeyNested("prefersBorder"), true);
|
|
634
|
-
assert.strictEqual(isResourceMetaKeyNested("PrefersBorder"), false);
|
|
635
|
-
assert.strictEqual(isResourceMetaKeyNested("PREFERSBORDER"), false);
|
|
636
|
-
|
|
637
|
-
assert.strictEqual(isResourceMetaKeyNested("connectDomains"), true);
|
|
638
|
-
assert.strictEqual(isResourceMetaKeyNested("ConnectDomains"), false);
|
|
639
|
-
});
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
describe("SEP-1865 Protocol Compliance", () => {
|
|
643
|
-
describe("UIResource Metadata Splitting", () => {
|
|
644
|
-
it("should correctly handle UIResourceMeta structure", () => {
|
|
645
|
-
// Full UIResourceMeta as defined in SEP-1865
|
|
646
|
-
const meta = {
|
|
647
|
-
ui: {
|
|
648
|
-
csp: {
|
|
649
|
-
connectDomains: ["https://api.weather.com", "wss://realtime.service.com"],
|
|
650
|
-
resourceDomains: ["https://cdn.jsdelivr.net", "https://*.cloudflare.com"],
|
|
651
|
-
},
|
|
652
|
-
domain: "https://weather-widget.example.com",
|
|
653
|
-
prefersBorder: true,
|
|
654
|
-
},
|
|
655
|
-
};
|
|
656
|
-
const result = splitUIMetaNested(meta);
|
|
657
|
-
|
|
658
|
-
// All these should go to resourceMeta per SEP-1865
|
|
659
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
660
|
-
ui: {
|
|
661
|
-
csp: {
|
|
662
|
-
connectDomains: ["https://api.weather.com", "wss://realtime.service.com"],
|
|
663
|
-
resourceDomains: ["https://cdn.jsdelivr.net", "https://*.cloudflare.com"],
|
|
664
|
-
},
|
|
665
|
-
domain: "https://weather-widget.example.com",
|
|
666
|
-
prefersBorder: true,
|
|
667
|
-
},
|
|
668
|
-
});
|
|
669
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
|
|
673
|
-
describe("Tool Metadata with ui/resourceUri", () => {
|
|
674
|
-
it("should correctly handle Tool _meta with ui/resourceUri", () => {
|
|
675
|
-
// Tool metadata as defined in SEP-1865
|
|
676
|
-
const toolMeta = {
|
|
677
|
-
"ui/resourceUri": "ui://weather-server/dashboard-template",
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
// When wrapped in ui key for nested format
|
|
681
|
-
const meta = {
|
|
682
|
-
ui: toolMeta,
|
|
683
|
-
};
|
|
684
|
-
const result = splitUIMetaNested(meta);
|
|
685
|
-
|
|
686
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
687
|
-
ui: {
|
|
688
|
-
"ui/resourceUri": "ui://weather-server/dashboard-template",
|
|
689
|
-
},
|
|
690
|
-
});
|
|
691
|
-
});
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
describe("Resource Content Metadata Splitting", () => {
|
|
695
|
-
it("should split resources/read response _meta correctly", () => {
|
|
696
|
-
// From SEP-1865 resources/read response example
|
|
697
|
-
const contentMeta = {
|
|
698
|
-
ui: {
|
|
699
|
-
csp: {
|
|
700
|
-
connectDomains: ["https://api.openweathermap.org"],
|
|
701
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
702
|
-
},
|
|
703
|
-
prefersBorder: true,
|
|
704
|
-
},
|
|
705
|
-
};
|
|
706
|
-
const result = splitUIMetaNested(contentMeta);
|
|
707
|
-
|
|
708
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
709
|
-
ui: {
|
|
710
|
-
csp: {
|
|
711
|
-
connectDomains: ["https://api.openweathermap.org"],
|
|
712
|
-
resourceDomains: ["https://cdn.jsdelivr.net"],
|
|
713
|
-
},
|
|
714
|
-
prefersBorder: true,
|
|
715
|
-
},
|
|
716
|
-
});
|
|
717
|
-
assert.deepStrictEqual(result.toolMeta, {});
|
|
718
|
-
});
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
describe("HostContext Metadata (Not Split)", () => {
|
|
722
|
-
it("should preserve non-ui metadata that might come from HostContext", () => {
|
|
723
|
-
// HostContext fields from SEP-1865 should be preserved in toolMeta
|
|
724
|
-
const meta = {
|
|
725
|
-
theme: "dark",
|
|
726
|
-
displayMode: "inline",
|
|
727
|
-
viewport: { width: 400, height: 300 },
|
|
728
|
-
locale: "en-US",
|
|
729
|
-
timeZone: "America/New_York",
|
|
730
|
-
};
|
|
731
|
-
const result = splitUIMetaNested(meta);
|
|
732
|
-
|
|
733
|
-
assert.deepStrictEqual(result.toolMeta, meta);
|
|
734
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
735
|
-
});
|
|
736
|
-
});
|
|
737
|
-
|
|
738
|
-
describe("Tool Result _meta Splitting", () => {
|
|
739
|
-
it("should handle tool result _meta with mixed content", () => {
|
|
740
|
-
// From SEP-1865 tool result example
|
|
741
|
-
const toolResultMeta = {
|
|
742
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
743
|
-
source: "weather-api",
|
|
744
|
-
ui: {
|
|
745
|
-
"ui/resourceUri": "ui://weather/display",
|
|
746
|
-
},
|
|
747
|
-
};
|
|
748
|
-
const result = splitUIMetaNested(toolResultMeta);
|
|
749
|
-
|
|
750
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
751
|
-
timestamp: "2025-11-10T15:30:00Z",
|
|
752
|
-
source: "weather-api",
|
|
753
|
-
ui: {
|
|
754
|
-
"ui/resourceUri": "ui://weather/display",
|
|
755
|
-
},
|
|
756
|
-
});
|
|
757
|
-
assert.deepStrictEqual(result.resourceMeta, {});
|
|
758
|
-
});
|
|
759
|
-
});
|
|
760
|
-
|
|
761
|
-
describe("Combined Tool and Resource Registration", () => {
|
|
762
|
-
it("should handle metadata for both tool and associated resource", () => {
|
|
763
|
-
// When a tool references a resource, we need to split the metadata
|
|
764
|
-
// for proper association
|
|
765
|
-
const combinedMeta = {
|
|
766
|
-
ui: {
|
|
767
|
-
// Tool-specific: tells the host which UI resource to use
|
|
768
|
-
"ui/resourceUri": "ui://weather-server/dashboard",
|
|
769
|
-
// Resource-specific: CSP and display preferences for the resource
|
|
770
|
-
csp: {
|
|
771
|
-
connectDomains: ["https://api.weather.com"],
|
|
772
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
773
|
-
},
|
|
774
|
-
prefersBorder: true,
|
|
775
|
-
domain: "https://weather.example.com",
|
|
776
|
-
},
|
|
777
|
-
// Non-UI metadata
|
|
778
|
-
version: "2.0.0",
|
|
779
|
-
};
|
|
780
|
-
const result = splitUIMetaNested(combinedMeta);
|
|
781
|
-
|
|
782
|
-
// Tool gets: ui/resourceUri and non-UI metadata
|
|
783
|
-
assert.deepStrictEqual(result.toolMeta, {
|
|
784
|
-
ui: {
|
|
785
|
-
"ui/resourceUri": "ui://weather-server/dashboard",
|
|
786
|
-
},
|
|
787
|
-
version: "2.0.0",
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
// Resource gets: CSP, domain, and display preferences
|
|
791
|
-
assert.deepStrictEqual(result.resourceMeta, {
|
|
792
|
-
ui: {
|
|
793
|
-
csp: {
|
|
794
|
-
connectDomains: ["https://api.weather.com"],
|
|
795
|
-
resourceDomains: ["https://cdn.example.com"],
|
|
796
|
-
},
|
|
797
|
-
prefersBorder: true,
|
|
798
|
-
domain: "https://weather.example.com",
|
|
799
|
-
},
|
|
800
|
-
});
|
|
801
|
-
});
|
|
802
|
-
});
|
|
803
|
-
});
|