@exogee/graphweaver-mikroorm 0.1.24 → 0.2.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/lib/base-resolver/assign.d.ts +1 -1
- package/lib/base-resolver/provider.d.ts +5 -2
- package/lib/base-resolver/provider.js +27 -36
- package/lib/base-resolver/provider.js.map +3 -3
- package/lib/database.d.ts +4 -1
- package/lib/database.js +13 -2
- package/lib/database.js.map +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +2 -2
- package/lib/introspection/files/base-file.d.ts +8 -0
- package/lib/introspection/files/base-file.js +38 -0
- package/lib/introspection/files/base-file.js.map +7 -0
- package/lib/introspection/files/data-entity-file.d.ts +27 -0
- package/lib/introspection/files/data-entity-file.js +324 -0
- package/lib/introspection/files/data-entity-file.js.map +7 -0
- package/lib/introspection/files/data-entity-index-file.d.ts +10 -0
- package/lib/introspection/files/data-entity-index-file.js +61 -0
- package/lib/introspection/files/data-entity-index-file.js.map +7 -0
- package/lib/introspection/files/data-source-index-file.d.ts +8 -0
- package/lib/introspection/files/data-source-index-file.js +44 -0
- package/lib/introspection/files/data-source-index-file.js.map +7 -0
- package/lib/introspection/files/database-file.d.ts +9 -0
- package/lib/introspection/files/database-file.js +75 -0
- package/lib/introspection/files/database-file.js.map +7 -0
- package/lib/introspection/files/index.d.ts +8 -0
- package/lib/introspection/files/index.js +26 -0
- package/lib/introspection/files/index.js.map +7 -0
- package/lib/introspection/files/schema-entity-file.d.ts +25 -0
- package/lib/introspection/files/schema-entity-file.js +239 -0
- package/lib/introspection/files/schema-entity-file.js.map +7 -0
- package/lib/introspection/files/schema-entity-index-file.d.ts +6 -0
- package/lib/introspection/files/schema-entity-index-file.js +44 -0
- package/lib/introspection/files/schema-entity-index-file.js.map +7 -0
- package/lib/introspection/files/schema-index-file.d.ts +8 -0
- package/lib/introspection/files/schema-index-file.js +60 -0
- package/lib/introspection/files/schema-index-file.js.map +7 -0
- package/lib/introspection/files/schema-resolver-file.d.ts +6 -0
- package/lib/introspection/files/schema-resolver-file.js +62 -0
- package/lib/introspection/files/schema-resolver-file.js.map +7 -0
- package/lib/introspection/generate.d.ts +11 -0
- package/lib/introspection/generate.js +215 -0
- package/lib/introspection/generate.js.map +7 -0
- package/lib/introspection/index.d.ts +6 -0
- package/lib/introspection/index.js +30 -0
- package/lib/introspection/index.js.map +7 -0
- package/lib/introspection/utils.d.ts +3 -0
- package/lib/introspection/utils.js +43 -0
- package/lib/introspection/utils.js.map +7 -0
- package/lib/plugins/connect-to-database.js +3 -1
- package/lib/plugins/connect-to-database.js.map +2 -2
- package/package.json +12 -5
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var generate_exports = {};
|
|
26
|
+
__export(generate_exports, {
|
|
27
|
+
IntrospectionError: () => IntrospectionError,
|
|
28
|
+
generate: () => generate
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(generate_exports);
|
|
31
|
+
var import_knex = require("@mikro-orm/knex");
|
|
32
|
+
var import_core = require("@mikro-orm/core");
|
|
33
|
+
var import_pluralize = __toESM(require("pluralize"));
|
|
34
|
+
var import_database = require("../database");
|
|
35
|
+
var import_files = require("./files");
|
|
36
|
+
var import_utils = require("./utils");
|
|
37
|
+
const CONNECTION_MANAGER_ID = "generate";
|
|
38
|
+
class IntrospectionError extends Error {
|
|
39
|
+
constructor(title = "", message = "") {
|
|
40
|
+
super(message);
|
|
41
|
+
this.title = title;
|
|
42
|
+
this.type = "IntrospectionError";
|
|
43
|
+
this.title = title;
|
|
44
|
+
this.message = message;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const hasErrorMessage = (error) => error.message;
|
|
48
|
+
const generateBidirectionalRelations = (metadata) => {
|
|
49
|
+
for (const meta of metadata.filter((m) => !m.pivotTable)) {
|
|
50
|
+
for (const prop of meta.relations) {
|
|
51
|
+
if (!prop.name.includes("Inverse")) {
|
|
52
|
+
const targetMeta = metadata.find((m) => m.className === prop.type);
|
|
53
|
+
const newProp = {
|
|
54
|
+
name: prop.name + "Inverse",
|
|
55
|
+
type: meta.className,
|
|
56
|
+
joinColumns: prop.fieldNames,
|
|
57
|
+
referencedTableName: meta.tableName,
|
|
58
|
+
referencedColumnNames: import_core.Utils.flatten(
|
|
59
|
+
(targetMeta?.getPrimaryProps() ?? []).map((pk) => pk.fieldNames)
|
|
60
|
+
),
|
|
61
|
+
mappedBy: prop.name
|
|
62
|
+
};
|
|
63
|
+
const inverseMeta = metadata.find((m) => m.className === meta.className);
|
|
64
|
+
const inverseProp = inverseMeta?.props.find((p) => p.name === newProp.mappedBy);
|
|
65
|
+
if (inverseProp)
|
|
66
|
+
inverseProp.inversedBy = newProp.name;
|
|
67
|
+
if (prop.reference === import_core.ReferenceType.MANY_TO_ONE) {
|
|
68
|
+
const name = (0, import_utils.pascalToCamelCaseString)(meta.tableName);
|
|
69
|
+
newProp.name = (0, import_pluralize.default)(name);
|
|
70
|
+
newProp.reference = import_core.ReferenceType.ONE_TO_MANY;
|
|
71
|
+
} else if (prop.reference === import_core.ReferenceType.ONE_TO_ONE && !prop.mappedBy) {
|
|
72
|
+
newProp.reference = import_core.ReferenceType.ONE_TO_ONE;
|
|
73
|
+
newProp.nullable = true;
|
|
74
|
+
} else if (prop.reference === import_core.ReferenceType.MANY_TO_MANY && !prop.mappedBy) {
|
|
75
|
+
const name = (0, import_utils.pascalToCamelCaseString)(meta.tableName);
|
|
76
|
+
newProp.name = (0, import_pluralize.default)(name);
|
|
77
|
+
newProp.reference = import_core.ReferenceType.MANY_TO_MANY;
|
|
78
|
+
} else {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
targetMeta?.addProperty(newProp);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const detectManyToManyRelations = (metadata, namingStrategy) => {
|
|
87
|
+
for (const meta of metadata) {
|
|
88
|
+
if (meta.compositePK && meta.primaryKeys.length === meta.relations.length && meta.relations.length === 2 && meta.relations.length === meta.props.length && meta.relations.every((prop) => prop.reference === import_core.ReferenceType.MANY_TO_ONE)) {
|
|
89
|
+
meta.pivotTable = true;
|
|
90
|
+
const owner = metadata.find((m) => m.className === meta.relations[0].type);
|
|
91
|
+
if (!owner)
|
|
92
|
+
throw new Error("No Owner");
|
|
93
|
+
const name = (0, import_utils.pascalToCamelCaseString)(meta.relations?.[1]?.type);
|
|
94
|
+
owner.addProperty({
|
|
95
|
+
name: (0, import_pluralize.default)(name),
|
|
96
|
+
reference: import_core.ReferenceType.MANY_TO_MANY,
|
|
97
|
+
pivotTable: meta.tableName,
|
|
98
|
+
type: meta.relations[1].type,
|
|
99
|
+
joinColumns: meta.relations[0].fieldNames,
|
|
100
|
+
inverseJoinColumns: meta.relations[1].fieldNames
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const generateIdentifiedReferences = (metadata) => {
|
|
106
|
+
for (const meta of metadata.filter((m) => !m.pivotTable)) {
|
|
107
|
+
for (const prop of meta.relations) {
|
|
108
|
+
if ([import_core.ReferenceType.MANY_TO_ONE, import_core.ReferenceType.ONE_TO_ONE].includes(prop.reference)) {
|
|
109
|
+
const name = (0, import_utils.pascalToCamelCaseString)(prop.referencedTableName);
|
|
110
|
+
prop.name = import_pluralize.default.singular(name);
|
|
111
|
+
prop.wrappedReference = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const generateSingularTypeReferences = (metadata) => {
|
|
117
|
+
for (const meta of metadata.filter((m) => !m.pivotTable)) {
|
|
118
|
+
meta.className = import_pluralize.default.singular(meta.className);
|
|
119
|
+
for (const prop of meta.relations) {
|
|
120
|
+
prop.type = import_pluralize.default.singular(prop.type);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const convertToCamelCasePropertyNames = (metadata) => {
|
|
125
|
+
for (const meta of metadata.filter((m) => !m.pivotTable)) {
|
|
126
|
+
const props = Object.values(meta.properties);
|
|
127
|
+
props.forEach((prop) => {
|
|
128
|
+
prop.name = (0, import_utils.pascalToCamelCaseString)(prop.name);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const convertSchemaToMetadata = async (schema, platform, namingStrategy) => {
|
|
133
|
+
const helper = platform.getSchemaHelper();
|
|
134
|
+
if (!helper)
|
|
135
|
+
throw new Error("cannot connect to database");
|
|
136
|
+
const metadata = schema.getTables().sort((a, b) => a.name.localeCompare(b.name)).map((table) => table.getEntityDeclaration(namingStrategy, helper));
|
|
137
|
+
if (metadata.length === 0) {
|
|
138
|
+
throw new IntrospectionError(
|
|
139
|
+
`Warning: No tables found, this database is empty.`,
|
|
140
|
+
`Make sure you have tables in this database and then try again.`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
convertToCamelCasePropertyNames(metadata);
|
|
144
|
+
detectManyToManyRelations(metadata, namingStrategy);
|
|
145
|
+
generateIdentifiedReferences(metadata);
|
|
146
|
+
generateBidirectionalRelations(metadata);
|
|
147
|
+
generateSingularTypeReferences(metadata);
|
|
148
|
+
return metadata;
|
|
149
|
+
};
|
|
150
|
+
const openConnection = async (type, options) => {
|
|
151
|
+
await import_database.ConnectionManager.connect(CONNECTION_MANAGER_ID, {
|
|
152
|
+
mikroOrmConfig: {
|
|
153
|
+
type,
|
|
154
|
+
...options.mikroOrmConfig
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const closeConnection = async () => {
|
|
159
|
+
console.log("Closing database connection...");
|
|
160
|
+
await import_database.ConnectionManager.close(CONNECTION_MANAGER_ID);
|
|
161
|
+
console.log("Database connection closed.");
|
|
162
|
+
};
|
|
163
|
+
const generate = async (databaseType, options) => {
|
|
164
|
+
try {
|
|
165
|
+
await openConnection(databaseType, options);
|
|
166
|
+
const database = import_database.ConnectionManager.database(CONNECTION_MANAGER_ID);
|
|
167
|
+
if (!database)
|
|
168
|
+
throw new IntrospectionError(
|
|
169
|
+
`Warning: Unable to connect to database.`,
|
|
170
|
+
"Please check the connection settings and try again"
|
|
171
|
+
);
|
|
172
|
+
const config = database.em.config;
|
|
173
|
+
const driver = database.em.getDriver();
|
|
174
|
+
const platform = driver.getPlatform();
|
|
175
|
+
const namingStrategy = config.getNamingStrategy();
|
|
176
|
+
const connection = driver.getConnection();
|
|
177
|
+
console.log("Fetching database schema...");
|
|
178
|
+
const schema = await import_knex.DatabaseSchema.create(connection, platform, config);
|
|
179
|
+
console.log("Building metadata...");
|
|
180
|
+
const metadata = await convertSchemaToMetadata(schema, platform, namingStrategy);
|
|
181
|
+
const source = [];
|
|
182
|
+
for (const meta of metadata) {
|
|
183
|
+
if (!meta.pivotTable) {
|
|
184
|
+
source.push(new import_files.DataEntityFile(meta, namingStrategy, platform, databaseType));
|
|
185
|
+
source.push(new import_files.SchemaEntityFile(meta, namingStrategy, platform));
|
|
186
|
+
source.push(new import_files.SchemaEntityIndexFile(meta, namingStrategy, platform));
|
|
187
|
+
source.push(new import_files.SchemaResolverFile(meta, namingStrategy, platform));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
source.push(new import_files.DataEntityIndexFile(metadata, databaseType));
|
|
191
|
+
source.push(new import_files.DataSourceIndexFile(databaseType));
|
|
192
|
+
source.push(new import_files.SchemaIndexFile(metadata));
|
|
193
|
+
source.push(new import_files.DatabaseFile(databaseType, options));
|
|
194
|
+
const files = source.map((file) => ({
|
|
195
|
+
path: file.getBasePath(),
|
|
196
|
+
name: file.getBaseName(),
|
|
197
|
+
contents: file.generate()
|
|
198
|
+
}));
|
|
199
|
+
await closeConnection();
|
|
200
|
+
return files;
|
|
201
|
+
} catch (err) {
|
|
202
|
+
if (err instanceof IntrospectionError)
|
|
203
|
+
throw err;
|
|
204
|
+
throw new IntrospectionError(
|
|
205
|
+
`Warning: Unable to connect to database.`,
|
|
206
|
+
hasErrorMessage(err) ? err.message : "Please check the connection settings and try again"
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
211
|
+
0 && (module.exports = {
|
|
212
|
+
IntrospectionError,
|
|
213
|
+
generate
|
|
214
|
+
});
|
|
215
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/introspection/generate.ts"],
|
|
4
|
+
"sourcesContent": ["import { DatabaseSchema, AbstractSqlPlatform } from '@mikro-orm/knex';\nimport {\n\tEntityMetadata,\n\tEntityProperty,\n\tNamingStrategy,\n\tReferenceType,\n\tUtils,\n} from '@mikro-orm/core';\nimport pluralize from 'pluralize';\n\nimport { ConnectionManager, ConnectionOptions, DatabaseType } from '../database';\nimport {\n\tDataEntityFile,\n\tDataEntityIndexFile,\n\tDataSourceIndexFile,\n\tSchemaEntityFile,\n\tSchemaIndexFile,\n\tSchemaResolverFile,\n\tSchemaEntityIndexFile,\n\tDatabaseFile,\n} from './files';\nimport { pascalToCamelCaseString } from './utils';\n\nconst CONNECTION_MANAGER_ID = 'generate';\n\nexport class IntrospectionError extends Error {\n\tprotected type: string;\n\tconstructor(protected title = '', message = '') {\n\t\tsuper(message);\n\t\tthis.type = 'IntrospectionError';\n\t\tthis.title = title;\n\t\tthis.message = message;\n\t}\n}\n\nconst hasErrorMessage = (error: any): error is { message: string } => error.message;\n\nconst generateBidirectionalRelations = (metadata: EntityMetadata[]): void => {\n\tfor (const meta of metadata.filter((m) => !m.pivotTable)) {\n\t\tfor (const prop of meta.relations) {\n\t\t\tif (!prop.name.includes('Inverse')) {\n\t\t\t\tconst targetMeta = metadata.find((m) => m.className === prop.type);\n\t\t\t\tconst newProp = {\n\t\t\t\t\tname: prop.name + 'Inverse',\n\t\t\t\t\ttype: meta.className,\n\t\t\t\t\tjoinColumns: prop.fieldNames,\n\t\t\t\t\treferencedTableName: meta.tableName,\n\t\t\t\t\treferencedColumnNames: Utils.flatten(\n\t\t\t\t\t\t(targetMeta?.getPrimaryProps() ?? []).map((pk) => pk.fieldNames)\n\t\t\t\t\t),\n\t\t\t\t\tmappedBy: prop.name,\n\t\t\t\t} as EntityProperty;\n\n\t\t\t\t// Add reference to the inverse entity\n\t\t\t\tconst inverseMeta = metadata.find((m) => m.className === meta.className);\n\t\t\t\tconst inverseProp = inverseMeta?.props.find((p) => p.name === newProp.mappedBy);\n\t\t\t\tif (inverseProp) inverseProp.inversedBy = newProp.name;\n\n\t\t\t\tif (prop.reference === ReferenceType.MANY_TO_ONE) {\n\t\t\t\t\tconst name = pascalToCamelCaseString(meta.tableName);\n\t\t\t\t\tnewProp.name = pluralize(name);\n\t\t\t\t\tnewProp.reference = ReferenceType.ONE_TO_MANY;\n\t\t\t\t} else if (prop.reference === ReferenceType.ONE_TO_ONE && !prop.mappedBy) {\n\t\t\t\t\tnewProp.reference = ReferenceType.ONE_TO_ONE;\n\t\t\t\t\tnewProp.nullable = true;\n\t\t\t\t} else if (prop.reference === ReferenceType.MANY_TO_MANY && !prop.mappedBy) {\n\t\t\t\t\tconst name = pascalToCamelCaseString(meta.tableName);\n\t\t\t\t\tnewProp.name = pluralize(name);\n\t\t\t\t\tnewProp.reference = ReferenceType.MANY_TO_MANY;\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttargetMeta?.addProperty(newProp);\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst detectManyToManyRelations = (metadata: EntityMetadata[], namingStrategy: NamingStrategy) => {\n\tfor (const meta of metadata) {\n\t\tif (\n\t\t\tmeta.compositePK && // needs to have composite PK\n\t\t\tmeta.primaryKeys.length === meta.relations.length && // all relations are PKs\n\t\t\tmeta.relations.length === 2 && // there are exactly two relation properties\n\t\t\tmeta.relations.length === meta.props.length && // all properties are relations\n\t\t\tmeta.relations.every((prop) => prop.reference === ReferenceType.MANY_TO_ONE) // all relations are m:1\n\t\t) {\n\t\t\tmeta.pivotTable = true;\n\t\t\tconst owner = metadata.find((m) => m.className === meta.relations[0].type);\n\t\t\tif (!owner) throw new Error('No Owner');\n\t\t\tconst name = pascalToCamelCaseString(meta.relations?.[1]?.type);\n\t\t\towner.addProperty({\n\t\t\t\tname: pluralize(name),\n\t\t\t\treference: ReferenceType.MANY_TO_MANY,\n\t\t\t\tpivotTable: meta.tableName,\n\t\t\t\ttype: meta.relations[1].type,\n\t\t\t\tjoinColumns: meta.relations[0].fieldNames,\n\t\t\t\tinverseJoinColumns: meta.relations[1].fieldNames,\n\t\t\t} as EntityProperty);\n\t\t}\n\t}\n};\n\nconst generateIdentifiedReferences = (metadata: EntityMetadata[]): void => {\n\tfor (const meta of metadata.filter((m) => !m.pivotTable)) {\n\t\tfor (const prop of meta.relations) {\n\t\t\tif ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(prop.reference)) {\n\t\t\t\tconst name = pascalToCamelCaseString(prop.referencedTableName);\n\t\t\t\tprop.name = pluralize.singular(name);\n\t\t\t\tprop.wrappedReference = true;\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst generateSingularTypeReferences = (metadata: EntityMetadata[]): void => {\n\tfor (const meta of metadata.filter((m) => !m.pivotTable)) {\n\t\tmeta.className = pluralize.singular(meta.className);\n\t\tfor (const prop of meta.relations) {\n\t\t\tprop.type = pluralize.singular(prop.type);\n\t\t}\n\t}\n};\n\n// Convert properties like FirstName to firstName\nconst convertToCamelCasePropertyNames = (metadata: EntityMetadata[]): void => {\n\tfor (const meta of metadata.filter((m) => !m.pivotTable)) {\n\t\tconst props = Object.values(meta.properties);\n\t\tprops.forEach((prop) => {\n\t\t\tprop.name = pascalToCamelCaseString(prop.name);\n\t\t});\n\t}\n};\n\nconst convertSchemaToMetadata = async (\n\tschema: DatabaseSchema,\n\tplatform: AbstractSqlPlatform,\n\tnamingStrategy: NamingStrategy\n) => {\n\tconst helper = platform.getSchemaHelper();\n\n\tif (!helper) throw new Error('cannot connect to database');\n\n\tconst metadata = schema\n\t\t.getTables()\n\t\t.sort((a, b) => a.name.localeCompare(b.name))\n\t\t.map((table) => table.getEntityDeclaration(namingStrategy, helper));\n\n\tif (metadata.length === 0) {\n\t\tthrow new IntrospectionError(\n\t\t\t`Warning: No tables found, this database is empty.`,\n\t\t\t`Make sure you have tables in this database and then try again.`\n\t\t);\n\t}\n\n\tconvertToCamelCasePropertyNames(metadata);\n\tdetectManyToManyRelations(metadata, namingStrategy);\n\tgenerateIdentifiedReferences(metadata);\n\tgenerateBidirectionalRelations(metadata);\n\tgenerateSingularTypeReferences(metadata);\n\n\treturn metadata;\n};\n\nconst openConnection = async (type: DatabaseType, options: ConnectionOptions) => {\n\tawait ConnectionManager.connect(CONNECTION_MANAGER_ID, {\n\t\tmikroOrmConfig: {\n\t\t\ttype,\n\t\t\t...options.mikroOrmConfig,\n\t\t},\n\t});\n};\n\nconst closeConnection = async () => {\n\tconsole.log('Closing database connection...');\n\tawait ConnectionManager.close(CONNECTION_MANAGER_ID);\n\tconsole.log('Database connection closed.');\n};\n\ntype File =\n\t| DataEntityFile\n\t| SchemaEntityFile\n\t| SchemaEntityIndexFile\n\t| SchemaIndexFile\n\t| SchemaResolverFile\n\t| DataEntityIndexFile\n\t| DataSourceIndexFile\n\t| DatabaseFile;\n\nexport const generate = async (databaseType: DatabaseType, options: ConnectionOptions) => {\n\ttry {\n\t\tawait openConnection(databaseType, options);\n\n\t\tconst database = ConnectionManager.database(CONNECTION_MANAGER_ID);\n\t\tif (!database)\n\t\t\tthrow new IntrospectionError(\n\t\t\t\t`Warning: Unable to connect to database.`,\n\t\t\t\t'Please check the connection settings and try again'\n\t\t\t);\n\n\t\tconst config = database.em.config;\n\t\tconst driver = database.em.getDriver();\n\t\tconst platform = driver.getPlatform();\n\t\tconst namingStrategy = config.getNamingStrategy();\n\t\tconst connection = driver.getConnection();\n\n\t\tconsole.log('Fetching database schema...');\n\t\tconst schema = await DatabaseSchema.create(connection, platform, config);\n\t\tconsole.log('Building metadata...');\n\t\tconst metadata = await convertSchemaToMetadata(schema, platform, namingStrategy);\n\n\t\tconst source: File[] = [];\n\n\t\tfor (const meta of metadata) {\n\t\t\tif (!meta.pivotTable) {\n\t\t\t\tsource.push(new DataEntityFile(meta, namingStrategy, platform, databaseType));\n\t\t\t\tsource.push(new SchemaEntityFile(meta, namingStrategy, platform));\n\t\t\t\tsource.push(new SchemaEntityIndexFile(meta, namingStrategy, platform));\n\t\t\t\tsource.push(new SchemaResolverFile(meta, namingStrategy, platform));\n\t\t\t}\n\t\t}\n\n\t\t// Export all the entities from the data source directory\n\t\tsource.push(new DataEntityIndexFile(metadata, databaseType));\n\t\t// Export the data source from the entities directory\n\t\tsource.push(new DataSourceIndexFile(databaseType));\n\t\t// Export the data source from the entities directory\n\t\tsource.push(new SchemaIndexFile(metadata));\n\t\t// Export the database connection to its own file\n\t\tsource.push(new DatabaseFile(databaseType, options));\n\n\t\tconst files = source.map((file) => ({\n\t\t\tpath: file.getBasePath(),\n\t\t\tname: file.getBaseName(),\n\t\t\tcontents: file.generate(),\n\t\t}));\n\n\t\tawait closeConnection();\n\n\t\treturn files;\n\t} catch (err) {\n\t\tif (err instanceof IntrospectionError) throw err;\n\n\t\tthrow new IntrospectionError(\n\t\t\t`Warning: Unable to connect to database.`,\n\t\t\thasErrorMessage(err) ? err.message : 'Please check the connection settings and try again'\n\t\t);\n\t}\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoD;AACpD,kBAMO;AACP,uBAAsB;AAEtB,sBAAmE;AACnE,mBASO;AACP,mBAAwC;AAExC,MAAM,wBAAwB;AAEvB,MAAM,2BAA2B,MAAM;AAAA,EAE7C,YAAsB,QAAQ,IAAI,UAAU,IAAI;AAC/C,UAAM,OAAO;AADQ;AAErB,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,UAAU;AAAA,EAChB;AACD;AAEA,MAAM,kBAAkB,CAAC,UAA6C,MAAM;AAE5E,MAAM,iCAAiC,CAAC,aAAqC;AAC5E,aAAW,QAAQ,SAAS,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG;AACzD,eAAW,QAAQ,KAAK,WAAW;AAClC,UAAI,CAAC,KAAK,KAAK,SAAS,SAAS,GAAG;AACnC,cAAM,aAAa,SAAS,KAAK,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI;AACjE,cAAM,UAAU;AAAA,UACf,MAAM,KAAK,OAAO;AAAA,UAClB,MAAM,K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2BAAe,OAAO,YAAY,UAAU,MAAM;AACvE,YAAQ,IAAI,sBAAsB;AAClC,UAAM,WAAW,MAAM,wBAAwB,QAAQ,UAAU,cAAc;AAE/E,UAAM,SAAiB,CAAC;AAExB,eAAW,QAAQ,UAAU;AAC5B,UAAI,CAAC,KAAK,YAAY;AACrB,eAAO,KAAK,IAAI,4BAAe,MAAM,gBAAgB,UAAU,YAAY,CAAC;AAC5E,eAAO,KAAK,IAAI,8BAAiB,MAAM,gBAAgB,QAAQ,CAAC;AAChE,eAAO,KAAK,IAAI,mCAAsB,MAAM,gBAAgB,QAAQ,CAAC;AACrE,eAAO,KAAK,IAAI,gCAAmB,MAAM,gBAAgB,QAAQ,CAAC;AAAA,MACnE;AAAA,IACD;AAGA,WAAO,KAAK,IAAI,iCAAoB,UAAU,YAAY,CAAC;AAE3D,WAAO,KAAK,IAAI,iCAAoB,YAAY,CAAC;AAEjD,WAAO,KAAK,IAAI,6BAAgB,QAAQ,CAAC;AAEzC,WAAO,KAAK,IAAI,0BAAa,cAAc,OAAO,CAAC;AAEnD,UAAM,QAAQ,OAAO,IAAI,CAAC,UAAU;AAAA,MACnC,MAAM,KAAK,YAAY;AAAA,MACvB,MAAM,KAAK,YAAY;AAAA,MACvB,UAAU,KAAK,SAAS;AAAA,IACzB,EAAE;AAEF,UAAM,gBAAgB;AAEtB,WAAO;AAAA,EACR,SAAS,KAAP;AACD,QAAI,eAAe;AAAoB,YAAM;AAE7C,UAAM,IAAI;AAAA,MACT;AAAA,MACA,gBAAgB,GAAG,IAAI,IAAI,UAAU;AAAA,IACtC;AAAA,EACD;AACD;",
|
|
6
|
+
"names": ["pluralize"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var introspection_exports = {};
|
|
20
|
+
__export(introspection_exports, {
|
|
21
|
+
introspection: () => introspection
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(introspection_exports);
|
|
24
|
+
var import_generate = require("./generate");
|
|
25
|
+
const introspection = async (databaseType, options) => (0, import_generate.generate)(databaseType, options);
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
introspection
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/introspection/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { ConnectionOptions, DatabaseType } from '../database';\nimport { generate } from './generate';\n\nexport const introspection = async (databaseType: DatabaseType, options: ConnectionOptions) =>\n\tgenerate(databaseType, options);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAyB;AAElB,MAAM,gBAAgB,OAAO,cAA4B,gBAC/D,0BAAS,cAAc,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
pascalToCamelCaseString: () => pascalToCamelCaseString,
|
|
22
|
+
pascalToKebabCaseString: () => pascalToKebabCaseString,
|
|
23
|
+
snakeToCamelCaseString: () => snakeToCamelCaseString
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(utils_exports);
|
|
26
|
+
const pascalToKebabCaseString = (value) => {
|
|
27
|
+
return value.replace(/([a-z0–9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
28
|
+
};
|
|
29
|
+
const snakeToCamelCaseString = (value) => {
|
|
30
|
+
return value.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
31
|
+
};
|
|
32
|
+
const pascalToCamelCaseString = (value) => {
|
|
33
|
+
const firstChar = value.charAt(0).toLowerCase();
|
|
34
|
+
const restOfString = value.slice(1);
|
|
35
|
+
return firstChar + restOfString;
|
|
36
|
+
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
pascalToCamelCaseString,
|
|
40
|
+
pascalToKebabCaseString,
|
|
41
|
+
snakeToCamelCaseString
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/introspection/utils.ts"],
|
|
4
|
+
"sourcesContent": ["export const pascalToKebabCaseString = (value: string) => {\n\treturn value.replace(/([a-z0\u20139])([A-Z])/g, '$1-$2').toLowerCase();\n};\n\nexport const snakeToCamelCaseString = (value: string) => {\n\treturn value.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const pascalToCamelCaseString = (value: string) => {\n\tconst firstChar = value.charAt(0).toLowerCase();\n\tconst restOfString = value.slice(1);\n\treturn firstChar + restOfString;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,0BAA0B,CAAC,UAAkB;AACzD,SAAO,MAAM,QAAQ,sBAAsB,OAAO,EAAE,YAAY;AACjE;AAEO,MAAM,yBAAyB,CAAC,UAAkB;AACxD,SAAO,MAAM,QAAQ,aAAa,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC;AACtE;AAEO,MAAM,0BAA0B,CAAC,UAAkB;AACzD,QAAM,YAAY,MAAM,OAAO,CAAC,EAAE,YAAY;AAC9C,QAAM,eAAe,MAAM,MAAM,CAAC;AAClC,SAAO,YAAY;AACpB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -31,7 +31,9 @@ const connectToDatabase = (options) => {
|
|
|
31
31
|
await import_database.ConnectionManager.connect(option.connectionManagerId, option);
|
|
32
32
|
}
|
|
33
33
|
} else {
|
|
34
|
-
|
|
34
|
+
if (options.connectionManagerId) {
|
|
35
|
+
await import_database.ConnectionManager.connect(options.connectionManagerId, options);
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugins/connect-to-database.ts"],
|
|
4
|
-
"sourcesContent": ["import { ApolloServerPlugin } from '@apollo/server';\nimport { ConnectionManager, ConnectionOptions } from '../database';\n\nexport const connectToDatabase = (\n\toptions: ConnectionOptions[] | ConnectionOptions\n): ApolloServerPlugin => {\n\treturn {\n\t\tserverWillStart: async () => {\n\t\t\tif (Array.isArray(options)) {\n\t\t\t\tfor (const option of options) {\n\t\t\t\t\tif (option.connectionManagerId)\n\t\t\t\t\t\tawait ConnectionManager.connect(option.connectionManagerId, option);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tawait ConnectionManager.connect(options.connectionManagerId, options);\n\t\t\t}\n\t\t},\n\t};\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAqD;AAE9C,MAAM,oBAAoB,CAChC,YACwB;AACxB,SAAO;AAAA,IACN,iBAAiB,YAAY;AAC5B,UAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,mBAAW,UAAU,SAAS;AAC7B,cAAI,OAAO;AACV,kBAAM,kCAAkB,QAAQ,OAAO,qBAAqB,MAAM;AAAA,QACpE;AAAA,MACD,OAAO;AACN,
|
|
4
|
+
"sourcesContent": ["import { ApolloServerPlugin } from '@apollo/server';\nimport { ConnectionManager, ConnectionOptions } from '../database';\n\nexport const connectToDatabase = (\n\toptions: ConnectionOptions[] | ConnectionOptions\n): ApolloServerPlugin => {\n\treturn {\n\t\tserverWillStart: async () => {\n\t\t\tif (Array.isArray(options)) {\n\t\t\t\tfor (const option of options) {\n\t\t\t\t\tif (option.connectionManagerId)\n\t\t\t\t\t\tawait ConnectionManager.connect(option.connectionManagerId, option);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (options.connectionManagerId) {\n\t\t\t\t\tawait ConnectionManager.connect(options.connectionManagerId, options);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAqD;AAE9C,MAAM,oBAAoB,CAChC,YACwB;AACxB,SAAO;AAAA,IACN,iBAAiB,YAAY;AAC5B,UAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,mBAAW,UAAU,SAAS;AAC7B,cAAI,OAAO;AACV,kBAAM,kCAAkB,QAAQ,OAAO,qBAAqB,MAAM;AAAA,QACpE;AAAA,MACD,OAAO;AACN,YAAI,QAAQ,qBAAqB;AAChC,gBAAM,kCAAkB,QAAQ,QAAQ,qBAAqB,OAAO;AAAA,QACrE;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exogee/graphweaver-mikroorm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MikroORM backend for @exogee/graphweaver",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -18,24 +18,31 @@
|
|
|
18
18
|
"dotenv": "16.0.0",
|
|
19
19
|
"graphql": "16.6.0",
|
|
20
20
|
"reflect-metadata": "0.1.13",
|
|
21
|
-
"
|
|
22
|
-
"@exogee/
|
|
21
|
+
"pluralize": "8.0.0",
|
|
22
|
+
"@exogee/graphweaver": "0.2.0",
|
|
23
|
+
"@exogee/logger": "0.2.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@mikro-orm/core": "5.4.2",
|
|
26
27
|
"@mikro-orm/mysql": "5.4.2",
|
|
27
28
|
"@mikro-orm/postgresql": "5.4.2",
|
|
29
|
+
"@mikro-orm/sqlite": "5.4.2",
|
|
30
|
+
"@mikro-orm/knex": "5.4.2",
|
|
28
31
|
"@types/node": "18.11.11",
|
|
32
|
+
"@types/pluralize": "0.0.29",
|
|
29
33
|
"esbuild": "0.15.5",
|
|
30
34
|
"ts-node": "10.4.0",
|
|
31
35
|
"typescript": "5.0.2"
|
|
32
36
|
},
|
|
33
37
|
"optionalDependencies": {
|
|
34
38
|
"@mikro-orm/mysql": "5.4.2",
|
|
35
|
-
"@mikro-orm/postgresql": "5.4.2"
|
|
39
|
+
"@mikro-orm/postgresql": "5.4.2",
|
|
40
|
+
"@mikro-orm/sqlite": "5.4.2",
|
|
41
|
+
"@mikro-orm/knex": "5.4.2"
|
|
36
42
|
},
|
|
37
43
|
"peerDependencies": {
|
|
38
|
-
"@mikro-orm/core": "5.4.2"
|
|
44
|
+
"@mikro-orm/core": "5.4.2",
|
|
45
|
+
"@mikro-orm/knex": "5.4.2"
|
|
39
46
|
},
|
|
40
47
|
"scripts": {
|
|
41
48
|
"build": "npm run build:js && npm run build:types",
|