@haddowg/json-api-mcp 0.0.0-stage → 1.2.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.
@@ -0,0 +1,534 @@
1
+ import { ActionDescriptor, ApiDescriptor, HeadersInit, JsonApiTransport, RelationDescriptor, ResourceDescriptor } from "@haddowg/json-api-client";
2
+
3
+ //#region src/openapi.d.ts
4
+ /**
5
+ * The parts of an OpenAPI 3.1 document this package reads, typed loosely: every object keeps its
6
+ * other members, vendor extensions included, so hooks see the operation as the server wrote it.
7
+ */
8
+ /** A JSON Schema node as the document writes it. */
9
+ type JsonSchema = {
10
+ [key: string]: unknown;
11
+ };
12
+ /** One security requirement: scheme name to the scopes it needs. */
13
+ type SecurityRequirement = Readonly<Record<string, readonly string[]>>;
14
+ interface ParameterObject {
15
+ name: string;
16
+ in: string;
17
+ description?: string;
18
+ required?: boolean;
19
+ schema?: JsonSchema;
20
+ [key: string]: unknown;
21
+ }
22
+ interface MediaTypeObject {
23
+ schema?: JsonSchema;
24
+ [key: string]: unknown;
25
+ }
26
+ interface RequestBodyObject {
27
+ description?: string;
28
+ required?: boolean;
29
+ content?: Record<string, MediaTypeObject>;
30
+ [key: string]: unknown;
31
+ }
32
+ interface ResponseObject {
33
+ description?: string;
34
+ content?: Record<string, MediaTypeObject>;
35
+ [key: string]: unknown;
36
+ }
37
+ interface OperationObject {
38
+ operationId?: string;
39
+ summary?: string;
40
+ description?: string;
41
+ parameters?: (ParameterObject | {
42
+ $ref: string;
43
+ })[];
44
+ requestBody?: RequestBodyObject | {
45
+ $ref: string;
46
+ };
47
+ responses?: Record<string, ResponseObject | {
48
+ $ref: string;
49
+ }>;
50
+ security?: SecurityRequirement[];
51
+ [key: string]: unknown;
52
+ }
53
+ type HttpMethod = 'get' | 'post' | 'patch' | 'put' | 'delete';
54
+ type PathItemObject = Partial<Record<HttpMethod, OperationObject>> & {
55
+ parameters?: (ParameterObject | {
56
+ $ref: string;
57
+ })[];
58
+ [key: string]: unknown;
59
+ };
60
+ interface OpenApiDocument {
61
+ openapi?: string;
62
+ info?: {
63
+ 'x-generator'?: {
64
+ contract?: unknown;
65
+ [key: string]: unknown;
66
+ };
67
+ [key: string]: unknown;
68
+ };
69
+ servers?: {
70
+ url: string;
71
+ [key: string]: unknown;
72
+ }[];
73
+ paths?: Record<string, PathItemObject>;
74
+ components?: {
75
+ schemas?: Record<string, JsonSchema>;
76
+ parameters?: Record<string, ParameterObject>;
77
+ requestBodies?: Record<string, RequestBodyObject>;
78
+ responses?: Record<string, ResponseObject>;
79
+ [key: string]: unknown;
80
+ };
81
+ security?: SecurityRequirement[];
82
+ [key: string]: unknown;
83
+ }
84
+ //#endregion
85
+ //#region src/contract.d.ts
86
+ /** The oldest generator contract this package reads: the baseline current servers stamp. */
87
+ declare const MINIMUM_CONTRACT = 13;
88
+ /** The newest generator contract this package reads. */
89
+ declare const MAXIMUM_CONTRACT = 18;
90
+ /**
91
+ * Throw unless the document's `info.x-generator.contract` is in the range this package reads. A
92
+ * document outside it would yield tools that miss or misread what the server offers, so there is
93
+ * no warning mode.
94
+ */
95
+ declare function assertContract(doc: OpenApiDocument): number;
96
+ //#endregion
97
+ //#region src/types.d.ts
98
+ /** MCP tool annotations: hints a client may show or act on. */
99
+ type McpToolAnnotations = {
100
+ title?: string;
101
+ readOnlyHint?: boolean;
102
+ destructiveHint?: boolean;
103
+ idempotentHint?: boolean;
104
+ openWorldHint?: boolean;
105
+ };
106
+ /** An MCP tool definition, as a `tools/list` response carries it. */
107
+ type McpTool = {
108
+ name: string;
109
+ title?: string;
110
+ description?: string;
111
+ inputSchema: {
112
+ type: 'object';
113
+ [key: string]: unknown;
114
+ };
115
+ outputSchema?: {
116
+ type: 'object';
117
+ [key: string]: unknown;
118
+ };
119
+ annotations?: McpToolAnnotations;
120
+ _meta?: {
121
+ [key: string]: unknown;
122
+ };
123
+ };
124
+ /** A content block in a tool result. */
125
+ type McpContent = {
126
+ type: 'text';
127
+ text: string;
128
+ } | {
129
+ type: 'image';
130
+ data: string;
131
+ mimeType: string;
132
+ } | {
133
+ type: 'resource';
134
+ resource: {
135
+ uri: string;
136
+ mimeType?: string;
137
+ blob: string;
138
+ };
139
+ };
140
+ /** The result of an MCP `tools/call`. */
141
+ type McpCallToolResult = {
142
+ content: McpContent[];
143
+ structuredContent?: {
144
+ [key: string]: unknown;
145
+ };
146
+ isError?: boolean;
147
+ };
148
+ /** What a tool does, from its operation's kind. */
149
+ type McpOperationKind = 'list' | 'get' | 'create' | 'update' | 'delete' | 'related' | 'action';
150
+ /**
151
+ * One operation the package turned into a tool. Every hook receives it: the descriptor entries,
152
+ * the raw OpenAPI operation with its vendor extensions, and the security it carries.
153
+ */
154
+ interface McpOperation {
155
+ operationId: string;
156
+ toolName: string;
157
+ kind: McpOperationKind;
158
+ /** The JSON:API type, exactly as in the document. */
159
+ type: string;
160
+ /** The relation, for a related read. */
161
+ relation?: string;
162
+ /** The action's path segment, for a custom action. */
163
+ action?: string;
164
+ /** The HTTP method, upper-case. */
165
+ method: string;
166
+ /** The path template, such as `/albums/{id}`. */
167
+ path: string;
168
+ /** The type's descriptor entry. */
169
+ resource: ResourceDescriptor;
170
+ /** The relation's descriptor entry, for a related read. */
171
+ relationDescriptor?: RelationDescriptor;
172
+ /** The action's descriptor entry, for a custom action. */
173
+ actionDescriptor?: ActionDescriptor;
174
+ /** The operation object as the document writes it, extensions included. */
175
+ operation: OperationObject;
176
+ /**
177
+ * The operation's own `security`, else the document's. Empty means none is required. The
178
+ * default scope filtering reads the scopes it lists.
179
+ */
180
+ security: readonly SecurityRequirement[];
181
+ /**
182
+ * The OAuth scopes the operation needs, as the descriptor carries them (generator contract
183
+ * 16): the ones its `security` lists under an `oauth2` scheme. Absent when it needs none.
184
+ */
185
+ scopes?: readonly string[];
186
+ }
187
+ /** What the host's capabilities resource says about one operation for this caller. */
188
+ type McpCapability = 'allowed' | 'denied' | 'depends';
189
+ /** Request settings a host supplies per call. */
190
+ interface McpRequestInit {
191
+ /** The API's base URL for this call, overriding {@link JsonApiMcpOptions.baseUrl}. */
192
+ baseUrl?: string;
193
+ /** Headers for this call, such as `Authorization`. */
194
+ headers?: HeadersInit;
195
+ }
196
+ /** One error object of a failed call, in the shape the tool result carries. */
197
+ interface McpToolErrorObject {
198
+ status?: string;
199
+ code?: string;
200
+ title?: string;
201
+ detail?: string;
202
+ source?: {
203
+ pointer?: string;
204
+ parameter?: string;
205
+ header?: string;
206
+ };
207
+ /** The tool argument the error is about, such as `title` or `releaseInfo.label`. */
208
+ path?: string;
209
+ }
210
+ /** A failed call, before it becomes an `isError` tool result. */
211
+ interface McpToolError {
212
+ /** The HTTP status of an error response; absent when no response came back. */
213
+ status?: number;
214
+ message: string;
215
+ errors: McpToolErrorObject[];
216
+ /** What was thrown: a `JsonApiError`, a transport failure, or the package's own refusal. */
217
+ cause: unknown;
218
+ }
219
+ /** The optional hooks a host plugs into. Each gets the per-request context it supplied. */
220
+ interface JsonApiMcpHooks<Ctx> {
221
+ /** Called per operation when the tool list is built, after scopes and capabilities. */
222
+ includeOperation?: (op: McpOperation, ctx: Ctx) => boolean | Promise<boolean>;
223
+ /** Called per tool after the package built it. Return the tool to list. */
224
+ decorateTool?: (tool: McpTool, op: McpOperation, ctx: Ctx) => McpTool | Promise<McpTool>;
225
+ /** Called per call before the request: headers and the base URL. */
226
+ requestInit?: (op: McpOperation, ctx: Ctx) => McpRequestInit | Promise<McpRequestInit>;
227
+ /** Called per failed call. Return the error the tool result carries. */
228
+ mapError?: (error: McpToolError, op: McpOperation, ctx: Ctx) => McpToolError | Promise<McpToolError>;
229
+ /**
230
+ * Whether the caller's granted scopes satisfy the scopes one security requirement lists.
231
+ * Defaults to every required scope appearing in `granted`.
232
+ */
233
+ scopeMatcher?: (granted: readonly string[], required: readonly string[]) => boolean;
234
+ /**
235
+ * The caller's capabilities, keyed by `operationId`, called once per tool list. A `denied`
236
+ * operation is left out; `depends` and an operation the result doesn't name stay in.
237
+ */
238
+ capabilities?: (ctx: Ctx) => Readonly<Record<string, McpCapability>> | ReadonlyMap<string, McpCapability> | Promise<Readonly<Record<string, McpCapability>> | ReadonlyMap<string, McpCapability>>;
239
+ }
240
+ /** Options for {@link createJsonApiMcp}. */
241
+ interface JsonApiMcpOptions<Ctx> {
242
+ /**
243
+ * The model the generator wrote, parsed: `require('./api.mcp.json')`, or `JSON.parse` of the
244
+ * file. Checked before use.
245
+ */
246
+ model: unknown;
247
+ /** The API's base URL. Defaults to the source document's first server. */
248
+ baseUrl?: string;
249
+ /** The transport the client sends through. Defaults to `fetch`. */
250
+ transport?: JsonApiTransport;
251
+ /**
252
+ * The security schemes an MCP caller authenticates with. Scope filtering ignores a security
253
+ * requirement naming any other scheme, such as a session cookie. Defaults to the model's, the
254
+ * document's `oauth2` schemes. When neither names one, every requirement counts.
255
+ */
256
+ credentialSchemes?: readonly string[];
257
+ hooks?: JsonApiMcpHooks<Ctx>;
258
+ }
259
+ /** Per-request input to {@link JsonApiMcp.forRequest}. */
260
+ interface McpRequest<Ctx> {
261
+ /**
262
+ * The caller's granted scopes. Omit to skip scope filtering, credential schemes included. `null`
263
+ * grants none, the same as `[]`, unlike core's `GrantedScopesProviderInterface`, where null means
264
+ * unrestricted.
265
+ */
266
+ grantedScopes?: readonly string[] | null;
267
+ /** The host's own per-request context, handed to every hook. */
268
+ context: Ctx;
269
+ }
270
+ /** Options for one call. */
271
+ interface McpCallOptions {
272
+ signal?: AbortSignal;
273
+ }
274
+ /** The tools one caller may use, and the handler for their calls. */
275
+ interface McpToolSession {
276
+ readonly tools: readonly McpTool[];
277
+ /** Run a tool from {@link tools}. Any other name is a tool error. */
278
+ callTool(name: string, args: unknown, options?: McpCallOptions): Promise<McpCallToolResult>;
279
+ }
280
+ /** An operation the package left out of the catalogue, and why. */
281
+ interface SkippedOperation {
282
+ operationId: string;
283
+ reason: string;
284
+ }
285
+ /** The tool catalogue built from one document and descriptor. */
286
+ interface JsonApiMcp<Ctx> {
287
+ /** Every operation that became a tool, before any per-caller filtering. */
288
+ readonly operations: readonly McpOperation[];
289
+ /** Every tool, before any per-caller filtering or decoration. */
290
+ readonly tools: readonly McpTool[];
291
+ /** Operations that couldn't become a tool, such as an action whose body only takes binary. */
292
+ readonly skipped: readonly SkippedOperation[];
293
+ /** The generator contract of the document the model was built from. */
294
+ readonly contract: number;
295
+ /** The document the model was built from, and its content hash. */
296
+ readonly source: {
297
+ readonly title: string;
298
+ readonly hash: string;
299
+ };
300
+ /** The credential schemes scope filtering counts. `undefined` when it counts every scheme. */
301
+ readonly credentialSchemes: readonly string[] | undefined;
302
+ /** Filter and decorate the tools for one caller. */
303
+ forRequest(request: McpRequest<Ctx>): Promise<McpToolSession>;
304
+ }
305
+ //#endregion
306
+ //#region src/mcp.d.ts
307
+ /** Every required scope appears among the granted ones. */
308
+ declare const exactScopeMatcher: (granted: readonly string[], required: readonly string[]) => boolean;
309
+ /**
310
+ * Whether granted scopes satisfy an operation's security. No requirement, or an empty one, needs
311
+ * nothing. Given `credentialSchemes`, the schemes the caller authenticates with, a requirement
312
+ * counts only when it names nothing else, so an operation whose every requirement needs another
313
+ * credential fails. A counted requirement passes when its scopes, across its schemes, all match,
314
+ * or when it lists none. Without `credentialSchemes` every requirement counts.
315
+ */
316
+ declare function satisfiesSecurity(security: readonly SecurityRequirement[], granted: readonly string[], matcher?: (granted: readonly string[], required: readonly string[]) => boolean, credentialSchemes?: readonly string[]): boolean;
317
+ /**
318
+ * Serve MCP tools from a model the generator wrote: `createJsonApiMcp({ model })` with the parsed
319
+ * artefact. Throws when the artefact isn't one this runtime can read.
320
+ */
321
+ declare function createJsonApiMcp<Ctx = unknown>(options: JsonApiMcpOptions<Ctx>): JsonApiMcp<Ctx>;
322
+ //#endregion
323
+ //#region src/portable.d.ts
324
+ /** The string formats both APIs accept. */
325
+ declare const PORTABLE_FORMATS: ReadonlySet<string>;
326
+ type Decoder = {
327
+ kind: 'value';
328
+ } | {
329
+ kind: 'json';
330
+ } | {
331
+ kind: 'object';
332
+ props: Readonly<Record<string, PropertyDecoder>>;
333
+ } | {
334
+ kind: 'array';
335
+ items: Decoder;
336
+ };
337
+ interface PropertyDecoder {
338
+ decoder: Decoder;
339
+ /** The conversion made this property nullable, so `null` means "not given". */
340
+ nullMeansOmit: boolean;
341
+ }
342
+ //#endregion
343
+ //#region src/inputs.d.ts
344
+ /** How the handler reads a read tool's query arguments. */
345
+ interface QueryPlan {
346
+ filter?: Decoder;
347
+ sort: boolean;
348
+ include: boolean;
349
+ /**
350
+ * The include paths the tool accepts, the ones its input lists. A model before format 3
351
+ * doesn't carry them and its tools accept any path.
352
+ */
353
+ includePaths?: readonly string[];
354
+ fields: readonly string[];
355
+ /** The wire key `pageSize` maps to, when the endpoint paginates by a size. */
356
+ sizeKey?: string;
357
+ maxPageSize?: number;
358
+ defaultPageSize?: number;
359
+ /** Whether `pageLink` is offered: the endpoint paginates at all. */
360
+ paginated: boolean;
361
+ /**
362
+ * Whether `withCount` is offered: the endpoint counts its own collection under the Countable
363
+ * profile, sent as `withCount=_self_` with this profile negotiated.
364
+ */
365
+ countProfile?: string;
366
+ }
367
+ /** One top-level write field: an attribute, or a relation sent as ids. */
368
+ interface WriteField {
369
+ relation?: {
370
+ cardinality: 'one' | 'many';
371
+ types: readonly string[];
372
+ polymorphic?: boolean;
373
+ };
374
+ property: PropertyDecoder;
375
+ }
376
+ /** How the handler reads a create, update or flat document action's arguments. */
377
+ interface WritePlan {
378
+ fields: Readonly<Record<string, WriteField>>;
379
+ /** The client id argument: whether the body takes one. */
380
+ clientId: 'none' | 'optional' | 'required';
381
+ /** Fields `clear` may name, for an update. */
382
+ clearable: readonly string[];
383
+ }
384
+ /** How the handler reads a custom action's body. */
385
+ type ActionBodyPlan = {
386
+ kind: 'none';
387
+ } | {
388
+ kind: 'flat';
389
+ write: WritePlan;
390
+ } | {
391
+ kind: 'body';
392
+ decoder: Decoder;
393
+ required: boolean; /** The request media type the body goes out as. */
394
+ mediaType: string;
395
+ mediaKind: 'document' | 'json' | 'text' | 'form';
396
+ };
397
+ //#endregion
398
+ //#region src/catalogue.d.ts
399
+ /** How the handler shapes a call's result. */
400
+ type ResultShape = 'collection' | 'resource' | 'item' | 'deleted' | 'meta' | 'location' | 'none' | 'raw' | 'loose';
401
+ //#endregion
402
+ //#region src/model.d.ts
403
+ /** The artefact's own format. A runtime refuses a format it doesn't know. */
404
+ declare const MODEL_FORMAT = 3;
405
+ /** The package that writes the artefact. */
406
+ declare const MODEL_GENERATOR = "@haddowg/json-api-mcp";
407
+ /** One operation, as hooks see it, without the descriptor entries the runtime adds back. */
408
+ interface McpModelOperation {
409
+ operationId: string;
410
+ toolName: string;
411
+ kind: McpOperationKind;
412
+ type: string;
413
+ relation?: string;
414
+ action?: string;
415
+ /** The action's key in the type's descriptor `actions`. */
416
+ actionKey?: string;
417
+ method: string;
418
+ path: string;
419
+ /**
420
+ * The operation object, extensions included, without its `parameters`, `requestBody` and
421
+ * `responses`: the tool already holds what those say, and they can refer to components the
422
+ * artefact doesn't carry. From format 3 it has no `security` either: the runtime puts back
423
+ * the `security` below.
424
+ */
425
+ operation: OperationObject;
426
+ /**
427
+ * The operation's own `security`, else the document's. From format 3 it is absent when the
428
+ * operation declares none, and the runtime takes the model's `security`.
429
+ */
430
+ security?: readonly SecurityRequirement[];
431
+ /**
432
+ * Formats 1 and 2: the OAuth scopes the descriptor says the operation needs. From format 3
433
+ * the runtime reads them from the descriptor.
434
+ */
435
+ scopes?: readonly string[];
436
+ }
437
+ /** How the handler turns one tool's arguments into a client call. */
438
+ interface McpModelPlan {
439
+ query?: QueryPlan;
440
+ write?: WritePlan;
441
+ action?: ActionBodyPlan;
442
+ }
443
+ interface McpModelTool {
444
+ operation: McpModelOperation;
445
+ tool: McpTool;
446
+ plan: McpModelPlan;
447
+ result: ResultShape;
448
+ }
449
+ /** The generated artefact. */
450
+ interface McpModel {
451
+ format: 1 | 2 | typeof MODEL_FORMAT;
452
+ generator: typeof MODEL_GENERATOR;
453
+ /** The generator contract the source document declared. */
454
+ contract: number;
455
+ /** Which document it was built from. */
456
+ source: {
457
+ title: string;
458
+ hash: string;
459
+ };
460
+ /** The document's first server URL, the default base URL. */
461
+ baseUrl?: string;
462
+ /**
463
+ * The security schemes an MCP caller authenticates with: the document's `oauth2` schemes.
464
+ * Empty when it has none. A format 1 model doesn't carry it.
465
+ */
466
+ credentialSchemes?: string[];
467
+ /**
468
+ * Format 3: the document's `security`, which an operation declaring none of its own takes.
469
+ * Absent when the document declares none.
470
+ */
471
+ security?: readonly SecurityRequirement[];
472
+ /**
473
+ * How many relationships deep a tool's `include` may reach; null for every path the document
474
+ * declares. Formats 1 and 2 don't carry it and set no cap.
475
+ */
476
+ includeDepth?: number | null;
477
+ /** The json-api-ts descriptor the client calls through. */
478
+ descriptor: ApiDescriptor;
479
+ tools: McpModelTool[];
480
+ skipped: SkippedOperation[];
481
+ }
482
+ /** Thrown when an artefact can't be read: another format, or a contract out of range. */
483
+ declare class McpModelError extends Error {
484
+ constructor(message: string);
485
+ }
486
+ /** Check a parsed artefact before the runtime trusts it. */
487
+ declare function assertModel(value: unknown): McpModel;
488
+ //#endregion
489
+ //#region src/names.d.ts
490
+ /** The name pattern OpenAI's and Anthropic's tool names share. */
491
+ declare const TOOL_NAME_PATTERN: RegExp;
492
+ /** What an `operationId` names, for an operation that becomes a tool. */
493
+ interface ParsedOperationId {
494
+ kind: McpOperationKind;
495
+ type: string;
496
+ relation?: string;
497
+ action?: string;
498
+ /** The method suffix of a multi-method action's id. */
499
+ method?: HttpMethod;
500
+ }
501
+ /**
502
+ * Parse an `operationId` into what a tool needs. `undefined` for an operation that isn't a tool:
503
+ * relationship endpoints, Atomic Operations, or an id this package doesn't recognise.
504
+ */
505
+ declare function parseOperationId(operationId: string): ParsedOperationId | undefined;
506
+ /**
507
+ * The tool name for a parsed `operationId`: noun first, the type as the document spells it with
508
+ * kebab-case turned into snake_case. A related read ends in `list` or `get` by the relation's
509
+ * cardinality; an action is named after its path, plus the method for a multi-method action.
510
+ */
511
+ declare function toolName(parsed: ParsedOperationId, descriptor: ApiDescriptor): string;
512
+ /** Thrown when the tools can't be named: a name too long, with a stray character, or a clash. */
513
+ declare class ToolNameError extends Error {
514
+ readonly problems: readonly string[];
515
+ constructor(problems: readonly string[]);
516
+ }
517
+ //#endregion
518
+ //#region src/safety.d.ts
519
+ /** The vendor extension an action's operation declares its safety in. */
520
+ declare const SAFETY_EXTENSION = "x-safety";
521
+ /** What an action declares about itself. A flag it doesn't declare is absent. */
522
+ interface ActionSafety {
523
+ readOnly?: boolean;
524
+ destructive?: boolean;
525
+ idempotent?: boolean;
526
+ }
527
+ /**
528
+ * Read an action's declared safety from its operation. An operation without the extension, or
529
+ * with one this package can't read, declares nothing.
530
+ */
531
+ declare function readActionSafety(operation: OperationObject): ActionSafety;
532
+ //#endregion
533
+ export { type ActionSafety, type JsonApiMcp, type JsonApiMcpHooks, type JsonApiMcpOptions, type JsonSchema, MAXIMUM_CONTRACT, MINIMUM_CONTRACT, MODEL_FORMAT, MODEL_GENERATOR, type McpCallOptions, type McpCallToolResult, type McpCapability, type McpContent, type McpModel, McpModelError, type McpModelOperation, type McpModelPlan, type McpModelTool, type McpOperation, type McpOperationKind, type McpRequest, type McpRequestInit, type McpTool, type McpToolAnnotations, type McpToolError, type McpToolErrorObject, type McpToolSession, type OpenApiDocument, type OperationObject, PORTABLE_FORMATS, type ParsedOperationId, SAFETY_EXTENSION, type SecurityRequirement, type SkippedOperation, TOOL_NAME_PATTERN, ToolNameError, assertContract, assertModel, createJsonApiMcp, exactScopeMatcher, parseOperationId, readActionSafety, satisfiesSecurity, toolName };
534
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/openapi.ts","../src/contract.ts","../src/types.ts","../src/mcp.ts","../src/portable.ts","../src/inputs.ts","../src/catalogue.ts","../src/model.ts","../src/names.ts","../src/safety.ts"],"mappings":";;;;;;AAMA;;KAAY,UAAA;EAAA,CA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