@memberjunction/codegen-lib 1.0.4 → 1.0.7-next.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/dist/advanced_generation.d.ts +3 -0
- package/dist/advanced_generation.d.ts.map +1 -1
- package/dist/advanced_generation.js +39 -26
- package/dist/advanced_generation.js.map +1 -1
- package/dist/angular_client_codegen.d.ts +45 -2
- package/dist/angular_client_codegen.d.ts.map +1 -1
- package/dist/angular_client_codegen.js +423 -399
- package/dist/angular_client_codegen.js.map +1 -1
- package/dist/createNewUser.d.ts +6 -1
- package/dist/createNewUser.d.ts.map +1 -1
- package/dist/createNewUser.js +68 -53
- package/dist/createNewUser.js.map +1 -1
- package/dist/dbSchema.d.ts +10 -3
- package/dist/dbSchema.d.ts.map +1 -1
- package/dist/dbSchema.js +144 -130
- package/dist/dbSchema.js.map +1 -1
- package/dist/entity_subclasses_codegen.d.ts +11 -6
- package/dist/entity_subclasses_codegen.d.ts.map +1 -1
- package/dist/entity_subclasses_codegen.js +144 -131
- package/dist/entity_subclasses_codegen.js.map +1 -1
- package/dist/graphql_server_codegen.d.ts +28 -5
- package/dist/graphql_server_codegen.d.ts.map +1 -1
- package/dist/graphql_server_codegen.js +552 -531
- package/dist/graphql_server_codegen.js.map +1 -1
- package/dist/logging.d.ts +20 -0
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +61 -26
- package/dist/logging.js.map +1 -1
- package/dist/manageMetadata.d.ts +128 -7
- package/dist/manageMetadata.d.ts.map +1 -1
- package/dist/manageMetadata.js +992 -898
- package/dist/manageMetadata.js.map +1 -1
- package/dist/runCodeGen.d.ts +16 -0
- package/dist/runCodeGen.d.ts.map +1 -1
- package/dist/runCodeGen.js +185 -140
- package/dist/runCodeGen.js.map +1 -1
- package/dist/runCommand.d.ts +7 -2
- package/dist/runCommand.d.ts.map +1 -1
- package/dist/runCommand.js +104 -90
- package/dist/runCommand.js.map +1 -1
- package/dist/sql.d.ts +21 -16
- package/dist/sql.d.ts.map +1 -1
- package/dist/sql.js +98 -87
- package/dist/sql.js.map +1 -1
- package/dist/sql_codegen.d.ts +56 -13
- package/dist/sql_codegen.d.ts.map +1 -1
- package/dist/sql_codegen.js +836 -795
- package/dist/sql_codegen.js.map +1 -1
- package/dist/util.js +0 -2
- package/dist/util.js.map +1 -1
- package/package.json +32 -32
- package/readme.md +2 -2
- package/dist/graphql_client_codegen.d.ts +0 -4
- package/dist/graphql_client_codegen.js +0 -161
- package/dist/graphql_client_codegen.js.map +0 -1
- package/dist/react_client_codegen.d.ts +0 -4
- package/dist/react_client_codegen.js +0 -147
- package/dist/react_client_codegen.js.map +0 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { EntityInfo } from '@memberjunction/core';
|
|
2
|
-
export declare function generateAllEntitySubClasses(entities: EntityInfo[], directory: string): boolean;
|
|
3
|
-
export declare function generateEntitySubClassFileHeader(): string;
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param entity
|
|
7
|
-
* @param includeFileHeader
|
|
3
|
+
* Base class for generating entity sub-classes, you can sub-class this class to modify/extend your own entity sub-class generator logic
|
|
8
4
|
*/
|
|
9
|
-
export declare
|
|
5
|
+
export declare class EntitySubClassGeneratorBase {
|
|
6
|
+
generateAllEntitySubClasses(entities: EntityInfo[], directory: string): boolean;
|
|
7
|
+
generateEntitySubClassFileHeader(): string;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param entity
|
|
11
|
+
* @param includeFileHeader
|
|
12
|
+
*/
|
|
13
|
+
generateEntitySubClass(entity: EntityInfo, includeFileHeader?: boolean): string;
|
|
14
|
+
}
|
|
10
15
|
//# sourceMappingURL=entity_subclasses_codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_subclasses_codegen.d.ts","sourceRoot":"","sources":["../src/entity_subclasses_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,UAAU,EAA6B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"entity_subclasses_codegen.d.ts","sourceRoot":"","sources":["../src/entity_subclasses_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,UAAU,EAA6B,MAAM,sBAAsB,CAAC;AAMvG;;GAEG;AACH,qBACa,2BAA2B;IAC7B,2BAA2B,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAa/E,gCAAgC,IAAI,MAAM;IAMjD;;;;OAIG;IACI,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAE,OAAe,GAAK,MAAM;CAsHlG"}
|
|
@@ -1,150 +1,163 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
12
|
+
exports.EntitySubClassGeneratorBase = void 0;
|
|
7
13
|
const core_1 = require("@memberjunction/core");
|
|
8
14
|
const fs_1 = __importDefault(require("fs"));
|
|
9
15
|
const path_1 = __importDefault(require("path"));
|
|
10
16
|
const util_1 = require("./util");
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const sContent = generateEntitySubClassFileHeader() + entities.map(e => generateEntitySubClass(e, false)).join('');
|
|
14
|
-
(0, util_1.makeDir)(directory);
|
|
15
|
-
fs_1.default.writeFileSync(path_1.default.join(directory, 'entity_subclasses.ts'), sContent);
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
console.error(err);
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.generateAllEntitySubClasses = generateAllEntitySubClasses;
|
|
24
|
-
function generateEntitySubClassFileHeader() {
|
|
25
|
-
return `import { BaseEntity, PrimaryKeyValue, EntitySaveOptions } from "@memberjunction/core";
|
|
26
|
-
import { RegisterClass } from "@memberjunction/global";
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
|
-
exports.generateEntitySubClassFileHeader = generateEntitySubClassFileHeader;
|
|
17
|
+
const global_1 = require("@memberjunction/global");
|
|
30
18
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param entity
|
|
33
|
-
* @param includeFileHeader
|
|
19
|
+
* Base class for generating entity sub-classes, you can sub-class this class to modify/extend your own entity sub-class generator logic
|
|
34
20
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
let EntitySubClassGeneratorBase = class EntitySubClassGeneratorBase {
|
|
22
|
+
generateAllEntitySubClasses(entities, directory) {
|
|
23
|
+
try {
|
|
24
|
+
const sContent = this.generateEntitySubClassFileHeader() + entities.map(e => this.generateEntitySubClass(e, false)).join('');
|
|
25
|
+
(0, util_1.makeDir)(directory);
|
|
26
|
+
fs_1.default.writeFileSync(path_1.default.join(directory, 'entity_subclasses.ts'), sContent);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
console.error(err);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
generateEntitySubClassFileHeader() {
|
|
35
|
+
return `import { BaseEntity, PrimaryKeyValue, EntitySaveOptions } from "@memberjunction/core";
|
|
36
|
+
import { RegisterClass } from "@memberjunction/global";
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param entity
|
|
42
|
+
* @param includeFileHeader
|
|
43
|
+
*/
|
|
44
|
+
generateEntitySubClass(entity, includeFileHeader = false) {
|
|
45
|
+
if (entity.PrimaryKeys.length === 0) {
|
|
46
|
+
console.warn(`Entity ${entity.Name} has no primary keys. Skipping.`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const fields = entity.Fields.map(e => {
|
|
50
|
+
let values = '';
|
|
51
|
+
let valueList = '';
|
|
52
|
+
if (e.ValueListType &&
|
|
53
|
+
e.ValueListType.length > 0 &&
|
|
54
|
+
e.ValueListType.trim().toLowerCase() !== 'none') {
|
|
55
|
+
values = e.EntityFieldValues.map(v => `\n * * ${v.Value}${v.Description && v.Description.length > 0 ? ' - ' + v.Description : ''}`).join('');
|
|
56
|
+
valueList = `\n * * Value List Type: ${e.ValueListType}\n * * Possible Values ` + values;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
if (e.
|
|
60
|
-
typeString
|
|
58
|
+
let typeString = (0, core_1.TypeScriptTypeFromSQLType)(e.Type) + (e.AllowsNull ? ' | null' : '');
|
|
59
|
+
if (e.ValueListTypeEnum !== core_1.EntityFieldValueListType.None && e.EntityFieldValues && e.EntityFieldValues.length > 0) {
|
|
60
|
+
// construct a typeString that is a union of the possible values
|
|
61
|
+
const quotes = e.NeedsQuotes ? "'" : '';
|
|
62
|
+
typeString = e.EntityFieldValues.map(v => `${quotes}${v.Value}${quotes}`).join(' | ');
|
|
63
|
+
if (e.ValueListTypeEnum === core_1.EntityFieldValueListType.ListOrUserEntry) {
|
|
64
|
+
// special case becuase a user can enter whatever they want
|
|
65
|
+
typeString += ' | ' + (0, core_1.TypeScriptTypeFromSQLType)(e.Type);
|
|
66
|
+
}
|
|
67
|
+
// finally, add the null type if it allows null
|
|
68
|
+
if (e.AllowsNull) {
|
|
69
|
+
typeString += ' | null';
|
|
70
|
+
}
|
|
61
71
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* *
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.Set('${e.Name}', value);
|
|
72
|
+
let sRet = ` /**
|
|
73
|
+
* * Field Name: ${e.Name}${e.DisplayName && e.DisplayName.length > 0 ? '\n * * Display Name: ' + e.DisplayName : ''}
|
|
74
|
+
* * SQL Data Type: ${e.SQLFullType}${e.RelatedEntity ? '\n * * Related Entity/Foreign Key: ' + e.RelatedEntity + ' (' + e.RelatedEntityBaseView + '.' + e.RelatedEntityFieldName + ')' : ''}${e.DefaultValue && e.DefaultValue.length > 0 ? '\n * * Default Value: ' + e.DefaultValue : ''}${valueList}${e.Description && e.Description.length > 0 ? '\n * * Description: ' + e.Description : ''}
|
|
75
|
+
*/
|
|
76
|
+
get ${e.CodeName}(): ${typeString} {
|
|
77
|
+
return this.Get('${e.Name}');
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
if (!e.ReadOnly) {
|
|
81
|
+
sRet += `set ${e.CodeName}(value: ${typeString}) {
|
|
82
|
+
this.Set('${e.Name}', value);
|
|
74
83
|
}`;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* Loads the ${entity.Name} record from the database
|
|
86
|
-
${entity.PrimaryKeys.map(f => `* @param ${f.CodeName}: ${f.TSType} - primary key value to load the ${entity.Name} record.`).join('\n ')}
|
|
87
|
-
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
88
|
-
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
89
|
-
* @public
|
|
90
|
-
* @async
|
|
91
|
-
* @memberof ${sClassName}
|
|
92
|
-
* @method
|
|
93
|
-
* @override
|
|
94
|
-
*/
|
|
95
|
-
public async Load(${loadFieldString}, EntityRelationshipsToLoad: string[] = null) : Promise<boolean> {
|
|
96
|
-
const pkeyValues: PrimaryKeyValue[] = [];
|
|
97
|
-
${entity.PrimaryKeys.map(f => `pkeyValues.push({ FieldName: '${f.Name}', Value: ${f.CodeName} });`).join('\n ')}
|
|
98
|
-
return await super.InnerLoad(pkeyValues, EntityRelationshipsToLoad);
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
const deleteFunction = entity.AllowDeleteAPI ? '' : `
|
|
102
|
-
/**
|
|
103
|
-
* ${entity.Name} - AllowDeleteAPI is set to 0 in the database. Delete is not allowed, so this method is generated to override the base class method and throw an error. To enable delete for this entity, set AllowDeleteAPI to 1 in the database.
|
|
104
|
-
* @public
|
|
105
|
-
* @method
|
|
106
|
-
* @override
|
|
107
|
-
* @memberof ${sClassName}
|
|
108
|
-
* @throws {Error} - Delete is not allowed for ${entity.Name}, to enable it set AllowDeleteAPI to 1 in the database.
|
|
109
|
-
*/
|
|
110
|
-
public async Delete(): Promise<boolean> {
|
|
111
|
-
throw new Error('Delete is not allowed for ${entity.Name}, to enable it set AllowDeleteAPI to 1 in the database.');
|
|
112
|
-
}
|
|
84
|
+
}
|
|
85
|
+
return sRet + '\n';
|
|
86
|
+
}).join('');
|
|
87
|
+
const sClassName = `${entity.ClassName}Entity`;
|
|
88
|
+
const subClass = entity.EntityObjectSubclassName ? entity.EntityObjectSubclassName : '';
|
|
89
|
+
const subClassImport = entity.EntityObjectSubclassImport ? entity.EntityObjectSubclassImport : '';
|
|
90
|
+
const sBaseClass = subClass.length > 0 && subClassImport.length > 0 ? `${subClass}` : 'BaseEntity';
|
|
91
|
+
const subClassImportStatement = subClass.length > 0 && subClassImport.length > 0 ? `import { ${subClass} } from '${subClassImport}';\n` : '';
|
|
92
|
+
const loadFieldString = entity.PrimaryKeys.map(f => `${f.CodeName}: ${f.TSType}`).join(', ');
|
|
93
|
+
const loadFunction = ` /**
|
|
94
|
+
* Loads the ${entity.Name} record from the database
|
|
95
|
+
${entity.PrimaryKeys.map(f => `* @param ${f.CodeName}: ${f.TSType} - primary key value to load the ${entity.Name} record.`).join('\n ')}
|
|
96
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
97
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
98
|
+
* @public
|
|
99
|
+
* @async
|
|
100
|
+
* @memberof ${sClassName}
|
|
101
|
+
* @method
|
|
102
|
+
* @override
|
|
103
|
+
*/
|
|
104
|
+
public async Load(${loadFieldString}, EntityRelationshipsToLoad: string[] = null) : Promise<boolean> {
|
|
105
|
+
const pkeyValues: PrimaryKeyValue[] = [];
|
|
106
|
+
${entity.PrimaryKeys.map(f => `pkeyValues.push({ FieldName: '${f.Name}', Value: ${f.CodeName} });`).join('\n ')}
|
|
107
|
+
return await super.InnerLoad(pkeyValues, EntityRelationshipsToLoad);
|
|
108
|
+
}
|
|
113
109
|
`;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* ${entity.Name} -
|
|
117
|
-
* @public
|
|
118
|
-
* @method
|
|
119
|
-
* @override
|
|
120
|
-
* @memberof ${sClassName}
|
|
121
|
-
* @throws {Error} -
|
|
122
|
-
*/
|
|
123
|
-
public async
|
|
124
|
-
throw new Error('
|
|
125
|
-
}
|
|
110
|
+
const deleteFunction = entity.AllowDeleteAPI ? '' : `
|
|
111
|
+
/**
|
|
112
|
+
* ${entity.Name} - AllowDeleteAPI is set to 0 in the database. Delete is not allowed, so this method is generated to override the base class method and throw an error. To enable delete for this entity, set AllowDeleteAPI to 1 in the database.
|
|
113
|
+
* @public
|
|
114
|
+
* @method
|
|
115
|
+
* @override
|
|
116
|
+
* @memberof ${sClassName}
|
|
117
|
+
* @throws {Error} - Delete is not allowed for ${entity.Name}, to enable it set AllowDeleteAPI to 1 in the database.
|
|
118
|
+
*/
|
|
119
|
+
public async Delete(): Promise<boolean> {
|
|
120
|
+
throw new Error('Delete is not allowed for ${entity.Name}, to enable it set AllowDeleteAPI to 1 in the database.');
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
const saveFunction = entity.AllowCreateAPI || entity.AllowUpdateAPI ? '' : `
|
|
124
|
+
/**
|
|
125
|
+
* ${entity.Name} - AllowCreateAPI and AllowUpdateAPI are both set to 0 in the database. Save is not allowed, so this method is generated to override the base class method and throw an error. To enable save for this entity, set AllowCreateAPI and/or AllowUpdateAPI to 1 in the database.
|
|
126
|
+
* @public
|
|
127
|
+
* @method
|
|
128
|
+
* @override
|
|
129
|
+
* @memberof ${sClassName}
|
|
130
|
+
* @throws {Error} - Save is not allowed for ${entity.Name}, to enable it set AllowCreateAPI and/or AllowUpdateAPI to 1 in the database.
|
|
131
|
+
*/
|
|
132
|
+
public async Save(options?: EntitySaveOptions) : Promise<boolean> {
|
|
133
|
+
throw new Error('Save is not allowed for ${entity.Name}, to enable it set AllowCreateAPI and/or AllowUpdateAPI to 1 in the database.');
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
let sRet = `
|
|
137
|
+
/**
|
|
138
|
+
* ${entity.Name} - strongly typed entity sub-class
|
|
139
|
+
* * Schema: ${entity.SchemaName}
|
|
140
|
+
* * Base Table: ${entity.BaseTable}
|
|
141
|
+
* * Base View: ${entity.BaseView}${entity.Description && entity.Description.length > 0 ? '\n * * @description ' + entity.Description : ''}
|
|
142
|
+
* * Primary Key${entity.PrimaryKeys.length > 1 ? 's' : ''}: ${entity.PrimaryKeys.map(f => f.Name).join(', ')}
|
|
143
|
+
* @extends {BaseEntity}
|
|
144
|
+
* @class
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
${subClassImportStatement}@RegisterClass(BaseEntity, '${entity.Name}')
|
|
148
|
+
export class ${sClassName} extends ${sBaseClass} {
|
|
149
|
+
${loadFunction}${saveFunction}${deleteFunction}
|
|
150
|
+
${fields}
|
|
151
|
+
}
|
|
126
152
|
`;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* * Base Table: ${entity.BaseTable}
|
|
132
|
-
* * Base View: ${entity.BaseView}${entity.Description && entity.Description.length > 0 ? '\n * * @description ' + entity.Description : ''}
|
|
133
|
-
* * Primary Key${entity.PrimaryKeys.length > 1 ? 's' : ''}: ${entity.PrimaryKeys.map(f => f.Name).join(', ')}
|
|
134
|
-
* @extends {BaseEntity}
|
|
135
|
-
* @class
|
|
136
|
-
* @public
|
|
137
|
-
*/
|
|
138
|
-
${subClassImportStatement}@RegisterClass(BaseEntity, '${entity.Name}')
|
|
139
|
-
export class ${sClassName} extends ${sBaseClass} {
|
|
140
|
-
${loadFunction}${saveFunction}${deleteFunction}
|
|
141
|
-
${fields}
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
if (includeFileHeader)
|
|
145
|
-
sRet = generateEntitySubClassFileHeader() + sRet;
|
|
146
|
-
return sRet;
|
|
153
|
+
if (includeFileHeader)
|
|
154
|
+
sRet = this.generateEntitySubClassFileHeader() + sRet;
|
|
155
|
+
return sRet;
|
|
156
|
+
}
|
|
147
157
|
}
|
|
148
|
-
}
|
|
149
|
-
exports.
|
|
158
|
+
};
|
|
159
|
+
exports.EntitySubClassGeneratorBase = EntitySubClassGeneratorBase;
|
|
160
|
+
exports.EntitySubClassGeneratorBase = EntitySubClassGeneratorBase = __decorate([
|
|
161
|
+
(0, global_1.RegisterClass)(EntitySubClassGeneratorBase)
|
|
162
|
+
], EntitySubClassGeneratorBase);
|
|
150
163
|
//# sourceMappingURL=entity_subclasses_codegen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_subclasses_codegen.js","sourceRoot":"","sources":["../src/entity_subclasses_codegen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity_subclasses_codegen.js","sourceRoot":"","sources":["../src/entity_subclasses_codegen.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAuG;AACvG,4CAAoB;AACpB,gDAAwB;AACxB,iCAAiC;AACjC,mDAAuD;AAEvD;;GAEG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAC7B,2BAA2B,CAAC,QAAsB,EAAE,SAAiB;QACxE,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,gCAAgC,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC5H,IAAA,cAAO,EAAC,SAAS,CAAC,CAAC;YACnB,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,EAAE,QAAQ,CAAC,CAAC;YAEzE,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAEM,gCAAgC;QACnC,OAAO;;KAEV,CAAA;IACD,CAAC;IAED;;;;OAIG;IACI,sBAAsB,CAAC,MAAkB,EAAE,oBAA6B,KAAK;QAChF,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,IAAI,kCAAkC,CAAC,CAAA;QACzE,CAAC;aACI,CAAC;YACF,MAAM,MAAM,GAAW,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;g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IAAI,CAAC;YAE1D,OAAO,IAAI,CAAA;QACf,CAAC;IACL,CAAC;CACJ,CAAA;AA/IY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAa,EAAC,2BAA2B,CAAC;GAC9B,2BAA2B,CA+IvC"}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
import { EntityInfo } from '@memberjunction/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { EntityInfo, EntityFieldInfo, EntityRelationshipInfo, Metadata } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* This class is responsible for generating the GraphQL Server resolvers and types for the entities, you can sub-class this class to extend/modify the logic, make sure to use @memberjunction/global RegisterClass decorator
|
|
4
|
+
* so that your class is used.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GraphQLServerGeneratorBase {
|
|
7
|
+
generateGraphQLServerCode(entities: EntityInfo[], outputDirectory: string, generatedEntitiesImportLibrary: string, excludeRelatedEntitiesExternalToSchema: boolean): boolean;
|
|
8
|
+
protected _graphQLTypeSuffix: string;
|
|
9
|
+
/**
|
|
10
|
+
* The suffix to append to the GraphQL Type name, default is an underscore, override this property in your sub-class to change the suffix
|
|
11
|
+
*/
|
|
12
|
+
get GraphQLTypeSuffix(): string;
|
|
13
|
+
generateServerEntityString(entity: EntityInfo, includeFileHeader: boolean, generatedEntitiesImportLibrary: string, excludeRelatedEntitiesExternalToSchema: boolean): string;
|
|
14
|
+
generateAllEntitiesServerFileHeader(entities: EntityInfo[], importLibrary: string): string;
|
|
15
|
+
generateEntitySpecificServerFileHeader(entity: EntityInfo, importLibrary: string, excludeRelatedEntitiesExternalToSchema: boolean): string;
|
|
16
|
+
protected generateServerEntityHeader(entity: EntityInfo, serverGraphQLTypeName: string): string;
|
|
17
|
+
protected generateServerEntityFooter(entity: EntityInfo): string;
|
|
18
|
+
protected generateServerField(fieldInfo: EntityFieldInfo): string;
|
|
19
|
+
protected getTypeGraphQLFieldString(fieldInfo: EntityFieldInfo): string;
|
|
20
|
+
protected generateServerRelationship(md: Metadata, r: EntityRelationshipInfo): string;
|
|
21
|
+
protected generateServerGraphQLResolver(entity: EntityInfo, serverGraphQLTypeName: string, excludeRelatedEntitiesExternalToSchema: boolean): string;
|
|
22
|
+
protected schemaName(entity: EntityInfo): string;
|
|
23
|
+
protected generateServerGraphQLInputType(entity: EntityInfo): string;
|
|
24
|
+
protected generateServerGraphQLInputTypeInner(entity: EntityInfo, isUpdate: boolean, classPrefix: string): string;
|
|
25
|
+
protected generateServerGraphQLMutations(entity: EntityInfo, serverGraphQLTypeName: string): string;
|
|
26
|
+
protected generateOneToManyFieldResolver(entity: EntityInfo, r: EntityRelationshipInfo): string;
|
|
27
|
+
protected generateManyToManyFieldResolver(entity: EntityInfo, r: EntityRelationshipInfo): string;
|
|
28
|
+
}
|
|
6
29
|
//# sourceMappingURL=graphql_server_codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql_server_codegen.d.ts","sourceRoot":"","sources":["../src/graphql_server_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"graphql_server_codegen.d.ts","sourceRoot":"","sources":["../src/graphql_server_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,sBAAsB,EAA6B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAQhI;;;GAGG;AACH,qBACa,0BAA0B;IAE5B,yBAAyB,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,8BAA8B,EAAE,MAAM,EAAE,sCAAsC,EAAE,OAAO,GAAG,OAAO;IAkBnL,SAAS,CAAC,kBAAkB,SAAQ;IACpC;;OAEG;IACH,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAEM,0BAA0B,CAAC,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,8BAA8B,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