@chronicle.app/marvin 0.3.0 → 0.5.0

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.
@@ -78,10 +78,10 @@ export default class MarvinTransformer extends ChronicleTransformer {
78
78
  };
79
79
  const quoteAction = {
80
80
  '@type': 'QuoteAction',
81
- '@key': ['@type', 'source', 'sourceId'],
81
+ // Keyed by the quotation it made, which has the annotation's ID.
82
+ '@key': ['@type', 'source', 'result.sourceId'],
82
83
  timestamp,
83
84
  source: 'marvin',
84
- sourceId: data.ID,
85
85
  agent: this.buildAgent(),
86
86
  result: quotation,
87
87
  };
@@ -89,20 +89,32 @@ export default class MarvinTransformer extends ChronicleTransformer {
89
89
  }
90
90
  // Handle annotation (EntryText)
91
91
  if (data.EntryText) {
92
- const comment = {
93
- '@type': 'Comment',
94
- '@key': ['@type', 'source', 'sourceId'],
95
- description: data.EntryText,
96
- source: 'marvin',
97
- sourceId: data.ID,
98
- about: quotation ? [quotation] : [sourceBook], // Comment about quote if it exists, otherwise about book
99
- };
92
+ // A comment on a highlight is keyed by the quotation it's about, which
93
+ // has the annotation's ID. A comment on its own has the ID itself.
94
+ const comment = quotation
95
+ ? {
96
+ '@type': 'Comment',
97
+ '@key': ['@type', 'source', 'about[*].sourceId'],
98
+ description: data.EntryText,
99
+ source: 'marvin',
100
+ about: [quotation],
101
+ }
102
+ : {
103
+ '@type': 'Comment',
104
+ '@key': ['@type', 'source', 'sourceId'],
105
+ description: data.EntryText,
106
+ source: 'marvin',
107
+ sourceId: data.ID,
108
+ about: [sourceBook],
109
+ };
100
110
  const annotateAction = {
101
111
  '@type': 'AnnotateAction',
102
- '@key': ['@type', 'source', 'sourceId'],
112
+ // Keyed by the comment it made.
113
+ '@key': quotation
114
+ ? ['@type', 'source', 'result.about[*].sourceId']
115
+ : ['@type', 'source', 'result.sourceId'],
103
116
  timestamp,
104
117
  source: 'marvin',
105
- sourceId: data.ID,
106
118
  agent: this.buildAgent(),
107
119
  result: comment,
108
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chronicle.app/marvin",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -21,9 +21,9 @@
21
21
  "type": "module",
22
22
  "description": "Chronicle plugin for reading sessions and annotations from Marvin",
23
23
  "devDependencies": {
24
- "@chronicle.app/etl": "0.3.0",
25
- "@chronicle.app/schema": "0.3.0",
26
- "@chronicle.app/tsconfig": "0.3.0",
24
+ "@chronicle.app/etl": "0.5.0",
25
+ "@chronicle.app/schema": "0.5.0",
26
+ "@chronicle.app/tsconfig": "0.5.0",
27
27
  "@types/node": "^22.10.1",
28
28
  "typescript": "^5.7.2"
29
29
  },
@@ -65,7 +65,62 @@
65
65
  "annotations",
66
66
  "reading-sessions"
67
67
  ],
68
- "default": true
68
+ "default": true,
69
+ "files": [
70
+ {
71
+ "names": [
72
+ "*.csv"
73
+ ],
74
+ "recordTypes": [
75
+ "annotations"
76
+ ],
77
+ "match": [
78
+ {
79
+ "csv": [
80
+ "ID",
81
+ "Type",
82
+ "HighlightText",
83
+ "EntryText"
84
+ ]
85
+ }
86
+ ],
87
+ "requires": [
88
+ {
89
+ "csv": [
90
+ "Title",
91
+ "Author",
92
+ "Created"
93
+ ]
94
+ }
95
+ ]
96
+ },
97
+ {
98
+ "names": [
99
+ "*.csv"
100
+ ],
101
+ "recordTypes": [
102
+ "reading-sessions"
103
+ ],
104
+ "match": [
105
+ {
106
+ "csv": [
107
+ "Session ID",
108
+ "Part ID",
109
+ "Part Time"
110
+ ]
111
+ }
112
+ ],
113
+ "requires": [
114
+ {
115
+ "csv": [
116
+ "Date Created",
117
+ "Book Title",
118
+ "Book Author"
119
+ ]
120
+ }
121
+ ]
122
+ }
123
+ ]
69
124
  }
70
125
  }
71
126
  }