Skip to content

Commit 02c85b0

Browse files
committed
v1.0.0 update. Code comments updated. JSDoc updated
1 parent d59ba7f commit 02c85b0

File tree

14 files changed

+3313
-3502
lines changed

14 files changed

+3313
-3502
lines changed

.jsdoc.conf.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"plugins": [],
3+
"recurseDepth": 10,
4+
"source": {
5+
"includePattern": ".+\\.js(doc|x)?$",
6+
"excludePattern": "(^|\\/|\\\\)_"
7+
},
8+
"sourceType": "module",
9+
"tags": {
10+
"allowUnknownTags": true,
11+
"dictionaries": ["jsdoc", "closure"]
12+
},
13+
"templates": {
14+
"cleverLinks": false,
15+
"monospaceLinks": false
16+
}
17+
}

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jest.config.js
99
# Configs
1010
.jsbeautifyrc
1111
tsconfig.json
12+
.jsdoc.conf.json
1213

1314
# Source files
1415
src

dist/stack.js

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ class Stack {
779779
return this;
780780
}
781781
/**
782+
* @public
782783
* @method entries
783784
* @description
784785
* Query for a set of entries on a content type
@@ -804,6 +805,7 @@ class Stack {
804805
throw new Error('Kindly call \'contentType()\' before \'entries()\'!');
805806
}
806807
/**
808+
* @public
807809
* @method asset
808810
* @description
809811
* Query for a single asset
@@ -835,6 +837,7 @@ class Stack {
835837
return stack;
836838
}
837839
/**
840+
* @public
838841
* @method assets
839842
* @description
840843
* Query for a set of assets
@@ -859,6 +862,7 @@ class Stack {
859862
return stack;
860863
}
861864
/**
865+
* @public
862866
* @method schema
863867
* @description
864868
* Query for a single content type's schema
@@ -891,10 +895,10 @@ class Stack {
891895
return stack;
892896
}
893897
/**
898+
* @public
894899
* @method schemas
895900
* @description
896901
* Query for a set of content type schemas
897-
* @public
898902
* @example
899903
* Stack
900904
* .schemas()
@@ -915,9 +919,11 @@ class Stack {
915919
return stack;
916920
}
917921
/**
922+
* @public
923+
* @method limit
924+
* @description
918925
* Parameter - used to limit the total no of items returned/scanned
919926
* Defaults to 100 (internally, which is overridden)
920-
*
921927
* @param {number} no Max count of the 'items' returned
922928
*
923929
* @example
@@ -944,9 +950,11 @@ class Stack {
944950
throw new Error('Kindly provide a valid \'numeric\' value for \'limit()\'');
945951
}
946952
/**
953+
* @public
954+
* @method skip
955+
* @description
947956
* Parameter - used to skip initial no of items scanned
948957
* Defaults to 0 (internally, which is overridden)
949-
*
950958
* @param {number} no Min count of the 'items' to be scanned
951959
*
952960
* @example
@@ -973,6 +981,9 @@ class Stack {
973981
throw new Error('Kindly provide a valid \'numeric\' value for \'skip()\'');
974982
}
975983
/**
984+
* @public
985+
* @method query
986+
* @description
976987
* Wrapper around a raw query wrapper
977988
* @param {object} queryObject Query filter
978989
*
@@ -1001,6 +1012,9 @@ class Stack {
10011012
return this;
10021013
}
10031014
/**
1015+
* @public
1016+
* @method only
1017+
* @description
10041018
* Projections - returns only the fields passed here
10051019
*
10061020
* @param {array} fields Array of 'fields', separated by dot ('.') notation for embedded document query
@@ -1034,6 +1048,9 @@ class Stack {
10341048
return this;
10351049
}
10361050
/**
1051+
* @public
1052+
* @method except
1053+
* @description
10371054
* Projections - returns fields except the ones passed here
10381055
*
10391056
* @param {array} fields Array of 'fields', separated by dot ('.') notation for embedded document query
@@ -1066,6 +1083,9 @@ class Stack {
10661083
return this;
10671084
}
10681085
/**
1086+
* @public
1087+
* @method regex
1088+
* @description
10691089
* Raw regex to be applied on a field - wrapper
10701090
*
10711091
* @param {string} field Field on which the regex is to be applied on
@@ -1152,6 +1172,7 @@ class Stack {
11521172
return this;
11531173
}
11541174
/**
1175+
* @public
11551176
* @method where
11561177
* @summary Pass JS expression or a full function to the query system
11571178
* @description
@@ -1252,6 +1273,8 @@ class Stack {
12521273
return this;
12531274
}
12541275
/**
1276+
* @public
1277+
* @method includeContentType
12551278
* @description
12561279
* Includes 'content_type' key in response, which is the content type schema of the entries filtered/scanned
12571280
* @example
@@ -1274,6 +1297,7 @@ class Stack {
12741297
return this;
12751298
}
12761299
/**
1300+
* @public
12771301
* @method excludeReferences
12781302
* @description
12791303
* Excludes all references of the entries being scanned
@@ -1299,6 +1323,7 @@ class Stack {
12991323
return this;
13001324
}
13011325
/**
1326+
* @public
13021327
* @method queryReferences
13031328
* @description
13041329
* Wrapper, that allows querying on the entry's references.
@@ -1329,14 +1354,8 @@ class Stack {
13291354
}
13301355
throw new Error('Kindly pass a query object for \'.queryReferences()\'');
13311356
}
1332-
queryReferencesBeta(query) {
1333-
if (query && typeof query === 'object') {
1334-
this.internal.queryReferencesBeta = query;
1335-
return this;
1336-
}
1337-
throw new Error('Kindly pass a query object for \'.queryReferences()\'');
1338-
}
13391357
/**
1358+
* @public
13401359
* @method getQuery
13411360
* @description
13421361
* Returns the query build thusfar
@@ -1364,7 +1383,11 @@ class Stack {
13641383
* .includeAllReferences()
13651384
* @returns {Stack} Returns 'this' instance (of Stack)
13661385
*/
1367-
includeReferences() {
1386+
includeReferences(depth) {
1387+
console.warn('.includeReferences() is a relatively slow query..!');
1388+
if (typeof depth === 'number') {
1389+
this.q.referenceDepth = depth;
1390+
}
13681391
this.internal.includeAllReferences = true;
13691392
return this;
13701393
}
@@ -1394,6 +1417,7 @@ class Stack {
13941417
return this;
13951418
}
13961419
/**
1420+
* @public
13971421
* @method find
13981422
* @description
13991423
* Queries the db using the query built/passed
@@ -1476,6 +1500,7 @@ class Stack {
14761500
}));
14771501
}
14781502
/**
1503+
* @public
14791504
* @method count
14801505
* @descriptionReturns the count of the entries/assets that match the filter
14811506
* @param {object} query Optional query filter object
@@ -1501,6 +1526,7 @@ class Stack {
15011526
});
15021527
}
15031528
/**
1529+
* @public
15041530
* @method findOne
15051531
* @description
15061532
* Queries the db using the query built/passed. Returns a single entry/asset/content type object

0 commit comments

Comments
 (0)