@contentstack/datasync-manager 2.0.0 → 2.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 (63) hide show
  1. package/LICENSE +1 -1
  2. package/dist/api.js +4 -2
  3. package/dist/core/q.js +4 -2
  4. package/dist/util/index.js +1 -1
  5. package/dist/util/validations.js +2 -2
  6. package/package.json +6 -1
  7. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  8. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  9. package/.github/workflows/codeql-analysis.yml +0 -68
  10. package/.github/workflows/jira.yml +0 -28
  11. package/.github/workflows/release.yml +0 -53
  12. package/.github/workflows/sast-scan.yml +0 -11
  13. package/.github/workflows/sca-scan.yml +0 -15
  14. package/.github/workflows/secrets-scan.yml +0 -11
  15. package/.releaserc +0 -9
  16. package/.talismanrc +0 -4
  17. package/CODEOWNERS +0 -1
  18. package/SECURITY.md +0 -27
  19. package/example/config.js +0 -60
  20. package/example/index.js +0 -30
  21. package/test/api.ts +0 -152
  22. package/test/core/filteredItems.ts +0 -58
  23. package/test/core/index.ts +0 -18
  24. package/test/core/inet.ts +0 -23
  25. package/test/core/q.ts +0 -42
  26. package/test/core/sync.ts +0 -19
  27. package/test/core/token-management.ts +0 -40
  28. package/test/dummy/api-responses/404.ts +0 -3
  29. package/test/dummy/api-responses/content-type.ts +0 -30
  30. package/test/dummy/api-responses/delete-asset.ts +0 -9
  31. package/test/dummy/api-responses/delete-content-type.ts +0 -6
  32. package/test/dummy/api-responses/delete-entry.ts +0 -9
  33. package/test/dummy/api-responses/delete.ts +0 -32
  34. package/test/dummy/api-responses/empty.ts +0 -7
  35. package/test/dummy/api-responses/entries.ts +0 -31
  36. package/test/dummy/api-responses/filter-items.ts +0 -32
  37. package/test/dummy/api-responses/global-field.ts +0 -175
  38. package/test/dummy/api-responses/markdown-content-type.ts +0 -202
  39. package/test/dummy/api-responses/markdown-entries.ts +0 -56
  40. package/test/dummy/api-responses/mixed.ts +0 -77
  41. package/test/dummy/api-responses/publish-asset.ts +0 -14
  42. package/test/dummy/api-responses/publish-entry.ts +0 -14
  43. package/test/dummy/api-responses/publish.ts +0 -35
  44. package/test/dummy/api-responses/references-content-type-2.ts +0 -240
  45. package/test/dummy/api-responses/references-content-type.ts +0 -272
  46. package/test/dummy/api-responses/references-entries.ts +0 -156
  47. package/test/dummy/api-responses/unpublish-asset.ts +0 -9
  48. package/test/dummy/api-responses/unpublish-entry.ts +0 -9
  49. package/test/dummy/api-responses/unpublish.ts +0 -26
  50. package/test/dummy/config.ts +0 -34
  51. package/test/dummy/connector-listener-instances.ts +0 -69
  52. package/test/dummy/filter-items.ts +0 -32
  53. package/test/dummy/plugins/myplugin1/index.js +0 -20
  54. package/test/dummy/plugins/myplugin2/index.js +0 -20
  55. package/test/dummy/references-content-type.ts +0 -340
  56. package/test/dummy/references-entry-expected.ts +0 -161
  57. package/test/dummy/references-entry.ts +0 -95
  58. package/test/index.ts +0 -330
  59. package/test/util/fs.ts +0 -92
  60. package/test/util/index.ts +0 -157
  61. package/test/util/log-save-filtered-items.ts +0 -42
  62. package/test/util/validations.ts +0 -158
  63. package/tslint.json +0 -53
@@ -1,58 +0,0 @@
1
- import { cloneDeep, merge } from 'lodash'
2
- import { join, resolve} from 'path'
3
- import rimraf from 'rimraf'
4
- import { setConfig } from '../../src'
5
- import { config as internalConfig } from '../../src/config'
6
- import { buildConfigPaths } from '../../src/util/build-paths'
7
- import { setLogger } from '../../src/util/logger'
8
- import { saveFilteredItems } from '../../src/util/unprocessible'
9
- import { config as mockConfig } from '../dummy/config'
10
-
11
- const config = cloneDeep(merge({}, internalConfig, mockConfig))
12
-
13
- describe('filter items', () => {
14
- beforeAll(() => {
15
- setLogger()
16
- })
17
- afterAll(() => {
18
- const filteredFilePath = resolve(join(__dirname, '..', '..', 'test-filtered'))
19
- rimraf.sync(filteredFilePath)
20
- })
21
-
22
- test('Save filtered items should work without errors', () => {
23
- const items = [
24
- {
25
- key: 'dummy object',
26
- },
27
- ]
28
- const name = 'dummy_token'
29
- const token = '123'
30
-
31
- const configs: any = cloneDeep(config)
32
- configs.paths = buildConfigPaths()
33
- configs.paths.filtered = resolve(join(__dirname, '..', '..', 'test-filtered'))
34
- setConfig(configs)
35
-
36
- return saveFilteredItems(items, name, token).then((empty) => {
37
- expect(empty).toBeUndefined()
38
- }).catch((error) => {
39
- expect(error).toBeNull()
40
- })
41
- })
42
-
43
- test('Save filtered items should throw ENOENT error', () => {
44
- const items = [
45
- {
46
- key: 'dummy object',
47
- },
48
- ]
49
- const name = 'dummy_token'
50
- const token = '123'
51
-
52
- return saveFilteredItems(items, name, token).then((empty) => {
53
- expect(empty).toBeUndefined()
54
- }).catch((error) => {
55
- expect(error).toBeNull()
56
- })
57
- })
58
- })
@@ -1,18 +0,0 @@
1
- /*!
2
- * Contentstack Sync Manager
3
- * Copyright (c) 2019 Contentstack LLC
4
- * MIT Licensed
5
- */
6
-
7
- import { lock, unlock } from '../../src/core'
8
- import { setLogger } from '../../src/util/logger'
9
-
10
- describe('check lock-unlock', () => {
11
- beforeAll(() => {
12
- setLogger()
13
- })
14
- test('lock-unlock', () => {
15
- expect(lock()).toBeUndefined()
16
- expect(unlock(true)).toBeUndefined()
17
- })
18
- })
package/test/core/inet.ts DELETED
@@ -1,23 +0,0 @@
1
- import { cloneDeep, merge } from 'lodash'
2
- import { setConfig } from '../../src'
3
- import { config as internalConfig } from '../../src/config'
4
- import { checkNetConnectivity, init, netConnectivityIssues } from '../../src/core/inet'
5
- import { config as mockConfig } from '../dummy/config'
6
-
7
- const config = cloneDeep(merge({}, internalConfig, mockConfig))
8
-
9
- describe('# inet', () => {
10
- beforeAll(() => {
11
- setConfig(config)
12
- init()
13
- })
14
- test('Check for internet connectivity', () => {
15
- expect(checkNetConnectivity())
16
- .toBeUndefined()
17
- })
18
-
19
- test('Check for internet connectivity issue', () => {
20
- expect(netConnectivityIssues({}))
21
- .toEqual(false)
22
- })
23
- })
package/test/core/q.ts DELETED
@@ -1,42 +0,0 @@
1
- import { cloneDeep, merge } from 'lodash'
2
- import { setConfig } from '../../src'
3
- import { config as internalConfig } from '../../src/config'
4
- import { notifications, Q } from '../../src/core/q'
5
- import { buildConfigPaths } from '../../src/util/build-paths'
6
- import { setLogger } from '../../src/util/logger'
7
- import { config } from '../dummy/config'
8
- import { assetConnector, contentConnector } from '../dummy/connector-listener-instances'
9
-
10
- const configs: any = cloneDeep(merge({}, internalConfig, config))
11
-
12
- beforeAll(() => {
13
- setLogger()
14
- })
15
-
16
- test('error handler should work fine', () => {
17
- setConfig(configs)
18
- configs.paths = buildConfigPaths()
19
-
20
- const q = new Q(contentConnector, assetConnector, configs)
21
- const errorObject = {
22
- data: {
23
- _checkpoint: {
24
- name: 'dummyCheckpointName',
25
- token: 'dummyCheckpointToken',
26
- },
27
- uid: '123',
28
- },
29
- error: 'dummyError',
30
- }
31
- notifications.on('error', (error) => {
32
- expect(error).toMatchObject(errorObject)
33
- })
34
-
35
- return q.errorHandler(errorObject)
36
- .then((result) => {
37
- expect(result).toBeUndefined()
38
- })
39
- .catch((error) => {
40
- expect(error).toBeNull()
41
- })
42
- })
package/test/core/sync.ts DELETED
@@ -1,19 +0,0 @@
1
- import { cloneDeep, merge } from 'lodash'
2
- import { setConfig } from '../../src'
3
- import { config as internalConfig } from '../../src/config'
4
- import { poke } from '../../src/core'
5
- import { buildConfigPaths } from '../../src/util/build-paths'
6
- import { setLogger } from '../../src/util/logger'
7
- import { config } from '../dummy/config'
8
-
9
- const configs: any = cloneDeep(merge({}, internalConfig, config))
10
-
11
- beforeAll(() => {
12
- setConfig(configs)
13
- configs.paths = buildConfigPaths()
14
- setLogger()
15
- })
16
-
17
- test('Poke should work without errors', () => {
18
- expect(poke()).toBeUndefined()
19
- })
@@ -1,40 +0,0 @@
1
- import { writeFileSync } from 'fs'
2
- import { cloneDeep } from 'lodash'
3
- import mkdirp from 'mkdirp'
4
- import { join, resolve } from 'path'
5
- import rimraf from 'rimraf'
6
- import { setConfig } from '../../src'
7
- import { getToken } from '../../src/core/token-management'
8
- import { buildConfigPaths } from '../../src/util/build-paths'
9
- import { setLogger } from '../../src/util/logger'
10
- import { config } from '../dummy/config'
11
-
12
- describe('token management', () => {
13
- beforeAll(() => {
14
- setLogger()
15
- })
16
-
17
- test('get token by type should work without errors', () => {
18
- const tokenData = {
19
- name: 'sync_token',
20
- timestamp: 'ts-one',
21
- token: 'token-one',
22
- }
23
- const configs: any = cloneDeep(config)
24
- configs.paths = buildConfigPaths()
25
- const tknPath = resolve(join(__dirname, '..', 'testing'))
26
- mkdirp.sync(tknPath)
27
- configs.paths.checkpoint = resolve(join(tknPath, '.checkpoint'))
28
- configs.paths.ledger = resolve(join(__dirname, 'testing', '..', '.ledger'))
29
- setConfig(configs)
30
-
31
- writeFileSync(configs.paths.checkpoint, JSON.stringify(tokenData))
32
-
33
- return getToken().then((tokenDetails) => {
34
- expect(tokenDetails).toMatchObject(tokenData)
35
- rimraf.sync(tknPath)
36
- }).catch((error) => {
37
- expect(error).toBeNull()
38
- })
39
- })
40
- })
@@ -1,3 +0,0 @@
1
- export const response = {
2
-
3
- }
@@ -1,30 +0,0 @@
1
- export const contentType = {
2
- content_type: {
3
- _version: 1,
4
- schema: [{
5
- data_type: 'text',
6
- display_name: 'Title',
7
- field_metadata: {
8
- _default: true,
9
- },
10
- mandatory: true,
11
- multiple: false,
12
- uid: 'title',
13
- unique: true,
14
- },
15
- {
16
- data_type: 'text',
17
- display_name: 'URL',
18
- field_metadata: {
19
- _default: true,
20
- },
21
- mandatory: true,
22
- multiple: false,
23
- uid: 'url',
24
- unique: true,
25
- },
26
- ],
27
- title: 'Authors',
28
- uid: 'authors',
29
- },
30
- }
@@ -1,9 +0,0 @@
1
- export const item = {
2
- content_type_uid: 'sys_assets',
3
- data: {
4
- locale: 'es-es',
5
- uid: 'blt39193a579518bb10',
6
- },
7
- event_at: '2019-01-08T15:19:53.844Z',
8
- type: 'asset_deleted',
9
- }
@@ -1,6 +0,0 @@
1
- export const item = {
2
- content_type_uid: 'del',
3
- data: {},
4
- event_at: '2019-01-08T15:21:10.552Z',
5
- type: 'content_type_deleted',
6
- }
@@ -1,9 +0,0 @@
1
- export const item = {
2
- content_type_uid: 'a',
3
- data: {
4
- locale: 'es-es',
5
- uid: 'blt6aa83e702326fc65',
6
- },
7
- event_at: '2019-01-08T15:20:17.873Z',
8
- type: 'entry_deleted',
9
- }
@@ -1,32 +0,0 @@
1
- export const response = {
2
- items: [
3
- {
4
- content_type_uid: 'del',
5
- data: {},
6
- event_at: '2019-01-08T15:21:10.552Z',
7
- type: 'content_type_deleted',
8
- },
9
- {
10
- content_type_uid: 'a',
11
- data: {
12
- locale: 'es-es',
13
- uid: 'blt6aa83e702326fc65',
14
- },
15
- event_at: '2019-01-08T15:20:17.873Z',
16
- type: 'entry_deleted',
17
- },
18
- {
19
- content_type_uid: 'sys_assets',
20
- data: {
21
- locale: 'es-es',
22
- uid: 'blt39193a579518bb10',
23
- },
24
- event_at: '2019-01-08T15:19:53.844Z',
25
- type: 'asset_deleted',
26
- },
27
- ],
28
- limit: 100,
29
- skip: 0,
30
- sync_token: 'delete-token',
31
- total_count: 3,
32
- }
@@ -1,7 +0,0 @@
1
- export const response = {
2
- items: [],
3
- limit: 100,
4
- sync_token: 'last-token',
5
- skip: 0,
6
- total_count: 0,
7
- }
@@ -1,31 +0,0 @@
1
- export const response = {
2
- items: [
3
- {
4
- content_type_uid: 'authors',
5
- data: {
6
- locale: 'es-es',
7
- publish_details: {
8
- locale: 'es-es',
9
- time: '2019-01-04T20:37:11.052Z',
10
- },
11
- title: 'Test Global Search',
12
- uid: 'blt862233378d02b304',
13
- },
14
- event_at: '2019-01-04T20:37:11.052Z',
15
- type: 'entry_published',
16
- },
17
- {
18
- content_type_uid: 'authors',
19
- data: {
20
- locale: 'es-es',
21
- uid: 'blt1e5bcf16685e2505',
22
- },
23
- event_at: '2019-01-07T13:42:00.625Z',
24
- type: 'entry_unpublished',
25
- },
26
- ],
27
- limit: 100,
28
- skip: 0,
29
- sync_token: 'entries-token',
30
- total_count: 2,
31
- }
@@ -1,32 +0,0 @@
1
- export const response = {
2
- items: [
3
- {
4
- content_type_uid: 'authors',
5
- data: {
6
- locale: 'es-es',
7
- publish_details: {
8
- locale: 'es-es',
9
- time: '2019-01-04T20:37:11.052Z',
10
- },
11
- title: 'Test Global Search',
12
- uid: 'blt862233378d02b304',
13
- },
14
- event_at: '2019-01-04T20:37:11.052Z',
15
- type: 'entry_published',
16
- },
17
- {
18
- content_type_uid: 'sys_assets',
19
- data: {
20
- publish_details: {
21
- locale: 'es-es',
22
- time: '2019-01-02T13:42:58.721Z',
23
- },
24
- title: 'medium.png',
25
- uid: 'blt2a94dd7005d1229c',
26
- },
27
- event_at: '2019-01-04T20:37:11.052Z',
28
- type: 'asset_published',
29
- },
30
- ],
31
- pagination_token: 'pagination-token-2',
32
- }
@@ -1,175 +0,0 @@
1
- export const response = {
2
- "content_type": {
3
- "created_at": "2019-09-06T12:48:55.523Z",
4
- "updated_at": "2019-09-10T05:40:56.137Z",
5
- "title": "test",
6
- "uid": "test",
7
- "_version": 10,
8
- "inbuilt_class": false,
9
- "schema": [
10
- {
11
- "display_name": "Title",
12
- "uid": "title",
13
- "data_type": "text",
14
- "mandatory": true,
15
- "unique": true,
16
- "field_metadata": {
17
- "_default": true,
18
- "version": 3
19
- },
20
- "multiple": false,
21
- "non_localizable": false
22
- },
23
- {
24
- "display_name": "URL",
25
- "uid": "url",
26
- "data_type": "text",
27
- "mandatory": false,
28
- "field_metadata": {
29
- "_default": true,
30
- "version": 3
31
- },
32
- "multiple": false,
33
- "unique": false,
34
- "non_localizable": false
35
- },
36
- {
37
- "data_type": "text",
38
- "display_name": "Rich text editor",
39
- "uid": "description",
40
- "field_metadata": {
41
- "allow_rich_text": true,
42
- "description": "",
43
- "multiline": false,
44
- "rich_text_type": "advanced",
45
- "options": [],
46
- "version": 3
47
- },
48
- "multiple": false,
49
- "mandatory": false,
50
- "unique": false,
51
- "non_localizable": false
52
- },
53
- {
54
- "data_type": "text",
55
- "display_name": "Rich text editor",
56
- "uid": "rich_text_editor",
57
- "field_metadata": {
58
- "allow_rich_text": true,
59
- "description": "",
60
- "multiline": false,
61
- "rich_text_type": "advanced",
62
- "options": [],
63
- "version": 3
64
- },
65
- "multiple": false,
66
- "mandatory": false,
67
- "unique": false,
68
- "non_localizable": false
69
- },
70
- {
71
- "data_type": "global_field",
72
- "display_name": "Global Field",
73
- "reference_to": "blt981fee3f999f3c12",
74
- "field_metadata": {
75
- "description": ""
76
- },
77
- "uid": "global_field",
78
- "multiple": true,
79
- "max_instance": 50,
80
- "mandatory": false,
81
- "unique": false,
82
- "non_localizable": false,
83
- "schema": [
84
- {
85
- "display_name": "Name",
86
- "uid": "name",
87
- "data_type": "text",
88
- "multiple": false,
89
- "mandatory": false,
90
- "unique": false,
91
- "non_localizable": false,
92
- "indexed": false,
93
- "inbuilt_model": false
94
- },
95
- {
96
- "data_type": "text",
97
- "display_name": "Rich text editor",
98
- "uid": "description",
99
- "field_metadata": {
100
- "allow_rich_text": true,
101
- "description": "",
102
- "multiline": false,
103
- "rich_text_type": "advanced",
104
- "options": [],
105
- "version": 3
106
- },
107
- "multiple": false,
108
- "mandatory": false,
109
- "unique": false,
110
- "non_localizable": false,
111
- "indexed": false,
112
- "inbuilt_model": false
113
- },
114
- {
115
- "data_type": "file",
116
- "display_name": "File",
117
- "uid": "file_di",
118
- "extensions": [],
119
- "field_metadata": {
120
- "description": "",
121
- "rich_text_type": "standard"
122
- },
123
- "multiple": true,
124
- "mandatory": false,
125
- "unique": false,
126
- "non_localizable": false,
127
- "indexed": false,
128
- "inbuilt_model": false
129
- }
130
- ]
131
- },
132
- {
133
- "data_type": "file",
134
- "display_name": "File",
135
- "uid": "file_dinesh",
136
- "extensions": [],
137
- "field_metadata": {
138
- "description": "",
139
- "rich_text_type": "standard"
140
- },
141
- "multiple": false,
142
- "mandatory": false,
143
- "unique": false,
144
- "non_localizable": false
145
- },
146
- {
147
- "data_type": "group",
148
- "display_name": "Group",
149
- "field_metadata": {},
150
- "schema": [
151
- {
152
- "data_type": "file",
153
- "display_name": "File",
154
- "uid": "file",
155
- "extensions": [],
156
- "field_metadata": {
157
- "description": "",
158
- "rich_text_type": "standard"
159
- },
160
- "multiple": true,
161
- "mandatory": false,
162
- "unique": false,
163
- "non_localizable": false
164
- }
165
- ],
166
- "uid": "group",
167
- "multiple": false,
168
- "mandatory": false,
169
- "unique": false,
170
- "non_localizable": false
171
- }
172
- ]
173
- }
174
-
175
- }