@webiny/handler-graphql 0.0.0-unstable.9bd236cf5e → 0.0.0-unstable.9f53ea597d
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/README.md +9 -5
- package/ResolverDecoration.d.ts +1 -1
- package/ResolverDecoration.js +18 -21
- package/ResolverDecoration.js.map +1 -1
- package/builtInTypes/AnyScalar.d.ts +1 -1
- package/builtInTypes/AnyScalar.js +8 -15
- package/builtInTypes/AnyScalar.js.map +1 -1
- package/builtInTypes/DateScalar.d.ts +1 -1
- package/builtInTypes/DateScalar.js +19 -23
- package/builtInTypes/DateScalar.js.map +1 -1
- package/builtInTypes/DateTimeScalar.d.ts +1 -1
- package/builtInTypes/DateTimeScalar.js +14 -23
- package/builtInTypes/DateTimeScalar.js.map +1 -1
- package/builtInTypes/DateTimeZScalar.d.ts +1 -1
- package/builtInTypes/DateTimeZScalar.js +25 -44
- package/builtInTypes/DateTimeZScalar.js.map +1 -1
- package/builtInTypes/IconScalar.d.ts +10 -0
- package/builtInTypes/IconScalar.js +65 -0
- package/builtInTypes/IconScalar.js.map +1 -0
- package/builtInTypes/JsonScalar.d.ts +1 -1
- package/builtInTypes/JsonScalar.js +3 -8
- package/builtInTypes/JsonScalar.js.map +1 -1
- package/builtInTypes/LongScalar.d.ts +1 -1
- package/builtInTypes/LongScalar.js +32 -48
- package/builtInTypes/LongScalar.js.map +1 -1
- package/builtInTypes/NumberScalar.d.ts +1 -1
- package/builtInTypes/NumberScalar.js +33 -47
- package/builtInTypes/NumberScalar.js.map +1 -1
- package/builtInTypes/RefInputScalar.d.ts +1 -1
- package/builtInTypes/RefInputScalar.js +46 -69
- package/builtInTypes/RefInputScalar.js.map +1 -1
- package/builtInTypes/TimeScalar.d.ts +1 -1
- package/builtInTypes/TimeScalar.js +29 -49
- package/builtInTypes/TimeScalar.js.map +1 -1
- package/builtInTypes/index.d.ts +10 -9
- package/builtInTypes/index.js +10 -106
- package/createGraphQLHandler.d.ts +3 -3
- package/createGraphQLHandler.js +74 -102
- package/createGraphQLHandler.js.map +1 -1
- package/createGraphQLSchema.d.ts +4 -4
- package/createGraphQLSchema.js +55 -67
- package/createGraphQLSchema.js.map +1 -1
- package/createRequestBody.d.ts +2 -0
- package/createRequestBody.js +28 -0
- package/createRequestBody.js.map +1 -0
- package/createResolverDecorator.d.ts +1 -1
- package/createResolverDecorator.js +2 -10
- package/createResolverDecorator.js.map +1 -1
- package/debugPlugins.d.ts +3 -3
- package/debugPlugins.js +26 -36
- package/debugPlugins.js.map +1 -1
- package/errors.js +6 -13
- package/errors.js.map +1 -1
- package/exports/api/graphql.d.ts +2 -0
- package/exports/api/graphql.js +2 -0
- package/features/GraphQLSchemaBuilder/GraphQLSchemaBuilder.d.ts +16 -0
- package/features/GraphQLSchemaBuilder/GraphQLSchemaBuilder.js +57 -0
- package/features/GraphQLSchemaBuilder/GraphQLSchemaBuilder.js.map +1 -0
- package/features/GraphQLSchemaBuilder/GraphQLSchemaComposer.d.ts +13 -0
- package/features/GraphQLSchemaBuilder/GraphQLSchemaComposer.js +35 -0
- package/features/GraphQLSchemaBuilder/GraphQLSchemaComposer.js.map +1 -0
- package/features/GraphQLSchemaBuilder/abstractions.d.ts +34 -0
- package/features/GraphQLSchemaBuilder/abstractions.js +6 -0
- package/features/GraphQLSchemaBuilder/abstractions.js.map +1 -0
- package/features/GraphQLSchemaBuilder/feature.d.ts +4 -0
- package/features/GraphQLSchemaBuilder/feature.js +11 -0
- package/features/GraphQLSchemaBuilder/feature.js.map +1 -0
- package/graphql/abstractions.core.d.ts +11 -0
- package/graphql/abstractions.core.js +5 -0
- package/graphql/abstractions.core.js.map +1 -0
- package/graphql/abstractions.d.ts +2 -0
- package/graphql/abstractions.js +2 -0
- package/graphql/abstractions.public.d.ts +18 -0
- package/graphql/abstractions.public.js +5 -0
- package/graphql/abstractions.public.js.map +1 -0
- package/index.d.ts +10 -10
- package/index.js +10 -97
- package/index.js.map +1 -1
- package/interceptConsole.js +30 -34
- package/interceptConsole.js.map +1 -1
- package/package.json +32 -27
- package/plugins/GraphQLSchemaPlugin.d.ts +2 -2
- package/plugins/GraphQLSchemaPlugin.js +21 -30
- package/plugins/GraphQLSchemaPlugin.js.map +1 -1
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +1 -18
- package/processRequestBody.d.ts +3 -3
- package/processRequestBody.js +34 -44
- package/processRequestBody.js.map +1 -1
- package/responses.d.ts +11 -1
- package/responses.js +43 -61
- package/responses.js.map +1 -1
- package/types.d.ts +6 -6
- package/types.js +0 -7
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -18
- package/utils/resolve.d.ts +2 -2
- package/utils/resolve.js +16 -24
- package/utils/resolve.js.map +1 -1
- package/builtInTypes/index.js.map +0 -1
- package/plugins/index.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/index.js.map +0 -1
package/createGraphQLHandler.js
CHANGED
|
@@ -1,110 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const createCacheKey = context => {
|
|
17
|
-
const plugins = (0, _createGraphQLSchema.getSchemaPlugins)(context);
|
|
18
|
-
// TODO: in the near future, we have to assign a fixed name to every
|
|
19
|
-
// TODO: GraphQLSchema plugin, to be able to create a reliable cache key.
|
|
20
|
-
|
|
21
|
-
// TODO: `getCurrentTenant` should be injected as a parameter.
|
|
22
|
-
// @ts-expect-error TODO: We should not be accessing `context` like this here.
|
|
23
|
-
const tenant = context.tenancy?.getCurrentTenant();
|
|
24
|
-
|
|
25
|
-
// TODO: `getContentLocale` should be injected as a parameter.
|
|
26
|
-
// @ts-expect-error TODO: We should not be accessing `context` like this here.
|
|
27
|
-
const contentLocale = context.i18n?.getContentLocale();
|
|
28
|
-
return [tenant ? `tenant:${tenant.id}` : null, contentLocale ? `locale:${contentLocale.code}` : null, plugins.length.toString()].filter(Boolean).join("#");
|
|
1
|
+
import { toBoolean } from "@webiny/stdlib";
|
|
2
|
+
import { RoutePlugin } from "@webiny/handler";
|
|
3
|
+
import _webiny_error from "@webiny/error";
|
|
4
|
+
import { createGraphQLSchema, getSchemaPlugins } from "./createGraphQLSchema.js";
|
|
5
|
+
import debugPlugins from "./debugPlugins.js";
|
|
6
|
+
import { processRequestBody } from "./processRequestBody.js";
|
|
7
|
+
import { createRequestBody } from "./createRequestBody.js";
|
|
8
|
+
const DEFAULT_CACHE_MAX_AGE = 30758400;
|
|
9
|
+
const createCacheKey = (context)=>{
|
|
10
|
+
const plugins = getSchemaPlugins(context);
|
|
11
|
+
const tenant = context.tenancy?.getCurrentTenant();
|
|
12
|
+
return [
|
|
13
|
+
tenant ? `tenant:${tenant.id}` : null,
|
|
14
|
+
plugins.length.toString()
|
|
15
|
+
].filter(Boolean).join("#");
|
|
29
16
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (error instanceof _error.default) {
|
|
17
|
+
const formatErrorPayload = (error)=>{
|
|
18
|
+
if (error instanceof _webiny_error) return JSON.stringify({
|
|
19
|
+
type: "CoreGraphQLWebinyError",
|
|
20
|
+
message: error.message,
|
|
21
|
+
code: error.code,
|
|
22
|
+
data: error.data,
|
|
23
|
+
stack: error.stack
|
|
24
|
+
});
|
|
39
25
|
return JSON.stringify({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
type: "Error",
|
|
27
|
+
name: error.name,
|
|
28
|
+
message: error.message,
|
|
29
|
+
stack: error.stack
|
|
44
30
|
});
|
|
45
|
-
}
|
|
46
|
-
return JSON.stringify({
|
|
47
|
-
type: "Error",
|
|
48
|
-
name: error.name,
|
|
49
|
-
message: error.message,
|
|
50
|
-
stack: error.stack
|
|
51
|
-
});
|
|
52
31
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (reply.sent) {
|
|
92
|
-
console.warn("Reply already sent, cannot send the result (handler-graphql).");
|
|
93
|
-
return reply;
|
|
94
|
-
}
|
|
95
|
-
return reply.status(200).send(result);
|
|
96
|
-
} catch (ex) {
|
|
97
|
-
console.error(`Error while processing the body request.`);
|
|
98
|
-
console.error(formatErrorPayload(ex));
|
|
99
|
-
throw ex;
|
|
100
|
-
}
|
|
32
|
+
const createGraphQLHandler = (options = {})=>{
|
|
33
|
+
let schema;
|
|
34
|
+
let cacheKey;
|
|
35
|
+
const debug = toBoolean(options.debug);
|
|
36
|
+
const path = options?.path || "/graphql";
|
|
37
|
+
const route = new RoutePlugin(async ({ onPost, onOptions, context })=>{
|
|
38
|
+
onOptions(path, async (_, reply)=>reply.status(204).headers({
|
|
39
|
+
"Cache-Control": `public, max-age=${DEFAULT_CACHE_MAX_AGE}`
|
|
40
|
+
}).send({}).hijack());
|
|
41
|
+
onPost(path, async (request, reply)=>{
|
|
42
|
+
const contextCacheKey = createCacheKey(context);
|
|
43
|
+
if (!schema || cacheKey !== contextCacheKey) try {
|
|
44
|
+
schema = await createGraphQLSchema(context);
|
|
45
|
+
cacheKey = contextCacheKey;
|
|
46
|
+
} catch (ex) {
|
|
47
|
+
return reply.code(500).send(formatErrorPayload(ex));
|
|
48
|
+
}
|
|
49
|
+
let body;
|
|
50
|
+
try {
|
|
51
|
+
body = createRequestBody(request.body);
|
|
52
|
+
} catch (ex) {
|
|
53
|
+
console.error("Error while creating the body request.");
|
|
54
|
+
console.error(formatErrorPayload(ex));
|
|
55
|
+
throw ex;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const result = await processRequestBody(body, schema, context);
|
|
59
|
+
if (reply.sent) {
|
|
60
|
+
console.warn("Reply already sent, cannot send the result (handler-graphql).");
|
|
61
|
+
return reply;
|
|
62
|
+
}
|
|
63
|
+
return reply.status(200).send(result);
|
|
64
|
+
} catch (ex) {
|
|
65
|
+
console.error("Error while processing the body request.");
|
|
66
|
+
console.error(formatErrorPayload(ex));
|
|
67
|
+
throw ex;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
101
70
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
71
|
+
route.name = "handler.graphql.route.default";
|
|
72
|
+
return [
|
|
73
|
+
...debug ? debugPlugins() : [],
|
|
74
|
+
{
|
|
75
|
+
type: "wcp-telemetry-tracker"
|
|
76
|
+
},
|
|
77
|
+
route
|
|
78
|
+
];
|
|
107
79
|
};
|
|
108
|
-
|
|
80
|
+
export default createGraphQLHandler;
|
|
109
81
|
|
|
110
82
|
//# sourceMappingURL=createGraphQLHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"createGraphQLHandler.js","sources":["../src/createGraphQLHandler.ts"],"sourcesContent":["import { toBoolean } from \"@webiny/stdlib\";\nimport type { GraphQLSchema } from \"graphql\";\nimport type { Context } from \"@webiny/handler\";\nimport { RoutePlugin } from \"@webiny/handler\";\nimport WebinyError from \"@webiny/error\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport type { GraphQLRequestBody, HandlerGraphQLOptions } from \"./types.js\";\nimport { createGraphQLSchema, getSchemaPlugins } from \"./createGraphQLSchema.js\";\nimport debugPlugins from \"./debugPlugins.js\";\nimport { processRequestBody } from \"./processRequestBody.js\";\nimport { createRequestBody } from \"~/createRequestBody.js\";\n\nconst DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year\n\nconst createCacheKey = (context: Context) => {\n const plugins = getSchemaPlugins(context);\n // TODO: in the near future, we have to assign a fixed name to every\n // TODO: GraphQLSchema plugin, to be able to create a reliable cache key.\n\n // TODO: `getCurrentTenant` should be injected as a parameter.\n // @ts-expect-error TODO: We should not be accessing `context` like this here.\n const tenant = context.tenancy?.getCurrentTenant();\n\n return [tenant ? `tenant:${tenant.id}` : null, plugins.length.toString()]\n .filter(Boolean)\n .join(\"#\");\n};\n\nconst formatErrorPayload = (error: Error): string => {\n if (error instanceof WebinyError) {\n return JSON.stringify({\n type: \"CoreGraphQLWebinyError\",\n message: error.message,\n code: error.code,\n data: error.data,\n stack: error.stack\n });\n }\n\n return JSON.stringify({\n type: \"Error\",\n name: error.name,\n message: error.message,\n stack: error.stack\n });\n};\n\nexport default (options: HandlerGraphQLOptions = {}): Plugin[] => {\n let schema: GraphQLSchema | undefined = undefined;\n let cacheKey: string | undefined = undefined;\n\n const debug = toBoolean(options.debug);\n\n const path = options?.path || \"/graphql\";\n\n const route = new RoutePlugin(async ({ onPost, onOptions, context }) => {\n onOptions(path, async (_, reply) => {\n return reply\n .status(204)\n .headers({\n \"Cache-Control\": `public, max-age=${DEFAULT_CACHE_MAX_AGE}`\n })\n .send({})\n .hijack();\n });\n onPost(path, async (request, reply) => {\n const contextCacheKey = createCacheKey(context as Context);\n if (!schema || cacheKey !== contextCacheKey) {\n try {\n schema = await createGraphQLSchema(context);\n cacheKey = contextCacheKey;\n } catch (ex) {\n return reply.code(500).send(formatErrorPayload(ex));\n }\n }\n let body: GraphQLRequestBody | GraphQLRequestBody[];\n try {\n body = createRequestBody(request.body);\n } catch (ex) {\n console.error(`Error while creating the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n try {\n const result = await processRequestBody(body, schema, context);\n /**\n * IMPORTANT! Do not send anything if reply was already sent.\n */\n if (reply.sent) {\n console.warn(\"Reply already sent, cannot send the result (handler-graphql).\");\n return reply;\n }\n return reply.status(200).send(result);\n } catch (ex) {\n console.error(`Error while processing the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n });\n });\n\n route.name = \"handler.graphql.route.default\";\n\n return [\n ...(debug ? debugPlugins() : []),\n {\n type: \"wcp-telemetry-tracker\"\n },\n route\n ];\n};\n"],"names":["DEFAULT_CACHE_MAX_AGE","createCacheKey","context","plugins","getSchemaPlugins","tenant","Boolean","formatErrorPayload","error","WebinyError","JSON","options","schema","cacheKey","debug","toBoolean","path","route","RoutePlugin","onPost","onOptions","_","reply","request","contextCacheKey","createGraphQLSchema","ex","body","createRequestBody","console","result","processRequestBody","debugPlugins"],"mappings":";;;;;;;AAYA,MAAMA,wBAAwB;AAE9B,MAAMC,iBAAiB,CAACC;IACpB,MAAMC,UAAUC,iBAAiBF;IAMjC,MAAMG,SAASH,QAAQ,OAAO,EAAE;IAEhC,OAAO;QAACG,SAAS,CAAC,OAAO,EAAEA,OAAO,EAAE,EAAE,GAAG;QAAMF,QAAQ,MAAM,CAAC,QAAQ;KAAG,CACpE,MAAM,CAACG,SACP,IAAI,CAAC;AACd;AAEA,MAAMC,qBAAqB,CAACC;IACxB,IAAIA,iBAAiBC,eACjB,OAAOC,KAAK,SAAS,CAAC;QAClB,MAAM;QACN,SAASF,MAAM,OAAO;QACtB,MAAMA,MAAM,IAAI;QAChB,MAAMA,MAAM,IAAI;QAChB,OAAOA,MAAM,KAAK;IACtB;IAGJ,OAAOE,KAAK,SAAS,CAAC;QAClB,MAAM;QACN,MAAMF,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,OAAOA,MAAM,KAAK;IACtB;AACJ;AAEA,6BAAgB,CAAAG,UAAiC,CAAC,CAAC;IAC/C,IAAIC;IACJ,IAAIC;IAEJ,MAAMC,QAAQC,UAAUJ,QAAQ,KAAK;IAErC,MAAMK,OAAOL,SAAS,QAAQ;IAE9B,MAAMM,QAAQ,IAAIC,YAAY,OAAO,EAAEC,MAAM,EAAEC,SAAS,EAAElB,OAAO,EAAE;QAC/DkB,UAAUJ,MAAM,OAAOK,GAAGC,QACfA,MACF,MAAM,CAAC,KACP,OAAO,CAAC;gBACL,iBAAiB,CAAC,gBAAgB,EAAEtB,uBAAuB;YAC/D,GACC,IAAI,CAAC,CAAC,GACN,MAAM;QAEfmB,OAAOH,MAAM,OAAOO,SAASD;YACzB,MAAME,kBAAkBvB,eAAeC;YACvC,IAAI,CAACU,UAAUC,aAAaW,iBACxB,IAAI;gBACAZ,SAAS,MAAMa,oBAAoBvB;gBACnCW,WAAWW;YACf,EAAE,OAAOE,IAAI;gBACT,OAAOJ,MAAM,IAAI,CAAC,KAAK,IAAI,CAACf,mBAAmBmB;YACnD;YAEJ,IAAIC;YACJ,IAAI;gBACAA,OAAOC,kBAAkBL,QAAQ,IAAI;YACzC,EAAE,OAAOG,IAAI;gBACTG,QAAQ,KAAK,CAAC;gBACdA,QAAQ,KAAK,CAACtB,mBAAmBmB;gBACjC,MAAMA;YACV;YACA,IAAI;gBACA,MAAMI,SAAS,MAAMC,mBAAmBJ,MAAMf,QAAQV;gBAItD,IAAIoB,MAAM,IAAI,EAAE;oBACZO,QAAQ,IAAI,CAAC;oBACb,OAAOP;gBACX;gBACA,OAAOA,MAAM,MAAM,CAAC,KAAK,IAAI,CAACQ;YAClC,EAAE,OAAOJ,IAAI;gBACTG,QAAQ,KAAK,CAAC;gBACdA,QAAQ,KAAK,CAACtB,mBAAmBmB;gBACjC,MAAMA;YACV;QACJ;IACJ;IAEAT,MAAM,IAAI,GAAG;IAEb,OAAO;WACCH,QAAQkB,iBAAiB,EAAE;QAC/B;YACI,MAAM;QACV;QACAf;KACH;AACL"}
|
package/createGraphQLSchema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from "@webiny/api/types";
|
|
2
|
-
import type { GraphQLSchemaPlugin } from "./plugins";
|
|
3
|
-
export declare const getSchemaPlugins: (context: Context) => import("@webiny/plugins/PluginsContainer").WithName<GraphQLSchemaPlugin<Context>>[];
|
|
4
|
-
export declare const createGraphQLSchema: (context: Context) => import("graphql").GraphQLSchema
|
|
1
|
+
import type { Context } from "@webiny/api/types.js";
|
|
2
|
+
import type { GraphQLSchemaPlugin } from "./plugins/index.js";
|
|
3
|
+
export declare const getSchemaPlugins: (context: Context) => import("@webiny/plugins/PluginsContainer.js").WithName<GraphQLSchemaPlugin<Context>>[];
|
|
4
|
+
export declare const createGraphQLSchema: (context: Context) => Promise<import("graphql").GraphQLSchema>;
|
package/createGraphQLSchema.js
CHANGED
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.getSchemaPlugins = getSchemaPlugins;
|
|
22
|
-
const createGraphQLSchema = context => {
|
|
23
|
-
const scalars = context.plugins.byType("graphql-scalar").map(item => item.scalar);
|
|
24
|
-
|
|
25
|
-
// TODO: once the API packages are more closed, we'll have the opportunity
|
|
26
|
-
// TODO: to maybe import the @ps directive from `api-prerendering-service` package.
|
|
27
|
-
const typeDefs = [(0, _graphqlTag.default)`
|
|
1
|
+
import graphql_tag from "graphql-tag";
|
|
2
|
+
import { makeExecutableSchema } from "@graphql-tools/schema";
|
|
3
|
+
import { mergeResolvers } from "@graphql-tools/merge";
|
|
4
|
+
import { AnyScalar, DateScalar, DateTimeScalar, IconScalar, JsonScalar, LongScalar, NumberScalar, RefInputScalar, TimeScalar } from "./builtInTypes/index.js";
|
|
5
|
+
import { ResolverDecoration } from "./ResolverDecoration.js";
|
|
6
|
+
import { GraphQLSchemaComposer } from "./features/GraphQLSchemaBuilder/abstractions.js";
|
|
7
|
+
import { GraphQLSchemaComposerFeature } from "./features/GraphQLSchemaBuilder/feature.js";
|
|
8
|
+
const getSchemaPlugins = (context)=>context.plugins.byType("graphql-schema").filter((pl)=>{
|
|
9
|
+
if ("function" == typeof pl.isApplicable) return pl.isApplicable(context);
|
|
10
|
+
return true;
|
|
11
|
+
});
|
|
12
|
+
const createGraphQLSchema = async (context)=>{
|
|
13
|
+
GraphQLSchemaComposerFeature.register(context.container);
|
|
14
|
+
const scalars = context.plugins.byType("graphql-scalar").map((item)=>item.scalar);
|
|
15
|
+
const typeDefs = [
|
|
16
|
+
graphql_tag`
|
|
28
17
|
type Query
|
|
29
18
|
type Mutation
|
|
30
|
-
${scalars.map(scalar
|
|
19
|
+
${scalars.map((scalar)=>`scalar ${scalar.name}`).join(" ")}
|
|
31
20
|
scalar JSON
|
|
32
21
|
scalar Long
|
|
22
|
+
scalar Icon
|
|
33
23
|
scalar RefInput
|
|
34
24
|
scalar Number
|
|
35
25
|
scalar Any
|
|
@@ -37,11 +27,6 @@ const createGraphQLSchema = context => {
|
|
|
37
27
|
scalar DateTime
|
|
38
28
|
scalar Time
|
|
39
29
|
|
|
40
|
-
# This directive doesn't do anything on the GraphQL resolution level. It just serves
|
|
41
|
-
# as a way to tell the Prerendering Service whether the GraphQL query needs to be
|
|
42
|
-
# cached or not.
|
|
43
|
-
directive @ps(cache: Boolean) on QUERY
|
|
44
|
-
|
|
45
30
|
type Error {
|
|
46
31
|
code: String
|
|
47
32
|
message: String
|
|
@@ -53,41 +38,44 @@ const createGraphQLSchema = context => {
|
|
|
53
38
|
data: Boolean
|
|
54
39
|
error: Error
|
|
55
40
|
}
|
|
56
|
-
`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
resolverDecoration.addDecorators(schema.resolverDecorators);
|
|
41
|
+
`
|
|
42
|
+
];
|
|
43
|
+
const resolvers = [
|
|
44
|
+
{
|
|
45
|
+
...scalars.reduce((acc, s)=>{
|
|
46
|
+
acc[s.name] = s;
|
|
47
|
+
return acc;
|
|
48
|
+
}, {}),
|
|
49
|
+
JSON: JsonScalar,
|
|
50
|
+
Long: LongScalar,
|
|
51
|
+
RefInput: RefInputScalar,
|
|
52
|
+
Number: NumberScalar,
|
|
53
|
+
Any: AnyScalar,
|
|
54
|
+
DateTime: DateTimeScalar,
|
|
55
|
+
Date: DateScalar,
|
|
56
|
+
Time: TimeScalar,
|
|
57
|
+
Icon: IconScalar
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
const resolverDecoration = new ResolverDecoration();
|
|
61
|
+
const plugins = getSchemaPlugins(context);
|
|
62
|
+
for (const plugin of plugins){
|
|
63
|
+
const schema = plugin.schema;
|
|
64
|
+
if (schema.typeDefs) typeDefs.push(schema.typeDefs);
|
|
65
|
+
if (schema.resolvers) resolvers.push(schema.resolvers);
|
|
66
|
+
if (schema.resolverDecorators) resolverDecoration.addDecorators(schema.resolverDecorators);
|
|
83
67
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
typeDefs
|
|
87
|
-
resolvers
|
|
88
|
-
|
|
89
|
-
|
|
68
|
+
const graphQLSchemaComposer = context.container.resolve(GraphQLSchemaComposer);
|
|
69
|
+
const schema = await graphQLSchemaComposer.build();
|
|
70
|
+
if (schema.typeDefs) typeDefs.push(schema.typeDefs);
|
|
71
|
+
if (schema.resolvers) resolvers.push(schema.resolvers);
|
|
72
|
+
if (schema.resolverDecorators) resolverDecoration.addDecorators(schema.resolverDecorators);
|
|
73
|
+
return makeExecutableSchema({
|
|
74
|
+
typeDefs,
|
|
75
|
+
resolvers: resolverDecoration.decorateResolvers(mergeResolvers(resolvers)),
|
|
76
|
+
inheritResolversFromInterfaces: true
|
|
77
|
+
});
|
|
90
78
|
};
|
|
91
|
-
|
|
79
|
+
export { createGraphQLSchema, getSchemaPlugins };
|
|
92
80
|
|
|
93
81
|
//# sourceMappingURL=createGraphQLSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"createGraphQLSchema.js","sources":["../src/createGraphQLSchema.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { makeExecutableSchema } from \"@graphql-tools/schema\";\nimport { mergeResolvers } from \"@graphql-tools/merge\";\nimport type { GraphQLScalarType } from \"graphql/type/definition.js\";\nimport type { GraphQLScalarPlugin, Resolvers, TypeDefs } from \"./types.js\";\nimport type { Context } from \"@webiny/api/types.js\";\nimport {\n RefInputScalar,\n NumberScalar,\n AnyScalar,\n DateScalar,\n DateTimeScalar,\n JsonScalar,\n TimeScalar,\n LongScalar,\n IconScalar\n} from \"./builtInTypes/index.js\";\nimport { ResolverDecoration } from \"./ResolverDecoration.js\";\nimport type { GraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { GraphQLSchemaComposer } from \"~/features/GraphQLSchemaBuilder/abstractions.js\";\nimport { GraphQLSchemaComposerFeature } from \"~/features/GraphQLSchemaBuilder/feature.js\";\n\nexport const getSchemaPlugins = (context: Context) => {\n return context.plugins.byType<GraphQLSchemaPlugin>(\"graphql-schema\").filter(pl => {\n if (typeof pl.isApplicable === \"function\") {\n return pl.isApplicable(context);\n }\n return true;\n });\n};\n\nexport const createGraphQLSchema = async (context: Context) => {\n GraphQLSchemaComposerFeature.register(context.container);\n\n const scalars = context.plugins\n .byType<GraphQLScalarPlugin>(\"graphql-scalar\")\n .map(item => item.scalar);\n\n const typeDefs: TypeDefs[] = [\n gql`\n type Query\n type Mutation\n ${scalars.map(scalar => `scalar ${scalar.name}`).join(\" \")}\n scalar JSON\n scalar Long\n scalar Icon\n scalar RefInput\n scalar Number\n scalar Any\n scalar Date\n scalar DateTime\n scalar Time\n\n type Error {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type BooleanResponse {\n data: Boolean\n error: Error\n }\n `\n ];\n\n const resolvers: Resolvers<any>[] = [\n {\n ...scalars.reduce<Record<string, GraphQLScalarType>>((acc, s) => {\n acc[s.name] = s;\n return acc;\n }, {}),\n JSON: JsonScalar,\n Long: LongScalar,\n RefInput: RefInputScalar,\n Number: NumberScalar,\n Any: AnyScalar,\n DateTime: DateTimeScalar,\n Date: DateScalar,\n Time: TimeScalar,\n Icon: IconScalar\n }\n ];\n\n const resolverDecoration = new ResolverDecoration();\n\n // Process legacy plugins\n const plugins = getSchemaPlugins(context);\n\n for (const plugin of plugins) {\n const schema = plugin.schema;\n if (schema.typeDefs) {\n typeDefs.push(schema.typeDefs);\n }\n if (schema.resolvers) {\n resolvers.push(schema.resolvers);\n }\n if (schema.resolverDecorators) {\n resolverDecoration.addDecorators(schema.resolverDecorators);\n }\n }\n\n // Process new DI implementations\n const graphQLSchemaComposer = context.container.resolve(GraphQLSchemaComposer);\n const schema = await graphQLSchemaComposer.build();\n\n if (schema.typeDefs) {\n typeDefs.push(schema.typeDefs);\n }\n if (schema.resolvers) {\n resolvers.push(schema.resolvers);\n }\n if (schema.resolverDecorators) {\n resolverDecoration.addDecorators(schema.resolverDecorators);\n }\n\n // Create executable schema\n return makeExecutableSchema({\n typeDefs,\n resolvers: resolverDecoration.decorateResolvers(mergeResolvers(resolvers)),\n inheritResolversFromInterfaces: true\n });\n};\n"],"names":["getSchemaPlugins","context","pl","createGraphQLSchema","GraphQLSchemaComposerFeature","scalars","item","typeDefs","gql","scalar","resolvers","acc","s","JsonScalar","LongScalar","RefInputScalar","NumberScalar","AnyScalar","DateTimeScalar","DateScalar","TimeScalar","IconScalar","resolverDecoration","ResolverDecoration","plugins","plugin","schema","graphQLSchemaComposer","GraphQLSchemaComposer","makeExecutableSchema","mergeResolvers"],"mappings":";;;;;;;AAsBO,MAAMA,mBAAmB,CAACC,UACtBA,QAAQ,OAAO,CAAC,MAAM,CAAsB,kBAAkB,MAAM,CAACC,CAAAA;QACxE,IAAI,AAA2B,cAA3B,OAAOA,GAAG,YAAY,EACtB,OAAOA,GAAG,YAAY,CAACD;QAE3B,OAAO;IACX;AAGG,MAAME,sBAAsB,OAAOF;IACtCG,6BAA6B,QAAQ,CAACH,QAAQ,SAAS;IAEvD,MAAMI,UAAUJ,QAAQ,OAAO,CAC1B,MAAM,CAAsB,kBAC5B,GAAG,CAACK,CAAAA,OAAQA,KAAK,MAAM;IAE5B,MAAMC,WAAuB;QACzBC,WAAG,CAAC;;;YAGA,EAAEH,QAAQ,GAAG,CAACI,CAAAA,SAAU,CAAC,OAAO,EAAEA,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;QAsB/D,CAAC;KACJ;IAED,MAAMC,YAA8B;QAChC;YACI,GAAGL,QAAQ,MAAM,CAAoC,CAACM,KAAKC;gBACvDD,GAAG,CAACC,EAAE,IAAI,CAAC,GAAGA;gBACd,OAAOD;YACX,GAAG,CAAC,EAAE;YACN,MAAME;YACN,MAAMC;YACN,UAAUC;YACV,QAAQC;YACR,KAAKC;YACL,UAAUC;YACV,MAAMC;YACN,MAAMC;YACN,MAAMC;QACV;KACH;IAED,MAAMC,qBAAqB,IAAIC;IAG/B,MAAMC,UAAUxB,iBAAiBC;IAEjC,KAAK,MAAMwB,UAAUD,QAAS;QAC1B,MAAME,SAASD,OAAO,MAAM;QAC5B,IAAIC,OAAO,QAAQ,EACfnB,SAAS,IAAI,CAACmB,OAAO,QAAQ;QAEjC,IAAIA,OAAO,SAAS,EAChBhB,UAAU,IAAI,CAACgB,OAAO,SAAS;QAEnC,IAAIA,OAAO,kBAAkB,EACzBJ,mBAAmB,aAAa,CAACI,OAAO,kBAAkB;IAElE;IAGA,MAAMC,wBAAwB1B,QAAQ,SAAS,CAAC,OAAO,CAAC2B;IACxD,MAAMF,SAAS,MAAMC,sBAAsB,KAAK;IAEhD,IAAID,OAAO,QAAQ,EACfnB,SAAS,IAAI,CAACmB,OAAO,QAAQ;IAEjC,IAAIA,OAAO,SAAS,EAChBhB,UAAU,IAAI,CAACgB,OAAO,SAAS;IAEnC,IAAIA,OAAO,kBAAkB,EACzBJ,mBAAmB,aAAa,CAACI,OAAO,kBAAkB;IAI9D,OAAOG,qBAAqB;QACxBtB;QACA,WAAWe,mBAAmB,iBAAiB,CAACQ,eAAepB;QAC/D,gCAAgC;IACpC;AACJ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { WebinyError } from "@webiny/error";
|
|
3
|
+
import { createZodError } from "@webiny/utils/createZodError.js";
|
|
4
|
+
const requestBodySchema = zod.looseObject({
|
|
5
|
+
query: zod.string(),
|
|
6
|
+
variables: zod.record(zod.string(), zod.any()).nullish().optional(),
|
|
7
|
+
operationName: zod.string().nullish().optional().transform((value)=>value || void 0)
|
|
8
|
+
});
|
|
9
|
+
const schema = zod.union([
|
|
10
|
+
requestBodySchema,
|
|
11
|
+
zod.array(requestBodySchema)
|
|
12
|
+
]);
|
|
13
|
+
const createRequestBody = (input)=>{
|
|
14
|
+
const body = "string" == typeof input ? JSON.parse(input) : input;
|
|
15
|
+
const result = schema.safeParse(body);
|
|
16
|
+
if (!result.success) {
|
|
17
|
+
const error = createZodError(result.error);
|
|
18
|
+
throw new WebinyError({
|
|
19
|
+
message: "Invalid GraphQL request! Check your query and variables.",
|
|
20
|
+
code: "GRAPHQL_REQUEST_INVALID",
|
|
21
|
+
data: error.data
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return result.data;
|
|
25
|
+
};
|
|
26
|
+
export { createRequestBody };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=createRequestBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRequestBody.js","sources":["../src/createRequestBody.ts"],"sourcesContent":["import zod from \"zod\";\nimport { WebinyError } from \"@webiny/error\";\nimport { createZodError } from \"@webiny/utils/createZodError.js\";\nimport type { GraphQLRequestBody } from \"~/types.js\";\n\nconst requestBodySchema = zod.looseObject({\n query: zod.string(),\n variables: zod.record(zod.string(), zod.any()).nullish().optional(),\n operationName: zod\n .string()\n .nullish()\n .optional()\n .transform(value => {\n return value || undefined;\n })\n});\n\nconst schema = zod.union([requestBodySchema, zod.array(requestBodySchema)]);\n\nexport const createRequestBody = (input: unknown): GraphQLRequestBody | GraphQLRequestBody[] => {\n const body = typeof input === \"string\" ? JSON.parse(input) : input;\n\n const result = schema.safeParse(body);\n if (!result.success) {\n const error = createZodError(result.error);\n throw new WebinyError({\n message: \"Invalid GraphQL request! Check your query and variables.\",\n code: \"GRAPHQL_REQUEST_INVALID\",\n data: error.data\n });\n }\n return result.data;\n};\n"],"names":["requestBodySchema","zod","value","undefined","schema","createRequestBody","input","body","JSON","result","error","createZodError","WebinyError"],"mappings":";;;AAKA,MAAMA,oBAAoBC,IAAI,WAAW,CAAC;IACtC,OAAOA,IAAI,MAAM;IACjB,WAAWA,IAAI,MAAM,CAACA,IAAI,MAAM,IAAIA,IAAI,GAAG,IAAI,OAAO,GAAG,QAAQ;IACjE,eAAeA,IAAAA,MACJ,GACN,OAAO,GACP,QAAQ,GACR,SAAS,CAACC,CAAAA,QACAA,SAASC;AAE5B;AAEA,MAAMC,SAASH,IAAI,KAAK,CAAC;IAACD;IAAmBC,IAAI,KAAK,CAACD;CAAmB;AAEnE,MAAMK,oBAAoB,CAACC;IAC9B,MAAMC,OAAO,AAAiB,YAAjB,OAAOD,QAAqBE,KAAK,KAAK,CAACF,SAASA;IAE7D,MAAMG,SAASL,OAAO,SAAS,CAACG;IAChC,IAAI,CAACE,OAAO,OAAO,EAAE;QACjB,MAAMC,QAAQC,eAAeF,OAAO,KAAK;QACzC,MAAM,IAAIG,YAAY;YAClB,SAAS;YACT,MAAM;YACN,MAAMF,MAAM,IAAI;QACpB;IACJ;IACA,OAAOD,OAAO,IAAI;AACtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ResolverDecorator } from "./types";
|
|
1
|
+
import type { ResolverDecorator } from "./types.js";
|
|
2
2
|
export declare const createResolverDecorator: <TSource = any, TContext = any, TArgs = any>(decorator: ResolverDecorator<TSource, TContext, TArgs>) => ResolverDecorator<TSource, TContext, TArgs>;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createResolverDecorator = void 0;
|
|
7
|
-
const createResolverDecorator = decorator => {
|
|
8
|
-
return decorator;
|
|
9
|
-
};
|
|
10
|
-
exports.createResolverDecorator = createResolverDecorator;
|
|
1
|
+
const createResolverDecorator = (decorator)=>decorator;
|
|
2
|
+
export { createResolverDecorator };
|
|
11
3
|
|
|
12
4
|
//# sourceMappingURL=createResolverDecorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"createResolverDecorator.js","sources":["../src/createResolverDecorator.ts"],"sourcesContent":["import type { ResolverDecorator } from \"./types.js\";\n\nexport const createResolverDecorator = <TSource = any, TContext = any, TArgs = any>(\n decorator: ResolverDecorator<TSource, TContext, TArgs>\n) => {\n return decorator;\n};\n"],"names":["createResolverDecorator","decorator"],"mappings":"AAEO,MAAMA,0BAA0B,CACnCC,YAEOA"}
|
package/debugPlugins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GraphQLAfterQueryPlugin } from "./types";
|
|
2
|
-
import type { Context } from "@webiny/api/types";
|
|
1
|
+
import type { GraphQLAfterQueryPlugin } from "./types.js";
|
|
2
|
+
import type { Context } from "@webiny/api/types.js";
|
|
3
3
|
import { ContextPlugin } from "@webiny/api";
|
|
4
4
|
interface Log {
|
|
5
5
|
method: string;
|
|
@@ -10,5 +10,5 @@ interface DebugContext extends Context {
|
|
|
10
10
|
logs?: Log[];
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
declare const _default: () => (ContextPlugin<DebugContext> | GraphQLAfterQueryPlugin<DebugContext>)[];
|
|
14
13
|
export default _default;
|
|
14
|
+
declare function _default(): (ContextPlugin<DebugContext> | GraphQLAfterQueryPlugin<DebugContext>)[];
|
package/debugPlugins.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) {
|
|
28
|
-
result["extensions"] = {
|
|
29
|
-
console: [...(context.debug.logs || [])]
|
|
30
|
-
};
|
|
31
|
-
if (context.debug.logs) {
|
|
32
|
-
context.debug.logs.length = 0;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}];
|
|
36
|
-
exports.default = _default;
|
|
1
|
+
import { interceptConsole } from "./interceptConsole.js";
|
|
2
|
+
import { ContextPlugin } from "@webiny/api";
|
|
3
|
+
const debugPlugins = ()=>[
|
|
4
|
+
new ContextPlugin(async (context)=>{
|
|
5
|
+
if (!context.debug) context.debug = {};
|
|
6
|
+
if (!context.debug.logs) context.debug.logs = [];
|
|
7
|
+
interceptConsole((method, args)=>{
|
|
8
|
+
context.debug.logs.push({
|
|
9
|
+
method,
|
|
10
|
+
args
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
}),
|
|
14
|
+
{
|
|
15
|
+
type: "graphql-after-query",
|
|
16
|
+
apply ({ result, context }) {
|
|
17
|
+
result["extensions"] = {
|
|
18
|
+
console: [
|
|
19
|
+
...context.debug.logs || []
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
if (context.debug.logs) context.debug.logs.length = 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
export default debugPlugins;
|
|
37
27
|
|
|
38
28
|
//# sourceMappingURL=debugPlugins.js.map
|
package/debugPlugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"debugPlugins.js","sources":["../src/debugPlugins.ts"],"sourcesContent":["import { interceptConsole } from \"./interceptConsole.js\";\nimport type { GraphQLAfterQueryPlugin } from \"./types.js\";\nimport type { Context } from \"@webiny/api/types.js\";\nimport { ContextPlugin } from \"@webiny/api\";\n\ninterface Log {\n method: string;\n args: any;\n}\ninterface DebugContext extends Context {\n debug: {\n logs?: Log[];\n };\n}\n\nexport default () => [\n new ContextPlugin<DebugContext>(async context => {\n if (!context.debug) {\n context.debug = {};\n }\n\n if (!context.debug.logs) {\n context.debug.logs = [];\n }\n\n interceptConsole((method, args) => {\n (context.debug.logs as Log[]).push({ method, args });\n });\n }),\n {\n type: \"graphql-after-query\",\n apply({ result, context }) {\n result[\"extensions\"] = { console: [...(context.debug.logs || [])] };\n if (context.debug.logs) {\n context.debug.logs.length = 0;\n }\n }\n } as GraphQLAfterQueryPlugin<DebugContext>\n];\n"],"names":["ContextPlugin","context","interceptConsole","method","args","result"],"mappings":";;AAeA,qBAAgB,IAAK;QACjB,IAAIA,cAA4B,OAAMC;YAClC,IAAI,CAACA,QAAQ,KAAK,EACdA,QAAQ,KAAK,GAAG,CAAC;YAGrB,IAAI,CAACA,QAAQ,KAAK,CAAC,IAAI,EACnBA,QAAQ,KAAK,CAAC,IAAI,GAAG,EAAE;YAG3BC,iBAAiB,CAACC,QAAQC;gBACrBH,QAAQ,KAAK,CAAC,IAAI,CAAW,IAAI,CAAC;oBAAEE;oBAAQC;gBAAK;YACtD;QACJ;QACA;YACI,MAAM;YACN,OAAM,EAAEC,MAAM,EAAEJ,OAAO,EAAE;gBACrBI,MAAM,CAAC,aAAa,GAAG;oBAAE,SAAS;2BAAKJ,QAAQ,KAAK,CAAC,IAAI,IAAI,EAAE;qBAAE;gBAAC;gBAClE,IAAIA,QAAQ,KAAK,CAAC,IAAI,EAClBA,QAAQ,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG;YAEpC;QACJ;KACJ"}
|