@eddeee888/gcg-typescript-resolver-files 0.5.0 → 0.7.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/README.md +34 -0
- package/package.json +3 -2
- package/src/addVirtualTypesFileToTsMorphProject/addVirtualTypesFileToTsMorphProject.d.ts +5 -2
- package/src/addVirtualTypesFileToTsMorphProject/addVirtualTypesFileToTsMorphProject.js +27 -7
- package/src/addVirtualTypesFileToTsMorphProject/addVirtualTypesFileToTsMorphProject.js.map +1 -1
- package/src/defineConfig.d.ts +3 -2
- package/src/defineConfig.js +3 -2
- package/src/defineConfig.js.map +1 -1
- package/src/generateResolverFiles/addExternalResolverImport.d.ts +7 -0
- package/src/generateResolverFiles/addExternalResolverImport.js +41 -18
- package/src/generateResolverFiles/addExternalResolverImport.js.map +1 -1
- package/src/generateResolverFiles/addResolverMainFiles.d.ts +10 -0
- package/src/generateResolverFiles/{addResolverMainFile.js → addResolverMainFiles.js} +79 -23
- package/src/generateResolverFiles/addResolverMainFiles.js.map +1 -0
- package/src/generateResolverFiles/generateResolverFiles.js +46 -5
- package/src/generateResolverFiles/generateResolverFiles.js.map +1 -1
- package/src/generateResolverFiles/getVariableStatementWithExpectedIdentifier.js +14 -0
- package/src/generateResolverFiles/getVariableStatementWithExpectedIdentifier.js.map +1 -1
- package/src/generateResolverFiles/handleGraphQLInterfaceType.d.ts +2 -0
- package/src/generateResolverFiles/handleGraphQLInterfaceType.js +32 -0
- package/src/generateResolverFiles/handleGraphQLInterfaceType.js.map +1 -0
- package/src/generateResolverFiles/handleGraphQLObjectType.d.ts +3 -1
- package/src/generateResolverFiles/handleGraphQLObjectType.js +28 -4
- package/src/generateResolverFiles/handleGraphQLObjectType.js.map +1 -1
- package/src/generateResolverFiles/handleGraphQLRootObjectTypeField.js +12 -4
- package/src/generateResolverFiles/handleGraphQLRootObjectTypeField.js.map +1 -1
- package/src/generateResolverFiles/handleGraphQLScalarType.js +20 -3
- package/src/generateResolverFiles/handleGraphQLScalarType.js.map +1 -1
- package/src/generateResolverFiles/handleGraphQLUnionType.d.ts +2 -0
- package/src/generateResolverFiles/{handleGraphQLUninionType.js → handleGraphQLUnionType.js} +9 -4
- package/src/generateResolverFiles/handleGraphQLUnionType.js.map +1 -0
- package/src/generateResolverFiles/types.d.ts +13 -7
- package/src/generateResolverFiles/visitNamedType.d.ts +6 -1
- package/src/generateResolverFiles/visitNamedType.js +32 -10
- package/src/generateResolverFiles/visitNamedType.js.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -1
- package/src/index.js.map +1 -1
- package/src/normalizeAddConfigPath/index.d.ts +1 -0
- package/src/normalizeAddConfigPath/index.js +5 -0
- package/src/normalizeAddConfigPath/index.js.map +1 -0
- package/src/normalizeAddConfigPath/normalizeAddConfigPath.d.ts +11 -0
- package/src/normalizeAddConfigPath/normalizeAddConfigPath.js +22 -0
- package/src/normalizeAddConfigPath/normalizeAddConfigPath.js.map +1 -0
- package/src/parseTypeMappers/collectTypeMappersFromSourceFile.js +19 -0
- package/src/parseTypeMappers/collectTypeMappersFromSourceFile.js.map +1 -1
- package/src/preset.js +18 -6
- package/src/preset.js.map +1 -1
- package/src/utils/getNodePropertyMap.js +26 -0
- package/src/utils/getNodePropertyMap.js.map +1 -1
- package/src/utils/printImportLine.d.ts +10 -1
- package/src/utils/printImportLine.js +6 -3
- package/src/utils/printImportLine.js.map +1 -1
- package/src/validateAndMergeParsedConfigs/validateAndMergeParsedConfigs.js +1 -4
- package/src/validateAndMergeParsedConfigs/validateAndMergeParsedConfigs.js.map +1 -1
- package/src/validatePresetConfig/validatePresetConfig.d.ts +19 -2
- package/src/validatePresetConfig/validatePresetConfig.js +66 -8
- package/src/validatePresetConfig/validatePresetConfig.js.map +1 -1
- package/src/generateResolverFiles/addResolverMainFile.d.ts +0 -5
- package/src/generateResolverFiles/addResolverMainFile.js.map +0 -1
- package/src/generateResolverFiles/handleGraphQLUninionType.d.ts +0 -2
- package/src/generateResolverFiles/handleGraphQLUninionType.js.map +0 -1
package/README.md
CHANGED
|
@@ -136,6 +136,17 @@ How to generate file/s that put resolvers map together:
|
|
|
136
136
|
|
|
137
137
|
File that puts all generated resolvers together. Relative from `baseOutputDir`.
|
|
138
138
|
|
|
139
|
+
### resolverGeneration
|
|
140
|
+
|
|
141
|
+
`disabled` or `recommended` or `all` (Default: `recommended`)
|
|
142
|
+
|
|
143
|
+
Decides which resolvers to generate:
|
|
144
|
+
|
|
145
|
+
- `disabled`: generates no resolvers. Use this if you want to use your own structures. Note: if custom scalars are detected and used, resolver main files are still generated.
|
|
146
|
+
- `recommended`: generates the minimal amount of resolvers. Use this if you want a managed experience.
|
|
147
|
+
- no union/interface resolvers are generated because we rely on certain settings in `typescript-resolvers` that make these not required.
|
|
148
|
+
- `all`: generates all resolvers. Use this if you want all resolvers to be generated and use the ones you need.
|
|
149
|
+
|
|
139
150
|
### typeDefsFileMode
|
|
140
151
|
|
|
141
152
|
`merged` or `mergedWhitelisted` or `modules` (Default: `merged`)
|
|
@@ -158,6 +169,29 @@ If `typeDefsFileMode=merged` or `typeDefsFileMode=mergedWhitelisted`, this path
|
|
|
158
169
|
|
|
159
170
|
If `typeDefsFileMode=modules`, this path is relative from each module directory.
|
|
160
171
|
|
|
172
|
+
### add
|
|
173
|
+
|
|
174
|
+
`Record<string, (@graphql-codegen/add).AddPluginConfig>` (Default: `undefined`) (EXPERIMENTAL)
|
|
175
|
+
|
|
176
|
+
Allows using [add](https://the-guild.dev/graphql/codegen/plugins/other/add) plugin on a given file.
|
|
177
|
+
|
|
178
|
+
Note: Currently only supports `resolverTypesPath` file i.e. `types.generated.ts`
|
|
179
|
+
|
|
180
|
+
Example:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
// codegen.ts
|
|
184
|
+
{
|
|
185
|
+
generates: {
|
|
186
|
+
'src/schema': defineConfig({
|
|
187
|
+
add: {
|
|
188
|
+
'./types.generated.ts': { content: '/* eslint-disable */' },
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
161
195
|
### whitelistedModules
|
|
162
196
|
|
|
163
197
|
`Array<string>` (Only works with `config.mode=modules`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eddeee888/gcg-typescript-resolver-files",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/eddeee888/graphql-code-generator-plugins.git",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"graphql": "^15.0.0 || ^16.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@eddeee888/gcg-server-config": "0.1.0",
|
|
30
31
|
"@graphql-codegen/add": "^5.0.0",
|
|
31
32
|
"@graphql-codegen/plugin-helpers": "^5.0.0",
|
|
32
33
|
"@graphql-codegen/typescript": "^4.0.0",
|
|
33
34
|
"@graphql-codegen/typescript-resolvers": "^4.0.0",
|
|
34
|
-
"ts-morph": "^
|
|
35
|
+
"ts-morph": "^19.0.0"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"directory": "../../dist/packages/typescript-resolver-files"
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { AddPluginConfig } from '@graphql-codegen/add/typings/config';
|
|
1
2
|
import type { GraphQLSchema } from 'graphql';
|
|
2
3
|
import { type SourceFile, Project } from 'ts-morph';
|
|
3
|
-
|
|
4
|
+
import type { ServerConfig } from '@eddeee888/gcg-server-config';
|
|
5
|
+
export declare const addVirtualTypesFileToTsMorphProject: ({ tsMorphProject, schemaAst, resolverTypesPath, resolverTypesConfig, addConfig, }: {
|
|
4
6
|
tsMorphProject: Project;
|
|
5
7
|
schemaAst: GraphQLSchema;
|
|
6
8
|
resolverTypesPath: string;
|
|
7
|
-
resolverTypesConfig:
|
|
9
|
+
resolverTypesConfig: ServerConfig;
|
|
10
|
+
addConfig?: AddPluginConfig | undefined;
|
|
8
11
|
}) => Promise<SourceFile>;
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addVirtualTypesFileToTsMorphProject = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const addPlugin = require("@graphql-codegen/add");
|
|
5
6
|
const typeScriptPlugin = require("@graphql-codegen/typescript");
|
|
6
7
|
const typeScriptResolversPlugin = require("@graphql-codegen/typescript-resolvers");
|
|
7
|
-
const addVirtualTypesFileToTsMorphProject = ({ tsMorphProject, schemaAst, resolverTypesPath, resolverTypesConfig, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const addVirtualTypesFileToTsMorphProject = ({ tsMorphProject, schemaAst, resolverTypesPath, resolverTypesConfig, addConfig, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
9
|
const typesFile = yield generateVirtualTypesFile({
|
|
9
10
|
schemaAst,
|
|
10
11
|
resolverTypesPath,
|
|
11
12
|
resolverTypesConfig,
|
|
13
|
+
addConfig,
|
|
12
14
|
});
|
|
13
15
|
const typesSourceFile = tsMorphProject.createSourceFile(typesFile.filePath, typesFile.content, { overwrite: true });
|
|
14
16
|
return typesSourceFile;
|
|
@@ -18,18 +20,36 @@ exports.addVirtualTypesFileToTsMorphProject = addVirtualTypesFileToTsMorphProjec
|
|
|
18
20
|
* getVirtualTypesFile generates a virtual types.generated.ts file
|
|
19
21
|
* This is used to statically detect and compare types in the parse and post-process steps
|
|
20
22
|
*/
|
|
21
|
-
const generateVirtualTypesFile = ({ schemaAst, resolverTypesPath, resolverTypesConfig, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
const [typescriptResult, typescriptResolversResult] = yield Promise.all([
|
|
23
|
+
const generateVirtualTypesFile = ({ schemaAst, resolverTypesPath, resolverTypesConfig, addConfig, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
const [typescriptResult, typescriptResolversResult, addResult] = yield Promise.all([
|
|
24
26
|
typeScriptPlugin.plugin(schemaAst, [], resolverTypesConfig),
|
|
25
27
|
typeScriptResolversPlugin.plugin(schemaAst, [], resolverTypesConfig),
|
|
28
|
+
addConfig ? addPlugin.plugin(schemaAst, [], addConfig) : '',
|
|
26
29
|
]);
|
|
30
|
+
const addResultAsComplextOutput = convertPluginOutputToComplextPluginOutput(addResult);
|
|
27
31
|
return {
|
|
28
32
|
filePath: resolverTypesPath,
|
|
29
33
|
content: `
|
|
30
|
-
${(_a =
|
|
31
|
-
${(_b =
|
|
32
|
-
${
|
|
34
|
+
${(_a = addResultAsComplextOutput.prepend) === null || _a === void 0 ? void 0 : _a.join('\n')}
|
|
35
|
+
${(_b = typescriptResult.prepend) === null || _b === void 0 ? void 0 : _b.join('\n')}
|
|
36
|
+
${(_c = typescriptResolversResult.prepend) === null || _c === void 0 ? void 0 : _c.join('\n')}
|
|
37
|
+
${typescriptResult.content}
|
|
38
|
+
${typescriptResolversResult.content}
|
|
39
|
+
${addResultAsComplextOutput.content}
|
|
40
|
+
${(_d = addResultAsComplextOutput.append) === null || _d === void 0 ? void 0 : _d.join('\n')}
|
|
41
|
+
`,
|
|
33
42
|
};
|
|
34
43
|
});
|
|
44
|
+
const convertPluginOutputToComplextPluginOutput = (output) => {
|
|
45
|
+
if (typeof output === 'string') {
|
|
46
|
+
return {
|
|
47
|
+
content: output || '',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(output.content)) {
|
|
51
|
+
output.content = output.content.join('\n');
|
|
52
|
+
}
|
|
53
|
+
return output;
|
|
54
|
+
};
|
|
35
55
|
//# sourceMappingURL=addVirtualTypesFileToTsMorphProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addVirtualTypesFileToTsMorphProject.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/addVirtualTypesFileToTsMorphProject/addVirtualTypesFileToTsMorphProject.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"addVirtualTypesFileToTsMorphProject.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/addVirtualTypesFileToTsMorphProject/addVirtualTypesFileToTsMorphProject.ts"],"names":[],"mappings":";;;;AACA,kDAAkD;AAElD,gEAAgE;AAChE,mFAAmF;AAK5E,MAAM,mCAAmC,GAAG,CAAO,EACxD,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,GAOV,EAAuB,EAAE;IACxB,MAAM,SAAS,GAAG,MAAM,wBAAwB,CAAC;QAC/C,SAAS;QACT,iBAAiB;QACjB,mBAAmB;QACnB,SAAS;KACV,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,cAAc,CAAC,gBAAgB,CACrD,SAAS,CAAC,QAAQ,EAClB,SAAS,CAAC,OAAO,EACjB,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AA3BW,QAAA,mCAAmC,uCA2B9C;AAEF;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAO,EACtC,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,GAMV,EAGE,EAAE;;IACH,MAAM,CAAC,gBAAgB,EAAE,yBAAyB,EAAE,SAAS,CAAC,GAC5D,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,mBAAmB,CAAC;QAC3D,yBAAyB,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,mBAAmB,CAAC;QACpE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;KAC5D,CAAC,CAAC;IAEL,MAAM,yBAAyB,GAC7B,yCAAyC,CAAC,SAAS,CAAC,CAAC;IAEvD,OAAO;QACL,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE;MACP,MAAA,yBAAyB,CAAC,OAAO,0CAAE,IAAI,CAAC,IAAI,CAAC;MAC7C,MAAA,gBAAgB,CAAC,OAAO,0CAAE,IAAI,CAAC,IAAI,CAAC;MACpC,MAAA,yBAAyB,CAAC,OAAO,0CAAE,IAAI,CAAC,IAAI,CAAC;MAC7C,gBAAgB,CAAC,OAAO;MACxB,yBAAyB,CAAC,OAAO;MACjC,yBAAyB,CAAC,OAAO;MACjC,MAAA,yBAAyB,CAAC,MAAM,0CAAE,IAAI,CAAC,IAAI,CAAC;KAC7C;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,yCAAyC,GAAG,CAChD,MAA0B,EACC,EAAE;IAC7B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,EAAE;SACtB,CAAC;KACH;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QACjC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC5C;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/src/defineConfig.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@graphql-codegen/plugin-helpers';
|
|
2
2
|
import type { TypedPresetConfig } from './validatePresetConfig';
|
|
3
3
|
export declare const defineConfig: (presetConfig?: TypedPresetConfig, context?: {
|
|
4
|
-
baseOutputDir
|
|
5
|
-
|
|
4
|
+
baseOutputDir?: string;
|
|
5
|
+
schema?: Types.ConfiguredOutput['schema'];
|
|
6
|
+
}) => Pick<Types.ConfiguredOutput, 'preset' | 'presetConfig' | 'watchPattern' | 'schema'>;
|
package/src/defineConfig.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.defineConfig = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const preset_1 = require("./preset");
|
|
6
|
-
const defineConfig = (presetConfig = {}, context = {
|
|
7
|
-
const { baseOutputDir } = context;
|
|
6
|
+
const defineConfig = (presetConfig = {}, context = {}) => {
|
|
7
|
+
const { schema, baseOutputDir = '' } = context;
|
|
8
8
|
const mappersFileExtension = presetConfig.mappersFileExtension || '.mappers.ts';
|
|
9
9
|
const watchPattern = [];
|
|
10
10
|
const mapperWatchPattern = path.posix.join(baseOutputDir, '**', `*${mappersFileExtension}`);
|
|
@@ -13,6 +13,7 @@ const defineConfig = (presetConfig = {}, context = { baseOutputDir: '' }) => {
|
|
|
13
13
|
preset: preset_1.preset,
|
|
14
14
|
presetConfig,
|
|
15
15
|
watchPattern,
|
|
16
|
+
schema,
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
exports.defineConfig = defineConfig;
|
package/src/defineConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../../../../packages/typescript-resolver-files/src/defineConfig.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAG7B,qCAAkC;AAE3B,MAAM,YAAY,GAAG,CAC1B,eAAkC,EAAE,EACpC,
|
|
1
|
+
{"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../../../../packages/typescript-resolver-files/src/defineConfig.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAG7B,qCAAkC;AAE3B,MAAM,YAAY,GAAG,CAC1B,eAAkC,EAAE,EACpC,UAGI,EAAE,EAIN,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAE/C,MAAM,oBAAoB,GACxB,YAAY,CAAC,oBAAoB,IAAI,aAAa,CAAC;IAErD,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CACxC,aAAa,EACb,IAAI,EACJ,IAAI,oBAAoB,EAAE,CAC3B,CAAC;IACF,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAEtC,OAAO;QACL,MAAM,EAAN,eAAM;QACN,YAAY;QACZ,YAAY;QACZ,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,YAAY,gBA6BvB"}
|
|
@@ -4,5 +4,12 @@ interface AddExternalResolverImportParams {
|
|
|
4
4
|
normalizedResolverName: string;
|
|
5
5
|
configImportSyntax: string;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* addExternalResolverImport
|
|
9
|
+
*
|
|
10
|
+
* 1. parse external resolvers (originally from config.externalResolvers) import syntax
|
|
11
|
+
* 2. dedupes any duplicated imports
|
|
12
|
+
* 3. declares the which identifier name to use for GraphQL object or resolver in identifierUsages
|
|
13
|
+
*/
|
|
7
14
|
export declare const addExternalResolverImport: (params: AddExternalResolverImportParams, { result, config: { emitLegacyCommonJSImports }, }: GenerateResolverFilesContext) => void;
|
|
8
15
|
export {};
|
|
@@ -2,47 +2,70 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addExternalResolverImport = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
+
/**
|
|
6
|
+
* addExternalResolverImport
|
|
7
|
+
*
|
|
8
|
+
* 1. parse external resolvers (originally from config.externalResolvers) import syntax
|
|
9
|
+
* 2. dedupes any duplicated imports
|
|
10
|
+
* 3. declares the which identifier name to use for GraphQL object or resolver in identifierUsages
|
|
11
|
+
*/
|
|
5
12
|
const addExternalResolverImport = (params, { result, config: { emitLegacyCommonJSImports }, }) => {
|
|
6
13
|
const { importIdentifier, identifierUsage, moduleImport } = parseImportSyntax(params);
|
|
14
|
+
let shouldPushIndentifierUsages = false;
|
|
7
15
|
result.externalImports[moduleImport] =
|
|
8
16
|
result.externalImports[moduleImport] ||
|
|
9
|
-
{
|
|
17
|
+
({
|
|
10
18
|
moduleName: params.moduleName,
|
|
11
19
|
importLineMeta: {
|
|
12
20
|
isTypeImport: false,
|
|
13
21
|
module: moduleImport,
|
|
22
|
+
moduleType: 'preserve',
|
|
14
23
|
namedImports: [],
|
|
15
24
|
defaultImport: undefined,
|
|
16
|
-
emitLegacyCommonJSImports
|
|
25
|
+
emitLegacyCommonJSImports,
|
|
17
26
|
},
|
|
18
27
|
identifierUsages: [],
|
|
19
|
-
};
|
|
20
|
-
const
|
|
28
|
+
});
|
|
29
|
+
const { importLineMeta, identifierUsages } = result.externalImports[moduleImport];
|
|
21
30
|
switch (importIdentifier.__type) {
|
|
22
31
|
case 'default':
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
throw new Error(`There can be only one default import from '${moduleImport}'. Current: ${externalImport.importLineMeta.defaultImport}. New: ${importIdentifier.defaultImport}`);
|
|
32
|
+
if (importLineMeta.defaultImport &&
|
|
33
|
+
importLineMeta.defaultImport !== importIdentifier.defaultImport) {
|
|
34
|
+
throw new Error(`There can be only one default import from '${moduleImport}'. Current: ${importLineMeta.defaultImport}. New: ${importIdentifier.defaultImport}`);
|
|
27
35
|
}
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
importLineMeta.defaultImport = importIdentifier.defaultImport;
|
|
37
|
+
shouldPushIndentifierUsages = true;
|
|
30
38
|
break;
|
|
31
|
-
case 'named':
|
|
32
|
-
|
|
39
|
+
case 'named': {
|
|
40
|
+
const foundSameImport = importLineMeta.namedImports.find((existingImport) => typeof existingImport === 'string' &&
|
|
41
|
+
existingImport === importIdentifier.namedImport);
|
|
42
|
+
if (!foundSameImport) {
|
|
43
|
+
importLineMeta.namedImports.push(importIdentifier.namedImport);
|
|
44
|
+
shouldPushIndentifierUsages = true;
|
|
45
|
+
}
|
|
33
46
|
break;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
identifierName
|
|
38
|
-
|
|
47
|
+
}
|
|
48
|
+
case 'namedWithAlias': {
|
|
49
|
+
const foundSameImport = importLineMeta.namedImports.find((existingImport) => typeof existingImport === 'object' &&
|
|
50
|
+
existingImport.identifierName === importIdentifier.identifierName &&
|
|
51
|
+
existingImport.propertyName === importIdentifier.propertyName);
|
|
52
|
+
if (!foundSameImport) {
|
|
53
|
+
importLineMeta.namedImports.push({
|
|
54
|
+
propertyName: importIdentifier.propertyName,
|
|
55
|
+
identifierName: importIdentifier.identifierName,
|
|
56
|
+
});
|
|
57
|
+
shouldPushIndentifierUsages = true;
|
|
58
|
+
}
|
|
39
59
|
break;
|
|
60
|
+
}
|
|
40
61
|
default:
|
|
41
62
|
// importIdentifier is `never` unless new __type is added
|
|
42
63
|
// i.e. this is here for typesafety
|
|
43
64
|
return importIdentifier;
|
|
44
65
|
}
|
|
45
|
-
|
|
66
|
+
if (shouldPushIndentifierUsages) {
|
|
67
|
+
identifierUsages.push(identifierUsage);
|
|
68
|
+
}
|
|
46
69
|
};
|
|
47
70
|
exports.addExternalResolverImport = addExternalResolverImport;
|
|
48
71
|
const parseImportSyntax = ({ configImportSyntax, normalizedResolverName, }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addExternalResolverImport.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/generateResolverFiles/addExternalResolverImport.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;
|
|
1
|
+
{"version":3,"file":"addExternalResolverImport.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/generateResolverFiles/addExternalResolverImport.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AAcjD;;;;;;GAMG;AACI,MAAM,yBAAyB,GAAG,CACvC,MAAuC,EACvC,EACE,MAAM,EACN,MAAM,EAAE,EAAE,yBAAyB,EAAE,GACR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
* @description Function to create resolver main file/s (default: resolvers.generated.ts)
|
|
6
|
+
* If resolverMainFileMode=merged, only one file is generated
|
|
7
|
+
* If resolverMainFileMode=modules, one file is generated for each module
|
|
8
|
+
* If no resolvers are created or imported, do not generate a file.
|
|
9
|
+
*/
|
|
10
|
+
export declare const addResolverMainFiles: ({ config: { baseOutputDir, resolverTypesPath, resolverMainFile, resolverMainFileMode, emitLegacyCommonJSImports, }, result, }: GenerateResolverFilesContext) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addResolverMainFiles = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const createDefaultFileDetails = () => ({
|
|
@@ -8,12 +8,18 @@ const createDefaultFileDetails = () => ({
|
|
|
8
8
|
queryFields: [],
|
|
9
9
|
mutationFields: [],
|
|
10
10
|
subscriptionFields: [],
|
|
11
|
-
objectTypes:
|
|
11
|
+
objectTypes: {},
|
|
12
12
|
});
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* addResolverMainFiles
|
|
15
|
+
*
|
|
16
|
+
* @description Function to create resolver main file/s (default: resolvers.generated.ts)
|
|
17
|
+
* If resolverMainFileMode=merged, only one file is generated
|
|
18
|
+
* If resolverMainFileMode=modules, one file is generated for each module
|
|
19
|
+
* If no resolvers are created or imported, do not generate a file.
|
|
15
20
|
*/
|
|
16
|
-
const
|
|
21
|
+
const addResolverMainFiles = ({ config: { baseOutputDir, resolverTypesPath, resolverMainFile, resolverMainFileMode, emitLegacyCommonJSImports, }, result, }) => {
|
|
22
|
+
const baseIdentifierUsage = countBaseIdentifiersUsage(result.files);
|
|
17
23
|
const resolverMainFiles = Object.entries(result.files).reduce((res, [filepath, file]) => {
|
|
18
24
|
if (file.__filetype === 'file') {
|
|
19
25
|
return res;
|
|
@@ -27,32 +33,36 @@ const addResolverMainFile = ({ config: { baseOutputDir, resolverTypesPath, resol
|
|
|
27
33
|
if (!res[resolverMainFilename]) {
|
|
28
34
|
res[resolverMainFilename] = createDefaultFileDetails();
|
|
29
35
|
}
|
|
36
|
+
const baseIdentifierName = makeNormalizedResolverNameVariableCompatible(file.meta.normalizedResolverName.base);
|
|
37
|
+
const identifierName = baseIdentifierUsage[baseIdentifierName] > 1
|
|
38
|
+
? makeNormalizedResolverNameVariableCompatible(file.meta.normalizedResolverName.withModule)
|
|
39
|
+
: baseIdentifierName;
|
|
40
|
+
const fieldMapping = {
|
|
41
|
+
propertyName: file.mainImportIdentifier,
|
|
42
|
+
identifierName,
|
|
43
|
+
};
|
|
30
44
|
// Non Root Object fields that was generated
|
|
31
45
|
if (file.__filetype === 'objectType' ||
|
|
32
46
|
file.__filetype === 'generalResolver') {
|
|
33
47
|
res[resolverMainFilename].importLines.push((0, utils_1.printImportLine)({
|
|
34
48
|
isTypeImport: false,
|
|
35
49
|
module: (0, utils_1.relativeModulePath)(outputDir, filepath),
|
|
36
|
-
|
|
50
|
+
moduleType: 'file',
|
|
51
|
+
namedImports: [fieldMapping],
|
|
37
52
|
emitLegacyCommonJSImports,
|
|
38
53
|
}));
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
pushToObjectTypes({
|
|
55
|
+
objectTypes: res[resolverMainFilename].objectTypes,
|
|
56
|
+
property: file.mainImportIdentifier,
|
|
57
|
+
value: identifierName,
|
|
42
58
|
});
|
|
43
59
|
return res;
|
|
44
60
|
}
|
|
45
61
|
// Root object fields
|
|
46
|
-
const identifierName = file.meta.normalizedResolverName
|
|
47
|
-
.split('.')
|
|
48
|
-
.join('_');
|
|
49
|
-
const fieldMapping = {
|
|
50
|
-
propertyName: file.mainImportIdentifier,
|
|
51
|
-
identifierName,
|
|
52
|
-
};
|
|
53
62
|
res[resolverMainFilename].importLines.push((0, utils_1.printImportLine)({
|
|
54
63
|
isTypeImport: false,
|
|
55
64
|
module: (0, utils_1.relativeModulePath)(outputDir, filepath),
|
|
65
|
+
moduleType: 'file',
|
|
56
66
|
namedImports: [fieldMapping],
|
|
57
67
|
emitLegacyCommonJSImports,
|
|
58
68
|
}));
|
|
@@ -75,6 +85,7 @@ const addResolverMainFile = ({ config: { baseOutputDir, resolverTypesPath, resol
|
|
|
75
85
|
res[resolverMainFilename].importLines.push((0, utils_1.printImportLine)({
|
|
76
86
|
isTypeImport: false,
|
|
77
87
|
module,
|
|
88
|
+
moduleType: 'preserve',
|
|
78
89
|
namedImports: meta.importLineMeta.namedImports,
|
|
79
90
|
defaultImport: meta.importLineMeta.defaultImport,
|
|
80
91
|
emitLegacyCommonJSImports,
|
|
@@ -83,9 +94,10 @@ const addResolverMainFile = ({ config: { baseOutputDir, resolverTypesPath, resol
|
|
|
83
94
|
const resolverNameParts = usage.normalizedResolverName.split('.');
|
|
84
95
|
// Only 1 part, this is a GraphQL ObjectType
|
|
85
96
|
if (resolverNameParts.length === 1) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
pushToObjectTypes({
|
|
98
|
+
objectTypes: res[resolverMainFilename].objectTypes,
|
|
99
|
+
property: resolverNameParts[0],
|
|
100
|
+
value: usage.identifierName,
|
|
89
101
|
});
|
|
90
102
|
return;
|
|
91
103
|
}
|
|
@@ -129,24 +141,68 @@ const addResolverMainFile = ({ config: { baseOutputDir, resolverTypesPath, resol
|
|
|
129
141
|
: '';
|
|
130
142
|
result.files[resolverMainFilename] = {
|
|
131
143
|
__filetype: 'file',
|
|
144
|
+
mainImportIdentifier: resolversIdentifier,
|
|
132
145
|
content: `/* This file was automatically generated. DO NOT UPDATE MANUALLY. */
|
|
133
146
|
${(0, utils_1.printImportLine)({
|
|
134
147
|
isTypeImport: true,
|
|
135
148
|
module: relativePathToResolverTypes,
|
|
149
|
+
moduleType: 'file',
|
|
136
150
|
namedImports: [resolversTypeName],
|
|
137
151
|
emitLegacyCommonJSImports,
|
|
138
152
|
})}
|
|
139
|
-
${resolverMainFile.importLines.
|
|
153
|
+
${resolverMainFile.importLines.join('\n')}
|
|
140
154
|
export const ${resolversIdentifier}: ${resolversTypeName} = {
|
|
141
155
|
${queries}
|
|
142
156
|
${mutations}
|
|
143
157
|
${suscriptions}
|
|
144
|
-
${resolverMainFile.objectTypes
|
|
158
|
+
${printObjectTypes(resolverMainFile.objectTypes)}
|
|
145
159
|
}`,
|
|
146
|
-
mainImportIdentifier: resolversIdentifier,
|
|
147
160
|
};
|
|
148
161
|
});
|
|
149
162
|
};
|
|
150
|
-
exports.
|
|
163
|
+
exports.addResolverMainFiles = addResolverMainFiles;
|
|
151
164
|
const printObjectMapping = ({ propertyName, identifierName, }) => `${propertyName}: ${identifierName}`;
|
|
152
|
-
|
|
165
|
+
const pushToObjectTypes = ({ objectTypes, property, value, }) => {
|
|
166
|
+
if (!objectTypes[property]) {
|
|
167
|
+
objectTypes[property] = [];
|
|
168
|
+
}
|
|
169
|
+
objectTypes[property].push(value);
|
|
170
|
+
};
|
|
171
|
+
const printObjectTypes = (objectTypes) => {
|
|
172
|
+
return Object.entries(objectTypes)
|
|
173
|
+
.map(([property, values]) => {
|
|
174
|
+
if (values.length === 1) {
|
|
175
|
+
return `${property}: ${values[0]}`;
|
|
176
|
+
}
|
|
177
|
+
const spreadedValueString = values
|
|
178
|
+
.map((value) => `...${value}`)
|
|
179
|
+
.join(',');
|
|
180
|
+
return `${property}: { ${spreadedValueString} }`;
|
|
181
|
+
})
|
|
182
|
+
.join(',\n');
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* countBaseIdentifiersUsage
|
|
186
|
+
*
|
|
187
|
+
* function to count how many of the same identifier is used across all files
|
|
188
|
+
*/
|
|
189
|
+
const countBaseIdentifiersUsage = (files) => {
|
|
190
|
+
return Object.entries(files).reduce((res, [_filepath, file]) => {
|
|
191
|
+
if (file.__filetype === 'file') {
|
|
192
|
+
return res;
|
|
193
|
+
}
|
|
194
|
+
const identifier = makeNormalizedResolverNameVariableCompatible(file.meta.normalizedResolverName.base);
|
|
195
|
+
if (!res[identifier]) {
|
|
196
|
+
res[identifier] = 0;
|
|
197
|
+
}
|
|
198
|
+
res[identifier]++;
|
|
199
|
+
return res;
|
|
200
|
+
}, {});
|
|
201
|
+
};
|
|
202
|
+
const makeNormalizedResolverNameVariableCompatible = (identifier) => {
|
|
203
|
+
return identifier
|
|
204
|
+
.split('.')
|
|
205
|
+
.filter((part) => Boolean(part))
|
|
206
|
+
.join('_');
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=addResolverMainFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addResolverMainFiles.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/generateResolverFiles/addResolverMainFiles.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,oCAKkB;AAUlB,MAAM,wBAAwB,GAAG,GAAgB,EAAE,CAAC,CAAC;IACnD,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,cAAc,EAAE,EAAE;IAClB,kBAAkB,EAAE,EAAE;IACtB,WAAW,EAAE,EAAE;CAChB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACI,MAAM,oBAAoB,GAAG,CAAC,EACnC,MAAM,EAAE,EACN,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,GAC1B,EACD,MAAM,GACuB,EAAQ,EAAE;IACvC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpE,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAE3D,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;QAC1B,IAAI,IAAI,CAAC,UAAU,KAAK,MAAM,EAAE;YAC9B,OAAO,GAAG,CAAC;SACZ;QAED,MAAM,EAAE,IAAI,EAAE,GAAG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AC;SAC/B,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateResolverFiles = void 0;
|
|
4
|
+
const path = require("path");
|
|
4
5
|
const graphql_1 = require("graphql");
|
|
5
6
|
const utils_1 = require("../utils");
|
|
6
|
-
const
|
|
7
|
+
const addResolverMainFiles_1 = require("./addResolverMainFiles");
|
|
7
8
|
const postProcessFiles_1 = require("./postProcessFiles");
|
|
8
9
|
const handleGraphQLRootObjectTypeField_1 = require("./handleGraphQLRootObjectTypeField");
|
|
9
10
|
const handleGraphQLObjectType_1 = require("./handleGraphQLObjectType");
|
|
10
|
-
const
|
|
11
|
+
const handleGraphQLUnionType_1 = require("./handleGraphQLUnionType");
|
|
11
12
|
const handleGraphQLScalarType_1 = require("./handleGraphQLScalarType");
|
|
13
|
+
const handleGraphQLInterfaceType_1 = require("./handleGraphQLInterfaceType");
|
|
12
14
|
const visitNamedType_1 = require("./visitNamedType");
|
|
13
15
|
const generateResolverFiles = (ctx) => {
|
|
14
16
|
Object.entries(ctx.config.schema.getTypeMap()).forEach(([schemaType, namedType]) => {
|
|
@@ -22,9 +24,11 @@ const generateResolverFiles = (ctx) => {
|
|
|
22
24
|
const visitor = {
|
|
23
25
|
RootObjectTypeField: handleGraphQLRootObjectTypeField_1.handleGraphQLRootObjectTypeField,
|
|
24
26
|
ObjectType: handleGraphQLObjectType_1.handleGraphQLObjectType,
|
|
25
|
-
UnionType:
|
|
27
|
+
UnionType: handleGraphQLUnionType_1.handleGraphQLUnionType,
|
|
26
28
|
ScalarType: handleGraphQLScalarType_1.handleGraphQLScalarType,
|
|
29
|
+
InterfaceType: handleGraphQLInterfaceType_1.handleGraphQLInterfaceType,
|
|
27
30
|
};
|
|
31
|
+
// Root object types e.g. Query, Mutation, Subscription
|
|
28
32
|
if ((0, utils_1.isRootObjectType)(schemaType) && (0, graphql_1.isObjectType)(namedType)) {
|
|
29
33
|
Object.entries(namedType.getFields()).forEach(([fieldName, fieldNode]) => {
|
|
30
34
|
var _a;
|
|
@@ -38,6 +42,43 @@ const generateResolverFiles = (ctx) => {
|
|
|
38
42
|
});
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
45
|
+
// Other output object types
|
|
46
|
+
if ((0, graphql_1.isObjectType)(namedType)) {
|
|
47
|
+
const fieldsByGraphQLModule = Object.entries(namedType.getFields()).reduce((res, [_, fieldNode]) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const fieldLocation = (_a = fieldNode.astNode) === null || _a === void 0 ? void 0 : _a.loc;
|
|
50
|
+
const graphQLModule = path.dirname((fieldLocation === null || fieldLocation === void 0 ? void 0 : fieldLocation.source.name) || '');
|
|
51
|
+
if (!res[graphQLModule]) {
|
|
52
|
+
res[graphQLModule] = {
|
|
53
|
+
fieldNodes: [],
|
|
54
|
+
// Note: fieldLocation here is the location of the first field found in a GraphQL Module.
|
|
55
|
+
// The reason we use field's location instead of the object type's location is because when `extend type ObjectType` is used, the location of object type is the last found location.
|
|
56
|
+
// i.e. we cannot rely on object's location if `extend type` is used.
|
|
57
|
+
firstFieldLocation: fieldLocation,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
res[graphQLModule].fieldNodes.push(fieldNode);
|
|
61
|
+
return res;
|
|
62
|
+
}, {});
|
|
63
|
+
// If there are multiple object type files to generate e.g. `extend type ObjectType` is used across multiple modules
|
|
64
|
+
// Then, generate one file for each location
|
|
65
|
+
const fieldsToGenerate = Object.entries(fieldsByGraphQLModule);
|
|
66
|
+
if (fieldsToGenerate.length > 1) {
|
|
67
|
+
fieldsToGenerate.forEach(([_, { firstFieldLocation, fieldNodes }]) => {
|
|
68
|
+
const fieldsToPick = fieldNodes.map((field) => field.name);
|
|
69
|
+
(0, visitNamedType_1.visitNamedType)({
|
|
70
|
+
namedType,
|
|
71
|
+
resolverName: namedType.name,
|
|
72
|
+
belongsToRootObject: null,
|
|
73
|
+
location: firstFieldLocation,
|
|
74
|
+
visitor,
|
|
75
|
+
fieldsToPick,
|
|
76
|
+
}, ctx);
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Other types e.g. Union, Scalar, Interface
|
|
41
82
|
(0, visitNamedType_1.visitNamedType)({
|
|
42
83
|
namedType,
|
|
43
84
|
resolverName: namedType.name,
|
|
@@ -48,8 +89,8 @@ const generateResolverFiles = (ctx) => {
|
|
|
48
89
|
});
|
|
49
90
|
// Post process generated files (could be existing files or files to be generated)
|
|
50
91
|
(0, postProcessFiles_1.postProcessFiles)(ctx);
|
|
51
|
-
// Put all resolvers into
|
|
52
|
-
(0,
|
|
92
|
+
// Put all resolvers into barrel file/s (or main file/s)
|
|
93
|
+
(0, addResolverMainFiles_1.addResolverMainFiles)(ctx);
|
|
53
94
|
};
|
|
54
95
|
exports.generateResolverFiles = generateResolverFiles;
|
|
55
96
|
//# sourceMappingURL=generateResolverFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateResolverFiles.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/generateResolverFiles/generateResolverFiles.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"generateResolverFiles.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/generateResolverFiles/generateResolverFiles.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,qCAAyE;AACzE,oCAA+D;AAC/D,iEAA8D;AAC9D,yDAAsD;AACtD,yFAAsF;AACtF,uEAAoE;AACpE,qEAAkE;AAClE,uEAAoE;AACpE,6EAA0E;AAC1E,qDAAwE;AAGjE,MAAM,qBAAqB,GAAG,CACnC,GAAiC,EAC3B,EAAE;IACR,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,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