qtools-library-dot-d 1.0.12 → 1.0.13

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 (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/package.json +2 -2
  4. package/libDotD_Working_Example/README.md +0 -234
  5. package/libDotD_Working_Example/demoModules_DotD/demo1.js +0 -46
  6. package/libDotD_Working_Example/demoModules_DotD/demo2.js +0 -48
  7. package/libDotD_Working_Example/index.js +0 -133
  8. package/libDotD_Working_Example/node_modules/.package-lock.json +0 -29
  9. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/README.md +0 -213
  10. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/package.json +0 -20
  11. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/qtools-asynchronous-pipe-plus.js +0 -278
  12. package/libDotD_Working_Example/node_modules/qtools-asynchronous-pipe-plus/test.js +0 -79
  13. package/libDotD_Working_Example/node_modules/qtools-functional-library/README.md +0 -110
  14. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/package.json +0 -11
  15. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/qtools-clone.js +0 -103
  16. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-clone/test.js +0 -78
  17. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/package.json +0 -11
  18. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/qtools-get-by-property.js +0 -73
  19. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-get-by-property/test.js +0 -129
  20. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/package.json +0 -11
  21. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/qtools-includes-regex.js +0 -54
  22. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-includes-regex/test.js +0 -76
  23. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/package.json +0 -11
  24. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/qtools-log-output.js +0 -114
  25. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-log-output/test.js +0 -130
  26. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/package.json +0 -11
  27. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/qtools-map-properties.js +0 -99
  28. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-map-properties/test.js +0 -118
  29. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/package.json +0 -11
  30. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/qtools-merge.js +0 -147
  31. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-merge/test.js +0 -214
  32. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/package.json +0 -11
  33. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/qtools-new-method-template.js +0 -70
  34. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-new-method-template/test.js +0 -66
  35. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/package.json +0 -11
  36. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/qtools-number-iterator.js +0 -137
  37. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-iterator/test.js +0 -68
  38. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/package.json +0 -11
  39. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/qtools-number-keys-to-array.js +0 -131
  40. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-number-keys-to-array/test.js +0 -181
  41. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/package.json +0 -11
  42. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/qtools-object-sure-path.js +0 -204
  43. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-object-sure-path/test.js +0 -345
  44. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/package.json +0 -11
  45. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/qtools-pass-through.js +0 -58
  46. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pass-through/test.js +0 -66
  47. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/package.json +0 -11
  48. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/qtools-pop.js +0 -175
  49. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-pop/test.js +0 -118
  50. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/package.json +0 -11
  51. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/qtools-print-debug.js +0 -352
  52. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-print-debug/test.js +0 -77
  53. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/package.json +0 -11
  54. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/qtools-select-properties.js +0 -132
  55. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-select-properties/test.js +0 -156
  56. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/README.md +0 -3
  57. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/package.json +0 -11
  58. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/qtools-template-replace.js +0 -106
  59. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-template-replace/test.js +0 -168
  60. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/package.json +0 -11
  61. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/qtools-to-key-value-array.js +0 -83
  62. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-key-value-array/test.js +0 -68
  63. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/package.json +0 -11
  64. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/qtools-to-string.js +0 -84
  65. package/libDotD_Working_Example/node_modules/qtools-functional-library/lib/qtools-to-string/test.js +0 -63
  66. package/libDotD_Working_Example/node_modules/qtools-functional-library/package.json +0 -37
  67. package/libDotD_Working_Example/node_modules/qtools-functional-library/qtFunctionalDemo.js +0 -297
  68. package/libDotD_Working_Example/node_modules/qtools-functional-library/qtools-functional-library.js +0 -271
  69. package/libDotD_Working_Example/node_modules/qtools-functional-library/test.js +0 -47
  70. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/README.md +0 -208
  71. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/package.json +0 -15
  72. package/libDotD_Working_Example/node_modules/qtools-library-dot-d/qtools-library-dot-d.js +0 -239
  73. package/libDotD_Working_Example/package-lock.json +0 -37
  74. package/libDotD_Working_Example/package.json +0 -23
@@ -1,239 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const moduleName = __filename.replace(__dirname + '/', '').replace(/.js$/, ''); //this just seems to come in handy a lot
5
-
6
- // const qt = require('qtools-functional-library'); //also exposes qtLog(); qt.help({printOutput:true, queryString:'.*', sendJson:false});
7
-
8
- const os = require('os');
9
- const path = require('path');
10
- const fs = require('fs');
11
-
12
- const qt = require('qtools-functional-library');
13
-
14
- //START OF moduleFunction() ============================================================
15
- const moduleFunction =
16
- ({ moduleName } = {}) =>
17
- ({ libraryName='libraryDotD' }) => {
18
- // ======================================================================================
19
- // SETTERS
20
-
21
- // --------------------------------------------------------------------------------
22
- // SET LIBRARY PATH
23
-
24
- let libraryPath;
25
-
26
- const setLibraryPath = (dirPath, callback) => {
27
- try {
28
- libraryPath = fs.realpathSync(dirPath);
29
- } catch (err) {
30
- callback(err.toString());
31
- return;
32
- }
33
-
34
- if (typeof callback == 'function') {
35
- callback('', libraryPath);
36
- } else {
37
- return libraryPath;
38
- }
39
- };
40
-
41
- // --------------------------------------------------------------------------------
42
- // SET CUSTOM MODULE ADDING FUNCTION
43
-
44
- const defaultAdd = (item, callback) => {
45
- let error;
46
- try {
47
- require(item.endpointPath)(item.moduleArgs); //calls module with dotD object, including library.add()
48
- } catch (err) {
49
- item.exceptionList.push(
50
- `${path.basename(item.endpointPath)}: ${err.toString().split('\n').qtFirst('n/a')}`,
51
- );
52
- }
53
-
54
- if (typeof callback == 'function') {
55
- callback(error);
56
- } else {
57
- return;
58
- }
59
- };
60
-
61
- let add = defaultAdd;
62
-
63
- const setCustomAddFunction = (newFunction) => (add = newFunction);
64
-
65
- // ======================================================================================
66
- // LOG LIST OBJECT
67
-
68
- const logList = (() => {
69
- const list = [];
70
- const push = (item) => list.push(item);
71
- const formatList = () => {
72
- return list
73
- .reduce(
74
- (result, item) => `${result}${item}\n\t`,
75
- `\n${libraryName} Log\n\t`,
76
- )
77
- .replace(/\n\t$/, '');
78
- };
79
- return { push, formatList };
80
- })();
81
-
82
- // ======================================================================================
83
- // LIBRARY OBJECT
84
-
85
- const libraryObject = {}; //used only for producing display listings
86
- const exceptionList = [];
87
- const library = (() => {
88
- const add = (name, item) => {
89
- libraryObject[name] = item; //used only for producing display listings
90
- externalElements[name] = item;
91
- };
92
- return { add };
93
- })();
94
-
95
- // ======================================================================================
96
- // LIBRARY OBJECT
97
-
98
- const toString = () => {
99
- const formatProperty = (item) => {
100
- let outString = typeof item;
101
- if (typeof item == 'function') {
102
- const result = item.toString().match(/\((?<args>.*?\))/);
103
- const args = result.qtGetSurePath('groups.args', 'function');
104
- outString = `(${args == ')' ? args + ' # function takes no arguments' : args}`;
105
- }
106
- return outString;
107
- };
108
-
109
- const libString = Object.keys(libraryObject)
110
- .reduce(
111
- (result, name) =>
112
- `${result}${name}: ${
113
- (typeof libraryObject[name]).match(/(string|number)/i)
114
- ? libraryObject[name]
115
- : formatProperty(libraryObject[name])
116
- }\n\t`,
117
- `\n${libraryName} Library Elements\n\t`,
118
- )
119
- .replace(/\n\t$/, '');
120
-
121
- const exceptionString = '\n\t' + exceptionList.join('\n\t');
122
-
123
- return `${libString}${exceptionString}`;
124
- };
125
-
126
- // ======================================================================================
127
- // SEAL OBJECT (make immutable)
128
-
129
- const sealActual = (externalElements) => () => {
130
- Object.assign(
131
- externalElements.library.qtSelectProperties(['add'], {
132
- excludeMode: true,
133
- }),
134
- );
135
- Object.assign(
136
- externalElements.logList.qtSelectProperties(['push'], {
137
- excludeMode: true,
138
- }),
139
- );
140
-
141
- Object.assign(
142
- externalElements.qtSelectProperties(
143
- [
144
- 'setLibraryPath',
145
- 'loadModules',
146
- 'seal',
147
- 'setCustomAddFunction',
148
- 'library',
149
- 'logList',
150
- ],
151
- { excludeMode: true },
152
- ),
153
- );
154
- Object.freeze(externalElements);
155
- Object.seal(externalElements);
156
- };
157
-
158
- // ======================================================================================
159
- // LOAD MODULES (actual execution)
160
-
161
- const loadModules = ({ passThroughParameters }, callback) => {
162
- const asynchronousPipePlus = new require(
163
- 'qtools-asynchronous-pipe-plus',
164
- )();
165
- const pipeRunner = asynchronousPipePlus.pipeRunner;
166
- const taskListPlus = asynchronousPipePlus.taskListPlus;
167
-
168
- const taskList = new taskListPlus();
169
-
170
- // --------------------------------------------------------------------------------
171
- // INTERNAL UTILITIES
172
-
173
- const mergeArgs = (args, next, propertyName) => (err, result) =>
174
- next(err, {
175
- ...args,
176
- ...(propertyName ? { [propertyName]: result } : result),
177
- });
178
-
179
- const forwardArgs =
180
- ({ next, args }) =>
181
- (err) =>
182
- next(err, args);
183
-
184
- // --------------------------------------------------------------------------------
185
- // INITIALIZE COMMON ADDED MODULE PARAMETERS
186
-
187
- const dotD = { logList, library };
188
-
189
- const moduleArgs = {
190
- dotD,
191
- passThroughParameters,
192
- };
193
-
194
- fs.readdirSync(libraryPath)
195
- //.filter(file => path.extname(file) === '.js')
196
- .forEach((file) => {
197
- const endpointPath = path.join(libraryPath, file);
198
-
199
- add({
200
- endpointPath,
201
- moduleArgs,
202
- exceptionList,
203
- });
204
- });
205
-
206
- // --------------------------------------------------------------------------------
207
- // INIT AND EXECUTE THE PIPELINE
208
-
209
- if (typeof callback == 'function') {
210
- if (exceptionList.length) {
211
- callback(exceptionList);
212
- } else {
213
- callback();
214
- }
215
- } else {
216
- if (exceptionList.length) {
217
- return exceptionList;
218
- } else {
219
- return;
220
- }}
221
- };
222
-
223
- const externalElements = {
224
- setLibraryPath,
225
- setCustomAddFunction,
226
- logList,
227
- library,
228
- loadModules,
229
- toString,
230
- qtdProcessLog: logList.formatList,
231
- };
232
- externalElements.seal = sealActual(externalElements);
233
- return externalElements;
234
- };
235
-
236
- //END OF moduleFunction() ============================================================
237
-
238
- module.exports = moduleFunction({ moduleName });
239
-
@@ -1,37 +0,0 @@
1
- {
2
- "name": "libdotd_example",
3
- "version": "1.0.0",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "libdotd_example",
9
- "version": "1.0.0",
10
- "license": "ISC",
11
- "dependencies": {
12
- "qtools-library-dot-d": "^1.0.5"
13
- }
14
- },
15
- "node_modules/qtools-asynchronous-pipe-plus": {
16
- "version": "1.0.5",
17
- "resolved": "https://registry.npmjs.org/qtools-asynchronous-pipe-plus/-/qtools-asynchronous-pipe-plus-1.0.5.tgz",
18
- "integrity": "sha512-ejueK++dNl6AJL0OK14zTewXDg1+Wq8zFknI83THmgR9rNTB7EfngLt031/hkkc3/VpnqdaeO7mNqnu6YAzgIQ=="
19
- },
20
- "node_modules/qtools-functional-library": {
21
- "version": "2.0.4",
22
- "resolved": "https://registry.npmjs.org/qtools-functional-library/-/qtools-functional-library-2.0.4.tgz",
23
- "integrity": "sha512-noztSkJI37xcOTer5HVgOnuY/eZ1FeqtSvlpzhmSq7jjT6dQCQjIzwjoe1GqHc5Dt9Os+OFawAUz3hMpO4V1ng==",
24
- "license": "ISC"
25
- },
26
- "node_modules/qtools-library-dot-d": {
27
- "version": "1.0.5",
28
- "resolved": "https://registry.npmjs.org/qtools-library-dot-d/-/qtools-library-dot-d-1.0.5.tgz",
29
- "integrity": "sha512-MEkrc1NCk8OleAlUPrlJ4Pl8z9v4gOEQt6PIjTc7r16x4StnfQ/ntTfaFF2kS4pi6O1zY1YBpB8vG1q0rdwTcQ==",
30
- "license": "ISC",
31
- "dependencies": {
32
- "qtools-asynchronous-pipe-plus": "^1.0.2",
33
- "qtools-functional-library": "^2.0.4"
34
- }
35
- }
36
- }
37
- }
@@ -1,23 +0,0 @@
1
- {
2
- "name": "libdotd_example",
3
- "version": "1.0.0",
4
- "description": "Boilerplate for use of qtools-library-dot-d - demonstrates dynamic module loading",
5
- "license": "ISC",
6
- "author": "TQ White II",
7
- "type": "commonjs",
8
- "main": "index.js",
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1",
11
- "start": "node index.js"
12
- },
13
- "dependencies": {
14
- "_comment_qtools-library-dot-d": "Core library for dynamic dotD module loading - provides qtLibDotD factory function",
15
- "qtools-library-dot-d": "^1.0.5"
16
- },
17
- "_instructions": {
18
- "usage": "Run 'npm start' to see both synchronous and asynchronous dotD library demos",
19
- "creating_new_modules": "Add .js files to the demoModules_DotD directory - they'll automatically become library methods",
20
- "module_naming": "Filename determines method name: 'myModule.js' becomes 'libraryInstance.myModule()'",
21
- "shared_resources": "Use passThroughParameters in index.js to share config, utilities, database connections, etc. across all modules"
22
- }
23
- }