foxhound 2.0.22 → 2.0.23

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": "foxhound",
3
- "version": "2.0.22",
3
+ "version": "2.0.23",
4
4
  "description": "A Database Query generation library.",
5
5
  "main": "source/FoxHound.js",
6
6
  "scripts": {
@@ -11,7 +11,8 @@
11
11
  "build": "npx quack build",
12
12
  "docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t foxhound-image:local",
13
13
  "docker-dev-run": "docker run -it -d --name foxhound-dev -p 24238:8080 -p 42889:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/foxhound\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" foxhound-image:local",
14
- "docker-dev-shell": "docker exec -it foxhound-dev /bin/bash"
14
+ "docker-dev-shell": "docker exec -it foxhound-dev /bin/bash",
15
+ "check": "npx -p typescript tsc --noEmit"
15
16
  },
16
17
  "mocha": {
17
18
  "diff": true,
@@ -50,6 +51,7 @@
50
51
  "quackage": "^1.0.60"
51
52
  },
52
53
  "dependencies": {
53
- "fable": "^3.1.63"
54
+ "fable": "^3.1.63",
55
+ "typescript": "^5.9.3"
54
56
  }
55
57
  }
@@ -25,6 +25,7 @@ var FoxHound = function()
25
25
 
26
26
  // The parameters config object for the current query. This is the only
27
27
  // piece of internal state that is important to operation.
28
+ /** @type {Record<string, any>} */
28
29
  var _Parameters = false;
29
30
 
30
31
  var _Dialects = require('./Foxhound-Dialects.js');
@@ -36,6 +37,7 @@ var FoxHound = function()
36
37
  var _LogLevel = 0;
37
38
 
38
39
  // The dialect to use when generating queries
40
+ /** @type {Record<string, any>} */
39
41
  var _Dialect = false;
40
42
 
41
43
  /**
@@ -164,6 +166,7 @@ var FoxHound = function()
164
166
  */
165
167
  var setScope = function(pScope)
166
168
  {
169
+ /** @type {string} */
167
170
  var tmpScope = false;
168
171
 
169
172
  if (typeof(pScope) === 'string')
@@ -214,11 +217,12 @@ var FoxHound = function()
214
217
  * The passed values can be either a string, or an array.
215
218
  *
216
219
  * @method setDataElements
217
- * @param {String} pDataElements The Data Element(s) for the Query.
220
+ * @param {string | Array<string>} pDataElements The Data Element(s) for the Query.
218
221
  * @return {Object} Returns the current Query for chaining.
219
222
  */
220
223
  var setDataElements = function(pDataElements)
221
224
  {
225
+ /** @type {Array<string>} */
222
226
  var tmpDataElements = false;
223
227
 
224
228
  if (Array.isArray(pDataElements))
@@ -251,11 +255,12 @@ var FoxHound = function()
251
255
  * {Column:'Birthday', Direction:'Ascending'}
252
256
  *
253
257
  * @method setSort
254
- * @param {String} pSort The sort criteria(s) for the Query.
258
+ * @param {string | Array<Record<string, any>>} pSort The sort criteria(s) for the Query.
255
259
  * @return {Object} Returns the current Query for chaining.
256
260
  */
257
261
  var setSort = function(pSort)
258
262
  {
263
+ /** @type {Array<Record<string, any>>} */
259
264
  var tmpSort = false;
260
265
 
261
266
  if (Array.isArray(pSort))
@@ -325,11 +330,12 @@ var FoxHound = function()
325
330
  * {Column:'Birthday', Direction:'Ascending'}
326
331
  *
327
332
  * @method setSort
328
- * @param {String} pSort The sort criteria to add to the Query.
333
+ * @param {string | Record<string, any>} pSort The sort criteria to add to the Query.
329
334
  * @return {Object} Returns the current Query for chaining.
330
335
  */
331
336
  var addSort = function(pSort)
332
337
  {
338
+ /** @type {Record<string, any>} */
333
339
  var tmpSort = false;
334
340
 
335
341
  if (typeof(pSort) === 'string')
@@ -368,11 +374,12 @@ var FoxHound = function()
368
374
  * The passed value must be an Integer >= 0.
369
375
  *
370
376
  * @method setBegin
371
- * @param {Number} pBeginAmount The index to begin returning Query data.
377
+ * @param {number | boolean} pBeginAmount The index to begin returning Query data.
372
378
  * @return {Object} Returns the current Query for chaining.
373
379
  */
374
380
  var setBegin = function(pBeginAmount)
375
381
  {
382
+ /** @type {number} */
376
383
  var tmpBegin = false;
377
384
 
378
385
  // Test if it is an integer > -1
@@ -406,11 +413,12 @@ var FoxHound = function()
406
413
  * The passed value must be an Integer >= 0.
407
414
  *
408
415
  * @method setCap
409
- * @param {Number} pCapAmount The maximum records for the Query set.
416
+ * @param {number | boolean} pCapAmount The maximum records for the Query set.
410
417
  * @return {Object} Returns the current Query for chaining.
411
418
  */
412
419
  var setCap = function(pCapAmount)
413
420
  {
421
+ /** @type {number} */
414
422
  var tmpCapAmount = false;
415
423
 
416
424
  if (typeof(pCapAmount) === 'number' && (pCapAmount % 1) === 0 && pCapAmount >= 0)
@@ -444,11 +452,12 @@ var FoxHound = function()
444
452
  * {Column:'Name', Operator:'EQ', Value:'John', Connector:'And', Parameter:'Name'}
445
453
  *
446
454
  * @method setFilter
447
- * @param {String} pFilter The filter(s) for the Query.
455
+ * @param {Array<Record<string, any>>} pFilter The filter(s) for the Query.
448
456
  * @return {Object} Returns the current Query for chaining.
449
457
  */
450
458
  var setFilter = function(pFilter)
451
459
  {
460
+ /** @type {Record<string, any>} */
452
461
  var tmpFilter = false;
453
462
 
454
463
  if (Array.isArray(pFilter))
@@ -480,6 +489,11 @@ var FoxHound = function()
480
489
  * {Column:'Name', Operator:'EQ', Value:'John', Connector:'And', Parameter:'Name'}
481
490
  *
482
491
  * @method addFilter
492
+ * @param {string} pColumn
493
+ * @param {any} pValue
494
+ * @param {string} [pOperator]
495
+ * @param {string} [pConnector]
496
+ * @param {string} [pParameter]
483
497
  * @return {Object} Returns the current Query for chaining.
484
498
  */
485
499
  var addFilter = function(pColumn, pValue, pOperator, pConnector, pParameter)
@@ -896,6 +910,7 @@ var FoxHound = function()
896
910
  *
897
911
  * @property dialect
898
912
  * @type Object
913
+ * @return {Record<string, any>}
899
914
  */
900
915
  Object.defineProperty(tmpNewFoxHoundObject, 'dialect',
901
916
  {
@@ -919,7 +934,7 @@ var FoxHound = function()
919
934
  * Log Level
920
935
  *
921
936
  * @property logLevel
922
- * @type Integer
937
+ * @type {number}
923
938
  */
924
939
  Object.defineProperty(tmpNewFoxHoundObject, 'logLevel',
925
940
  {
@@ -13,8 +13,8 @@ var FoxHoundDialectMeadowEndpoints = function()
13
13
  * Generate a table name from the scope
14
14
  *
15
15
  * @method: generateTableName
16
- * @param: {Object} pParameters SQL Query Parameters
17
- * @return: {String} Returns the table name clause
16
+ * @param {Object} pParameters SQL Query Parameters
17
+ * @return {String} Returns the table name clause
18
18
  */
19
19
  var generateTableName = function(pParameters)
20
20
  {
@@ -25,8 +25,8 @@ var FoxHoundDialectMeadowEndpoints = function()
25
25
  * Generate the Identity column from the schema or scope
26
26
  *
27
27
  * @method: generateIdentityColumnName
28
- * @param: {Object} pParameters SQL Query Parameters
29
- * @return: {String} Returns the table name clause
28
+ * @param {Object} pParameters SQL Query Parameters
29
+ * @return {String} Returns the table name clause
30
30
  */
31
31
  var generateIdentityColumnName = function(pParameters)
32
32
  {
@@ -40,8 +40,8 @@ var FoxHoundDialectMeadowEndpoints = function()
40
40
  * Each entry in the dataElements is a simple string
41
41
  *
42
42
  * @method: generateFieldList
43
- * @param: {Object} pParameters SQL Query Parameters
44
- * @return: {String} Returns the field list clause
43
+ * @param {Object} pParameters SQL Query Parameters
44
+ * @return {String} Returns the field list clause
45
45
  */
46
46
  var generateFieldList = function(pParameters)
47
47
  {
@@ -77,8 +77,8 @@ var FoxHoundDialectMeadowEndpoints = function()
77
77
  }
78
78
  *
79
79
  * @method: generateWhere
80
- * @param: {Object} pParameters SQL Query Parameters
81
- * @return: {String} Returns the WHERE clause prefixed with WHERE, or an empty string if unnecessary
80
+ * @param {Object} pParameters SQL Query Parameters
81
+ * @return {String} Returns the WHERE clause prefixed with WHERE, or an empty string if unnecessary
82
82
  */
83
83
  var generateWhere = function(pParameters)
84
84
  {
@@ -99,7 +99,7 @@ var FoxHoundDialectMeadowEndpoints = function()
99
99
 
100
100
  let tmpfTranslateOperator = (pOperator) =>
101
101
  {
102
- tmpNewOperator = 'EQ';
102
+ let tmpNewOperator = 'EQ';
103
103
  switch(pOperator.toUpperCase())
104
104
  {
105
105
  case '!=':
@@ -199,8 +199,8 @@ var FoxHoundDialectMeadowEndpoints = function()
199
199
  * These are usually passed in for Update and Create when extra tracking is disabled.
200
200
  *
201
201
  * @method: generateFlags
202
- * @param: {Object} pParameters SQL Query Parameters
203
- * @return: {String} Flags to be sent, if any.
202
+ * @param {Object} pParameters SQL Query Parameters
203
+ * @return {String} Flags to be sent, if any.
204
204
  */
205
205
  function generateFlags(pParameters)
206
206
  {
@@ -235,8 +235,8 @@ var FoxHoundDialectMeadowEndpoints = function()
235
235
  * Get the ID for the record, to be used in URIs
236
236
  *
237
237
  * @method: getIDRecord
238
- * @param: {Object} pParameters SQL Query Parameters
239
- * @return: {String} ID of the record in string form for the URI
238
+ * @param {Object} pParameters SQL Query Parameters
239
+ * @return {String} ID of the record in string form for the URI
240
240
  */
241
241
  var getIDRecord = function(pParameters)
242
242
  {
@@ -276,13 +276,14 @@ var FoxHoundDialectMeadowEndpoints = function()
276
276
  * {Column:'Color',Direction:'Descending'}
277
277
  *
278
278
  * @method: generateOrderBy
279
- * @param: {Object} pParameters SQL Query Parameters
280
- * @return: {String} Returns the field list clause
279
+ * @param {Object} pParameters SQL Query Parameters
280
+ * @return {String} Returns the field list clause
281
281
  */
282
282
  var generateOrderBy = function(pParameters)
283
283
  {
284
284
  var tmpOrderBy = pParameters.sort;
285
- var tmpOrderClause = false;
285
+ /** @type {string} */
286
+ var tmpOrderClause = null;
286
287
 
287
288
  if (!Array.isArray(tmpOrderBy) || tmpOrderBy.length < 1)
288
289
  {
@@ -315,8 +316,8 @@ var FoxHoundDialectMeadowEndpoints = function()
315
316
  * Generate the limit clause
316
317
  *
317
318
  * @method: generateLimit
318
- * @param: {Object} pParameters SQL Query Parameters
319
- * @return: {String} Returns the table name clause
319
+ * @param {Object} pParameters SQL Query Parameters
320
+ * @return {String} Returns the table name clause
320
321
  */
321
322
  var generateLimit = function(pParameters)
322
323
  {
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "include": ["source"],
3
+ "compilerOptions":
4
+ {
5
+ "allowJs": true,
6
+ "declaration": true,
7
+ "emitDeclarationOnly": true,
8
+ "outDir": "dist",
9
+ "declarationMap": true,
10
+ "checkJs": true,
11
+ "lib": ["ES2020", "dom"]
12
+ }
13
+ }