@luvio/compiler 0.97.1 → 0.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/graphql/source-printer/graphql-type-source-printer.d.ts +4 -4
- package/dist/codegen/graphql/source-printer/graphql-type-source-printer.js +8 -8
- package/dist/codegen/graphql/source-printer/graphql-type-source-printer.js.map +1 -1
- package/dist/codegen/graphql/type/constants.d.ts +2 -0
- package/dist/codegen/graphql/type/constants.js +3 -1
- package/dist/codegen/graphql/type/constants.js.map +1 -1
- package/dist/codegen/graphql/type/convert.js +12 -2
- package/dist/codegen/graphql/type/convert.js.map +1 -1
- package/dist/codegen/graphql/type/index.js +5 -1
- package/dist/codegen/graphql/type/index.js.map +1 -1
- package/dist/codegen/graphql/type/ingest-field-by-type.d.ts +8 -0
- package/dist/codegen/graphql/type/ingest-field-by-type.js +84 -0
- package/dist/codegen/graphql/type/ingest-field-by-type.js.map +1 -0
- package/dist/codegen/graphql/type/ingest.d.ts +1 -5
- package/dist/codegen/graphql/type/ingest.js +29 -125
- package/dist/codegen/graphql/type/ingest.js.map +1 -1
- package/dist/codegen/graphql/type/is-mapped-field.d.ts +3 -0
- package/dist/codegen/graphql/type/is-mapped-field.js +37 -0
- package/dist/codegen/graphql/type/is-mapped-field.js.map +1 -0
- package/dist/codegen/graphql/type/select.d.ts +1 -1
- package/dist/codegen/graphql/type/select.js +20 -12
- package/dist/codegen/graphql/type/select.js.map +1 -1
- package/dist/codegen/graphql/type/type-from-field.d.ts +2 -5
- package/dist/codegen/graphql/type/type-from-field.js +4 -21
- package/dist/codegen/graphql/type/type-from-field.js.map +1 -1
- package/dist/codegen/shape/shape-utils.js +3 -3
- package/package.json +22 -17
|
@@ -9,11 +9,11 @@ import type { CompilerPlugin } from '../../../plugin';
|
|
|
9
9
|
export declare const GRAPHQL_OBJECT_TYPENAME = "typeName";
|
|
10
10
|
export declare type GraphQLTypeGenerationResult = Record<string, string>;
|
|
11
11
|
export declare class GraphQLTypeSourcePrinter implements GraphQLTypePrinter {
|
|
12
|
-
generate(graphQLResource: GraphQLResource, compilerBaseOutputDir: path.ParsedPath, metadata: GraphQLCodegenMetadata, modelInfo: ModelInfo, plugin
|
|
13
|
-
createGraphQLTypeImportContext(compilerBaseOutputDir: path.ParsedPath, defName: string): {
|
|
12
|
+
generate(graphQLResource: GraphQLResource, compilerBaseOutputDir: path.ParsedPath, metadata: GraphQLCodegenMetadata, modelInfo: ModelInfo, plugin?: CompilerPlugin): GraphQLTypeGenerationResult;
|
|
13
|
+
createGraphQLTypeImportContext(compilerBaseOutputDir: path.ParsedPath, defName: string, plugin?: CompilerPlugin): {
|
|
14
14
|
relPath: string;
|
|
15
15
|
importContext: ImportContext;
|
|
16
16
|
};
|
|
17
|
-
generateGraphQLInteropTypes(modelInfo: ModelInfo, compilerBaseOutputDir: path.ParsedPath,
|
|
18
|
-
addTypeModule(graphQLResource: GraphQLResource, compilerBaseOutputDir: path.ParsedPath, metadata: GraphQLCodegenMetadata, modules: GraphQLTypeGenerationResult): void;
|
|
17
|
+
generateGraphQLInteropTypes(modelInfo: ModelInfo, compilerBaseOutputDir: path.ParsedPath, graphqlResource: GraphQLResource, plugin?: CompilerPlugin): GraphQLTypeGenerationResult;
|
|
18
|
+
addTypeModule(graphQLResource: GraphQLResource, compilerBaseOutputDir: path.ParsedPath, metadata: GraphQLCodegenMetadata, modules: GraphQLTypeGenerationResult, plugin?: CompilerPlugin): void;
|
|
19
19
|
}
|
|
@@ -23,10 +23,10 @@ class GraphQLTypeSourcePrinter {
|
|
|
23
23
|
const { graphqlDSL } = graphQLResource;
|
|
24
24
|
const typeKeys = Object.keys(graphqlDSL.schema.getTypeMap());
|
|
25
25
|
const modules = {};
|
|
26
|
-
this.addTypeModule(graphQLResource, compilerBaseOutputDir, metadata, modules);
|
|
26
|
+
this.addTypeModule(graphQLResource, compilerBaseOutputDir, metadata, modules, plugin);
|
|
27
27
|
// TODO: What should happen if multiple endpoints use the same Representation? Technically this would be legal in RAML as the
|
|
28
28
|
// top level types are the same.
|
|
29
|
-
Object.assign(modules, this.generateGraphQLInteropTypes(modelInfo, compilerBaseOutputDir,
|
|
29
|
+
Object.assign(modules, this.generateGraphQLInteropTypes(modelInfo, compilerBaseOutputDir, graphQLResource, plugin));
|
|
30
30
|
typeKeys.forEach((typeKey) => {
|
|
31
31
|
const typeDefinition = graphqlDSL.schema.getType(typeKey);
|
|
32
32
|
if (typeDefinition !== undefined &&
|
|
@@ -34,7 +34,7 @@ class GraphQLTypeSourcePrinter {
|
|
|
34
34
|
typeDefinition.astNode !== undefined &&
|
|
35
35
|
typeDefinition.astNode !== null) {
|
|
36
36
|
const kind = typeDefinition.astNode.kind;
|
|
37
|
-
const { relPath, importContext } = this.createGraphQLTypeImportContext(compilerBaseOutputDir, typeDefinition.name);
|
|
37
|
+
const { relPath, importContext } = this.createGraphQLTypeImportContext(compilerBaseOutputDir, typeDefinition.name, plugin);
|
|
38
38
|
switch (kind) {
|
|
39
39
|
case graphql_parser_1.Kind.OBJECT_TYPE_DEFINITION:
|
|
40
40
|
modules[relPath] = (0, type_1.generateType)(graphqlDSL, typeDefinition.name, typeDefinition.astNode, importContext, metadata, modelInfo);
|
|
@@ -56,15 +56,15 @@ class GraphQLTypeSourcePrinter {
|
|
|
56
56
|
});
|
|
57
57
|
return modules;
|
|
58
58
|
}
|
|
59
|
-
createGraphQLTypeImportContext(compilerBaseOutputDir, defName) {
|
|
59
|
+
createGraphQLTypeImportContext(compilerBaseOutputDir, defName, plugin) {
|
|
60
60
|
const graphqlRelPath = path_1.default.join(_1.GRAPHQL_OUTPUT_DIRECTORY, GRAPHQL_TYPES_DIRECTORY, `${defName}.ts`);
|
|
61
61
|
const shapeAbsPath = path_1.default.parse(path_1.default.resolve(path_1.default.format(compilerBaseOutputDir), graphqlRelPath));
|
|
62
62
|
return {
|
|
63
63
|
relPath: graphqlRelPath,
|
|
64
|
-
importContext: (0, imports_1.createImportContext)(shapeAbsPath, compilerBaseOutputDir),
|
|
64
|
+
importContext: (0, imports_1.createImportContext)(shapeAbsPath, compilerBaseOutputDir, plugin),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
generateGraphQLInteropTypes(modelInfo, compilerBaseOutputDir,
|
|
67
|
+
generateGraphQLInteropTypes(modelInfo, compilerBaseOutputDir, graphqlResource, plugin) {
|
|
68
68
|
const modules = {};
|
|
69
69
|
for (const shape of Object.values(modelInfo.declaredShapeDefinitions)) {
|
|
70
70
|
if ((0, utils_1.isNodeShape)(shape) && modelInfo.graphQLShapes[shape.id]) {
|
|
@@ -81,8 +81,8 @@ class GraphQLTypeSourcePrinter {
|
|
|
81
81
|
}
|
|
82
82
|
return modules;
|
|
83
83
|
}
|
|
84
|
-
addTypeModule(graphQLResource, compilerBaseOutputDir, metadata, modules) {
|
|
85
|
-
const { importContext, relPath } = this.createGraphQLTypeImportContext(compilerBaseOutputDir, 'type-util');
|
|
84
|
+
addTypeModule(graphQLResource, compilerBaseOutputDir, metadata, modules, plugin) {
|
|
85
|
+
const { importContext, relPath } = this.createGraphQLTypeImportContext(compilerBaseOutputDir, 'type-util', plugin);
|
|
86
86
|
const typeUtil = (0, generateTypeUtil_1.generateTypeUtil)(graphQLResource, metadata, importContext);
|
|
87
87
|
modules[relPath] = typeUtil;
|
|
88
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-type-source-printer.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/source-printer/graphql-type-source-printer.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA6D;AAC7D,gDAAwB;AACxB,0DAA6C;AAC7C,kCAAuC;AACvC,+DAA4D;AAC5D,oCAAyD;AACzD,kCAAuD;AAIvD,uDAA0D;AAG1D,iDAAuE;AACvE,4CAAqD;AACrD,wBAA6C;AAEhC,QAAA,uBAAuB,GAAG,UAAU,CAAC;AAClD,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAIrC,MAAa,wBAAwB;IACjC,QAAQ,CACJ,eAAgC,EAChC,qBAAsC,EACtC,QAAgC,EAChC,SAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"graphql-type-source-printer.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/source-printer/graphql-type-source-printer.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA6D;AAC7D,gDAAwB;AACxB,0DAA6C;AAC7C,kCAAuC;AACvC,+DAA4D;AAC5D,oCAAyD;AACzD,kCAAuD;AAIvD,uDAA0D;AAG1D,iDAAuE;AACvE,4CAAqD;AACrD,wBAA6C;AAEhC,QAAA,uBAAuB,GAAG,UAAU,CAAC;AAClD,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAIrC,MAAa,wBAAwB;IACjC,QAAQ,CACJ,eAAgC,EAChC,qBAAsC,EACtC,QAAgC,EAChC,SAAoB,EACpB,MAAuB;QAEvB,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAgC,EAAE,CAAC;QAEhD,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEtF,6HAA6H;QAC7H,gCAAgC;QAChC,MAAM,CAAC,MAAM,CACT,OAAO,EACP,IAAI,CAAC,2BAA2B,CAC5B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,MAAM,CACT,CACJ,CAAC;QAEF,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACzB,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC1D,IACI,cAAc,KAAK,SAAS;gBAC5B,cAAc,KAA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AChC,qBAAsC,EACtC,QAAgC,EAChC,OAAoC,EACpC,MAAuB;QAEvB,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,8BAA8B,CAClE,qBAAqB,EACrB,WAAW,EACX,MAAM,CACT,CAAC;QACF,MAAM,QAAQ,GAAW,IAAA,mCAAgB,EAAC,eAAe,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;QACpF,OAAO,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;IAChC,CAAC;CACJ;AAxJD,4DAwJC"}
|
|
@@ -25,3 +25,5 @@ export declare const GET_QUERY_TRANSFORM_HELPER_FOR_TYPE_IDENTIFIER = "getQueryT
|
|
|
25
25
|
export declare const GET_MINIMUM_FIELDS_IDENTIFIER = "getMinimumFields";
|
|
26
26
|
export declare const QUERY_TRANSFORM_HELPER_IDENTIFIER = "QueryTransformHelper";
|
|
27
27
|
export declare const GET_FIELD_TYPE_IDENTIFIER = "getFieldType";
|
|
28
|
+
export declare const INGEST_FIELD_BY_TYPE_IDENTIFIER = "ingestFieldByType";
|
|
29
|
+
export declare const IS_MAPPED_FIELD_IDENTIFIER = "isMappedField";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_FIELD_TYPE_IDENTIFIER = exports.QUERY_TRANSFORM_HELPER_IDENTIFIER = exports.GET_MINIMUM_FIELDS_IDENTIFIER = exports.GET_QUERY_TRANSFORM_HELPER_FOR_TYPE_IDENTIFIER = exports.GET_QUERY_TRANSFORM_HELPER_FOR_FIELD_IDENTIFIER = exports.APPLY_MINIMUM_FIELDS_TO_QUERY_IDENTIFIER = exports.SINK_IDENTIFIER = exports.REQUESTED_FIELD_NAME_IDENTIFIER = exports.REQUESTED_FIELD_IDENTIFIER = exports.FIELD_DATA_KEY_IDENTIFIER = exports.FIELD_DATA_IDENTIFIER = exports.FIELD_KEY_IDENTIFIER = exports.GET_SERIALIZED_KEY_FOR_FIELD_IDENTIFIER = exports.GET_REQUESTED_FIELDS_FOR_TYPE_IDENTIFIER = exports.GET_REQUESTED_FIELD_IDENTIFIER = exports.SERIALIZE_FIELD_ARGUMENTS_IDENTIFIER = exports.KEY_BUILDER_IDENTIFIER = exports.TYPE_CACHE_KEYS_IDENTIFIER = exports.TYPE_CONVERT_IDENTIFIER = exports.TYPE_INGEST_IDENTIFIER = exports.TYPE_UTIL_IDENTIFIER = exports.CREATE_LINK_IDENTIFIER = exports.TIMESTAMP_IDENTIFIER = exports.GRAPHQL_STATE_INTERFACE_IDENTIFIER = exports.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER = exports.GRAPHQL_FRAGMENT_MAP_IDENTIFIER = exports.GRAPHQL_VARIABLES_IDENTIFIER = void 0;
|
|
3
|
+
exports.IS_MAPPED_FIELD_IDENTIFIER = exports.INGEST_FIELD_BY_TYPE_IDENTIFIER = exports.GET_FIELD_TYPE_IDENTIFIER = exports.QUERY_TRANSFORM_HELPER_IDENTIFIER = exports.GET_MINIMUM_FIELDS_IDENTIFIER = exports.GET_QUERY_TRANSFORM_HELPER_FOR_TYPE_IDENTIFIER = exports.GET_QUERY_TRANSFORM_HELPER_FOR_FIELD_IDENTIFIER = exports.APPLY_MINIMUM_FIELDS_TO_QUERY_IDENTIFIER = exports.SINK_IDENTIFIER = exports.REQUESTED_FIELD_NAME_IDENTIFIER = exports.REQUESTED_FIELD_IDENTIFIER = exports.FIELD_DATA_KEY_IDENTIFIER = exports.FIELD_DATA_IDENTIFIER = exports.FIELD_KEY_IDENTIFIER = exports.GET_SERIALIZED_KEY_FOR_FIELD_IDENTIFIER = exports.GET_REQUESTED_FIELDS_FOR_TYPE_IDENTIFIER = exports.GET_REQUESTED_FIELD_IDENTIFIER = exports.SERIALIZE_FIELD_ARGUMENTS_IDENTIFIER = exports.KEY_BUILDER_IDENTIFIER = exports.TYPE_CACHE_KEYS_IDENTIFIER = exports.TYPE_CONVERT_IDENTIFIER = exports.TYPE_INGEST_IDENTIFIER = exports.TYPE_UTIL_IDENTIFIER = exports.CREATE_LINK_IDENTIFIER = exports.TIMESTAMP_IDENTIFIER = exports.GRAPHQL_STATE_INTERFACE_IDENTIFIER = exports.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER = exports.GRAPHQL_FRAGMENT_MAP_IDENTIFIER = exports.GRAPHQL_VARIABLES_IDENTIFIER = void 0;
|
|
4
4
|
exports.GRAPHQL_VARIABLES_IDENTIFIER = 'GraphQLVariables';
|
|
5
5
|
exports.GRAPHQL_FRAGMENT_MAP_IDENTIFIER = 'GraphQLFragmentMap';
|
|
6
6
|
exports.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER = 'GraphQLIngestState';
|
|
@@ -28,4 +28,6 @@ exports.GET_QUERY_TRANSFORM_HELPER_FOR_TYPE_IDENTIFIER = 'getQueryTransformHelpe
|
|
|
28
28
|
exports.GET_MINIMUM_FIELDS_IDENTIFIER = 'getMinimumFields';
|
|
29
29
|
exports.QUERY_TRANSFORM_HELPER_IDENTIFIER = 'QueryTransformHelper';
|
|
30
30
|
exports.GET_FIELD_TYPE_IDENTIFIER = 'getFieldType';
|
|
31
|
+
exports.INGEST_FIELD_BY_TYPE_IDENTIFIER = 'ingestFieldByType';
|
|
32
|
+
exports.IS_MAPPED_FIELD_IDENTIFIER = 'isMappedField';
|
|
31
33
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG,kBAAkB,CAAC;AAClD,QAAA,+BAA+B,GAAG,oBAAoB,CAAC;AACvD,QAAA,yCAAyC,GAAG,oBAAoB,CAAC;AACjE,QAAA,kCAAkC,GAAG,cAAc,CAAC;AACpD,QAAA,oBAAoB,GAAG,WAAW,CAAC;AACnC,QAAA,sBAAsB,GAAG,YAA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BAAsB,GAAG,QAAQ,CAAC;AAClC,QAAA,uBAAuB,GAAG,sBAAsB,CAAC;AACjD,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAChD,QAAA,sBAAsB,GAAG,YAAY,CAAC;AACtC,QAAA,oCAAoC,GAAG,yBAAyB,CAAC;AACjE,QAAA,8BAA8B,GAAG,mBAAmB,CAAC;AACrD,QAAA,wCAAwC,GAAG,2BAA2B,CAAC;AACvE,QAAA,uCAAuC,GAAG,0BAA0B,CAAC;AACrE,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAClC,QAAA,qBAAqB,GAAG,WAAW,CAAC;AACpC,QAAA,yBAAyB,GAAG,cAAc,CAAC;AAC3C,QAAA,0BAA0B,GAAG,gBAAgB,CAAC;AAC9C,QAAA,+BAA+B,GAAG,oBAAoB,CAAC;AACvD,QAAA,eAAe,GAAG,MAAM,CAAC;AACzB,QAAA,wCAAwC,GAAG,2BAA2B,CAAC;AACvE,QAAA,+CAA+C,GAAG,iCAAiC,CAAC;AACpF,QAAA,8CAA8C,GAAG,gCAAgC,CAAC;AAClF,QAAA,6BAA6B,GAAG,kBAAkB,CAAC;AACnD,QAAA,iCAAiC,GAAG,sBAAsB,CAAC;AAC3D,QAAA,yBAAyB,GAAG,cAAc,CAAC;AAC3C,QAAA,+BAA+B,GAAG,mBAAmB,CAAC;AACtD,QAAA,0BAA0B,GAAG,eAAe,CAAC"}
|
|
@@ -32,6 +32,10 @@ function generateConvertNamedTypeField(graphqlField, typeNode, ramlFieldName, im
|
|
|
32
32
|
const fieldStateIdentifier = `${graphqlFieldName}State`;
|
|
33
33
|
return (0, deindent_1.default) `
|
|
34
34
|
case '${graphqlFieldName}': {
|
|
35
|
+
if (${constants_2.FIELD_DATA_IDENTIFIER} === null) {
|
|
36
|
+
${constants_2.SINK_IDENTIFIER}["${ramlFieldName}"] = ${constants_2.FIELD_DATA_IDENTIFIER};
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
35
39
|
const ${fieldStateIdentifier} = {
|
|
36
40
|
...state,
|
|
37
41
|
path: {
|
|
@@ -64,7 +68,11 @@ function generateConvertListType(graphqlField, typeNode, ramlFieldName, importCo
|
|
|
64
68
|
const recursivePartialInterface = importContext.importTypeUtil('RecursivePartial');
|
|
65
69
|
return (0, deindent_1.default) `
|
|
66
70
|
case '${graphqlFieldName}': {
|
|
67
|
-
|
|
71
|
+
if (${constants_2.FIELD_DATA_IDENTIFIER} === null) {
|
|
72
|
+
${constants_2.SINK_IDENTIFIER}["${ramlFieldName}"] = ${constants_2.FIELD_DATA_IDENTIFIER};
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
const ${collectionIdentifier}: (${recursivePartialInterface}<NonNullable<ReturnType<typeof ${typeConvertImport}>>> | null)[] = [];
|
|
68
76
|
const ${fullPathIdentifier} = \`\${key}__\${${constants_2.FIELD_KEY_IDENTIFIER}}\`;
|
|
69
77
|
for(let i = 0, len = ${constants_2.FIELD_DATA_IDENTIFIER}.length; i < len; i++) {
|
|
70
78
|
const item = ${constants_2.FIELD_DATA_IDENTIFIER}[i];
|
|
@@ -77,7 +85,9 @@ function generateConvertListType(graphqlField, typeNode, ramlFieldName, importCo
|
|
|
77
85
|
},
|
|
78
86
|
data: item,
|
|
79
87
|
};
|
|
80
|
-
${collectionIdentifier}[i] =
|
|
88
|
+
${collectionIdentifier}[i] = item === null?
|
|
89
|
+
null :
|
|
90
|
+
${typeConvertImport}(
|
|
81
91
|
${constants_2.REQUESTED_FIELD_IDENTIFIER},
|
|
82
92
|
itemState as any
|
|
83
93
|
) || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/convert.ts"],"names":[],"mappings":";;;;;;AAKA,uEAA+C;AAE/C,sDAIgC;AAEhC,oCAA2C;AAC3C,mCAAiF;AACjF,2CAYqB;AAErB,2CAA2D;AAC3D,0CAAiD;AAGjD,MAAM,2BAA2B,GAAG,iBAAiB,CAAC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./select");
|
|
|
15
15
|
const query_transformer_1 = require("./query-transformer");
|
|
16
16
|
const type_cache_keys_1 = require("./type-cache-keys");
|
|
17
17
|
const type_from_field_1 = require("./type-from-field");
|
|
18
|
+
const ingest_field_by_type_1 = require("./ingest-field-by-type");
|
|
19
|
+
const is_mapped_field_1 = require("./is-mapped-field");
|
|
18
20
|
function generateType(graphqlDsl, graphqlTypeName, def, importContext, metadata, modelInfo) {
|
|
19
21
|
return (0, imports_1.resolveImports)((0, deindent_1.default) `
|
|
20
22
|
export const name = '${graphqlTypeName}';
|
|
@@ -26,7 +28,9 @@ function generateType(graphqlDsl, graphqlTypeName, def, importContext, metadata,
|
|
|
26
28
|
${(0, select_1.generateSelect)(graphqlDsl, graphqlTypeName, def, importContext, metadata)}
|
|
27
29
|
${(0, query_transformer_1.generate)(graphqlDsl, graphqlTypeName, def, importContext, metadata)}
|
|
28
30
|
${(0, type_cache_keys_1.generateGetTypeCacheKeys)(graphqlDsl, graphqlTypeName, def, importContext, metadata)}
|
|
29
|
-
${(0, type_from_field_1.generateGetFieldType)(graphqlDsl, def
|
|
31
|
+
${(0, type_from_field_1.generateGetFieldType)(graphqlDsl, def)}
|
|
32
|
+
${(0, ingest_field_by_type_1.generateIngestFieldDataByType)(graphqlDsl, graphqlTypeName, def, importContext, metadata)}
|
|
33
|
+
${(0, is_mapped_field_1.generateIsMappedField)(graphqlDsl, graphqlTypeName, def)}
|
|
30
34
|
`);
|
|
31
35
|
}
|
|
32
36
|
exports.generateType = generateType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/index.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,+BAAoC;AACpC,2CAAiD;AACjD,qCAA0C;AAC1C,+BAAoC;AACpC,mCAAwC;AACxC,oDAAwD;AAKxD,qCAA0C;AAC1C,2DAA2E;AAE3E,uDAA6D;AAC7D,uDAAyD;
|
|
1
|
+
{"version":3,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E,GAAG,CAAC;KAC5D,CAAC,CAAC;AACP,CAAC;AAtBD,oCAsBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NamedTypeNode, ObjectTypeDefinitionNode, TypeNode } from '@luvio/graphql-parser';
|
|
2
|
+
import type { LuvioGraphQLDSL } from '../../../intermediate/graphql';
|
|
3
|
+
import type { ImportContext } from '../../../utils/imports';
|
|
4
|
+
import type { GraphQLCodegenMetadata } from '../source-printer';
|
|
5
|
+
import type { NormalizableTypes } from '../utils';
|
|
6
|
+
export declare function generateIngestFieldDataByType(graphqlDsl: LuvioGraphQLDSL, graphqlTypeName: string, def: ObjectTypeDefinitionNode, importContext: ImportContext, _metadata: GraphQLCodegenMetadata): string;
|
|
7
|
+
export declare function ingestType(typeNode: TypeNode, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
8
|
+
export declare function ingestNamedType(typeNode: NamedTypeNode, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ingestNamedType = exports.ingestType = exports.generateIngestFieldDataByType = void 0;
|
|
7
|
+
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
8
|
+
const constants_1 = require("../../shared/constants");
|
|
9
|
+
const types_1 = require("../utils/types");
|
|
10
|
+
const constants_2 = require("./constants");
|
|
11
|
+
const interface_1 = require("./interface");
|
|
12
|
+
function generateIngestFieldDataByType(graphqlDsl, graphqlTypeName, def, importContext, _metadata) {
|
|
13
|
+
const graphqlStateInterface = importContext.importGraphQLArtifact('types', constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER);
|
|
14
|
+
const normalizableTypeMap = (0, types_1.getNormalizableTypeMap)(graphqlDsl.schema);
|
|
15
|
+
const graphqlFields = (0, types_1.getObjectFields)(def);
|
|
16
|
+
const fieldIngestStatements = graphqlFields
|
|
17
|
+
.map((graphqlField) => {
|
|
18
|
+
return ingestType(graphqlField.type, importContext, normalizableTypeMap);
|
|
19
|
+
})
|
|
20
|
+
.filter((fieldIngestStatement) => fieldIngestStatement !== '')
|
|
21
|
+
.join('\n');
|
|
22
|
+
return `export function ${constants_2.INGEST_FIELD_BY_TYPE_IDENTIFIER}(typename: string, parentKey: string, ${constants_2.REQUESTED_FIELD_IDENTIFIER}: ${constants_1.LUVIO_GRAPHQL_FIELD_NODE_IMPORT}, ${constants_2.SINK_IDENTIFIER}: Record<string, any>, ${constants_2.FIELD_KEY_IDENTIFIER}: ${constants_1.LUVIO_SELECTION_PROPERTY_KEY_IMPORT}, ${constants_2.FIELD_DATA_IDENTIFIER}: any, state: ${graphqlStateInterface}<${interface_1.PARTIAL_INTERFACE_IDENTIFIER}>) {
|
|
23
|
+
// TODO: add validation logic to only allow nullable fields to be null in the future
|
|
24
|
+
if (${constants_2.FIELD_DATA_IDENTIFIER} === null) {
|
|
25
|
+
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = null;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
switch(typename) {
|
|
29
|
+
${fieldIngestStatements}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
exports.generateIngestFieldDataByType = generateIngestFieldDataByType;
|
|
35
|
+
function ingestType(typeNode, importContext, normalizableTypeMap) {
|
|
36
|
+
switch (typeNode.kind) {
|
|
37
|
+
case 'NamedType':
|
|
38
|
+
return ingestNamedType(typeNode, importContext, normalizableTypeMap);
|
|
39
|
+
case 'ListType':
|
|
40
|
+
case 'NonNullType':
|
|
41
|
+
return ingestType(typeNode.type, importContext, normalizableTypeMap);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ingestType = ingestType;
|
|
45
|
+
function ingestNamedType(typeNode, importContext, normalizableTypeMap) {
|
|
46
|
+
const graphqlTypeName = (0, types_1.resolveTypeName)(typeNode);
|
|
47
|
+
const { importGraphQLArtifact } = importContext;
|
|
48
|
+
const isScalar = normalizableTypeMap[graphqlTypeName] === undefined;
|
|
49
|
+
if (isScalar) {
|
|
50
|
+
return generateIngestScalarField(graphqlTypeName);
|
|
51
|
+
}
|
|
52
|
+
const typeNameIngestImport = importGraphQLArtifact('types', graphqlTypeName, constants_2.TYPE_INGEST_IDENTIFIER);
|
|
53
|
+
const graphqlStateInterface = importGraphQLArtifact('types', constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER);
|
|
54
|
+
const typeNamePartialInterfaceImport = importGraphQLArtifact('types', graphqlTypeName, interface_1.PARTIAL_INTERFACE_IDENTIFIER);
|
|
55
|
+
const fieldStateIdentifier = `${graphqlTypeName}State`;
|
|
56
|
+
return (0, deindent_1.default) `
|
|
57
|
+
case '${graphqlTypeName}': {
|
|
58
|
+
const ${fieldStateIdentifier} = {
|
|
59
|
+
...state,
|
|
60
|
+
path: {
|
|
61
|
+
parent: null,
|
|
62
|
+
propertyName: null,
|
|
63
|
+
fullPath: parentKey + '__' + ${constants_2.FIELD_KEY_IDENTIFIER}
|
|
64
|
+
},
|
|
65
|
+
data: ${constants_2.FIELD_DATA_IDENTIFIER},
|
|
66
|
+
};
|
|
67
|
+
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = ${typeNameIngestImport}(
|
|
68
|
+
${constants_2.REQUESTED_FIELD_IDENTIFIER},
|
|
69
|
+
${fieldStateIdentifier} as ${graphqlStateInterface}<${typeNamePartialInterfaceImport}>
|
|
70
|
+
) as any;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
exports.ingestNamedType = ingestNamedType;
|
|
76
|
+
function generateIngestScalarField(typename) {
|
|
77
|
+
return (0, deindent_1.default) `
|
|
78
|
+
case '${typename}': {
|
|
79
|
+
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = ${constants_2.FIELD_DATA_IDENTIFIER};
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=ingest-field-by-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-field-by-type.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/ingest-field-by-type.ts"],"names":[],"mappings":";;;;;;AAEA,uEAA+C;AAE/C,sDAGgC;AAGhC,0CAA0F;AAC1F,2CASqB;AACrB,2CAA2D;AAE3D,SAAgB,6BAA6B,CACzC,UAA2B,EAC3B,eAAuB,EACvB,GAA6B,EAC7B,aAA4B,EAC5B,SAAiC;IAEjC,MAAM,qBAAqB,GAAG,aAAa,CAAC,qBAAqB,CAC7D,OAAO,EACP,gCAAoB,EACpB,qDAAyC,CAC5C,CAAC;IACF,MAAM,mBAAmB,GAAG,IAAA,8BAAsB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAEtE,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,qBAAqB,GAAG,aAAa;SACtC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;QAClB,OAAO,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAC7E,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,oBAAoB,EAAE,EAAE,CAAC,oBAAoB,KAAK,EAAE,CAAC;SAC7D,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhB,OAAO,mBAAmB,2CAA+B,yCAAyC,sCAA0B,KAAK,2CAA+B,KAAK,2BAAe,0BAA0B,gCAAoB,KAAK,+CAAmC,KA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IAAI,gCAAoB,OAAO,oBAAoB;kBAC9D,sCAA0B;kBAC1B,oBAAoB,OAAO,qBAAqB,IAAI,8BAA8B;;;;KAI/F,CAAC;AACN,CAAC;AAlDD,0CAkDC;AAED,SAAS,yBAAyB,CAAC,QAAgB;IAC/C,OAAO,IAAA,kBAAQ,EAAA;oBACC,QAAQ;kBACV,2BAAe,IAAI,gCAAoB,OAAO,iCAAqB;;;SAG5E,CAAC;AACV,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
2
2
|
import type { ImportContext } from '../../../utils/imports';
|
|
3
|
-
import type { NormalizableTypes } from '../utils';
|
|
4
3
|
import type { LuvioGraphQLDSL } from '../../../intermediate/graphql';
|
|
5
4
|
import type { GraphQLCodegenMetadata } from '../source-printer';
|
|
6
5
|
import type { ModelInfo } from '../../../main';
|
|
7
|
-
export declare function ingestNamedType(graphqlField: FieldDefinitionNode, typeNode: NamedTypeNode, ramlFieldName: string | undefined, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
8
|
-
export declare function ingestListType(graphqlField: FieldDefinitionNode, typeNode: ListTypeNode, ramlFieldName: string | undefined, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
9
|
-
export declare function ingestType(graphqlField: FieldDefinitionNode, typeNode: TypeNode, ramlFieldName: string | undefined, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
10
6
|
export declare function generateIngest(graphqlDsl: LuvioGraphQLDSL, graphqlTypeName: string, def: ObjectTypeDefinitionNode, importContext: ImportContext, _metadata: GraphQLCodegenMetadata, modelInfo: ModelInfo): string;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateIngest =
|
|
6
|
+
exports.generateIngest = void 0;
|
|
7
7
|
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
8
8
|
const constants_1 = require("../../shared/constants");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
@@ -11,122 +11,12 @@ const utils_2 = require("./utils");
|
|
|
11
11
|
const convert_1 = require("./convert");
|
|
12
12
|
const constants_2 = require("./constants");
|
|
13
13
|
const interface_1 = require("./interface");
|
|
14
|
-
const
|
|
14
|
+
const FIELD_TYPE_IDENTIFIER = 'fieldType';
|
|
15
15
|
const REQUESTED_FIELDS_IDENTIFIER = 'requestedFields';
|
|
16
|
-
function
|
|
17
|
-
// omit scalar fields that are mapped to RAML fields
|
|
18
|
-
if (ramlFieldName === undefined) {
|
|
19
|
-
return (0, deindent_1.default) `
|
|
20
|
-
case '${graphqlFieldName}': {
|
|
21
|
-
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = ${constants_2.FIELD_DATA_IDENTIFIER};
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
}
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
function ingestNamedType(graphqlField, typeNode, ramlFieldName, importContext, normalizableTypeMap) {
|
|
29
|
-
const graphqlTypeName = (0, utils_1.resolveTypeName)(typeNode);
|
|
30
|
-
const { importGraphQLArtifact } = importContext;
|
|
31
|
-
const isScalar = normalizableTypeMap[graphqlTypeName] === undefined;
|
|
32
|
-
const graphqlFieldName = graphqlField.name.value;
|
|
33
|
-
if (isScalar) {
|
|
34
|
-
return generateIngestScalarField(graphqlFieldName, ramlFieldName);
|
|
35
|
-
}
|
|
36
|
-
const typeNameIngestImport = importGraphQLArtifact('types', graphqlTypeName, constants_2.TYPE_INGEST_IDENTIFIER);
|
|
37
|
-
const graphqlStateInterface = importGraphQLArtifact('types', constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER);
|
|
38
|
-
const typeNamePartialInterfaceImport = importGraphQLArtifact('types', graphqlTypeName, interface_1.PARTIAL_INTERFACE_IDENTIFIER);
|
|
39
|
-
const fieldStateIdentifier = `${graphqlFieldName}State`;
|
|
40
|
-
return (0, deindent_1.default) `
|
|
41
|
-
case '${graphqlFieldName}': {
|
|
42
|
-
const ${fieldStateIdentifier} = {
|
|
43
|
-
...state,
|
|
44
|
-
path: {
|
|
45
|
-
parent: null,
|
|
46
|
-
propertyName: null,
|
|
47
|
-
fullPath: key + '__' + ${constants_2.FIELD_KEY_IDENTIFIER}
|
|
48
|
-
},
|
|
49
|
-
data: ${constants_2.FIELD_DATA_IDENTIFIER},
|
|
50
|
-
};
|
|
51
|
-
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = ${typeNameIngestImport}(
|
|
52
|
-
${constants_2.REQUESTED_FIELD_IDENTIFIER},
|
|
53
|
-
${fieldStateIdentifier} as ${graphqlStateInterface}<${typeNamePartialInterfaceImport}>
|
|
54
|
-
) as any;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
}
|
|
59
|
-
exports.ingestNamedType = ingestNamedType;
|
|
60
|
-
function ingestListType(graphqlField, typeNode, ramlFieldName, importContext, normalizableTypeMap) {
|
|
61
|
-
const { importGraphQLArtifact } = importContext;
|
|
62
|
-
const graphqlFieldName = graphqlField.name.value;
|
|
63
|
-
const graphqlTypeName = (0, utils_1.resolveTypeName)(typeNode);
|
|
64
|
-
const fullPathIdentifier = `fullPath__${graphqlFieldName}`;
|
|
65
|
-
const collectionIdentifier = `${graphqlFieldName}__items`;
|
|
66
|
-
// Non-normalizable types
|
|
67
|
-
const isScalar = normalizableTypeMap[graphqlTypeName] === undefined;
|
|
68
|
-
if (isScalar) {
|
|
69
|
-
return generateIngestScalarField(graphqlFieldName, ramlFieldName);
|
|
70
|
-
}
|
|
71
|
-
const typeNameIngestImport = importGraphQLArtifact('types', graphqlTypeName, constants_2.TYPE_INGEST_IDENTIFIER);
|
|
72
|
-
const graphqlStateInterface = importGraphQLArtifact('types', constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GRAPHQL_INGEST_STATE_INTERFACE_IDENTIFIER);
|
|
73
|
-
const typeNamePartialInterfaceImport = importGraphQLArtifact('types', graphqlTypeName, interface_1.PARTIAL_INTERFACE_IDENTIFIER);
|
|
74
|
-
return (0, deindent_1.default) `
|
|
75
|
-
case '${graphqlFieldName}': {
|
|
76
|
-
const ${collectionIdentifier}: ${constants_1.LUVIO_STORE_LINK_IMPORT}[] = [];
|
|
77
|
-
const ${fullPathIdentifier} = \`\${key}__\${${constants_2.FIELD_KEY_IDENTIFIER}}\`;
|
|
78
|
-
for(let i = 0, len = ${constants_2.FIELD_DATA_IDENTIFIER}.length; i < len; i++) {
|
|
79
|
-
const item = ${constants_2.FIELD_DATA_IDENTIFIER}[i];
|
|
80
|
-
|
|
81
|
-
const itemState = {
|
|
82
|
-
...state,
|
|
83
|
-
path: {
|
|
84
|
-
parent: null,
|
|
85
|
-
propertyName: null,
|
|
86
|
-
fullPath: ${fullPathIdentifier} + i
|
|
87
|
-
},
|
|
88
|
-
data: item,
|
|
89
|
-
};
|
|
90
|
-
${collectionIdentifier}[i] = ${typeNameIngestImport}(
|
|
91
|
-
${constants_2.REQUESTED_FIELD_IDENTIFIER},
|
|
92
|
-
itemState as ${graphqlStateInterface}<${typeNamePartialInterfaceImport}>
|
|
93
|
-
) as any;
|
|
94
|
-
}
|
|
95
|
-
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = ${collectionIdentifier};
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
}
|
|
100
|
-
exports.ingestListType = ingestListType;
|
|
101
|
-
function ingestType(graphqlField, typeNode, ramlFieldName, importContext, normalizableTypeMap) {
|
|
102
|
-
if (graphqlField === undefined) {
|
|
103
|
-
return '';
|
|
104
|
-
}
|
|
105
|
-
switch (typeNode.kind) {
|
|
106
|
-
case 'NamedType':
|
|
107
|
-
return ingestNamedType(graphqlField, typeNode, ramlFieldName, importContext, normalizableTypeMap);
|
|
108
|
-
case 'ListType':
|
|
109
|
-
return ingestListType(graphqlField, typeNode, ramlFieldName, importContext, normalizableTypeMap);
|
|
110
|
-
default:
|
|
111
|
-
return ingestType(graphqlField, typeNode.type, ramlFieldName, importContext, normalizableTypeMap);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.ingestType = ingestType;
|
|
115
|
-
function generateObjectTypeIngest(graphqlDsl, graphqlTypeName, importContext, def, normalizableTypeMap) {
|
|
116
|
-
const graphqlFields = (0, types_1.getObjectFields)(def);
|
|
117
|
-
const fieldIngestStatements = graphqlFields
|
|
118
|
-
.filter((graphqlField) => graphqlField.type !== undefined)
|
|
119
|
-
.map((graphqlField) => {
|
|
120
|
-
const { typeNameToExtensions } = graphqlDsl;
|
|
121
|
-
const graphqlFieldName = graphqlField.name.value;
|
|
122
|
-
const ramlFieldName = (0, utils_2.getRamlFieldName)(typeNameToExtensions, graphqlTypeName, graphqlFieldName);
|
|
123
|
-
return ingestType(graphqlField, graphqlField.type, ramlFieldName, importContext, normalizableTypeMap);
|
|
124
|
-
})
|
|
125
|
-
.filter((fieldIngestStatement) => fieldIngestStatement !== '');
|
|
126
|
-
const eachFieldHandling = fieldIngestStatements.join('\n');
|
|
16
|
+
function generateObjectTypeIngest(importContext) {
|
|
127
17
|
const ingestStatements = [
|
|
128
18
|
getRequestedFieldsStatement(importContext),
|
|
129
|
-
iterateThroughResponseKeys(importContext
|
|
19
|
+
iterateThroughResponseKeys(importContext),
|
|
130
20
|
];
|
|
131
21
|
return ingestStatements.join('\n');
|
|
132
22
|
}
|
|
@@ -139,22 +29,36 @@ function getRequestedFieldsStatement(importContext) {
|
|
|
139
29
|
[];
|
|
140
30
|
`;
|
|
141
31
|
}
|
|
142
|
-
function iterateThroughResponseKeys(importContext
|
|
32
|
+
function iterateThroughResponseKeys(importContext) {
|
|
143
33
|
const getRequestedFieldImport = importContext.importGraphQLArtifact('types', constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GET_REQUESTED_FIELD_IDENTIFIER);
|
|
144
34
|
const getFieldKeyImport = importContext.importGraphQLArtifact('types', constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GET_SERIALIZED_KEY_FOR_FIELD_IDENTIFIER);
|
|
145
35
|
return (0, deindent_1.default) `
|
|
146
36
|
for(const ${constants_2.FIELD_DATA_KEY_IDENTIFIER} of Object.keys(data)){
|
|
147
37
|
const ${constants_2.FIELD_DATA_IDENTIFIER} = data[${constants_2.FIELD_DATA_KEY_IDENTIFIER}];
|
|
148
|
-
const ${constants_2.REQUESTED_FIELD_IDENTIFIER} = ${getRequestedFieldImport}(${constants_2.FIELD_DATA_KEY_IDENTIFIER}, ${REQUESTED_FIELDS_IDENTIFIER});
|
|
149
|
-
|
|
38
|
+
const ${constants_2.REQUESTED_FIELD_IDENTIFIER} = ${getRequestedFieldImport}(${constants_2.FIELD_DATA_KEY_IDENTIFIER}, ${REQUESTED_FIELDS_IDENTIFIER});
|
|
150
39
|
if(${constants_2.REQUESTED_FIELD_IDENTIFIER} === undefined) {
|
|
151
40
|
break; // TODO: (W-11132802) We got a field back we didn't ask for. Call handleUnknownField.
|
|
152
41
|
}
|
|
42
|
+
if(${constants_2.IS_MAPPED_FIELD_IDENTIFIER}(${constants_2.REQUESTED_FIELD_IDENTIFIER})) {
|
|
43
|
+
continue; // Skips scalar fields that are mapped to RAML.
|
|
44
|
+
}
|
|
153
45
|
const ${constants_2.FIELD_KEY_IDENTIFIER} = ${getFieldKeyImport}(${constants_2.REQUESTED_FIELD_IDENTIFIER}, state.variables);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
${
|
|
46
|
+
const ${FIELD_TYPE_IDENTIFIER} = ${constants_2.GET_FIELD_TYPE_IDENTIFIER}(${constants_2.REQUESTED_FIELD_IDENTIFIER});
|
|
47
|
+
if (${constants_2.FIELD_DATA_IDENTIFIER} === null) {
|
|
48
|
+
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = ${constants_2.FIELD_DATA_IDENTIFIER};
|
|
49
|
+
continue; // Don't delegate null to type ingest.
|
|
157
50
|
}
|
|
51
|
+
if(${FIELD_TYPE_IDENTIFIER}.isArray && ${constants_2.FIELD_DATA_IDENTIFIER}.length !== undefined) {
|
|
52
|
+
const arrayLength = ${constants_2.FIELD_DATA_IDENTIFIER}.length;
|
|
53
|
+
const arraySink: any[] = new Array(arrayLength);
|
|
54
|
+
for(let i = 0, len = arrayLength; i < len; i += 1) {
|
|
55
|
+
const arrayFullPathKey = key + '__' + ${constants_2.FIELD_KEY_IDENTIFIER};
|
|
56
|
+
${constants_2.INGEST_FIELD_BY_TYPE_IDENTIFIER}(${FIELD_TYPE_IDENTIFIER}.typename, arrayFullPathKey, ${constants_2.REQUESTED_FIELD_IDENTIFIER}, arraySink, i, ${constants_2.FIELD_DATA_IDENTIFIER}[i], state);
|
|
57
|
+
}
|
|
58
|
+
${constants_2.SINK_IDENTIFIER}[${constants_2.FIELD_KEY_IDENTIFIER}] = arraySink;
|
|
59
|
+
} else {
|
|
60
|
+
${constants_2.INGEST_FIELD_BY_TYPE_IDENTIFIER}(${FIELD_TYPE_IDENTIFIER}.typename, key, ${constants_2.REQUESTED_FIELD_IDENTIFIER}, ${constants_2.SINK_IDENTIFIER}, ${constants_2.FIELD_KEY_IDENTIFIER}, ${constants_2.FIELD_DATA_IDENTIFIER}, state);
|
|
61
|
+
}
|
|
158
62
|
}
|
|
159
63
|
`;
|
|
160
64
|
}
|
|
@@ -172,7 +76,7 @@ function generateIngest(graphqlDsl, graphqlTypeName, def, importContext, _metada
|
|
|
172
76
|
const astNodeParamType = ((_a = schema.getQueryType()) === null || _a === void 0 ? void 0 : _a.name) === graphqlTypeName
|
|
173
77
|
? constants_1.LUVIO_GRAPHQL_OPERATION_DEFINITION_NODE_IMPORT
|
|
174
78
|
: constants_1.LUVIO_GRAPHQL_FIELD_NODE_IMPORT;
|
|
175
|
-
const
|
|
79
|
+
const convertToRaml = (0, convert_1.generateRamlConversion)(graphqlDsl, graphqlTypeName, importContext, def, modelInfo, graphqlStateInterface, normalizableTypeMap);
|
|
176
80
|
let ramlIngest = undefined;
|
|
177
81
|
const ramlTypeName = (0, utils_2.getRamlTypeName)(typeNameToExtensions, graphqlTypeName);
|
|
178
82
|
if (ramlTypeName !== undefined) {
|
|
@@ -183,15 +87,15 @@ function generateIngest(graphqlDsl, graphqlTypeName, def, importContext, _metada
|
|
|
183
87
|
}
|
|
184
88
|
return (0, deindent_1.default) `
|
|
185
89
|
|
|
186
|
-
${
|
|
90
|
+
${convertToRaml}
|
|
187
91
|
|
|
188
92
|
export function ingest(astNode: ${astNodeParamType}, state: ${graphqlStateInterface}<${interface_1.PARTIAL_INTERFACE_IDENTIFIER}>) {
|
|
189
93
|
const { path, data, ${constants_1.LUVIO_IDENTIFIER}, ${constants_1.LUVIO_STORE_IDENTIFIER}, ${constants_2.TIMESTAMP_IDENTIFIER} } = state;
|
|
190
94
|
const key = ${constants_2.KEY_BUILDER_IDENTIFIER}(${constants_1.LUVIO_IDENTIFIER}, path, data);
|
|
191
95
|
const ${constants_2.SINK_IDENTIFIER}: Record<string,any> = {};
|
|
192
96
|
|
|
193
|
-
//
|
|
194
|
-
${generateObjectTypeIngest(
|
|
97
|
+
// ingest field data
|
|
98
|
+
${generateObjectTypeIngest(importContext)}
|
|
195
99
|
|
|
196
100
|
// merge existing cache data and new request response data
|
|
197
101
|
let mergedData: Record<string,any>;
|
|
@@ -203,7 +107,7 @@ function generateIngest(graphqlDsl, graphqlTypeName, def, importContext, _metada
|
|
|
203
107
|
mergedData = {data: ${constants_2.SINK_IDENTIFIER}};
|
|
204
108
|
}
|
|
205
109
|
|
|
206
|
-
${
|
|
110
|
+
${convertToRaml === ''
|
|
207
111
|
? ''
|
|
208
112
|
: (0, deindent_1.default) `
|
|
209
113
|
// delegate type ingest to RAML ingest if the type is in RAML mapping
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/ingest.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/ingest.ts"],"names":[],"mappings":";;;;;;AACA,uEAA+C;AAE/C,sDAKgC;AAChC,oCAAkD;AAClD,mCAAuF;AACvF,uCAAmD;AACnD,2CAkBqB;AAGrB,2CAA2D;AAG3D,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAC1C,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;AAEtD,SAAS,wBAAwB,CAAC,aAA4B;IAC1D,MAAM,gBAAgB,GAAa;QAC/B,2BAA2B,CAAC,aAAa,CAAC;QAC1C,0BAA0B,CAAC,aAAa,CAAC;KAC5C,CAAC;IAEF,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,2BAA2B,CAAC,aAA4B;IAC7D,MAAM,wBAAwB,GAAG,aAAa,CAAC,qBAAqB,CAChE,OAAO,EACP,gCAAoB,EACpB,oDAAwC,CAC3C,CAAC;IACF,OAAO,IAAA,kBAAQ,EAAA;gBACH,2BAA2B,KAAK,2CAA+B;;cAEjE,wBAAwB;;KAEjC,CAAC;AACN,CAAC;AAED,SAAS,0BAA0B,CAAC,aAA4B;IAC5D,MAAM,uBAAuB,GAAG,aAAa,CAAC,qBAAqB,CAC/D,OAAO,EACP,gCAAoB,EACpB,0CAA8B,CACjC,CAAC;IACF,MAAM,iBAAiB,GAAG,aAAa,CAAC,qBAAqB,CACzD,OAAO,EACP,gCAAoB,EACpB,mDAAuC,CAC1C,CAAC;IACF,OAAO,IAAA,kBAAQ,EAAA;oBACC,qCAAyB;oBACzB,iCAAqB,WAAW,qCAAyB;oBACzD,sCAA0B,MAAM,uBAAuB,IAAI,qCAA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@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ObjectTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
2
|
+
import type { LuvioGraphQLDSL } from '../../../intermediate/graphql';
|
|
3
|
+
export declare function generateIsMappedField(graphqlDsl: LuvioGraphQLDSL, graphqlTypeName: string, def: ObjectTypeDefinitionNode): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateIsMappedField = void 0;
|
|
4
|
+
const constants_1 = require("../../shared/constants");
|
|
5
|
+
const types_1 = require("../utils/types");
|
|
6
|
+
const constants_2 = require("./constants");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
function getMappedScalarFieldNames(graphqlDsl, graphqlTypeName, def) {
|
|
9
|
+
const { typeNameToExtensions, schema } = graphqlDsl;
|
|
10
|
+
const normalizableTypeMap = (0, types_1.getNormalizableTypeMap)(schema);
|
|
11
|
+
const graphqlFields = (0, types_1.getObjectFields)(def);
|
|
12
|
+
return graphqlFields
|
|
13
|
+
.filter(
|
|
14
|
+
// Filter to only mapped fields
|
|
15
|
+
(graphqlField) => (0, utils_1.getRamlFieldName)(typeNameToExtensions, graphqlTypeName, graphqlField.name.value) !==
|
|
16
|
+
undefined)
|
|
17
|
+
.filter(
|
|
18
|
+
// Filter to only scalar fields. Normalized fields might have their own mapping
|
|
19
|
+
(graphqlField) => {
|
|
20
|
+
const typename = (0, types_1.resolveTypeName)(graphqlField.type);
|
|
21
|
+
return normalizableTypeMap[typename] === undefined;
|
|
22
|
+
})
|
|
23
|
+
.map((graphqlField) => graphqlField.name.value);
|
|
24
|
+
}
|
|
25
|
+
function generateIsMappedField(graphqlDsl, graphqlTypeName, def) {
|
|
26
|
+
const mappedFields = getMappedScalarFieldNames(graphqlDsl, graphqlTypeName, def);
|
|
27
|
+
const functionBody = mappedFields.length > 0
|
|
28
|
+
? `
|
|
29
|
+
const mappedFields = [${mappedFields.map((field) => `'${field}'`).join(',')}];
|
|
30
|
+
return mappedFields.indexOf(field.name.value) !== -1;`
|
|
31
|
+
: `return false`;
|
|
32
|
+
return `export function ${constants_2.IS_MAPPED_FIELD_IDENTIFIER}(field: ${constants_1.LUVIO_GRAPHQL_FIELD_NODE_IMPORT}): boolean {
|
|
33
|
+
${functionBody}
|
|
34
|
+
}`;
|
|
35
|
+
}
|
|
36
|
+
exports.generateIsMappedField = generateIsMappedField;
|
|
37
|
+
//# sourceMappingURL=is-mapped-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-mapped-field.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/is-mapped-field.ts"],"names":[],"mappings":";;;AAEA,sDAAyE;AACzE,0CAA0F;AAC1F,2CAAyD;AACzD,mCAA2C;AAE3C,SAAS,yBAAyB,CAC9B,UAA2B,EAC3B,eAAuB,EACvB,GAA6B;IAE7B,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACpD,MAAM,mBAAmB,GAAG,IAAA,8BAAsB,EAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,aAAa;SACf,MAAM;IACH,+BAA+B;IAC/B,CAAC,YAAY,EAAE,EAAE,CACb,IAAA,wBAAgB,EAAC,oBAAoB,EAAE,eAAe,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAChF,SAAS,CAChB;SACA,MAAM;IACH,+EAA+E;IAC/E,CAAC,YAAY,EAAE,EAAE;QACb,MAAM,QAAQ,GAAG,IAAA,uBAAe,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC;IACvD,CAAC,CACJ;SACA,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,qBAAqB,CACjC,UAA2B,EAC3B,eAAuB,EACvB,GAA6B;IAE7B,MAAM,YAAY,GAAG,yBAAyB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,CAAC,CAAC;IAEjF,MAAM,YAAY,GACd,YAAY,CAAC,MAAM,GAAG,CAAC;QACnB,CAAC,CAAC;gCACkB,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;8DACrB;QAClD,CAAC,CAAC,cAAc,CAAC;IAEzB,OAAO,mBAAmB,sCAA0B,WAAW,2CAA+B;UACxF,YAAY;MAChB,CAAC;AACP,CAAC;AAjBD,sDAiBC"}
|
|
@@ -2,4 +2,4 @@ import type { ObjectTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
|
2
2
|
import type { ImportContext } from '../../../utils/imports';
|
|
3
3
|
import type { LuvioGraphQLDSL } from '../../../intermediate/graphql';
|
|
4
4
|
import type { GraphQLCodegenMetadata } from '../source-printer';
|
|
5
|
-
export declare function generateSelect(graphqlDsl: LuvioGraphQLDSL, graphqlTypeName: string, def: ObjectTypeDefinitionNode, importContext: ImportContext,
|
|
5
|
+
export declare function generateSelect(graphqlDsl: LuvioGraphQLDSL, graphqlTypeName: string, def: ObjectTypeDefinitionNode, importContext: ImportContext, _metadata: GraphQLCodegenMetadata): string;
|
|
@@ -13,7 +13,6 @@ const utils_2 = require("../utils");
|
|
|
13
13
|
const types_1 = require("../utils/types");
|
|
14
14
|
const interface_1 = require("./interface");
|
|
15
15
|
const util_1 = require("../directive/util");
|
|
16
|
-
const type_from_field_1 = require("./type-from-field");
|
|
17
16
|
function selectNamedType(field, typeNode, importContext, normalizableTypeMap) {
|
|
18
17
|
const fieldName = field.name.value;
|
|
19
18
|
const identifier = fieldName;
|
|
@@ -94,7 +93,7 @@ function generateDataMapping(graphqlDsl, graphqlTypeName, def, normalizableTypeM
|
|
|
94
93
|
.filter((fieldIngestStatement) => fieldIngestStatement !== '')
|
|
95
94
|
.join('\n');
|
|
96
95
|
}
|
|
97
|
-
function generateSelect(graphqlDsl, graphqlTypeName, def, importContext,
|
|
96
|
+
function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, _metadata) {
|
|
98
97
|
var _a;
|
|
99
98
|
const { schema } = graphqlDsl;
|
|
100
99
|
const type = schema.getType(def.name.value);
|
|
@@ -106,10 +105,10 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
106
105
|
const fieldSelectionByTypeCaseStatements = (0, types_1.getObjectFields)(def)
|
|
107
106
|
.map((field) => {
|
|
108
107
|
const type = field.type;
|
|
109
|
-
const typename = (0,
|
|
108
|
+
const typename = (0, types_1.resolveTypeName)(type);
|
|
110
109
|
const body = selectType(field, type, importContext, normalizableTypeMap);
|
|
111
110
|
return (0, deindent_1.default) `
|
|
112
|
-
case ${typename}: {
|
|
111
|
+
case '${typename}': {
|
|
113
112
|
${body}
|
|
114
113
|
break;
|
|
115
114
|
}
|
|
@@ -136,13 +135,17 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
|
-
function selectType(typename: string, sel: ${constants_2.LUVIO_GRAPHQL_FIELD_NODE_IMPORT},
|
|
138
|
+
export function selectType(typename: string, sel: ${constants_2.LUVIO_GRAPHQL_FIELD_NODE_IMPORT}, ${constants_3.FIELD_DATA_IDENTIFIER}: any, reader: ${constants_1.ADAPTER_READER_IMPORT}<any>, key: ${constants_2.LUVIO_SELECTION_PROPERTY_KEY_IMPORT}, ${constants_3.SINK_IDENTIFIER}: any, variables: ${graphqlVariablesImport}, fragments: ${fragmentMapImport}) {
|
|
139
|
+
if (${constants_3.FIELD_DATA_IDENTIFIER} === null) {
|
|
140
|
+
${generateSelectScalar()}
|
|
141
|
+
return ${constants_3.SINK_IDENTIFIER};
|
|
142
|
+
}
|
|
140
143
|
switch(typename) {
|
|
141
144
|
${fieldSelectionByTypeCaseStatements}
|
|
142
145
|
}
|
|
143
|
-
return
|
|
146
|
+
return ${constants_3.SINK_IDENTIFIER};
|
|
144
147
|
}
|
|
145
|
-
export function buildSelectionForField(source: ${interface_1.PARTIAL_INTERFACE_IDENTIFIER}, reader: ${constants_1.ADAPTER_READER_IMPORT}<any>, sel: ${constants_2.LUVIO_GRAPHQL_FIELD_NODE_IMPORT} , variables: ${graphqlVariablesImport}, fragments: ${fragmentMapImport}
|
|
148
|
+
export function buildSelectionForField(source: ${interface_1.PARTIAL_INTERFACE_IDENTIFIER}, reader: ${constants_1.ADAPTER_READER_IMPORT}<any>, sel: ${constants_2.LUVIO_GRAPHQL_FIELD_NODE_IMPORT} , variables: ${graphqlVariablesImport}, fragments: ${fragmentMapImport}) {
|
|
146
149
|
const ${constants_3.SINK_IDENTIFIER}: Record<string, any> = {}
|
|
147
150
|
const ${constants_3.FIELD_DATA_IDENTIFIER} = getFieldData(source, sel, variables);
|
|
148
151
|
const ${constants_3.REQUESTED_FIELD_NAME_IDENTIFIER} = sel.alias ? sel.alias.value : sel.name.value;
|
|
@@ -152,6 +155,11 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
152
155
|
return;
|
|
153
156
|
}
|
|
154
157
|
|
|
158
|
+
if(${constants_3.FIELD_DATA_IDENTIFIER} === null) {
|
|
159
|
+
reader.assignScalar(${constants_3.REQUESTED_FIELD_NAME_IDENTIFIER}, ${constants_3.SINK_IDENTIFIER}, ${constants_3.FIELD_DATA_IDENTIFIER});
|
|
160
|
+
return sink;
|
|
161
|
+
}
|
|
162
|
+
|
|
155
163
|
const fieldType = ${constants_3.GET_FIELD_TYPE_IDENTIFIER}(sel);
|
|
156
164
|
if(fieldType.isArray) {
|
|
157
165
|
const arraySink: any[] = [];
|
|
@@ -165,7 +173,7 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
165
173
|
selectType(fieldType.typename, sel, ${constants_3.FIELD_DATA_IDENTIFIER}, reader, ${constants_3.REQUESTED_FIELD_NAME_IDENTIFIER}, ${constants_3.SINK_IDENTIFIER}, variables, fragments);
|
|
166
174
|
}
|
|
167
175
|
|
|
168
|
-
return
|
|
176
|
+
return ${constants_3.SINK_IDENTIFIER};
|
|
169
177
|
}
|
|
170
178
|
export function buildSelectionForNode(source: ${interface_1.PARTIAL_INTERFACE_IDENTIFIER}, reader: ${constants_1.ADAPTER_READER_IMPORT}<any>, selectionNode: ${constants_2.LUVIO_GRAPHQL_SELECTION_NODE_IMPORT} , variables: ${graphqlVariablesImport}, fragments: ${fragmentMapImport}) {
|
|
171
179
|
const ${constants_3.SINK_IDENTIFIER}: Record<string, any> = {}
|
|
@@ -181,7 +189,7 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
181
189
|
// Get selections out of the inline fragment
|
|
182
190
|
selectionNode.selectionSet.selections.forEach(fragmentSelection => {
|
|
183
191
|
// Call into field handling with selections
|
|
184
|
-
Object.assign(
|
|
192
|
+
Object.assign(${constants_3.SINK_IDENTIFIER}, buildSelectionForNode(source, reader, fragmentSelection, variables, fragments));
|
|
185
193
|
});
|
|
186
194
|
}
|
|
187
195
|
}
|
|
@@ -190,12 +198,12 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
190
198
|
if(namedFragment && namedFragment.typeCondition.name.value === name) {
|
|
191
199
|
namedFragment.selectionSet.selections.forEach(fragmentSelection => {
|
|
192
200
|
// Call into field handling with selections
|
|
193
|
-
Object.assign(
|
|
201
|
+
Object.assign(${constants_3.SINK_IDENTIFIER}, buildSelectionForNode(source, reader, fragmentSelection, variables, fragments));
|
|
194
202
|
});
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
205
|
if(selectionNode.kind === "Field") {
|
|
198
|
-
Object.assign(
|
|
206
|
+
Object.assign(${constants_3.SINK_IDENTIFIER}, buildSelectionForField(source, reader, selectionNode, variables, fragments));
|
|
199
207
|
}
|
|
200
208
|
return ${constants_3.SINK_IDENTIFIER};
|
|
201
209
|
}
|
|
@@ -216,7 +224,7 @@ function generateSelect(graphqlDsl, graphqlTypeName, def, importContext, metadat
|
|
|
216
224
|
});
|
|
217
225
|
}
|
|
218
226
|
field.selectionSet?.selections.forEach((sel) => {
|
|
219
|
-
Object.assign(
|
|
227
|
+
Object.assign(${constants_3.SINK_IDENTIFIER}, buildSelectionForNode(source, reader, sel, variables, fragments));
|
|
220
228
|
});
|
|
221
229
|
return ${constants_3.SINK_IDENTIFIER} as ${interface_1.PARTIAL_INTERFACE_IDENTIFIER};
|
|
222
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/select.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,uDAAgE;AAQhE,sDAKgC;AAGhC,2CAUqB;AACrB,mCAA2C;AAE3C,oCAAkD;AAClD,0CAAkE;AAClE,2CAA2D;AAC3D,4CAG2B;
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/select.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,uDAAgE;AAQhE,sDAKgC;AAGhC,2CAUqB;AACrB,mCAA2C;AAE3C,oCAAkD;AAClD,0CAAkE;AAClE,2CAA2D;AAC3D,4CAG2B;AAE3B,SAAS,eAAe,CACpB,KAA0B,EAC1B,QAAuB,EACvB,aAA4B,EAC5B,mBAAsC;IAEtC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;IACnC,MAAM,UAAU,GAAG,SAAS,CAAC;IAC7B,MAAM,sBAAsB,GAAG,GAAG,UAAU,cAAc,CAAC;IAC3D,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,eAAe,C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,IAAA,kBAAQ,EAAA;mCACgB,2BAAe,KAAK,iCAAqB;KACvE,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { ObjectTypeDefinitionNode
|
|
1
|
+
import type { ObjectTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
2
2
|
import type { LuvioGraphQLDSL } from '../../../intermediate/graphql';
|
|
3
|
-
|
|
4
|
-
import type { GraphQLCodegenMetadata } from '../source-printer';
|
|
5
|
-
export declare function generateGetFieldType(graphqlDsl: LuvioGraphQLDSL, def: ObjectTypeDefinitionNode, importContext: ImportContext, metadata: GraphQLCodegenMetadata): string;
|
|
6
|
-
export declare function getTypeName(type: TypeNode, importContext: ImportContext, scalarToPrimitiveMap: Record<string, string>): string;
|
|
3
|
+
export declare function generateGetFieldType(graphqlDsl: LuvioGraphQLDSL, def: ObjectTypeDefinitionNode): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generateGetFieldType = void 0;
|
|
4
4
|
const constants_1 = require("../../shared/constants");
|
|
5
5
|
const types_1 = require("../utils/types");
|
|
6
6
|
const constants_2 = require("./constants");
|
|
7
|
-
function generateGetFieldType(graphqlDsl, def
|
|
7
|
+
function generateGetFieldType(graphqlDsl, def) {
|
|
8
8
|
const { schema } = graphqlDsl;
|
|
9
9
|
const type = schema.getType(def.name.value);
|
|
10
10
|
if (!type) {
|
|
@@ -15,12 +15,12 @@ function generateGetFieldType(graphqlDsl, def, importContext, metadata) {
|
|
|
15
15
|
const fieldName = field.name.value;
|
|
16
16
|
const type = field.type;
|
|
17
17
|
const isArrayAsString = isListType(type) ? 'true' : 'false';
|
|
18
|
-
const typeName =
|
|
18
|
+
const typeName = (0, types_1.resolveTypeName)(type);
|
|
19
19
|
return `
|
|
20
20
|
case '${fieldName}': {
|
|
21
21
|
return {
|
|
22
22
|
isArray: ${isArrayAsString},
|
|
23
|
-
typename: ${typeName}
|
|
23
|
+
typename: '${typeName}'
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
@@ -46,21 +46,4 @@ function isListType(type) {
|
|
|
46
46
|
return isListType(type.type);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function getTypeName(type, importContext, scalarToPrimitiveMap) {
|
|
50
|
-
switch (type.kind) {
|
|
51
|
-
case 'ListType':
|
|
52
|
-
case 'NonNullType':
|
|
53
|
-
return getTypeName(type.type, importContext, scalarToPrimitiveMap);
|
|
54
|
-
case 'NamedType':
|
|
55
|
-
return generateNamedTypeReference(type, importContext, scalarToPrimitiveMap);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.getTypeName = getTypeName;
|
|
59
|
-
function generateNamedTypeReference(type, importContext, scalarToPrimitiveMap) {
|
|
60
|
-
const typeName = type.name.value;
|
|
61
|
-
if (scalarToPrimitiveMap[typeName] !== undefined) {
|
|
62
|
-
return `'${scalarToPrimitiveMap[typeName]}'`;
|
|
63
|
-
}
|
|
64
|
-
return importContext.importGraphQLArtifact('types', typeName, 'name');
|
|
65
|
-
}
|
|
66
49
|
//# sourceMappingURL=type-from-field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-from-field.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/type-from-field.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"type-from-field.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/type-from-field.ts"],"names":[],"mappings":";;;AAEA,sDAAyE;AACzE,0CAAkE;AAClE,2CAAwD;AAExD,SAAgB,oBAAoB,CAAC,UAA2B,EAAE,GAA6B;IAC3F,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,EAAE;QACP,OAAO,EAAE,CAAC;KACb;IAED,MAAM,mBAAmB,GAAG,IAAA,uBAAe,EAAC,GAAG,CAAC;SAC3C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACX,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QACnC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAC5D,MAAM,QAAQ,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,CAAC;QAEvC,OAAO;wBACK,SAAS;;mCAEE,eAAe;qCACb,QAAQ;;;aAGhC,CAAC;IACN,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhB,OAAO,mBAAmB,qCAAyB,WAAW,2CAA+B;;kBAE/E,mBAAmB;;;;;SAK5B,CAAC;AACV,CAAC;AAjCD,oDAiCC;AAED,SAAS,UAAU,CAAC,IAAc;IAC9B,QAAQ,IAAI,CAAC,IAAI,EAAE;QACf,KAAK,UAAU;YACX,OAAO,IAAI,CAAC;QAChB,KAAK,WAAW;YACZ,OAAO,KAAK,CAAC;QACjB,KAAK,aAAa;YACd,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACpC;AACL,CAAC"}
|
|
@@ -11,11 +11,11 @@ const LANGUAGE = (0, deindent_1.default) `
|
|
|
11
11
|
export const { stringify: JSONStringify } = JSON;
|
|
12
12
|
`;
|
|
13
13
|
const INTERFACE = (0, deindent_1.default) `
|
|
14
|
-
type AllowedPrimitives = boolean | string | number | Date /* add any types than should be considered as a value, say, DateTimeOffset */;
|
|
14
|
+
type AllowedPrimitives = boolean | string | number | Date | null /* add any types than should be considered as a value, say, DateTimeOffset */;
|
|
15
15
|
type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
|
|
16
|
-
export type RecursivePartial<T> = {
|
|
16
|
+
export type RecursivePartial<T> = null | {
|
|
17
17
|
[P in keyof T]?:
|
|
18
|
-
T[P] extends Array<infer U> ? Array<Value<U>> : Value<T[P]
|
|
18
|
+
T[P] extends Array<infer U> ? Array<Value<U>> | null : Value<T[P]> | null;
|
|
19
19
|
};
|
|
20
20
|
`;
|
|
21
21
|
const EQUALS_ARRAY = (0, deindent_1.default) `
|
package/package.json
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.99.1",
|
|
4
4
|
"description": "Luvio Compiler",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/salesforce/luvio.git",
|
|
8
|
+
"directory": "packages/@luvio/compiler"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
5
11
|
"main": "dist/main.js",
|
|
6
12
|
"types": "dist/main.d.ts",
|
|
7
|
-
"
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"resources/"
|
|
16
|
+
],
|
|
8
17
|
"scripts": {
|
|
9
|
-
"clean": "rm -rf dist `find ./src/__tests__/fixtures/ -type d -name generated`",
|
|
10
18
|
"build": "tsc",
|
|
19
|
+
"clean": "rm -rf dist `find ./src/__tests__/fixtures/ -type d -name generated`",
|
|
11
20
|
"test": "jest",
|
|
12
|
-
"test
|
|
13
|
-
"test
|
|
21
|
+
"test-generated": "jest --config ./jest.generated.config.js",
|
|
22
|
+
"test:debug": "node --inspect-brk ../../../node_modules/jest/bin/jest.js --config ./jest.config.js --runInBand"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@luvio/graphql-parser": "0.99.1",
|
|
26
|
+
"amf-client-js": "4.2.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@luvio/adapter-test-library": "0.99.1",
|
|
30
|
+
"@luvio/engine": "0.99.1"
|
|
14
31
|
},
|
|
15
32
|
"nx": {
|
|
16
33
|
"targets": {
|
|
@@ -25,17 +42,5 @@
|
|
|
25
42
|
]
|
|
26
43
|
}
|
|
27
44
|
}
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist/",
|
|
31
|
-
"resources/"
|
|
32
|
-
],
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"@luvio/graphql-parser": "0.97.1",
|
|
35
|
-
"amf-client-js": "4.2.0"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@luvio/adapter-test-library": "0.97.1",
|
|
39
|
-
"@luvio/engine": "0.97.1"
|
|
40
45
|
}
|
|
41
46
|
}
|