imdone-core 1.51.0 → 1.52.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.
package/lib/card.js CHANGED
@@ -44,8 +44,11 @@ module.exports = function newCard(task, _project, dontParse) {
44
44
  this.innerInterpretedContent = value
45
45
  }
46
46
 
47
+ // TODO This should take an object of project level data and make it available to the card
48
+ // <!--
49
+ // order:-120
50
+ // -->
47
51
  init(totals = project.totals) {
48
- this.topics = project.extractWikilinkTopics(this.interpretedContent)
49
52
  this.updateLastLine()
50
53
  this.totals = totals
51
54
  this.onTaskUpdate()
@@ -28,7 +28,7 @@ module.exports = class ExtensionPlugin extends Plugin {
28
28
  }
29
29
 
30
30
  getCardProperties(task) {
31
- return this.cardPropertiesFunction(task)
31
+ return this.cardPropertiesFunction(task, this.project)
32
32
  }
33
33
 
34
34
  getCardActions(task) {
package/lib/project.js CHANGED
@@ -48,6 +48,7 @@ module.exports = class WorkerProject extends Project {
48
48
  this.repo = repo
49
49
  this.innerFilter = ''
50
50
  this.fileGateway = fileGateway
51
+ this._updatedAt = undefined
51
52
  }
52
53
 
53
54
  init(cb) {
@@ -99,6 +100,7 @@ module.exports = class WorkerProject extends Project {
99
100
  async toImdoneJSON() {
100
101
  this.pluginManager.initDevMode()
101
102
  console.time('toJSON time')
103
+ this._updatedAt = new Date()
102
104
  const totals = calculateTotals(
103
105
  this.getLists({
104
106
  populateFiltered: true,
@@ -168,6 +170,10 @@ module.exports = class WorkerProject extends Project {
168
170
  if (this.pluginManager) this.pluginManager.destroyPlugins()
169
171
  }
170
172
 
173
+ get allTopics() {
174
+ return [...this.repo.allTopics]
175
+ }
176
+
171
177
  get allTags() {
172
178
  return [...this.repo.allTags]
173
179
  }
@@ -198,6 +204,10 @@ module.exports = class WorkerProject extends Project {
198
204
  return getIsoDateWithOffset()
199
205
  }
200
206
 
207
+ get updatedAt() {
208
+ return this._updatedAt
209
+ }
210
+
201
211
  removeList(list) {
202
212
  this.repo.removeList(list)
203
213
  }
@@ -235,6 +245,7 @@ module.exports = class WorkerProject extends Project {
235
245
  ...new Set(queryProps),
236
246
  ...[...this.repo.metaKeys].map(key => `allMeta.${key}`),
237
247
  ...[...this.repo.metaKeys].map(key => `meta.${key}`),
248
+ ...this.allTopics,
238
249
  ...this.allTags,
239
250
  ...this.allContexts,
240
251
  ]
package/lib/repository.js CHANGED
@@ -68,6 +68,7 @@ function Repository(_path, config) {
68
68
  this.allMeta = {}
69
69
  this.metaKeys = new Set()
70
70
  this.allTags = new Set()
71
+ this.allTopics = new Set()
71
72
  this.allContexts = new Set()
72
73
  }
73
74
 
@@ -85,6 +86,11 @@ Repository.prototype.refresh = function (cb) {
85
86
  }
86
87
  this.config = config
87
88
  this.files = []
89
+ this.allMeta = {}
90
+ this.metaKeys = new Set()
91
+ this.allTags = new Set()
92
+ this.allTopics = new Set()
93
+ this.allContexts = new Set()
88
94
  this.readFiles((err, files) => {
89
95
  if (err) {
90
96
  this.emit('initialized', { ok: false })
@@ -170,6 +176,7 @@ Repository.prototype.createListeners = function () {
170
176
  self.saveConfig()
171
177
  }
172
178
  Object.keys(task.allMeta).forEach(key => self.metaKeys.add(key))
179
+ task.topics.forEach(topic => self.allTopics.add(topic))
173
180
  task.allTags.forEach(tag => self.allTags.add(tag))
174
181
  task.allContext.forEach(context => self.allContexts.add(context))
175
182
  self.allMeta = self.addAllMeta(task.allMeta)
package/lib/task.js CHANGED
@@ -12,7 +12,8 @@ var _clone = require('lodash.clone'),
12
12
  lineEnd = String(eol.auto),
13
13
  fastSort = require('fast-sort/dist/sort.js'),
14
14
  { escapeRegExp } = require('./tools'),
15
- cheerio = require('cheerio');
15
+ cheerio = require('cheerio'),
16
+ { extractWikilinkTopics } = require('./adapters/markdown');
16
17
 
17
18
  const {
18
19
  CHECK_REGEX,
@@ -104,6 +105,7 @@ class Task {
104
105
  this.metaKeys = Object.keys(this.allMeta)
105
106
  this.progress = this.getProgress()
106
107
  this.content = this.getContent()
108
+ this.topics = extractWikilinkTopics(this.content)
107
109
  }
108
110
 
109
111
  issueNumberRegExp() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.51.0",
3
+ "version": "1.52.1",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -59,7 +59,7 @@
59
59
  "find-up": "^5.0.0",
60
60
  "gray-matter": "^4.0.2",
61
61
  "ignore": "^5.2.0",
62
- "imdone-api": "^1.50.0",
62
+ "imdone-api": "^1.52.1",
63
63
  "isbinaryfile": "^3.0.2",
64
64
  "js-yaml": "^3.14.1",
65
65
  "json-fns": "^1.0.0",