Skip to content

Commit cbd9fb1

Browse files
committed
v1.0.0 update. Include all references feature added. .include() bug fixes
1 parent a771d14 commit cbd9fb1

File tree

11 files changed

+817
-799
lines changed

11 files changed

+817
-799
lines changed

dist/config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
88
exports.config = {
99
contentStore: {
1010
collection: {
11-
entry: 'contents',
1211
asset: 'contents',
12+
entry: 'contents',
1313
schema: 'content_types',
1414
},
1515
dbName: 'contentstack-db',
16-
indexes: {
17-
event_at: -1,
18-
_content_type_uid: 1,
19-
locale: 1,
20-
uid: 1
21-
},
16+
// indexes: {
17+
// event_at: -1,
18+
// _content_type_uid: 1,
19+
// locale: 1,
20+
// uid: 1
21+
// },
2222
internalContentTypes: {
23+
assets: '_assets',
2324
content_types: '_content_types',
24-
assets: '_assets'
2525
},
2626
limit: 100,
2727
locale: 'en-us',
@@ -36,16 +36,16 @@ exports.config = {
3636
useNewUrlParser: true,
3737
},
3838
projections: {
39-
_id: 0,
40-
_version: 0,
4139
_content_type_uid: 0,
40+
_id: 0,
4241
_synced_at: 0,
43-
app_user_object_uid: 0,
42+
_version: 0,
4443
created_at: 0,
4544
updated_at: 0,
4645
updated_by: 0,
4746
},
47+
referenceDepth: 20,
4848
skip: 0,
4949
uri: 'mongodb://localhost:27017',
50-
}
50+
},
5151
};

dist/stack.js

Lines changed: 328 additions & 312 deletions
Large diffs are not rendered by default.

dist/util.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
88
const lodash_1 = require("lodash");
99
/**
1010
* @private
11-
*
11+
* @method validateURI
1212
* @description
1313
* Validates the mongodb 'uri' passed
1414
* @param {string} uri - Mongodb connection 'uri' string
@@ -31,6 +31,7 @@ exports.validateURI = (uri) => {
3131
exports.checkCyclic = (uid, mapping) => {
3232
let flag = false;
3333
let list = [uid];
34+
// tslint:disable-next-line: prefer-for-of
3435
for (let i = 0; i < list.length; i++) {
3536
const parent = getParents(list[i], mapping);
3637
if (parent.indexOf(uid) !== -1) {
@@ -52,7 +53,7 @@ const getParents = (child, mapping) => {
5253
};
5354
const validateContentStore = (contentStore) => {
5455
if (typeof contentStore.dbName !== 'string' || contentStore.dbName.length === 0) {
55-
throw new Error(`Contentstore dbName should be of type string and not empty!`);
56+
throw new Error('Contentstore dbName should be of type string and not empty!');
5657
}
5758
if (typeof contentStore.collectionName === 'string') {
5859
contentStore.collection = {

example/index.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,9 @@ function close () {
2525
}
2626

2727
function find (contentType = 'blog') {
28-
return new Promise((resolve, reject) => {
29-
Stack.contentType(contentType)
28+
return Stack.contentType(contentType)
3029
.entries()
31-
// .includeCount()
32-
// .include(['reference_b'])
33-
// .include([
34-
// 'group.group.reference.reference_b.reference.reference',
35-
// ])
36-
// .include(['group.group.reference.reference_b.reference.reference', 'group.group.reference.reference_one',
37-
// 'group.group.reference.reference_two', 'group.group.reference.self_reference',
38-
// 'modular_blocks.block_one.reference', 'modular_blocks.block_two.group.reference.authors',
39-
// 'modular_blocks.block_two.group.reference.categories'
40-
// ])
41-
// .includeSchema()
42-
// .language('es-es')
43-
// .notEqualTo('title', 'Kolan')
44-
// .query({tags: {$in: ['one', 'two']}})
45-
.limit(1)
46-
// .skip(1)
4730
.find()
48-
.then(resolve)
49-
.catch(reject)
50-
})
5131
}
5232

5333
return connect()

package.json

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2+
"author": "Contentstack Ecosystem <[email protected]>",
23
"name": "datasync-mongodb-sdk",
3-
"version": "0.1.0",
4-
"description": "Contentstack sync utility's Mongodb SDK",
4+
"version": "1.0.0",
5+
"description": "DataSync Mongodb SDK. Mongodb query wrapper around contents synced via @contentstack/content-store-mongodb",
56
"main": "dist/index.js",
67
"scripts": {
78
"clean": "rimraf dist typings coverage",
@@ -13,23 +14,42 @@
1314
"tslint": "npx tslint -c tslint.json 'src/**/*.ts' --fix",
1415
"test": "jest"
1516
},
16-
"author": "Contentstack Ecosystem",
1717
"license": "MIT",
1818
"dependencies": {
1919
"debug": "4.1.1",
2020
"lodash": "4.17.11",
2121
"mongodb": "3.1.12",
22-
"sift": "7.0.1"
22+
"sift": "8.5.0"
2323
},
2424
"devDependencies": {
25-
"@types/jest": "^23.3.11",
26-
"@types/lodash": "4.14.119",
2725
"@types/node": "^10.12.18",
26+
"@types/jest": "^24.0.15",
27+
"@types/lodash": "^4.14.135",
2828
"@types/rimraf": "^2.0.2",
29-
"jest": "^23.6.0",
30-
"rimraf": "^2.6.3",
31-
"ts-jest": "^23.10.5",
32-
"tslint": "^5.12.1",
33-
"typescript": "^3.2.4"
34-
}
29+
"jest": "24.8.0",
30+
"rimraf": "2.6.3",
31+
"ts-jest": "24.0.2",
32+
"tslint": "5.18.0",
33+
"typescript": "3.5.2"
34+
},
35+
"engines": {
36+
"node": ">=8"
37+
},
38+
"publishConfig": {
39+
"access": "public"
40+
},
41+
"keywords": [
42+
"contentstack",
43+
"utility",
44+
"DataSync",
45+
"mongodb-content-store"
46+
],
47+
"repository": {
48+
"type": "git",
49+
"url": "https://github.com/contentstack/datasync-mongodb-sdk"
50+
},
51+
"bugs": {
52+
"url": "https://github.com/contentstack/datasync-mongodb-sdk#readme/issues"
53+
},
54+
"homepage": "https://www.contentstack.com/docs/guide/synchronization/contentstack-datasync"
3555
}

src/config.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
export const config = {
88
contentStore: {
99
collection: {
10-
entry: 'contents',
1110
asset: 'contents',
11+
entry: 'contents',
1212
schema: 'content_types',
1313
},
1414
dbName: 'contentstack-db',
15-
indexes: {
16-
event_at: -1,
17-
_content_type_uid: 1,
18-
locale: 1,
19-
uid: 1
20-
},
15+
// indexes: {
16+
// event_at: -1,
17+
// _content_type_uid: 1,
18+
// locale: 1,
19+
// uid: 1
20+
// },
2121
internalContentTypes: {
22+
assets: '_assets',
2223
content_types: '_content_types',
23-
assets: '_assets'
2424
},
2525
limit: 100,
2626
locale: 'en-us',
@@ -35,16 +35,16 @@ export const config = {
3535
useNewUrlParser: true,
3636
},
3737
projections: {
38-
_id: 0,
39-
_version: 0,
4038
_content_type_uid: 0,
39+
_id: 0,
4140
_synced_at: 0,
42-
app_user_object_uid: 0,
41+
_version: 0,
4342
created_at: 0,
4443
updated_at: 0,
4544
updated_by: 0,
4645
},
46+
referenceDepth: 20,
4747
skip: 0,
4848
uri: 'mongodb://localhost:27017',
49-
}
49+
},
5050
}

0 commit comments

Comments
 (0)