@graphitation/supermassive 2.4.8 → 2.6.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.
- package/.eslintcache +1 -1
- package/CHANGELOG.md +18 -2
- package/README.md +2 -42
- package/lib/benchmarks/index.js +3 -3
- package/lib/benchmarks/index.js.map +2 -2
- package/lib/benchmarks/index.mjs +1 -1
- package/lib/benchmarks/index.mjs.map +1 -1
- package/lib/collectFields.d.ts +1 -1
- package/lib/collectFields.d.ts.map +1 -1
- package/lib/collectFields.js.map +1 -1
- package/lib/collectFields.mjs.map +1 -1
- package/lib/directives.d.ts +1 -1
- package/lib/directives.d.ts.map +1 -1
- package/lib/directives.js.map +1 -1
- package/lib/directives.mjs.map +1 -1
- package/lib/executeWithoutSchema.d.ts +1 -1
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js.map +1 -1
- package/lib/executeWithoutSchema.mjs.map +1 -1
- package/lib/hooks/types.d.ts +1 -1
- package/lib/hooks/types.d.ts.map +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/index.js.map +2 -2
- package/lib/index.mjs +4 -2
- package/lib/index.mjs.map +2 -2
- package/lib/jsutils/Maybe.d.ts +1 -1
- package/lib/jsutils/Maybe.d.ts.map +1 -1
- package/lib/jsutils/ObjMap.d.ts +2 -2
- package/lib/jsutils/ObjMap.d.ts.map +1 -1
- package/lib/jsutils/PromiseOrValue.d.ts +1 -1
- package/lib/jsutils/PromiseOrValue.d.ts.map +1 -1
- package/lib/subscribeWithoutSchema.d.ts +1 -1
- package/lib/subscribeWithoutSchema.d.ts.map +1 -1
- package/lib/subscribeWithoutSchema.js.map +1 -1
- package/lib/subscribeWithoutSchema.mjs.map +1 -1
- package/lib/types.d.ts +19 -19
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utilities/typeNameFromAST.d.ts +1 -1
- package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
- package/lib/utilities/typeNameFromAST.js.map +1 -1
- package/lib/utilities/typeNameFromAST.mjs.map +1 -1
- package/lib/values.d.ts +2 -2
- package/lib/values.d.ts.map +1 -1
- package/lib/values.js.map +1 -1
- package/lib/values.mjs.map +1 -1
- package/package.json +5 -6
- package/lib/ast/TypedAST.d.ts +0 -367
- package/lib/ast/TypedAST.d.ts.map +0 -1
- package/lib/ast/TypedAST.js +0 -16
- package/lib/ast/TypedAST.js.map +0 -7
- package/lib/ast/TypedAST.mjs +0 -0
- package/lib/ast/TypedAST.mjs.map +0 -7
- package/lib/ast/addTypesToRequestDocument.d.ts +0 -6
- package/lib/ast/addTypesToRequestDocument.d.ts.map +0 -1
- package/lib/ast/addTypesToRequestDocument.js +0 -161
- package/lib/ast/addTypesToRequestDocument.js.map +0 -7
- package/lib/ast/addTypesToRequestDocument.mjs +0 -153
- package/lib/ast/addTypesToRequestDocument.mjs.map +0 -7
- package/lib/transforms/annotateDocumentGraphQLTransform.d.ts +0 -3
- package/lib/transforms/annotateDocumentGraphQLTransform.d.ts.map +0 -1
- package/lib/transforms/annotateDocumentGraphQLTransform.js +0 -34
- package/lib/transforms/annotateDocumentGraphQLTransform.js.map +0 -7
- package/lib/transforms/annotateDocumentGraphQLTransform.mjs +0 -17
- package/lib/transforms/annotateDocumentGraphQLTransform.mjs.map +0 -7
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
|
-
// src/ast/addTypesToRequestDocument.ts
|
|
22
|
-
import {
|
|
23
|
-
isListType,
|
|
24
|
-
isNamedType,
|
|
25
|
-
isNonNullType,
|
|
26
|
-
TypeInfo,
|
|
27
|
-
visit,
|
|
28
|
-
visitWithTypeInfo,
|
|
29
|
-
Kind,
|
|
30
|
-
astFromValue
|
|
31
|
-
} from "graphql";
|
|
32
|
-
export * from "./TypedAST.mjs";
|
|
33
|
-
function addTypesToRequestDocument(schema, document) {
|
|
34
|
-
const typeInfo = new TypeInfo(schema);
|
|
35
|
-
return visit(
|
|
36
|
-
document,
|
|
37
|
-
visitWithTypeInfo(typeInfo, {
|
|
38
|
-
Argument: {
|
|
39
|
-
leave(node, _key, _parent, _path, ancestors) {
|
|
40
|
-
const argument = typeInfo.getArgument();
|
|
41
|
-
if (argument) {
|
|
42
|
-
const typeNode = generateTypeNode(argument.type);
|
|
43
|
-
const newNode = __spreadProps(__spreadValues({}, node), {
|
|
44
|
-
__type: typeNode
|
|
45
|
-
});
|
|
46
|
-
if (argument.defaultValue && node.value.kind === Kind.VARIABLE) {
|
|
47
|
-
newNode.__defaultValue = astFromValue(
|
|
48
|
-
argument.defaultValue,
|
|
49
|
-
argument.type
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return newNode;
|
|
53
|
-
}
|
|
54
|
-
const errorPath = makeReadableErrorPath(ancestors);
|
|
55
|
-
throw new Error(
|
|
56
|
-
`Cannot find type for argument: ${errorPath.join(".")}.${node.name.value}`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
Field: {
|
|
61
|
-
leave(node, _key, _parent, _path, ancestors) {
|
|
62
|
-
const fieldDef = typeInfo.getFieldDef();
|
|
63
|
-
if (fieldDef) {
|
|
64
|
-
const type = fieldDef.type;
|
|
65
|
-
if (type) {
|
|
66
|
-
const typeNode = generateTypeNode(type);
|
|
67
|
-
const missingArgs = fieldDef.args.filter(
|
|
68
|
-
(argDef) => {
|
|
69
|
-
var _a;
|
|
70
|
-
return argDef.defaultValue != null && ((_a = node.arguments) == null ? void 0 : _a.findIndex(
|
|
71
|
-
(arg) => arg.name.value === argDef.name
|
|
72
|
-
)) === -1;
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
const newNode = __spreadProps(__spreadValues({}, node), {
|
|
76
|
-
__type: typeNode
|
|
77
|
-
});
|
|
78
|
-
if (missingArgs) {
|
|
79
|
-
newNode.arguments = (newNode.arguments || []).concat(
|
|
80
|
-
missingArgs.map((arg) => ({
|
|
81
|
-
__type: generateTypeNode(arg.type),
|
|
82
|
-
kind: Kind.ARGUMENT,
|
|
83
|
-
name: {
|
|
84
|
-
kind: Kind.NAME,
|
|
85
|
-
value: arg.name
|
|
86
|
-
},
|
|
87
|
-
value: astFromValue(
|
|
88
|
-
arg.defaultValue,
|
|
89
|
-
arg.type
|
|
90
|
-
)
|
|
91
|
-
}))
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
return newNode;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const errorPath = makeReadableErrorPath(ancestors);
|
|
98
|
-
throw new Error(
|
|
99
|
-
`Cannot find type for field: ${errorPath.join(".")}.${node.name.value}`
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
function generateTypeNode(type) {
|
|
107
|
-
if (isNonNullType(type)) {
|
|
108
|
-
const typeNode = generateTypeNode(type.ofType);
|
|
109
|
-
return {
|
|
110
|
-
kind: "NonNullType",
|
|
111
|
-
type: typeNode
|
|
112
|
-
};
|
|
113
|
-
} else if (isListType(type)) {
|
|
114
|
-
const typeNode = generateTypeNode(type.ofType);
|
|
115
|
-
return {
|
|
116
|
-
kind: "ListType",
|
|
117
|
-
type: typeNode
|
|
118
|
-
};
|
|
119
|
-
} else if (isNamedType(type)) {
|
|
120
|
-
return {
|
|
121
|
-
kind: "NamedType",
|
|
122
|
-
name: {
|
|
123
|
-
kind: "Name",
|
|
124
|
-
value: type.name
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
throw new Error(`Can't generate TypeNode for type: ${type}`);
|
|
129
|
-
}
|
|
130
|
-
function makeReadableErrorPath(ancestors) {
|
|
131
|
-
const path = [];
|
|
132
|
-
ancestors.forEach((ancestorOrArray) => {
|
|
133
|
-
let ancestor;
|
|
134
|
-
if (!Array.isArray(ancestorOrArray)) {
|
|
135
|
-
ancestor = ancestorOrArray;
|
|
136
|
-
if (ancestor && ancestor.kind === Kind.FIELD) {
|
|
137
|
-
path.push(ancestor.name.value);
|
|
138
|
-
} else if (ancestor && ancestor.kind === Kind.OPERATION_DEFINITION) {
|
|
139
|
-
let name;
|
|
140
|
-
if (ancestor.name) {
|
|
141
|
-
name = `${ancestor.operation} ${ancestor.name.value}`;
|
|
142
|
-
} else {
|
|
143
|
-
name = ancestor.operation;
|
|
144
|
-
}
|
|
145
|
-
path.push(name);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
return path;
|
|
150
|
-
}
|
|
151
|
-
export {
|
|
152
|
-
addTypesToRequestDocument
|
|
153
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ast/addTypesToRequestDocument.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n GraphQLType,\n GraphQLSchema,\n isListType,\n isNamedType,\n isNonNullType,\n TypeInfo,\n visit,\n visitWithTypeInfo,\n Kind,\n astFromValue,\n GraphQLArgument,\n} from \"graphql\";\n\nimport * as TypelessAST from \"graphql/language/ast\";\nimport * as TypedAST from \"./TypedAST\";\nexport * from \"./TypedAST\";\n\nexport function addTypesToRequestDocument(\n schema: GraphQLSchema,\n document: TypelessAST.DocumentNode,\n): TypedAST.DocumentNode {\n const typeInfo = new TypeInfo(schema);\n return visit(\n document,\n visitWithTypeInfo(typeInfo, {\n Argument: {\n leave(node, _key, _parent, _path, ancestors) {\n const argument = typeInfo.getArgument();\n if (argument) {\n const typeNode = generateTypeNode(argument.type);\n const newNode: TypedAST.ArgumentNode = {\n ...node,\n __type: typeNode,\n };\n // We only need default value for arguments with variable values\n if (argument.defaultValue && node.value.kind === Kind.VARIABLE) {\n (newNode.__defaultValue as\n | TypedAST.ValueNode\n | null\n | undefined) = astFromValue(\n argument.defaultValue,\n argument.type,\n );\n }\n return newNode;\n }\n const errorPath = makeReadableErrorPath(ancestors);\n throw new Error(\n `Cannot find type for argument: ${errorPath.join(\".\")}.${\n node.name.value\n }`,\n );\n },\n },\n Field: {\n leave(\n node: Omit<TypelessAST.FieldNode, \"selectionSet\" | \"directives\">,\n _key,\n _parent,\n _path,\n ancestors,\n ) {\n const fieldDef = typeInfo.getFieldDef();\n if (fieldDef) {\n const type = fieldDef.type;\n if (type) {\n const typeNode = generateTypeNode(type);\n const missingArgs: Array<GraphQLArgument> = fieldDef.args.filter(\n (argDef) =>\n argDef.defaultValue != null &&\n node.arguments?.findIndex(\n (arg) => arg.name.value === argDef.name,\n ) === -1,\n );\n const newNode: TypedAST.FieldNode = {\n ...(node as Omit<\n TypelessAST.FieldNode,\n \"selectionSet\" | \"arguments\" | \"directives\"\n >),\n __type: typeNode,\n };\n if (missingArgs) {\n (newNode.arguments as TypedAST.ArgumentNode[]) = (\n newNode.arguments || []\n ).concat(\n missingArgs.map((arg) => ({\n __type: generateTypeNode(arg.type),\n kind: Kind.ARGUMENT,\n name: {\n kind: Kind.NAME,\n value: arg.name,\n },\n value: astFromValue(\n arg.defaultValue,\n arg.type,\n ) as TypedAST.ValueNode,\n })),\n );\n }\n return newNode;\n }\n }\n\n const errorPath = makeReadableErrorPath(ancestors);\n\n // This happens whenever a new field is requested that hasn't been defined in schema\n throw new Error(\n `Cannot find type for field: ${errorPath.join(\".\")}.${\n node.name.value\n }`,\n );\n },\n },\n }),\n );\n}\n\nfunction generateTypeNode(type: GraphQLType): TypedAST.TypeNode {\n if (isNonNullType(type)) {\n const typeNode = generateTypeNode(type.ofType) as\n | TypedAST.NamedTypeNode\n | TypedAST.ListTypeNode;\n return {\n kind: \"NonNullType\",\n type: typeNode,\n };\n } else if (isListType(type)) {\n const typeNode = generateTypeNode(type.ofType) as\n | TypedAST.NamedTypeNode\n | TypedAST.NonNullTypeNode;\n return {\n kind: \"ListType\",\n type: typeNode,\n };\n } else if (isNamedType(type)) {\n return {\n kind: \"NamedType\",\n name: {\n kind: \"Name\",\n value: type.name,\n },\n };\n }\n throw new Error(`Can't generate TypeNode for type: ${type}`);\n}\n\nfunction makeReadableErrorPath(\n ancestors: ReadonlyArray<\n readonly TypelessAST.ASTNode[] | TypelessAST.ASTNode\n >,\n): string[] {\n const path: string[] = [];\n ancestors.forEach((ancestorOrArray) => {\n let ancestor: TypelessAST.ASTNode;\n if (!Array.isArray(ancestorOrArray)) {\n ancestor = ancestorOrArray as TypelessAST.ASTNode;\n if (ancestor && ancestor.kind === Kind.FIELD) {\n path.push(ancestor.name.value);\n } else if (ancestor && ancestor.kind === Kind.OPERATION_DEFINITION) {\n let name;\n if (ancestor.name) {\n name = `${ancestor.operation} ${ancestor.name.value}`;\n } else {\n name = ancestor.operation;\n }\n path.push(name);\n }\n }\n });\n return path;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAA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SAAS,KAAK,KAAK;AAAA,MAC/B,WAAW,YAAY,SAAS,SAAS,KAAK,sBAAsB;AAClE,YAAI;AACJ,YAAI,SAAS,MAAM;AACjB,iBAAO,GAAG,SAAS,aAAa,SAAS,KAAK;AAAA,QAChD,OAAO;AACL,iBAAO,SAAS;AAAA,QAClB;AACA,aAAK,KAAK,IAAI;AAAA,MAChB;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from "graphql";
|
|
2
|
-
export declare const annotateDocumentGraphQLTransform: (schema: GraphQLSchema) => (node: FragmentDefinitionNode | OperationDefinitionNode) => import("../ast/TypedAST").DefinitionNode;
|
|
3
|
-
//# sourceMappingURL=annotateDocumentGraphQLTransform.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotateDocumentGraphQLTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/annotateDocumentGraphQLTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,aAAa,EAEb,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,gCAAgC,WAAY,aAAa,YACtD,sBAAsB,GAAG,uBAAuB,6CAO/D,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var annotateDocumentGraphQLTransform_exports = {};
|
|
20
|
-
__export(annotateDocumentGraphQLTransform_exports, {
|
|
21
|
-
annotateDocumentGraphQLTransform: () => annotateDocumentGraphQLTransform
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(annotateDocumentGraphQLTransform_exports);
|
|
24
|
-
var import_graphql = require("graphql");
|
|
25
|
-
var import_addTypesToRequestDocument = require("../ast/addTypesToRequestDocument");
|
|
26
|
-
const annotateDocumentGraphQLTransform = (schema) => {
|
|
27
|
-
return (node) => {
|
|
28
|
-
const document = (0, import_addTypesToRequestDocument.addTypesToRequestDocument)(schema, {
|
|
29
|
-
kind: import_graphql.Kind.DOCUMENT,
|
|
30
|
-
definitions: [node]
|
|
31
|
-
});
|
|
32
|
-
return document.definitions[0];
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/transforms/annotateDocumentGraphQLTransform.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n FragmentDefinitionNode,\n GraphQLSchema,\n Kind,\n OperationDefinitionNode,\n} from \"graphql\";\nimport { addTypesToRequestDocument } from \"../ast/addTypesToRequestDocument\";\n\nexport const annotateDocumentGraphQLTransform = (schema: GraphQLSchema) => {\n return (node: FragmentDefinitionNode | OperationDefinitionNode) => {\n const document = addTypesToRequestDocument(schema, {\n kind: Kind.DOCUMENT,\n definitions: [node],\n });\n return document.definitions[0];\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAKO;AACP,uCAA0C;AAEnC,MAAM,mCAAmC,CAAC,WAA0B;AACzE,SAAO,CAAC,SAA2D;AACjE,UAAM,eAAW,4DAA0B,QAAQ;AAAA,MACjD,MAAM,oBAAK;AAAA,MACX,aAAa,CAAC,IAAI;AAAA,IACpB,CAAC;AACD,WAAO,SAAS,YAAY,CAAC;AAAA,EAC/B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// src/transforms/annotateDocumentGraphQLTransform.ts
|
|
2
|
-
import {
|
|
3
|
-
Kind
|
|
4
|
-
} from "graphql";
|
|
5
|
-
import { addTypesToRequestDocument } from "../ast/addTypesToRequestDocument.mjs";
|
|
6
|
-
var annotateDocumentGraphQLTransform = (schema) => {
|
|
7
|
-
return (node) => {
|
|
8
|
-
const document = addTypesToRequestDocument(schema, {
|
|
9
|
-
kind: Kind.DOCUMENT,
|
|
10
|
-
definitions: [node]
|
|
11
|
-
});
|
|
12
|
-
return document.definitions[0];
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
annotateDocumentGraphQLTransform
|
|
17
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/transforms/annotateDocumentGraphQLTransform.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n FragmentDefinitionNode,\n GraphQLSchema,\n Kind,\n OperationDefinitionNode,\n} from \"graphql\";\nimport { addTypesToRequestDocument } from \"../ast/addTypesToRequestDocument\";\n\nexport const annotateDocumentGraphQLTransform = (schema: GraphQLSchema) => {\n return (node: FragmentDefinitionNode | OperationDefinitionNode) => {\n const document = addTypesToRequestDocument(schema, {\n kind: Kind.DOCUMENT,\n definitions: [node],\n });\n return document.definitions[0];\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAAA;AAAA,EAGE;AAAA,OAEK;AACP,SAAS,iCAAiC;AAEnC,IAAM,mCAAmC,CAAC,WAA0B;AACzE,SAAO,CAAC,SAA2D;AACjE,UAAM,WAAW,0BAA0B,QAAQ;AAAA,MACjD,MAAM,KAAK;AAAA,MACX,aAAa,CAAC,IAAI;AAAA,IACpB,CAAC;AACD,WAAO,SAAS,YAAY,CAAC;AAAA,EAC/B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|