@contentstack/datasync-manager 1.2.4 → 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 (76) hide show
  1. package/LICENSE +1 -1
  2. package/dist/api.js +16 -10
  3. package/dist/config.js +1 -0
  4. package/dist/core/index.js +33 -26
  5. package/dist/core/inet.js +10 -7
  6. package/dist/core/plugins.js +6 -5
  7. package/dist/core/process.js +7 -6
  8. package/dist/core/q.js +22 -16
  9. package/dist/core/token-management.js +23 -20
  10. package/dist/index.js +48 -37
  11. package/dist/util/build-paths.js +15 -14
  12. package/dist/util/fs.js +19 -15
  13. package/dist/util/index.js +53 -43
  14. package/dist/util/logger.js +3 -2
  15. package/dist/util/promise.map.js +3 -2
  16. package/dist/util/series.js +3 -2
  17. package/dist/util/unprocessible.js +14 -12
  18. package/dist/util/validations.js +34 -24
  19. package/package.json +8 -2
  20. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  21. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  22. package/.github/workflows/codeql-analysis.yml +0 -68
  23. package/.github/workflows/jira.yml +0 -28
  24. package/.github/workflows/release.yml +0 -53
  25. package/.github/workflows/sast-scan.yml +0 -11
  26. package/.github/workflows/sca-scan.yml +0 -15
  27. package/.github/workflows/secrets-scan.yml +0 -11
  28. package/.releaserc +0 -9
  29. package/.talismanrc +0 -4
  30. package/CODEOWNERS +0 -1
  31. package/SECURITY.md +0 -27
  32. package/example/config.js +0 -60
  33. package/example/index.js +0 -30
  34. package/test/api.ts +0 -152
  35. package/test/core/filteredItems.ts +0 -58
  36. package/test/core/index.ts +0 -18
  37. package/test/core/inet.ts +0 -23
  38. package/test/core/q.ts +0 -42
  39. package/test/core/sync.ts +0 -19
  40. package/test/core/token-management.ts +0 -40
  41. package/test/dummy/api-responses/404.ts +0 -3
  42. package/test/dummy/api-responses/content-type.ts +0 -30
  43. package/test/dummy/api-responses/delete-asset.ts +0 -9
  44. package/test/dummy/api-responses/delete-content-type.ts +0 -6
  45. package/test/dummy/api-responses/delete-entry.ts +0 -9
  46. package/test/dummy/api-responses/delete.ts +0 -32
  47. package/test/dummy/api-responses/empty.ts +0 -7
  48. package/test/dummy/api-responses/entries.ts +0 -31
  49. package/test/dummy/api-responses/filter-items.ts +0 -32
  50. package/test/dummy/api-responses/global-field.ts +0 -175
  51. package/test/dummy/api-responses/markdown-content-type.ts +0 -202
  52. package/test/dummy/api-responses/markdown-entries.ts +0 -56
  53. package/test/dummy/api-responses/mixed.ts +0 -77
  54. package/test/dummy/api-responses/publish-asset.ts +0 -14
  55. package/test/dummy/api-responses/publish-entry.ts +0 -14
  56. package/test/dummy/api-responses/publish.ts +0 -35
  57. package/test/dummy/api-responses/references-content-type-2.ts +0 -240
  58. package/test/dummy/api-responses/references-content-type.ts +0 -272
  59. package/test/dummy/api-responses/references-entries.ts +0 -156
  60. package/test/dummy/api-responses/unpublish-asset.ts +0 -9
  61. package/test/dummy/api-responses/unpublish-entry.ts +0 -9
  62. package/test/dummy/api-responses/unpublish.ts +0 -26
  63. package/test/dummy/config.ts +0 -34
  64. package/test/dummy/connector-listener-instances.ts +0 -69
  65. package/test/dummy/filter-items.ts +0 -32
  66. package/test/dummy/plugins/myplugin1/index.js +0 -20
  67. package/test/dummy/plugins/myplugin2/index.js +0 -20
  68. package/test/dummy/references-content-type.ts +0 -340
  69. package/test/dummy/references-entry-expected.ts +0 -161
  70. package/test/dummy/references-entry.ts +0 -95
  71. package/test/index.ts +0 -330
  72. package/test/util/fs.ts +0 -92
  73. package/test/util/index.ts +0 -157
  74. package/test/util/log-save-filtered-items.ts +0 -42
  75. package/test/util/validations.ts +0 -158
  76. package/tslint.json +0 -53
@@ -13,7 +13,7 @@ const lodash_1 = require("lodash");
13
13
  * @description Check's if the application's config is enough to start the app without errors
14
14
  * @param {Object} config - Application config
15
15
  */
16
- exports.validateConfig = (config) => {
16
+ const validateConfig = (config) => {
17
17
  const keys = ['listener', 'assetStore', 'contentStore', 'syncManager', 'contentstack',
18
18
  'locales',
19
19
  ];
@@ -23,7 +23,7 @@ exports.validateConfig = (config) => {
23
23
  }
24
24
  });
25
25
  if (typeof config.contentstack !== 'object' || !config.contentstack.apiKey || !config.contentstack.deliveryToken) {
26
- throw new Error('Config \'contentstack\' should be of type object and have \'apiKey\' and \'token\'');
26
+ throw new Error('Config \'contentstack\' should be of type object and have \'apiKey\', \'token\'');
27
27
  }
28
28
  if (config.queue) {
29
29
  if (config.queue.resume_threshold >= config.queue.pause_threshold) {
@@ -31,92 +31,98 @@ exports.validateConfig = (config) => {
31
31
  }
32
32
  }
33
33
  };
34
+ exports.validateConfig = validateConfig;
34
35
  /**
35
36
  * @public
36
37
  * @method validateAssetStore
37
38
  * @description Validates if provided asset store has required methods
38
39
  * @param {Object} assetStore - Asset store
39
40
  */
40
- exports.validateAssetStore = (assetStore) => {
41
+ const validateAssetStore = (assetStore) => {
41
42
  if (typeof assetStore !== 'object' && typeof assetStore !== 'function') {
42
43
  throw new Error('Invalid Type! Asset store is of neither \'object\' or \'function\'!');
43
44
  }
44
45
  const methods = ['getConfig', 'getAssetLocation', 'setConfig', 'start'];
45
46
  methods.forEach((method) => {
46
- if (!(lodash_1.hasIn(assetStore, method)) && typeof assetStore[method] === 'function') {
47
+ if (!((0, lodash_1.hasIn)(assetStore, method)) && typeof assetStore[method] === 'function') {
47
48
  throw new Error(`Missing required methods! Asset store is missing '${method}()'!`);
48
49
  }
49
50
  });
50
51
  };
52
+ exports.validateAssetStore = validateAssetStore;
51
53
  /**
52
54
  * @public
53
55
  * @method validateContentStore
54
56
  * @description Validates if provided content store has required methods
55
57
  * @param {Object} contentStore - Content store
56
58
  */
57
- exports.validateContentStore = (contentStore) => {
59
+ const validateContentStore = (contentStore) => {
58
60
  if (typeof contentStore !== 'object' && typeof contentStore !== 'function') {
59
61
  throw new Error('Invalid Type! Content store is of neither \'object\' or \'function\'!');
60
62
  }
61
63
  const methods = ['getConfig', 'setConfig', 'setAssetStore', 'start'];
62
64
  methods.forEach((method) => {
63
- if (!(lodash_1.hasIn(contentStore, method)) && typeof contentStore[method] === 'function') {
65
+ if (!((0, lodash_1.hasIn)(contentStore, method)) && typeof contentStore[method] === 'function') {
64
66
  throw new Error(`Missing required methods! Content store is missing '${method}()'!`);
65
67
  }
66
68
  });
67
69
  };
70
+ exports.validateContentStore = validateContentStore;
68
71
  /**
69
72
  * @public
70
73
  * @method validateListener
71
74
  * @description Validates if the provided listener supports required methods
72
75
  * @param {Object} listener - Listener instance
73
76
  */
74
- exports.validateListener = (listener) => {
77
+ const validateListener = (listener) => {
75
78
  if (typeof listener !== 'object' && typeof listener !== 'function') {
76
79
  throw new Error('Invalid Type! Listener is of neither \'object\' or \'function\'!');
77
80
  }
78
81
  const methods = ['getConfig', 'setConfig', 'start', 'register'];
79
82
  methods.forEach((method) => {
80
- if (!(lodash_1.hasIn(listener, method)) || typeof listener[method] !== 'function') {
83
+ if (!((0, lodash_1.hasIn)(listener, method)) || typeof listener[method] !== 'function') {
81
84
  throw new Error(`Missing required methods! Listener is missing '${method}()'!`);
82
85
  }
83
86
  });
84
87
  };
88
+ exports.validateListener = validateListener;
85
89
  /**
86
90
  * @public
87
91
  * @method validateContentStoreInstance
88
92
  * @description Validates if the registered content store supports required methods
89
93
  * @param {Object} instance - Content store instance
90
94
  */
91
- exports.validateContentStoreInstance = (instance) => {
95
+ const validateContentStoreInstance = (instance) => {
92
96
  const fns = ['publish', 'unpublish', 'delete', 'updateContentType'];
93
97
  fns.forEach((fn) => {
94
- if (!(lodash_1.hasIn(instance, fn)) && typeof instance[fn] === 'function') {
98
+ if (!((0, lodash_1.hasIn)(instance, fn)) && typeof instance[fn] === 'function') {
95
99
  throw new Error(`${instance} content store does not support '${fn}()'`);
96
100
  }
97
101
  });
98
102
  };
103
+ exports.validateContentStoreInstance = validateContentStoreInstance;
99
104
  /**
100
105
  * @public
101
106
  * @method validateAssetStoreInstance
102
107
  * @description Validates if the registered asset store supports required methods
103
108
  * @param {Object} instance - Asset store instance
104
109
  */
105
- exports.validateAssetStoreInstance = (instance) => {
110
+ const validateAssetStoreInstance = (instance) => {
106
111
  const fns = ['delete', 'download', 'unpublish'];
107
112
  fns.forEach((fn) => {
108
- if (!(lodash_1.hasIn(instance, fn)) && typeof instance[fn] === 'function') {
113
+ if (!((0, lodash_1.hasIn)(instance, fn)) && typeof instance[fn] === 'function') {
109
114
  throw new Error(`${instance} asset store does not support '${fn}()'`);
110
115
  }
111
116
  });
112
117
  };
118
+ exports.validateAssetStoreInstance = validateAssetStoreInstance;
113
119
  /**
114
120
  * @public
115
121
  * @method validateExternalInput
116
122
  * @description Validates if the input provided by external method into 'Q' conforms standards
117
123
  * @param {Object} data - Input data
118
124
  */
119
- exports.validateExternalInput = (data) => {
125
+ const validateExternalInput = (data) => {
120
126
  if (typeof data._content_type_uid !== 'string' || data._content_type_uid.length === 0) {
121
127
  throw new Error('data._content_type_uid should be of type string and not empty!');
122
128
  }
@@ -126,15 +132,16 @@ exports.validateExternalInput = (data) => {
126
132
  if (typeof data.locale !== 'string' || data.locale.length === 0) {
127
133
  throw new Error('data.locale should be of type string and not empty!');
128
134
  }
129
- if (!(lodash_1.isPlainObject(data)) || lodash_1.isEmpty(data)) {
135
+ if (!((0, lodash_1.isPlainObject)(data)) || (0, lodash_1.isEmpty)(data)) {
130
136
  throw new Error('data should be of type object and not empty!');
131
137
  }
132
138
  };
139
+ exports.validateExternalInput = validateExternalInput;
133
140
  /**
134
141
  * @description Validates if the custom logger set supports required methods
135
142
  * @param {Object} instance - Custom logger instance
136
143
  */
137
- exports.validateLogger = (instance) => {
144
+ const validateLogger = (instance) => {
138
145
  let flag = false;
139
146
  if (!instance) {
140
147
  return flag;
@@ -147,7 +154,8 @@ exports.validateLogger = (instance) => {
147
154
  });
148
155
  return !flag;
149
156
  };
150
- exports.validateItemStructure = (item) => {
157
+ exports.validateLogger = validateLogger;
158
+ const validateItemStructure = (item) => {
151
159
  try {
152
160
  if (!(item.type) || typeof item.type !== 'string' || !(item.type.length)) {
153
161
  item._error = '\'type\' key is missing!';
@@ -174,12 +182,13 @@ exports.validateItemStructure = (item) => {
174
182
  return false;
175
183
  }
176
184
  };
185
+ exports.validateItemStructure = validateItemStructure;
177
186
  const assetPublishedStructure = (asset) => {
178
187
  const requiredKeys = ['content_type_uid', 'data', 'data.uid', 'data.url', 'data.publish_details',
179
188
  'data.publish_details.locale', 'data.title',
180
189
  ];
181
190
  requiredKeys.forEach((key) => {
182
- if (!(lodash_1.hasIn(asset, key))) {
191
+ if (!((0, lodash_1.hasIn)(asset, key))) {
183
192
  asset._error = asset._error || '';
184
193
  asset._error += `${key} is missing!\t`;
185
194
  }
@@ -189,17 +198,18 @@ const assetPublishedStructure = (asset) => {
189
198
  }
190
199
  return true;
191
200
  };
192
- exports.validatePlugin = (plugin) => {
201
+ const validatePlugin = (plugin) => {
193
202
  if (!plugin.name || typeof plugin.name !== 'string' || plugin.name.length < 1) {
194
203
  throw new Error(`Invalid plugin config, 'plugin.name' is a required property!`);
195
204
  }
196
205
  };
206
+ exports.validatePlugin = validatePlugin;
197
207
  const entryPublishedStructure = (entry) => {
198
208
  const requiredKeys = ['content_type_uid', 'data', 'data.uid', 'data.publish_details',
199
209
  'data.publish_details.locale',
200
210
  ];
201
211
  requiredKeys.forEach((key) => {
202
- if (!(lodash_1.hasIn(entry, key))) {
212
+ if (!((0, lodash_1.hasIn)(entry, key))) {
203
213
  entry._error = entry._error || '';
204
214
  entry._error += `${key} is missing!`;
205
215
  }
@@ -212,7 +222,7 @@ const entryPublishedStructure = (entry) => {
212
222
  const assetDeletedStructure = (asset) => {
213
223
  const requiredKeys = ['content_type_uid', 'data', 'data.uid', 'data.locale'];
214
224
  requiredKeys.forEach((key) => {
215
- if (!(lodash_1.hasIn(asset, key))) {
225
+ if (!((0, lodash_1.hasIn)(asset, key))) {
216
226
  asset._error = asset._error || '';
217
227
  asset._error += `${key} is missing!`;
218
228
  }
@@ -225,7 +235,7 @@ const assetDeletedStructure = (asset) => {
225
235
  const entryDeletedStructure = (entry) => {
226
236
  const requiredKeys = ['content_type_uid', 'data', 'data.uid', 'data.locale'];
227
237
  requiredKeys.forEach((key) => {
228
- if (!(lodash_1.hasIn(entry, key))) {
238
+ if (!((0, lodash_1.hasIn)(entry, key))) {
229
239
  entry._error = entry._error || '';
230
240
  entry._error += `${key} is missing!`;
231
241
  }
@@ -238,7 +248,7 @@ const entryDeletedStructure = (entry) => {
238
248
  const assetUnpublishedStructure = (asset) => {
239
249
  const requiredKeys = ['content_type_uid', 'data', 'data.uid', 'data.locale'];
240
250
  requiredKeys.forEach((key) => {
241
- if (!(lodash_1.hasIn(asset, key))) {
251
+ if (!((0, lodash_1.hasIn)(asset, key))) {
242
252
  asset._error = asset._error || '';
243
253
  asset._error += `${key} is missing!`;
244
254
  }
@@ -251,7 +261,7 @@ const assetUnpublishedStructure = (asset) => {
251
261
  const entryUnpublishedStructure = (entry) => {
252
262
  const requiredKeys = ['content_type_uid', 'data', 'data.uid', 'data.locale'];
253
263
  requiredKeys.forEach((key) => {
254
- if (!(lodash_1.hasIn(entry, key))) {
264
+ if (!((0, lodash_1.hasIn)(entry, key))) {
255
265
  entry._error = entry._error || '';
256
266
  entry._error += `${key} is missing!`;
257
267
  }
@@ -264,7 +274,7 @@ const entryUnpublishedStructure = (entry) => {
264
274
  const contentTypeDeletedStructure = (contentType) => {
265
275
  const requiredKeys = ['content_type_uid'];
266
276
  requiredKeys.forEach((key) => {
267
- if (!(lodash_1.hasIn(contentType, key))) {
277
+ if (!((0, lodash_1.hasIn)(contentType, key))) {
268
278
  contentType._error = contentType._error || '';
269
279
  contentType._error += `${key} is missing!`;
270
280
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@contentstack/datasync-manager",
3
3
  "author": "Contentstack LLC <support@contentstack.com>",
4
- "version": "1.2.4",
4
+ "version": "2.0.1",
5
5
  "description": "The primary module of Contentstack DataSync. Syncs Contentstack data with your server using Contentstack Sync API",
6
6
  "main": "dist/index.js",
7
7
  "dependencies": {
8
+ "@braintree/sanitize-url": "^6.0.2",
8
9
  "debug": "^4.3.4",
9
10
  "dns-socket": "^4.2.2",
10
11
  "lodash": "^4.17.21",
@@ -34,7 +35,7 @@
34
35
  "semantic-release": "^19.0.5",
35
36
  "ts-jest": "^29.0.1",
36
37
  "tslint": "^5.18.0",
37
- "typescript": "^3.9.2"
38
+ "typescript": "^4.9.4"
38
39
  },
39
40
  "scripts": {
40
41
  "clean": "rimraf dist typings coverage .tokens .ledger .checkpoint",
@@ -56,6 +57,11 @@
56
57
  "DataSync",
57
58
  "utility"
58
59
  ],
60
+ "files": [
61
+ "/dist",
62
+ "/typings",
63
+ "/npm-shrinkwrap.json"
64
+ ],
59
65
  "repository": {
60
66
  "type": "git",
61
67
  "url": "git+https://github.com/contentstack/datasync-manager"
@@ -1,31 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: "[BUG]"
5
- labels: bug
6
- assignees: iyerrama29, ninadhatkar
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Setup
16
- 2. Configuration info (except api_key/tokens)
17
- 3. Content type schema & entry details / asset details (if possible)
18
- 4. Copy paste the error in detail
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Desktop (please complete the following information):**
27
- - OS: [e.g. iOS]
28
- - Version [e.g. 22]
29
-
30
- **Additional context**
31
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: "[FEATURE]"
5
- labels: enhancement
6
- assignees: iyerrama29, ninadhatkar
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
@@ -1,68 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- #
7
- # ******** NOTE ********
8
- # We have attempted to detect the languages in your repository. Please check
9
- # the `language` matrix defined below to confirm you have the correct set of
10
- # supported CodeQL languages.
11
- #
12
- name: "CodeQL"
13
-
14
- on:
15
- pull_request:
16
- # The branches below must be a subset of the branches above
17
- branches: '*'
18
-
19
- jobs:
20
- analyze:
21
- name: Analyze
22
- runs-on: ubuntu-latest
23
- permissions:
24
- actions: read
25
- contents: read
26
- security-events: write
27
-
28
- strategy:
29
- fail-fast: false
30
- matrix:
31
- language: [ 'javascript' ]
32
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
33
- # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
34
-
35
- steps:
36
- - name: Checkout repository
37
- uses: actions/checkout@v3
38
-
39
- # Initializes the CodeQL tools for scanning.
40
- - name: Initialize CodeQL
41
- uses: github/codeql-action/init@v2
42
- with:
43
- languages: ${{ matrix.language }}
44
- # If you wish to specify custom queries, you can do so here or in a config file.
45
- # By default, queries listed here will override any specified in a config file.
46
- # Prefix the list here with "+" to use these queries and those in the config file.
47
-
48
- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
49
- # queries: security-extended,security-and-quality
50
-
51
-
52
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53
- # If this step fails, then you should remove it and run the build manually (see below)
54
- - name: Autobuild
55
- uses: github/codeql-action/autobuild@v2
56
-
57
- # ℹ️ Command-line programs to run using the OS shell.
58
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
59
-
60
- # If the Autobuild fails above, remove it and uncomment the following three lines.
61
- # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
62
-
63
- # - run: |
64
- # echo "Run, Build Application using script"
65
- # ./location_of_script_within_repo/buildscript.sh
66
-
67
- - name: Perform CodeQL Analysis
68
- uses: github/codeql-action/analyze@v2
@@ -1,28 +0,0 @@
1
- name: Create JIRA ISSUE
2
- on:
3
- pull_request:
4
- types: [opened]
5
- jobs:
6
- security:
7
- if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}}
8
- runs-on: ubuntu-latest
9
- steps:
10
- - uses: actions/checkout@v2
11
- - name: Login into JIRA
12
- uses: atlassian/gajira-login@master
13
- env:
14
- JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
15
- JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
16
- JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
17
- - name: Create a JIRA Issue
18
- id: create
19
- uses: atlassian/gajira-create@master
20
- with:
21
- project: ${{ secrets.JIRA_PROJECT }}
22
- issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
23
- summary: |
24
- ${{ github.event.pull_request.title }}
25
- description: |
26
- PR: ${{ github.event.pull_request.html_url }}
27
-
28
- fields: "${{ secrets.JIRA_FIELDS }}"
@@ -1,53 +0,0 @@
1
- name: Release
2
- on:
3
- push:
4
- branches:
5
- - master
6
- jobs:
7
- build:
8
- name: Build and upload
9
- runs-on: ubuntu-latest
10
- steps:
11
- - name: Checkout
12
- uses: actions/checkout@v2
13
- with:
14
- fetch-depth: 0
15
- - name: Setup Node.js
16
- uses: actions/setup-node@v1
17
- with:
18
- node-version: 12
19
- - name: Install dependencies
20
- run: npm install
21
- - name: Build
22
- run: npm run build-ts
23
- - name: Upload dist
24
- uses: actions/upload-artifact@v3
25
- with:
26
- name: dist
27
- path: dist
28
-
29
- release:
30
- name: Download dist and release
31
- runs-on: ubuntu-latest
32
- needs: build
33
- steps:
34
- - name: Checkout
35
- uses: actions/checkout@v2
36
- with:
37
- fetch-depth: 0
38
- - name: Setup Node.js
39
- uses: actions/setup-node@v1
40
- with:
41
- node-version: 12
42
- - name: Install dependencies
43
- run: npm install
44
- - name: Download dist
45
- uses: actions/download-artifact@v3
46
- with:
47
- name: dist
48
- run: ls dist
49
- - name: Release
50
- env:
51
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
52
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
53
- run: npx semantic-release
@@ -1,11 +0,0 @@
1
- name: SAST Scan
2
- on:
3
- pull_request:
4
- types: [opened, synchronize, reopened]
5
- jobs:
6
- security:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- - name: Horusec Scan
11
- run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/src horuszup/horusec-cli:latest horusec start -p /src -P $(pwd)
@@ -1,15 +0,0 @@
1
- name: Source Composition Analysis Scan
2
- on:
3
- pull_request:
4
- types: [opened, synchronize, reopened]
5
- jobs:
6
- security:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@master
10
- - name: Run Snyk to check for vulnerabilities
11
- uses: snyk/actions/node@master
12
- env:
13
- SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
14
- with:
15
- args: --all-projects
@@ -1,11 +0,0 @@
1
- name: Secrets Scan
2
- on:
3
- pull_request:
4
- types: [opened, synchronize, reopened]
5
- jobs:
6
- security:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v2
10
- - name: Gittyleaks
11
- uses: gupy-io/gittyleaks-action@v0.1
package/.releaserc DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "branches": ["master"],
3
- "plugins": [
4
- "@semantic-release/commit-analyzer",
5
- "@semantic-release/release-notes-generator",
6
- "@semantic-release/npm",
7
- "@semantic-release/git"
8
- ]
9
- }
package/.talismanrc DELETED
@@ -1,4 +0,0 @@
1
- fileignoreconfig:
2
- - filename: package-lock.json
3
- checksum: c95ab8723f7a15c72d1e6f2f6b2eb173ce46b14e4bcd864cc47119b60e1866de
4
- version: ""
package/CODEOWNERS DELETED
@@ -1 +0,0 @@
1
- * @contentstack/security-admin @contentstack/cli-admin
package/SECURITY.md DELETED
@@ -1,27 +0,0 @@
1
- ## Security
2
-
3
- Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations.
4
-
5
- If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below.
6
-
7
- ## Reporting Security Issues
8
-
9
- **Please do not report security vulnerabilities through public GitHub issues.**
10
-
11
- Send email to [security@contentstack.com](mailto:security@contentstack.com).
12
-
13
- You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
14
-
15
- Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
16
-
17
- - Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
18
- - Full paths of source file(s) related to the manifestation of the issue
19
- - The location of the affected source code (tag/branch/commit or direct URL)
20
- - Any special configuration required to reproduce the issue
21
- - Step-by-step instructions to reproduce the issue
22
- - Proof-of-concept or exploit code (if possible)
23
- - Impact of the issue, including how an attacker might exploit the issue
24
-
25
- This information will help us triage your report more quickly.
26
-
27
- [https://www.contentstack.com/trust/](https://www.contentstack.com/trust/)
package/example/config.js DELETED
@@ -1,60 +0,0 @@
1
- module.exports = {
2
- contentstack: {
3
- apiKey: '',
4
- deliveryToken: ''
5
- },
6
- contentStore: {
7
- dbName: 'contentstack',
8
- collectionName: 'development'
9
- },
10
- assetStore: {
11
- baseDir: './_development_contents'
12
- },
13
- plugins: [
14
- {
15
- disabled: false,
16
- name: '_cs_internal_transform_entries',
17
- // path: '',
18
- options: {
19
- // other overrides...
20
- },
21
- },
22
- {
23
- disabled: false,
24
- name: '_cs_internal_transform_schemas',
25
- options: {
26
- logAssetPaths: true,
27
- logReferencePaths: true,
28
- // other overrides...
29
- },
30
- },
31
- {
32
- disabled: false,
33
- name: '_cs_internal_save_rte_markdown_assets',
34
- options: {
35
- // other overrides...
36
- },
37
- },
38
- ],
39
- syncManager: {
40
- inet: {
41
- dns: '8.8.8.8',
42
- host: 'google.com',
43
- port: 53,
44
- retries: 2,
45
- retryTimeout: 3 * 1000,
46
- retryIncrement: 1 * 1000,
47
- timeout: 6 * 1000,
48
- type: 'A',
49
- },
50
- processTimeout: 0
51
- },
52
- // filtering now available!
53
- // syncManager: {
54
- // filters: {
55
- // content_type_uid: ['authors'],
56
- // locale: ['en-us'],
57
- // action: ['publish']
58
- // }
59
- // }
60
- }
package/example/index.js DELETED
@@ -1,30 +0,0 @@
1
- const assetStore = require('@contentstack/datasync-asset-store-filesystem')
2
- //const contentStore = require('@contentstack/datasync-content-store-mongodb')
3
-
4
- const contentStore = require('@contentstack/datasync-content-store-filesystem')
5
- const listener = require('@contentstack/webhook-listener')
6
- const syncManager = require('../dist/index')
7
- const config = require('./config')
8
-
9
- syncManager.setAssetStore(assetStore)
10
- syncManager.setContentStore(contentStore)
11
- syncManager.setListener(listener)
12
- syncManager.setConfig(config)
13
-
14
- syncManager.start().then(() => {
15
- console.log('Sync utility started successfully!')
16
- }).catch(console.error)
17
-
18
- syncManager.notifications
19
- .on('publish', (obj) => {
20
- // console.log('SYNC-PUBLISH: ', obj)
21
- })
22
- .on('unpublish', (obj) => {
23
- // console.log('SYNC-UNPUBLISH: ', obj)
24
- })
25
- .on('delete', (obj) => {
26
- // console.log('SYNC-DELETE: ', obj)
27
- })
28
- .on('error', (obj) => {
29
- // console.log('SYNC-ERROR: ', obj)
30
- })