meadow-integration 1.0.20 → 1.0.21
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/example-applications/mapping-demo/.quackage.json +10 -0
- package/example-applications/mapping-demo/README.md +99 -0
- package/example-applications/mapping-demo/data/books-sample.csv +21 -0
- package/example-applications/mapping-demo/generate-build-config.js +44 -0
- package/example-applications/mapping-demo/mappings/books-to-book.json +14 -0
- package/example-applications/mapping-demo/package.json +14 -0
- package/example-applications/mapping-demo/server.js +814 -0
- package/example-applications/mapping-demo/source/MappingDemoApp.js +52 -0
- package/example-applications/mapping-demo/source/views/MappingDemoEditorView.js +186 -0
- package/example-applications/mapping-demo/web/index.html +892 -0
- package/example-applications/mapping-demo/web/mapping-demo-editor.js +3195 -0
- package/example-applications/mapping-demo/web/mapping-demo-editor.js.map +1 -0
- package/example-applications/mapping-demo/web/mapping-demo-editor.min.js +2 -0
- package/example-applications/mapping-demo/web/mapping-demo-editor.min.js.map +1 -0
- package/example-applications/mapping-demo/web/pict.min.js +12 -0
- package/package.json +8 -4
- package/source/Meadow-Integration-Browser.js +31 -0
- package/source/Meadow-Integration.js +16 -1
- package/source/services/certainty/Service-CertaintyAccumulator.js +402 -0
- package/source/services/clone/Meadow-Service-Sync-Entity-Initial.js +16 -3
- package/source/services/clone/Meadow-Service-Sync-Entity-Ongoing.js +15 -2
- package/source/services/clone/Meadow-Service-Sync.js +21 -0
- package/source/views/MappingEditor-SchemaUtils.js +71 -0
- package/source/views/PictView-MeadowMappingEditor.js +1299 -0
- package/source/views/flow-cards/FlowCard-MappingSource.js +50 -0
- package/source/views/flow-cards/FlowCard-MappingTarget.js +49 -0
- package/source/views/flow-cards/FlowCard-SolverExpression.js +78 -0
- package/source/views/flow-cards/FlowCard-TemplateExpression.js +77 -0
- package/test/Meadow-Integration-CloneDeleteSync_test.js +809 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const MICRODDL_TYPE_MAP =
|
|
2
|
+
{
|
|
3
|
+
'@': { DataType: 'AutoIdentity', Label: 'Auto ID', HasSize: false },
|
|
4
|
+
'%': { DataType: 'GUID', Label: 'GUID', HasSize: false },
|
|
5
|
+
'$': { DataType: 'String', Label: 'String', HasSize: true },
|
|
6
|
+
'*': { DataType: 'Text', Label: 'Text', HasSize: false },
|
|
7
|
+
'#': { DataType: 'Numeric', Label: 'Numeric', HasSize: false },
|
|
8
|
+
'.': { DataType: 'Decimal', Label: 'Decimal', HasSize: true },
|
|
9
|
+
'&': { DataType: 'DateTime', Label: 'Date/Time', HasSize: false },
|
|
10
|
+
'^': { DataType: 'Boolean', Label: 'Boolean', HasSize: false }
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const DATATYPE_TO_SYMBOL = {};
|
|
14
|
+
for (let tmpSymbol in MICRODDL_TYPE_MAP)
|
|
15
|
+
{
|
|
16
|
+
DATATYPE_TO_SYMBOL[MICRODDL_TYPE_MAP[tmpSymbol].DataType] = tmpSymbol;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function columnsToMicroDDL(pColumns, pTableName)
|
|
20
|
+
{
|
|
21
|
+
let tmpTableName = (pTableName || 'Untitled').replace(/[^a-zA-Z0-9_]/g, '');
|
|
22
|
+
let tmpLines = ['!' + tmpTableName];
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < pColumns.length; i++)
|
|
25
|
+
{
|
|
26
|
+
let tmpCol = pColumns[i];
|
|
27
|
+
let tmpSymbol = DATATYPE_TO_SYMBOL[tmpCol.DataType] || '$';
|
|
28
|
+
let tmpLine = tmpSymbol + (tmpCol.Name || 'Column' + i);
|
|
29
|
+
|
|
30
|
+
if (MICRODDL_TYPE_MAP[tmpSymbol].HasSize && tmpCol.Size)
|
|
31
|
+
{
|
|
32
|
+
tmpLine += ' ' + tmpCol.Size;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
tmpLines.push(tmpLine);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return tmpLines.join('\n');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function microDDLToColumns(pDDL)
|
|
42
|
+
{
|
|
43
|
+
let tmpLines = pDDL.split('\n');
|
|
44
|
+
let tmpColumns = [];
|
|
45
|
+
|
|
46
|
+
for (let i = 0; i < tmpLines.length; i++)
|
|
47
|
+
{
|
|
48
|
+
let tmpLine = tmpLines[i].trim();
|
|
49
|
+
if (!tmpLine || tmpLine.startsWith('!') || tmpLine.startsWith('//') || tmpLine.startsWith('--') || tmpLine.startsWith('->'))
|
|
50
|
+
{
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let tmpSymbol = tmpLine.charAt(0);
|
|
55
|
+
if (MICRODDL_TYPE_MAP.hasOwnProperty(tmpSymbol))
|
|
56
|
+
{
|
|
57
|
+
let tmpRest = tmpLine.substring(1).trim();
|
|
58
|
+
let tmpParts = tmpRest.split(/\s+/);
|
|
59
|
+
tmpColumns.push(
|
|
60
|
+
{
|
|
61
|
+
Name: tmpParts[0] || '',
|
|
62
|
+
DataType: MICRODDL_TYPE_MAP[tmpSymbol].DataType,
|
|
63
|
+
Size: tmpParts[1] || ''
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return tmpColumns;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = { MICRODDL_TYPE_MAP, DATATYPE_TO_SYMBOL, columnsToMicroDDL, microDDLToColumns };
|