retold-data-service 2.0.4 → 2.0.5
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/package.json
CHANGED
|
@@ -47,7 +47,7 @@ class RetoldDataService extends libFableServiceProviderBase
|
|
|
47
47
|
this.fable.serviceManager.instantiateServiceProvider('Orator', this.options);
|
|
48
48
|
|
|
49
49
|
// TODO: This code will be much cleaner with meadow and meadow-endpoints as services
|
|
50
|
-
this._Meadow = libMeadow.new(
|
|
50
|
+
this._Meadow = libMeadow.new(pFable);
|
|
51
51
|
|
|
52
52
|
// Create DAL objects for each table in the schema
|
|
53
53
|
// These will be unnecessary when meadow and meadow-endpoints are full fledged fable services
|
|
@@ -92,31 +92,31 @@ class RetoldDataService extends libFableServiceProviderBase
|
|
|
92
92
|
// Create DAL objects for each table in the schema
|
|
93
93
|
|
|
94
94
|
// 1. Load full compiled schema of the model from stricture
|
|
95
|
-
|
|
95
|
+
this.fable.log.info(`...loading full model stricture schema...`);
|
|
96
96
|
this.fullModel = require (`${this.options.FullMeadowSchemaPath}${this.options.FullMeadowSchemaFilename}`);
|
|
97
|
-
|
|
97
|
+
this.fable.log.info(`...full model stricture schema loaded.`);
|
|
98
98
|
|
|
99
99
|
// 2. Extract an array of each table in the schema
|
|
100
|
-
|
|
100
|
+
this.fable.log.info(`...getting entity list...`);
|
|
101
101
|
this.entityList = Object.keys(this.fullModel.Tables);
|
|
102
102
|
|
|
103
103
|
// 3. Enumerate each entry in the compiled model and load a DAL for that table
|
|
104
|
-
|
|
104
|
+
this.fable.log.info(`...initializing ${this.entityList.length} DAL objects and corresponding Meadow Endpoints...`);
|
|
105
105
|
for (let i = 0; i < this.entityList.length; i++)
|
|
106
106
|
{
|
|
107
107
|
// 4. Create the DAL for each entry (e.g. it would be at _DAL.Movie for the Movie entity)
|
|
108
108
|
let tmpDALEntityName = this.entityList[i];
|
|
109
109
|
let tmpDALPackageFile = `${this.options.DALMeadowSchemaPath}${this.options.DALMeadowSchemaPrefix}${tmpDALEntityName}${this.options.DALMeadowSchemaPostfix}.json`
|
|
110
|
-
|
|
110
|
+
this.fable.log.info(`Initializing the ${tmpDALEntityName} DAL from [${tmpDALPackageFile}]...`);
|
|
111
111
|
this._DAL[tmpDALEntityName] = this._Meadow.loadFromPackage(tmpDALPackageFile);
|
|
112
112
|
// 5. Tell this DAL object to use MySQL
|
|
113
|
-
|
|
113
|
+
this.fable.log.info(`...defaulting the ${tmpDALEntityName} DAL to use MySQL`);
|
|
114
114
|
this._DAL[tmpDALEntityName].setProvider('MySQL');
|
|
115
115
|
// 6. Create a Meadow Endpoints class for this DAL
|
|
116
|
-
|
|
116
|
+
this.fable.log.info(`...initializing the ${tmpDALEntityName} Meadow Endpoints to use MySQL`);
|
|
117
117
|
this._MeadowEndpoints[tmpDALEntityName] = libMeadowEndpoints.new(this._DAL[tmpDALEntityName]);
|
|
118
118
|
// 8. Expose the meadow endpoints on Orator
|
|
119
|
-
|
|
119
|
+
this.fable.log.info(`...mapping the ${tmpDALEntityName} Meadow Endpoints to Orator`);
|
|
120
120
|
this._MeadowEndpoints[tmpDALEntityName].connectRoutes(this.fable.OratorServiceServer);
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -138,15 +138,15 @@ class RetoldDataService extends libFableServiceProviderBase
|
|
|
138
138
|
tmpAnticipate.anticipate(this.onBeforeInitialize.bind(this));
|
|
139
139
|
|
|
140
140
|
tmpAnticipate.anticipate(
|
|
141
|
-
(
|
|
141
|
+
(fInitCallback) =>
|
|
142
142
|
{
|
|
143
143
|
if (this.options.AutoStartOrator)
|
|
144
144
|
{
|
|
145
|
-
this.fable.Orator.startWebServer(
|
|
145
|
+
this.fable.Orator.startWebServer(fInitCallback);
|
|
146
146
|
}
|
|
147
147
|
else
|
|
148
148
|
{
|
|
149
|
-
return
|
|
149
|
+
return fInitCallback();
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
|