retold-facto 0.1.1 → 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "retold-facto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Data warehouse and knowledge graph storage for the Retold ecosystem.",
|
|
5
5
|
"main": "source/Retold-Facto.js",
|
|
6
6
|
"bin": {
|
|
@@ -96,30 +96,31 @@
|
|
|
96
96
|
"chai": "^6.2.2",
|
|
97
97
|
"pict-docuserve": "^0.1.5",
|
|
98
98
|
"puppeteer": "^24.40.0",
|
|
99
|
-
"quackage": "^1.1.
|
|
99
|
+
"quackage": "^1.1.3",
|
|
100
100
|
"stricture": "^4.0.2",
|
|
101
101
|
"supertest": "^7.2.2"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@codemirror/lang-markdown": "^6.5.0",
|
|
105
105
|
"@codemirror/state": "^6.6.0",
|
|
106
|
-
"meadow-connection-sqlite": "^1.0.
|
|
106
|
+
"meadow-connection-sqlite": "^1.0.19",
|
|
107
107
|
"@codemirror/view": "^6.41.0",
|
|
108
|
-
"bibliograph": "^0.1.
|
|
108
|
+
"bibliograph": "^0.1.6",
|
|
109
109
|
"codemirror": "^6.0.2",
|
|
110
110
|
"fable": "^3.1.71",
|
|
111
111
|
"fable-serviceproviderbase": "^3.0.19",
|
|
112
112
|
"fast-xml-parser": "^5.5.10",
|
|
113
113
|
"meadow": "^2.0.37",
|
|
114
|
-
"meadow-connection-manager": "^1.0
|
|
115
|
-
"meadow-connection-mysql": "^1.0.
|
|
114
|
+
"meadow-connection-manager": "^1.1.0",
|
|
115
|
+
"meadow-connection-mysql": "^1.0.18",
|
|
116
116
|
"meadow-endpoints": "^4.0.17",
|
|
117
|
-
"meadow-integration": "^1.0.
|
|
118
|
-
"orator": "^6.0
|
|
117
|
+
"meadow-integration": "^1.0.38",
|
|
118
|
+
"orator": "^6.1.0",
|
|
119
119
|
"orator-serviceserver-restify": "^2.0.10",
|
|
120
|
-
"orator-static-server": "^2.
|
|
121
|
-
"pict": "^1.0.
|
|
120
|
+
"orator-static-server": "^2.1.3",
|
|
121
|
+
"pict": "^1.0.365",
|
|
122
122
|
"pict-router": "^1.0.9",
|
|
123
|
+
"pict-section-connection-form": "^0.0.1",
|
|
123
124
|
"pict-section-flow": "^0.0.17",
|
|
124
125
|
"pict-section-histogram": "^1.0.0",
|
|
125
126
|
"pict-section-markdowneditor": "^1.0.10",
|
|
@@ -406,6 +406,25 @@ class RetoldFactoStoreConnectionManager extends libFableServiceProviderBase
|
|
|
406
406
|
return fNext();
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
+
// GET /facto/connection/schemas -- aggregated form schemas, drives
|
|
410
|
+
// the schema-driven Connections form (pict-section-connection-form).
|
|
411
|
+
// MCM 1.1.0+ exposes getAllProviderFormSchemas(); older versions are
|
|
412
|
+
// handled defensively so the UI surfaces a friendly empty state.
|
|
413
|
+
pOratorServiceServer.doGet(`${tmpRoutePrefix}/connection/schemas`,
|
|
414
|
+
(pRequest, pResponse, fNext) =>
|
|
415
|
+
{
|
|
416
|
+
let tmpMCM = this.fable.MeadowConnectionManager;
|
|
417
|
+
let tmpSchemas = (tmpMCM && typeof(tmpMCM.getAllProviderFormSchemas) === 'function')
|
|
418
|
+
? tmpMCM.getAllProviderFormSchemas()
|
|
419
|
+
: [];
|
|
420
|
+
if (tmpSchemas.length === 0)
|
|
421
|
+
{
|
|
422
|
+
this.fable.log.warn('Facto: meadow-connection-manager getAllProviderFormSchemas() returned no schemas; UI will show "no providers detected".');
|
|
423
|
+
}
|
|
424
|
+
pResponse.send({ Schemas: tmpSchemas });
|
|
425
|
+
return fNext();
|
|
426
|
+
});
|
|
427
|
+
|
|
409
428
|
this.fable.log.info(`StoreConnectionManager routes connected at ${tmpRoutePrefix}/connection*`);
|
|
410
429
|
}
|
|
411
430
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const libPictApplication = require('pict-application');
|
|
2
2
|
const libPictRouter = require('pict-router');
|
|
3
3
|
const libPictSectionModal = require('pict-section-modal');
|
|
4
|
+
const libPictSectionConnectionForm = require('pict-section-connection-form');
|
|
4
5
|
|
|
5
6
|
const THEME_LIST =
|
|
6
7
|
[
|
|
@@ -88,6 +89,20 @@ class FactoFullApplication extends libPictApplication
|
|
|
88
89
|
this.pict.addView('Facto-Full-SourceEditor', libViewSourceEditor.default_configuration, libViewSourceEditor);
|
|
89
90
|
this.pict.addView('Facto-Full-Scanner', libViewScanner.default_configuration, libViewScanner);
|
|
90
91
|
this.pict.addView('Facto-Full-Connections', libViewConnections.default_configuration, libViewConnections);
|
|
92
|
+
|
|
93
|
+
// Shared schema-driven connection form. Renders the type
|
|
94
|
+
// select + per-provider field block into the slot owned by
|
|
95
|
+
// the Facto-Full-Connections view. Schemas come from
|
|
96
|
+
// /facto/connection/schemas (Retold-Facto-StoreConnectionManager).
|
|
97
|
+
this.pict.addView('PictSection-ConnectionForm',
|
|
98
|
+
Object.assign({}, libPictSectionConnectionForm.default_configuration,
|
|
99
|
+
{
|
|
100
|
+
ContainerSelector: '#Facto-Conn-Form-FieldsSlot',
|
|
101
|
+
DefaultDestinationAddress: '#Facto-Conn-Form-FieldsSlot',
|
|
102
|
+
SchemasAddress: 'AppData.Facto.ConnectionFormSchemas',
|
|
103
|
+
ActiveAddress: 'AppData.Facto.ConnectionFormActiveProvider',
|
|
104
|
+
FieldIDPrefix: 'facto-conn'
|
|
105
|
+
}), libPictSectionConnectionForm);
|
|
91
106
|
this.pict.addView('Facto-Full-ProjectionDetail', libViewProjectionDetail.default_configuration, libViewProjectionDetail);
|
|
92
107
|
this.pict.addView('Facto-Full-Throughput', libViewThroughput.default_configuration, libViewThroughput);
|
|
93
108
|
this.pict.addView('Facto-Full-SchemaResearch', libViewSchemaResearch.default_configuration, libViewSchemaResearch);
|
|
@@ -70,49 +70,18 @@ const _ViewConfiguration =
|
|
|
70
70
|
|
|
71
71
|
<div id="Facto-Conn-Form" class="facto-conn-form">
|
|
72
72
|
<div class="facto-conn-form-grid">
|
|
73
|
-
<div>
|
|
73
|
+
<div style="grid-column: span 2;">
|
|
74
74
|
<label>Connection Name</label>
|
|
75
75
|
<input type="text" id="Facto-Conn-Name" placeholder="e.g. Production MySQL">
|
|
76
76
|
</div>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<option value="RocksDB">RocksDB</option>
|
|
86
|
-
</select>
|
|
87
|
-
</div>
|
|
88
|
-
<div id="Facto-Conn-FilePath-Wrap" style="display:none;">
|
|
89
|
-
<label>File Path</label>
|
|
90
|
-
<input type="text" id="Facto-Conn-FilePath" placeholder="/path/to/database.sqlite">
|
|
91
|
-
</div>
|
|
92
|
-
<div id="Facto-Conn-Host-Wrap">
|
|
93
|
-
<label>Host</label>
|
|
94
|
-
<input type="text" id="Facto-Conn-Host" placeholder="localhost">
|
|
95
|
-
</div>
|
|
96
|
-
<div id="Facto-Conn-Port-Wrap">
|
|
97
|
-
<label>Port</label>
|
|
98
|
-
<input type="number" id="Facto-Conn-Port" placeholder="3306">
|
|
99
|
-
</div>
|
|
100
|
-
<div id="Facto-Conn-User-Wrap">
|
|
101
|
-
<label>User</label>
|
|
102
|
-
<input type="text" id="Facto-Conn-User" placeholder="root">
|
|
103
|
-
</div>
|
|
104
|
-
<div id="Facto-Conn-Password-Wrap">
|
|
105
|
-
<label>Password</label>
|
|
106
|
-
<input type="password" id="Facto-Conn-Password" placeholder="password">
|
|
107
|
-
</div>
|
|
108
|
-
<div id="Facto-Conn-Database-Wrap">
|
|
109
|
-
<label>Database</label>
|
|
110
|
-
<input type="text" id="Facto-Conn-Database" placeholder="my_database">
|
|
111
|
-
</div>
|
|
112
|
-
<div class="facto-conn-form-actions">
|
|
113
|
-
<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views['Facto-Full-Connections'].addConnection()">Save Connection</button>
|
|
114
|
-
<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views['Facto-Full-Connections'].toggleConnectionForm()">Cancel</button>
|
|
115
|
-
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<!-- pict-section-connection-form renders the type select + per-provider field block here -->
|
|
80
|
+
<div id="Facto-Conn-Form-FieldsSlot" style="margin-top:0.6em"></div>
|
|
81
|
+
|
|
82
|
+
<div class="facto-conn-form-actions" style="margin-top:0.6em">
|
|
83
|
+
<button class="facto-btn facto-btn-primary facto-btn-small" onclick="{~P~}.views['Facto-Full-Connections'].addConnection()">Save Connection</button>
|
|
84
|
+
<button class="facto-btn facto-btn-secondary facto-btn-small" onclick="{~P~}.views['Facto-Full-Connections'].toggleConnectionForm()">Cancel</button>
|
|
116
85
|
</div>
|
|
117
86
|
</div>
|
|
118
87
|
|
|
@@ -155,6 +124,28 @@ class FactoFullConnectionsView extends libPictView
|
|
|
155
124
|
this.pict.views['Pict-Section-Modal'].toast('Error loading connections: ' + pError.message, {type: 'error'});
|
|
156
125
|
});
|
|
157
126
|
|
|
127
|
+
// Fetch the form schemas and hand them to the shared
|
|
128
|
+
// pict-section-connection-form view (which renders into
|
|
129
|
+
// #Facto-Conn-Form-FieldsSlot once the user opens the form).
|
|
130
|
+
this.pict.providers.Facto.api('GET', '/facto/connection/schemas').then(
|
|
131
|
+
(pData) =>
|
|
132
|
+
{
|
|
133
|
+
let tmpSchemas = (pData && Array.isArray(pData.Schemas)) ? pData.Schemas : [];
|
|
134
|
+
let tmpFormView = this.pict.views['PictSection-ConnectionForm'];
|
|
135
|
+
if (tmpFormView && typeof(tmpFormView.setSchemas) === 'function')
|
|
136
|
+
{
|
|
137
|
+
tmpFormView.setSchemas(tmpSchemas);
|
|
138
|
+
}
|
|
139
|
+
this.pict.AppData.Facto.ConnectionFormSchemas = tmpSchemas;
|
|
140
|
+
}).catch(
|
|
141
|
+
(pError) =>
|
|
142
|
+
{
|
|
143
|
+
if (this.pict.log && this.pict.log.warn)
|
|
144
|
+
{
|
|
145
|
+
this.pict.log.warn(`Facto: failed to fetch /facto/connection/schemas: ${pError && pError.message}`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
158
149
|
return super.onAfterRender();
|
|
159
150
|
}
|
|
160
151
|
|
|
@@ -166,31 +157,16 @@ class FactoFullConnectionsView extends libPictView
|
|
|
166
157
|
tmpForm.classList.toggle('active');
|
|
167
158
|
if (tmpForm.classList.contains('active'))
|
|
168
159
|
{
|
|
169
|
-
|
|
160
|
+
// Make sure the schema-driven form renders into the slot
|
|
161
|
+
// when the user opens the panel. AutoRender is false on
|
|
162
|
+
// the shared view so we trigger it here. Schemas were
|
|
163
|
+
// fetched earlier by loadAvailableConnectionTypes().
|
|
164
|
+
let tmpFormView = this.pict.views['PictSection-ConnectionForm'];
|
|
165
|
+
if (tmpFormView) { tmpFormView.render(); }
|
|
170
166
|
}
|
|
171
167
|
}
|
|
172
168
|
}
|
|
173
169
|
|
|
174
|
-
updateConnectionFormFields()
|
|
175
|
-
{
|
|
176
|
-
let tmpType = this.pict.providers.FactoUI.getVal('Facto-Conn-Type');
|
|
177
|
-
let tmpIsFileBased = (tmpType === 'SQLite' || tmpType === 'RocksDB');
|
|
178
|
-
|
|
179
|
-
let tmpFilePathWrap = document.getElementById('Facto-Conn-FilePath-Wrap');
|
|
180
|
-
let tmpHostWrap = document.getElementById('Facto-Conn-Host-Wrap');
|
|
181
|
-
let tmpPortWrap = document.getElementById('Facto-Conn-Port-Wrap');
|
|
182
|
-
let tmpUserWrap = document.getElementById('Facto-Conn-User-Wrap');
|
|
183
|
-
let tmpPasswordWrap = document.getElementById('Facto-Conn-Password-Wrap');
|
|
184
|
-
let tmpDatabaseWrap = document.getElementById('Facto-Conn-Database-Wrap');
|
|
185
|
-
|
|
186
|
-
if (tmpFilePathWrap) tmpFilePathWrap.style.display = tmpIsFileBased ? '' : 'none';
|
|
187
|
-
if (tmpHostWrap) tmpHostWrap.style.display = tmpIsFileBased ? 'none' : '';
|
|
188
|
-
if (tmpPortWrap) tmpPortWrap.style.display = tmpIsFileBased ? 'none' : '';
|
|
189
|
-
if (tmpUserWrap) tmpUserWrap.style.display = tmpIsFileBased ? 'none' : '';
|
|
190
|
-
if (tmpPasswordWrap) tmpPasswordWrap.style.display = tmpIsFileBased ? 'none' : '';
|
|
191
|
-
if (tmpDatabaseWrap) tmpDatabaseWrap.style.display = tmpIsFileBased ? 'none' : '';
|
|
192
|
-
}
|
|
193
|
-
|
|
194
170
|
refreshConnectionList()
|
|
195
171
|
{
|
|
196
172
|
let tmpContainer = document.getElementById('Facto-Conn-List');
|
|
@@ -229,41 +205,31 @@ class FactoFullConnectionsView extends libPictView
|
|
|
229
205
|
addConnection()
|
|
230
206
|
{
|
|
231
207
|
let tmpName = this.pict.providers.FactoUI.getVal('Facto-Conn-Name');
|
|
232
|
-
let tmpType = this.pict.providers.FactoUI.getVal('Facto-Conn-Type');
|
|
233
|
-
|
|
234
208
|
if (!tmpName)
|
|
235
209
|
{
|
|
236
210
|
this.pict.views['Pict-Section-Modal'].toast('Connection name is required.', {type: 'warning'});
|
|
237
211
|
return;
|
|
238
212
|
}
|
|
239
213
|
|
|
240
|
-
|
|
241
|
-
|
|
214
|
+
// Pull Type + Config straight from the shared schema-driven view.
|
|
215
|
+
// That view handles SQLite vs server-style providers, MSSQL retry
|
|
216
|
+
// tuning, etc., uniformly via its schema definitions.
|
|
217
|
+
let tmpFormView = this.pict.views['PictSection-ConnectionForm'];
|
|
218
|
+
let tmpConnInfo = (tmpFormView && typeof(tmpFormView.getProviderConfig) === 'function')
|
|
219
|
+
? tmpFormView.getProviderConfig()
|
|
220
|
+
: { Provider: '', Config: {} };
|
|
242
221
|
|
|
243
|
-
if (
|
|
244
|
-
{
|
|
245
|
-
tmpConfig.SQLiteFilePath = this.pict.providers.FactoUI.getVal('Facto-Conn-FilePath');
|
|
246
|
-
if (!tmpConfig.SQLiteFilePath)
|
|
247
|
-
{
|
|
248
|
-
this.pict.views['Pict-Section-Modal'].toast('File path is required for ' + tmpType + ' connections.', {type: 'warning'});
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
else
|
|
222
|
+
if (!tmpConnInfo.Provider)
|
|
253
223
|
{
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
tmpConfig.port = parseInt(this.pict.providers.FactoUI.getVal('Facto-Conn-Port')) || 0;
|
|
257
|
-
tmpConfig.user = this.pict.providers.FactoUI.getVal('Facto-Conn-User');
|
|
258
|
-
tmpConfig.password = this.pict.providers.FactoUI.getVal('Facto-Conn-Password');
|
|
259
|
-
tmpConfig.database = this.pict.providers.FactoUI.getVal('Facto-Conn-Database');
|
|
224
|
+
this.pict.views['Pict-Section-Modal'].toast('Pick a provider type.', {type: 'warning'});
|
|
225
|
+
return;
|
|
260
226
|
}
|
|
261
227
|
|
|
262
228
|
this.pict.providers.Facto.createStoreConnection(
|
|
263
229
|
{
|
|
264
|
-
Name:
|
|
265
|
-
Type:
|
|
266
|
-
Config:
|
|
230
|
+
Name: tmpName,
|
|
231
|
+
Type: tmpConnInfo.Provider,
|
|
232
|
+
Config: tmpConnInfo.Config || {}
|
|
267
233
|
}).then(
|
|
268
234
|
(pResponse) =>
|
|
269
235
|
{
|
|
@@ -277,16 +243,17 @@ class FactoFullConnectionsView extends libPictView
|
|
|
277
243
|
this.pict.providers.Facto.loadStoreConnections().then(
|
|
278
244
|
(pResult) =>
|
|
279
245
|
{
|
|
280
|
-
|
|
246
|
+
|
|
281
247
|
this.refreshConnectionList();
|
|
282
248
|
this.toggleConnectionForm();
|
|
283
249
|
|
|
284
|
-
// Clear
|
|
285
|
-
|
|
286
|
-
|
|
250
|
+
// Clear name input + reset the shared schema-driven
|
|
251
|
+
// form back to its default (first provider, default values).
|
|
252
|
+
let tmpNameEl = document.getElementById('Facto-Conn-Name');
|
|
253
|
+
if (tmpNameEl) tmpNameEl.value = '';
|
|
254
|
+
if (tmpFormView && typeof(tmpFormView.clear) === 'function')
|
|
287
255
|
{
|
|
288
|
-
|
|
289
|
-
if (tmpEl) tmpEl.value = '';
|
|
256
|
+
tmpFormView.clear();
|
|
290
257
|
}
|
|
291
258
|
});
|
|
292
259
|
});
|