retold-data-service 2.0.13 → 2.0.16
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/.claude/launch.json +11 -0
- package/bin/retold-data-service-clone.js +286 -0
- package/package.json +18 -9
- package/source/Retold-Data-Service.js +275 -73
- package/source/services/Retold-Data-Service-ConnectionManager.js +277 -0
- package/source/services/Retold-Data-Service-MeadowEndpoints.js +217 -0
- package/source/services/Retold-Data-Service-ModelManager.js +335 -0
- package/source/services/data-cloner/DataCloner-Command-Connection.js +138 -0
- package/source/services/data-cloner/DataCloner-Command-Headless.js +357 -0
- package/source/services/data-cloner/DataCloner-Command-Schema.js +367 -0
- package/source/services/data-cloner/DataCloner-Command-Session.js +229 -0
- package/source/services/data-cloner/DataCloner-Command-Sync.js +491 -0
- package/source/services/data-cloner/DataCloner-Command-WebUI.js +40 -0
- package/source/services/data-cloner/DataCloner-ProviderRegistry.js +20 -0
- package/source/services/data-cloner/Retold-Data-Service-DataCloner.js +751 -0
- package/source/services/data-cloner/data-cloner-web.html +2706 -0
- package/source/services/integration-telemetry/IntegrationTelemetry-Command-Dashboard.js +60 -0
- package/source/services/integration-telemetry/IntegrationTelemetry-Command-Integrations.js +132 -0
- package/source/services/integration-telemetry/IntegrationTelemetry-Command-Runs.js +93 -0
- package/source/services/integration-telemetry/IntegrationTelemetry-StorageProvider-Base.js +116 -0
- package/source/services/integration-telemetry/IntegrationTelemetry-StorageProvider-Bibliograph.js +495 -0
- package/source/services/integration-telemetry/Retold-Data-Service-IntegrationTelemetry.js +224 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-CSVCheck.js +85 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-CSVTransform.js +180 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-ComprehensionIntersect.js +153 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-ComprehensionPush.js +190 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-ComprehensionToArray.js +113 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-ComprehensionToCSV.js +211 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-EntityFromTabularFolder.js +244 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-JSONArrayTransform.js +213 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-TSVCheck.js +80 -0
- package/source/services/meadow-integration/MeadowIntegration-Command-TSVTransform.js +166 -0
- package/source/services/meadow-integration/Retold-Data-Service-MeadowIntegration.js +113 -0
- package/source/services/migration-manager/MigrationManager-Command-Connections.js +220 -0
- package/source/services/migration-manager/MigrationManager-Command-DiffMigrate.js +169 -0
- package/source/services/migration-manager/MigrationManager-Command-Schemas.js +532 -0
- package/source/services/migration-manager/MigrationManager-Command-WebUI.js +123 -0
- package/source/services/migration-manager/Retold-Data-Service-MigrationManager.js +357 -0
- package/source/services/stricture/Retold-Data-Service-Stricture.js +303 -0
- package/source/services/stricture/Stricture-Command-Compile.js +39 -0
- package/source/services/stricture/Stricture-Command-Generate-AuthorizationChart.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-DictionaryCSV.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-LaTeX.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-Markdown.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-Meadow.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-ModelGraph.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-MySQL.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-MySQLMigrate.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-Pict.js +14 -0
- package/source/services/stricture/Stricture-Command-Generate-TestObjectContainers.js +14 -0
- package/test/RetoldDataService_tests.js +161 -1
- package/debug/data/books.csv +0 -10001
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate Dictionary CSV
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/DictionaryCSV
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns a CSV data dictionary.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "DataDictionary.csv": "..." } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'DictionaryCSV', require('stricture/source/Stricture-Generate-DictionaryCSV.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate LaTeX Documentation
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/LaTeX
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns LaTeX documentation files.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "filename.tex": "..." } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'LaTeX', require('stricture/source/Stricture-Generate-LaTeX.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate Markdown Documentation
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/Markdown
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns Markdown documentation files.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "Dictionary.md": "...", "Model-Book.md": "...", "ModelChangeTracking.md": "..." } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'Markdown', require('stricture/source/Stricture-Generate-Markdown.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate Meadow
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/Meadow
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns per-entity Meadow schema JSON files.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "ModelBook.json": "{...}", "ModelAuthor.json": "{...}" } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'Meadow', require('stricture/source/Stricture-Generate-Meadow.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate Model Graph
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/ModelGraph
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns a GraphViz DOT relationship diagram.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "Model-Relationships.dot": "digraph ..." } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'ModelGraph', require('stricture/source/Stricture-Generate-ModelGraph.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate MySQL
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/MySQL
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns MySQL CREATE TABLE statements.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "Model.mysql.sql": "CREATE TABLE ..." } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'MySQL', require('stricture/source/Stricture-Generate-MySQL.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate MySQL Migrate
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/MySQLMigrate
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns MySQL migration stubs.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "Model-MigrateMySQL.sql": "INSERT INTO ... SELECT ..." } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'MySQLMigrate', require('stricture/source/Stricture-Generate-MySQL-Migrate.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate Pict
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/Pict
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns PICT UI model definitions.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "Model.json": "{...}" } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'Pict', require('stricture/source/Stricture-Generate-Pict.js'));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stricture Command - Generate Test Object Containers
|
|
3
|
+
*
|
|
4
|
+
* POST /1.0/Retold/Stricture/Generate/TestObjectContainers
|
|
5
|
+
*
|
|
6
|
+
* Accepts a compiled stricture model and returns per-entity test fixture JSON files.
|
|
7
|
+
*
|
|
8
|
+
* Body: { "Model": { "Tables": { ... }, ... } }
|
|
9
|
+
* Returns: { "Files": { "TestObjectContainer-Book.json": "[{...}, ...]", ... } }
|
|
10
|
+
*/
|
|
11
|
+
module.exports = function(pStrictureService, pOratorServiceServer)
|
|
12
|
+
{
|
|
13
|
+
pStrictureService.registerGenerateEndpoint(pOratorServiceServer, 'TestObjectContainers', require('stricture/source/Stricture-Generate-TestObjectContainers.js'));
|
|
14
|
+
};
|
|
@@ -181,7 +181,18 @@ suite
|
|
|
181
181
|
StorageProviderModule: 'meadow-connection-sqlite',
|
|
182
182
|
|
|
183
183
|
AutoInitializeDataService: true,
|
|
184
|
-
AutoStartOrator: true
|
|
184
|
+
AutoStartOrator: true,
|
|
185
|
+
|
|
186
|
+
Endpoints:
|
|
187
|
+
{
|
|
188
|
+
ConnectionManager: true,
|
|
189
|
+
ModelManagerWrite: true,
|
|
190
|
+
Stricture: true,
|
|
191
|
+
MeadowIntegration: true,
|
|
192
|
+
MeadowEndpoints: true,
|
|
193
|
+
MigrationManager: true,
|
|
194
|
+
MigrationManagerWebUI: true
|
|
195
|
+
}
|
|
185
196
|
});
|
|
186
197
|
|
|
187
198
|
_RetoldDataService.initializeService(
|
|
@@ -1349,5 +1360,154 @@ suite
|
|
|
1349
1360
|
);
|
|
1350
1361
|
}
|
|
1351
1362
|
);
|
|
1363
|
+
|
|
1364
|
+
suite
|
|
1365
|
+
(
|
|
1366
|
+
'Endpoint Allow-List Configuration',
|
|
1367
|
+
function()
|
|
1368
|
+
{
|
|
1369
|
+
test
|
|
1370
|
+
(
|
|
1371
|
+
'isEndpointGroupEnabled should return false for disabled groups',
|
|
1372
|
+
function()
|
|
1373
|
+
{
|
|
1374
|
+
// The main test service was created with all groups enabled
|
|
1375
|
+
Expect(_RetoldDataService.isEndpointGroupEnabled('MeadowEndpoints')).to.equal(true);
|
|
1376
|
+
Expect(_RetoldDataService.isEndpointGroupEnabled('Stricture')).to.equal(true);
|
|
1377
|
+
Expect(_RetoldDataService.isEndpointGroupEnabled('ConnectionManager')).to.equal(true);
|
|
1378
|
+
}
|
|
1379
|
+
);
|
|
1380
|
+
test
|
|
1381
|
+
(
|
|
1382
|
+
'isEndpointGroupEnabled should return false for unknown groups',
|
|
1383
|
+
function()
|
|
1384
|
+
{
|
|
1385
|
+
Expect(_RetoldDataService.isEndpointGroupEnabled('NonExistentGroup')).to.equal(false);
|
|
1386
|
+
}
|
|
1387
|
+
);
|
|
1388
|
+
test
|
|
1389
|
+
(
|
|
1390
|
+
'Default configuration should only enable MeadowEndpoints',
|
|
1391
|
+
function(fDone)
|
|
1392
|
+
{
|
|
1393
|
+
let tmpFable2 = new libFable(
|
|
1394
|
+
{
|
|
1395
|
+
APIServerPort: 9331,
|
|
1396
|
+
LogStreams: [{streamtype: 'console', level: 'fatal'}],
|
|
1397
|
+
SQLite: { SQLiteFilePath: ':memory:' }
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
tmpFable2.serviceManager.addServiceType('MeadowSQLiteProvider', libMeadowConnectionSQLite);
|
|
1401
|
+
tmpFable2.serviceManager.instantiateServiceProvider('MeadowSQLiteProvider');
|
|
1402
|
+
|
|
1403
|
+
tmpFable2.MeadowSQLiteProvider.connectAsync(
|
|
1404
|
+
(pConnError) =>
|
|
1405
|
+
{
|
|
1406
|
+
if (pConnError) { return fDone(pConnError); }
|
|
1407
|
+
|
|
1408
|
+
tmpFable2.serviceManager.addServiceType('RetoldDataService', require('../source/Retold-Data-Service.js'));
|
|
1409
|
+
let tmpService2 = tmpFable2.serviceManager.instantiateServiceProvider('RetoldDataService',
|
|
1410
|
+
{
|
|
1411
|
+
AutoStartOrator: false,
|
|
1412
|
+
StorageProvider: 'SQLite',
|
|
1413
|
+
StorageProviderModule: 'meadow-connection-sqlite',
|
|
1414
|
+
FullMeadowSchemaPath: `${process.cwd()}/test/model/`,
|
|
1415
|
+
FullMeadowSchemaFilename: `MeadowModel-Extended.json`
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
// Check the defaults
|
|
1419
|
+
Expect(tmpService2.isEndpointGroupEnabled('MeadowEndpoints')).to.equal(true);
|
|
1420
|
+
Expect(tmpService2.isEndpointGroupEnabled('ConnectionManager')).to.equal(false);
|
|
1421
|
+
Expect(tmpService2.isEndpointGroupEnabled('ModelManagerWrite')).to.equal(false);
|
|
1422
|
+
Expect(tmpService2.isEndpointGroupEnabled('Stricture')).to.equal(false);
|
|
1423
|
+
Expect(tmpService2.isEndpointGroupEnabled('MeadowIntegration')).to.equal(false);
|
|
1424
|
+
Expect(tmpService2.isEndpointGroupEnabled('MigrationManager')).to.equal(false);
|
|
1425
|
+
Expect(tmpService2.isEndpointGroupEnabled('MigrationManagerWebUI')).to.equal(false);
|
|
1426
|
+
|
|
1427
|
+
fDone();
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
);
|
|
1431
|
+
test
|
|
1432
|
+
(
|
|
1433
|
+
'Schema read routes should always be available even with restrictive config',
|
|
1434
|
+
function(fDone)
|
|
1435
|
+
{
|
|
1436
|
+
this.timeout(10000);
|
|
1437
|
+
|
|
1438
|
+
let tmpFable3 = new libFable(
|
|
1439
|
+
{
|
|
1440
|
+
APIServerPort: 9332,
|
|
1441
|
+
LogStreams: [{streamtype: 'console', level: 'fatal'}],
|
|
1442
|
+
SQLite: { SQLiteFilePath: ':memory:' }
|
|
1443
|
+
});
|
|
1444
|
+
|
|
1445
|
+
tmpFable3.serviceManager.addServiceType('MeadowSQLiteProvider', libMeadowConnectionSQLite);
|
|
1446
|
+
tmpFable3.serviceManager.instantiateServiceProvider('MeadowSQLiteProvider');
|
|
1447
|
+
|
|
1448
|
+
tmpFable3.MeadowSQLiteProvider.connectAsync(
|
|
1449
|
+
(pConnError) =>
|
|
1450
|
+
{
|
|
1451
|
+
if (pConnError) { return fDone(pConnError); }
|
|
1452
|
+
|
|
1453
|
+
let tmpDB3 = tmpFable3.MeadowSQLiteProvider.db;
|
|
1454
|
+
tmpDB3.exec(`CREATE TABLE IF NOT EXISTS Book (IDBook INTEGER PRIMARY KEY AUTOINCREMENT, GUIDBook TEXT, CreateDate TEXT, CreatingIDUser INTEGER DEFAULT 0, UpdateDate TEXT, UpdatingIDUser INTEGER DEFAULT 0, Deleted INTEGER DEFAULT 0, DeleteDate TEXT, DeletingIDUser INTEGER DEFAULT 0, Title TEXT, Type TEXT, Genre TEXT, ISBN TEXT, Language TEXT, ImageURL TEXT, PublicationYear INTEGER DEFAULT 0);`);
|
|
1455
|
+
|
|
1456
|
+
tmpFable3.serviceManager.addServiceType('RetoldDataService', require('../source/Retold-Data-Service.js'));
|
|
1457
|
+
tmpFable3.serviceManager.instantiateServiceProvider('RetoldDataService',
|
|
1458
|
+
{
|
|
1459
|
+
StorageProvider: 'SQLite',
|
|
1460
|
+
StorageProviderModule: 'meadow-connection-sqlite',
|
|
1461
|
+
FullMeadowSchemaPath: `${process.cwd()}/test/model/`,
|
|
1462
|
+
FullMeadowSchemaFilename: `MeadowModel-Extended.json`,
|
|
1463
|
+
AutoStartOrator: true,
|
|
1464
|
+
Endpoints:
|
|
1465
|
+
{
|
|
1466
|
+
ConnectionManager: false,
|
|
1467
|
+
ModelManagerWrite: false,
|
|
1468
|
+
Stricture: false,
|
|
1469
|
+
MeadowIntegration: false,
|
|
1470
|
+
MeadowEndpoints: true
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
tmpFable3.RetoldDataService.initializeService(
|
|
1475
|
+
(pInitError) =>
|
|
1476
|
+
{
|
|
1477
|
+
if (pInitError) { return fDone(pInitError); }
|
|
1478
|
+
|
|
1479
|
+
let tmpSuperTest3 = libSuperTest(`http://localhost:9332/`);
|
|
1480
|
+
|
|
1481
|
+
// Schema read routes should always be available
|
|
1482
|
+
tmpSuperTest3
|
|
1483
|
+
.get('1.0/Retold/Models')
|
|
1484
|
+
.expect(200)
|
|
1485
|
+
.end(
|
|
1486
|
+
(pError, pResponse) =>
|
|
1487
|
+
{
|
|
1488
|
+
let tmpModels = JSON.parse(pResponse.text);
|
|
1489
|
+
Expect(tmpModels).to.be.an('array');
|
|
1490
|
+
|
|
1491
|
+
// Clean up
|
|
1492
|
+
if (tmpFable3.OratorServiceServer && tmpFable3.OratorServiceServer.server)
|
|
1493
|
+
{
|
|
1494
|
+
tmpFable3.OratorServiceServer.server.close(
|
|
1495
|
+
() =>
|
|
1496
|
+
{
|
|
1497
|
+
try { tmpFable3.MeadowSQLiteProvider.db.close(); } catch(e) {}
|
|
1498
|
+
fDone();
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
else
|
|
1502
|
+
{
|
|
1503
|
+
fDone();
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
});
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
);
|
|
1510
|
+
}
|
|
1511
|
+
);
|
|
1352
1512
|
}
|
|
1353
1513
|
);
|