retold 1.0.6 → 4.0.1

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.
Files changed (71) hide show
  1. package/.claude/settings.local.json +58 -0
  2. package/CLAUDE.md +52 -0
  3. package/docs/.nojekyll +0 -0
  4. package/docs/README.md +161 -0
  5. package/docs/_sidebar.md +65 -0
  6. package/docs/_topbar.md +6 -0
  7. package/docs/architecture.md +312 -0
  8. package/docs/cover.md +15 -0
  9. package/docs/css/docuserve.css +73 -0
  10. package/docs/fable.md +198 -0
  11. package/docs/getting-started.md +272 -0
  12. package/docs/index.html +39 -0
  13. package/docs/js/pict.min.js +12 -0
  14. package/docs/js/pict.min.js.map +1 -0
  15. package/docs/meadow.md +211 -0
  16. package/docs/modules.md +96 -0
  17. package/docs/orator.md +164 -0
  18. package/docs/pict-docuserve.min.js +58 -0
  19. package/docs/pict-docuserve.min.js.map +1 -0
  20. package/docs/pict.md +213 -0
  21. package/docs/retold-building-documentation.md +33 -0
  22. package/docs/retold-catalog.json +2826 -0
  23. package/docs/retold-keyword-index.json +161289 -0
  24. package/docs/utility.md +63 -0
  25. package/examples/quickstart/README.md +47 -0
  26. package/examples/quickstart/layer1/README.md +21 -0
  27. package/examples/quickstart/layer1/index.js +49 -0
  28. package/examples/quickstart/layer1/package-lock.json +344 -0
  29. package/examples/quickstart/layer1/package.json +12 -0
  30. package/examples/quickstart/layer2/README.md +34 -0
  31. package/examples/quickstart/layer2/index.js +251 -0
  32. package/examples/quickstart/layer2/package-lock.json +4468 -0
  33. package/examples/quickstart/layer2/package.json +17 -0
  34. package/examples/quickstart/layer2/setup-database.js +61 -0
  35. package/examples/quickstart/layer3/README.md +39 -0
  36. package/examples/quickstart/layer3/index.js +91 -0
  37. package/examples/quickstart/layer3/package-lock.json +1936 -0
  38. package/examples/quickstart/layer3/package.json +14 -0
  39. package/examples/quickstart/layer4/README.md +47 -0
  40. package/examples/quickstart/layer4/generate-build-config.js +18 -0
  41. package/examples/quickstart/layer4/html/index.html +17 -0
  42. package/examples/quickstart/layer4/package-lock.json +13206 -0
  43. package/examples/quickstart/layer4/package.json +38 -0
  44. package/examples/quickstart/layer4/server.js +28 -0
  45. package/examples/quickstart/layer4/source/BookStore-Application-Config.json +15 -0
  46. package/examples/quickstart/layer4/source/BookStore-Application.js +54 -0
  47. package/examples/quickstart/layer4/source/providers/Router-Config.json +18 -0
  48. package/examples/quickstart/layer4/source/views/View-About.js +38 -0
  49. package/examples/quickstart/layer4/source/views/View-Home.js +50 -0
  50. package/examples/quickstart/layer4/source/views/View-Layout.js +60 -0
  51. package/examples/quickstart/layer5/README.md +26 -0
  52. package/examples/quickstart/layer5/index.js +121 -0
  53. package/examples/quickstart/layer5/package-lock.json +345 -0
  54. package/examples/quickstart/layer5/package.json +13 -0
  55. package/modules/.claude/settings.local.json +52 -0
  56. package/modules/CLAUDE.md +60 -0
  57. package/modules/Checkout.sh +42 -0
  58. package/modules/Include-Retold-Module-List.sh +15 -0
  59. package/modules/Retold-Modules.md +24 -0
  60. package/modules/Status.sh +59 -0
  61. package/modules/Update.sh +45 -0
  62. package/modules/fable/Fable.md +2 -0
  63. package/modules/meadow/Meadow.md +1 -0
  64. package/modules/orator/Orator.md +1 -0
  65. package/modules/pict/Pict.md +1 -0
  66. package/package.json +30 -35
  67. package/source/Retold.cjs +2 -0
  68. package/test/Retold_tests.js +23 -41
  69. package/.travis.yml +0 -13
  70. package/source/Retold-Meadow-Macros.js +0 -269
  71. package/source/Retold.js +0 -48
package/package.json CHANGED
@@ -1,37 +1,32 @@
1
1
  {
2
- "name": "retold",
3
- "version": "1.0.6",
4
- "description": "Common Application Services",
5
- "main": "source/Retold.js",
6
- "scripts": {
7
- "start": "node source/Retold.js",
8
- "coverage": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
9
- "test": "./node_modules/mocha/bin/_mocha -u tdd -R spec"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/stevenvelozo/retold.git"
14
- },
15
- "keywords": [
16
- "logging"
17
- ],
18
- "author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
19
- "license": "MIT",
20
- "bugs": {
21
- "url": "https://github.com/stevenvelozo/retold/issues"
22
- },
23
- "homepage": "https://github.com/stevenvelozo/retold",
24
- "devDependencies": {
25
- "async": "0.9.0",
26
- "chai": "2.0.0",
27
- "codeclimate-test-reporter": "0.0.4",
28
- "coveralls": "2.11.2",
29
- "istanbul": "0.3.5",
30
- "mocha": "2.1.0"
31
- },
32
- "dependencies": {
33
- "fable": "~1.0.1",
34
- "meadow": "~1.0.29",
35
- "meadow-endpoints": "~2.0.1"
36
- }
2
+ "name": "retold",
3
+ "version": "4.0.1",
4
+ "description": "The pict and fable node ecosystem.",
5
+ "main": "source/Retold.cjs",
6
+ "scripts": {
7
+ "start": "node source/Retold.cjs",
8
+ "coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
9
+ "test": "./node_modules/.bin/mocha -u tdd -R spec",
10
+ "build-docs": "npx quack prepare-docs ./docs -d ./modules",
11
+ "serve-docs": "npx pict-docuserve serve ./docs",
12
+ "docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t retold-image:local",
13
+ "docker-dev-run": "docker run -it -d --name retold-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/retold\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold-image:local",
14
+ "docker-dev-shell": "docker exec -it retold-dev /bin/bash"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/stevenvelozo/retold.git"
19
+ },
20
+ "keywords": [],
21
+ "author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/stevenvelozo/retold/issues"
25
+ },
26
+ "homepage": "https://github.com/stevenvelozo/retold",
27
+ "devDependencies": {
28
+ "indoctrinate": "^1.0.4",
29
+ "pict-docuserve": "^0.0.7",
30
+ "quackage": "^1.0.47"
31
+ }
37
32
  }
@@ -0,0 +1,2 @@
1
+
2
+
@@ -1,54 +1,36 @@
1
1
  /**
2
2
  * Unit tests for Retold
3
- *
4
- * @license MIT
5
- *
6
- * @author Steven Velozo <steven@velozo.com>
3
+ * @author Steven Velozo <steven@velozo.com>
7
4
  */
8
5
 
9
- var Chai = require("chai");
10
- var Expect = Chai.expect;
11
- var Assert = Chai.assert;
6
+ const Chai = require("chai");
7
+ const Expect = Chai.expect;
12
8
 
13
-
14
- var _MockSettings = (
15
- {
16
- Product: 'MockRetold',
17
- ProductVersion: '0.0.0'
18
- });
9
+ const libRetold = require('../source/Retold.js');
19
10
 
20
11
  suite
21
- (
22
- 'Retold',
23
- function()
24
- {
25
- var _Fable;
26
-
27
- setup
28
- (
29
- function()
30
- {
31
- _Fable = require('fable').new(_MockSettings);
32
- }
33
- );
12
+ (
13
+ 'Retold',
14
+ () =>
15
+ {
16
+ setup(() => { });
34
17
 
35
18
 
36
- suite
37
- (
38
- 'Object Sanity',
39
- function()
40
- {
41
- test
19
+ suite
42
20
  (
43
- 'The class should initialize itself into a happy little object.',
44
- function()
21
+ 'Object Sanity',
22
+ () =>
45
23
  {
46
- testFable = require('../source/Retold.js').new();
47
- // Instantiate the logger
48
- Expect(testFable).to.be.an('object', 'Retold should initialize as an object directly from the require statement.');
24
+ test
25
+ (
26
+ 'The class should initialize itself into a happy little object.',
27
+ function ()
28
+ {
29
+ testRetold = new libRetold();
30
+ Expect(testRetold).to.be.an('object', 'Go class go.');
31
+ }
32
+ );
49
33
  }
50
34
  );
51
- }
52
- );
53
- }
54
- );
35
+ }
36
+ );
package/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "0.12"
4
- addons:
5
- code_climate:
6
- repo_token: 6d316c5a0e98ac8a4f7a71362e80df2861882af98c1443bf0bdb56383bc45458
7
- after_success:
8
- - npm run coverage
9
- after_script:
10
- - cat coverage/lcov.info | ./node_modules/codeclimate-test-reporter/bin/codeclimate.js
11
- - cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
12
- notifications:
13
- slack: paviateam:C1q99hL9XXpiPpau2PUrVZPC
@@ -1,269 +0,0 @@
1
- // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system
2
- /**
3
- * @license MIT
4
- * @author <steven@velozo.com>
5
- */
6
-
7
- /**
8
- * Meadow Macro Functions
9
- *
10
- * @class MeadowMacros
11
- */
12
- var MeadowMacros = function()
13
- {
14
- function createNew(pFable)
15
- {
16
- // If a valid Fable object isn't passed in, return a constructor
17
- if (typeof(pFable) !== 'object')
18
- {
19
- return {new: createNew};
20
- }
21
-
22
- var _Fable = pFable;
23
-
24
-
25
- var libMeadow = require('meadow').new(pFable);
26
- var libMeadowEndpoints = require('meadow-endpoints');
27
-
28
- // The DAL cache object
29
- var _DALCache = {};
30
- var _MeadowEndpointCache = false;
31
-
32
- /**
33
- * Get a DAL for a particular schema.
34
- *
35
- * @method getDAL
36
- * @param {String} pSchemaName The string schema to get
37
- */
38
- var getDAL = function(pSchemaName)
39
- {
40
- var tmpSchemaJSONPath = _Fable.settings.MeadowSchemaFilePrefix+pSchemaName+'.json';
41
- if (_DALCache.hasOwnProperty(pSchemaName))
42
- {
43
- return _DALCache[pSchemaName];
44
- }
45
- else
46
- {
47
- try
48
- {
49
- // TODO: These need to be cached so we aren't loading them every request. Maybe?
50
- return libMeadow.loadFromPackage(tmpSchemaJSONPath);
51
- }
52
- catch(pError)
53
- {
54
- _Fable.log.error('Schema Load Error: '+pError, {Schema:pSchemaName});
55
- return false;
56
- }
57
- }
58
- };
59
-
60
- /**
61
- * Get the Meadow Endpoints for a particular DAL.
62
- *
63
- * @method getMeadowEndpoints
64
- * @param {Object} pDAL A Meadow DAL (or a string for a DAL to load)
65
- */
66
- var getMeadowEndpoints = function(pDAL, pOrator)
67
- {
68
- var tmpDAL = pDAL;
69
- if (typeof(tmpDAL) === 'string')
70
- {
71
- // Automatically try to load the DAL if a string was passed in
72
- tmpDAL = getDAL(pDAL);
73
- }
74
-
75
- if (typeof(tmpDAL) !== 'object')
76
- {
77
- _Fable.log.error('Meadow Endpoint Load Error: DAL was not a valid object', {DAL: pDAL});
78
- return false;
79
- }
80
-
81
- try
82
- {
83
- var tmpEndPoints = libMeadowEndpoints.new(tmpDAL);
84
-
85
- if ((typeof(pOrator) === 'object') && pOrator.hasOwnProperty('webServer'))
86
- {
87
- // Automatically connect the routes, since orator was passed in
88
- tmpEndPoints.connectRoutes(pOrator.webServer);
89
- }
90
-
91
- return tmpEndPoints;
92
- }
93
- catch(pError)
94
- {
95
- _Fable.log.error('Schema Load Error: '+pError, {Schema:pSchema});
96
- return false;
97
- }
98
- };
99
-
100
-
101
- /**
102
- * Create a record.
103
- *
104
- * A one-line create:
105
- * _CommonServices.doDALCreate({SchemaName:'ObservationTag', IDUser:15, Record:{Tag:'Accident',TagType:'User',IDCustomer:1}}, function(){});
106
- */
107
- var doDALCreate = function(pBundle, fCallBack)
108
- {
109
- // pBundle has: SchemaName, Record, IDUser
110
- // TODO: Validate pBundle
111
- var tmpDAL = getDAL(pBundle.SchemaName)
112
- .setIDUser(pBundle.IDUser);
113
- tmpDAL.doCreate(tmpDAL.query.addRecord(pBundle.Record), fCallBack);
114
- };
115
-
116
- /**
117
- * Read a record.
118
- *
119
- * A one-line read (do something with pRecord eh):
120
- * _CommonServices.doDALRead({SchemaName:'ObservationTag', IDRecord:3, IDUser:15}, function(pError, pQuery, pRecord){});
121
- */
122
- var doDALRead = function(pBundle, fCallBack)
123
- {
124
- // pBundle has: SchemaName, IDRecord
125
- // TODO: Validate pBundle
126
- var tmpDAL = getDAL(pBundle.SchemaName);
127
-
128
- var tmpQuery = tmpDAL.query;
129
-
130
- var tmpFilterString = (typeof(pBundle.Filter) === 'string') ? pBundle.Filter : null;
131
- if (tmpFilterString !== null)
132
- {
133
- // Lazily create an endpoint object with an empty DAL to use for parseFilter
134
- if (!_MeadowEndpointCache)
135
- {
136
- _MeadowEndpointCache = libMeadowEndpoints.new(libMeadow);
137
- }
138
- // Parse the filter
139
- _MeadowEndpointCache.parseFilter(tmpFilterString, tmpQuery);
140
- }
141
- else
142
- {
143
- // Expect an IDRecord otherwise.
144
- tmpQuery.addFilter(tmpDAL.defaultIdentifier, pBundle.IDRecord);
145
- }
146
-
147
- tmpDAL.doRead(tmpQuery, fCallBack);
148
- };
149
-
150
- /**
151
- * Read multiple records.
152
- *
153
- * A one-line read (do something with pRecords eh):
154
- * _CommonServices.doDALReads({SchemaName:'ObservationTag', Cap:25, Begin:0, Filter:''}, function(pError, pQuery, pRecords){});
155
- */
156
- var doDALReads = function(pBundle, fCallBack)
157
- {
158
- // pBundle has: SchemaName, Cap, Begin, FilterString
159
- // TODO: Validate pBundle
160
- var tmpDAL = getDAL(pBundle.SchemaName);
161
-
162
- var tmpQuery = tmpDAL.query;
163
-
164
- if (0 === pBundle.Cap % (!isNaN(parseFloat(pBundle.Cap)) && 0 <= ~~pBundle.Cap))
165
- tmpQuery.setCap(pBundle.Cap);
166
-
167
- if (0 === pBundle.Begin % (!isNaN(parseFloat(pBundle.Begin)) && 0 <= ~~pBundle.Begin))
168
- tmpQuery.setBegin(pBundle.Begin);
169
-
170
- var tmpFilterString = (typeof(pBundle.Filter) === 'string') ? pBundle.Filter : null;
171
- if (tmpFilterString !== null)
172
- {
173
- // Lazily create an endpoint object with an empty DAL to use for parseFilter
174
- if (!_MeadowEndpointCache)
175
- {
176
- _MeadowEndpointCache = libMeadowEndpoints.new(libMeadow);
177
- }
178
- // Parse the filter
179
- _MeadowEndpointCache.parseFilter(tmpFilterString, tmpQuery);
180
- }
181
-
182
- tmpDAL.doReads(tmpQuery, fCallBack);
183
- };
184
-
185
- /**
186
- * Update a record.
187
- *
188
- * A one-line Update (pRecord will have the updated record in it):
189
- * _CommonServices.doDALUpdate({SchemaName:'ObservationTag', IDUser:15, Record:{IDObservationTag:2,Tag:'ABC Contracting'}}, function(pError, pQuery, pReadQuery, pRecord){});
190
- */
191
- var doDALUpdate = function(pBundle, fCallBack)
192
- {
193
- // pBundle has: SchemaName, IDUser, Record
194
- // TODO: Validate pBundle
195
- var tmpDAL = getDAL(pBundle.SchemaName)
196
- .setIDUser(pBundle.IDUser);
197
-
198
- var tmpQuery = tmpDAL.query
199
- .addRecord(pBundle.Record);
200
-
201
- tmpDAL.doUpdate(tmpQuery, fCallBack);
202
- };
203
-
204
- /**
205
- * Delete a record.
206
- *
207
- * A one-line Delete (pRecord will have the updated record in it):
208
- * _CommonServices.doDALDelete({SchemaName:'ObservationTag', IDUser:15, IDRecord:2}, function(pError, pQuery, pCount){});
209
- */
210
- var doDALDelete = function(pBundle, fCallBack)
211
- {
212
- // pBundle has: SchemaName, IDUser, Record
213
- // TODO: Validate pBundle
214
- var tmpDAL = getDAL(pBundle.SchemaName)
215
- .setIDUser(pBundle.IDUser);
216
- var tmpQuery = tmpDAL.query.addFilter(tmpDAL.defaultIdentifier, pBundle.IDRecord);
217
- tmpDAL.doDelete(tmpQuery, fCallBack);
218
- };
219
-
220
- /**
221
- * Count records
222
- *
223
- * A one-line count (do something with pRecords eh):
224
- * _CommonServices.doDALCount({SchemaName:'ObservationTag', Filter:''}, function(pError, pQuery, pCount){});
225
- */
226
- var doDALCount = function(pBundle, fCallBack)
227
- {
228
- // pBundle has: SchemaName, Cap, Begin, FilterString
229
- // TODO: Validate pBundle
230
- var tmpDAL = getDAL(pBundle.SchemaName);
231
-
232
- var tmpQuery = tmpDAL.query;
233
-
234
- var tmpFilterString = (typeof(pBundle.Filter) === 'string') ? pBundle.Filter : null;
235
- if (tmpFilterString !== null)
236
- {
237
- // Lazily create an endpoint object with an empty DAL to use for parseFilter
238
- if (!_MeadowEndpointCache)
239
- {
240
- _MeadowEndpointCache = libMeadowEndpoints.new(libMeadow);
241
- }
242
- // Parse the filter
243
- _MeadowEndpointCache.parseFilter(tmpFilterString, tmpQuery);
244
- }
245
-
246
- tmpDAL.doCount(tmpQuery, fCallBack);
247
- };
248
-
249
- var oMeadowMacros = (
250
- {
251
-
252
- getDAL: getDAL,
253
- getMeadowEndpoints: getMeadowEndpoints,
254
-
255
- doDALCreate: doDALCreate,
256
- doDALRead: doDALRead,
257
- doDALReads: doDALReads,
258
- doDALUpdate: doDALUpdate,
259
- doDALDelete: doDALDelete,
260
- doDALCount: doDALCount
261
- });
262
-
263
- return oMeadowMacros;
264
- }
265
-
266
- return createNew();
267
- };
268
-
269
- module.exports = new MeadowMacros();
package/source/Retold.js DELETED
@@ -1,48 +0,0 @@
1
- // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system
2
- /**
3
- * @license MIT
4
- * @author <steven@velozo.com>
5
- */
6
-
7
- /**
8
- * Retold Common Services Library
9
- *
10
- * @class Retold
11
- */
12
- var Retold = function()
13
- {
14
- function createNew(pFable)
15
- {
16
- // If a valid Fable object isn't passed in, return a constructor
17
- if (typeof(pFable) !== 'object')
18
- {
19
- return {new: createNew};
20
- }
21
- var _Fable = pFable;
22
-
23
- // Setup the Meadow macro functions
24
- var _MeadowMacros = require('./Retold-Meadow-Macros.js').new(_Fable);
25
-
26
- var oRetold = (
27
- {
28
- new: createNew
29
- });
30
-
31
- /**
32
- * Meadow Macros
33
- *
34
- * @property DALMacros
35
- */
36
- Object.defineProperty(oRetold, 'DALMacros',
37
- {
38
- get: function() { return _MeadowMacros; },
39
- enumerable: false
40
- });
41
-
42
- return oRetold;
43
- }
44
-
45
- return createNew();
46
- };
47
-
48
- module.exports = new Retold();