@shaxpir/duiduidui-models 1.5.3 → 1.5.4
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/dist/models/Term.d.ts +4 -0
- package/dist/models/Term.js +19 -0
- package/package.json +1 -1
package/dist/models/Term.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare class Term extends Content {
|
|
|
53
53
|
static makeTermId(userId: ContentId, text: string, senseRank: number): ContentId;
|
|
54
54
|
private _reviewsView;
|
|
55
55
|
private _impliedReviewsView;
|
|
56
|
+
private _tagsView;
|
|
56
57
|
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
57
58
|
static forUserPhrase(userId: ContentId, text: string, senseRank: number, difficulty: number, phraseId?: number): Term;
|
|
58
59
|
static forUserPhrase(userId: ContentId, phrase: Phrase): Term;
|
|
@@ -66,6 +67,9 @@ export declare class Term extends Content {
|
|
|
66
67
|
get theta(): number;
|
|
67
68
|
get uncertainty(): number;
|
|
68
69
|
get starredAt(): CompactDateTime | null;
|
|
70
|
+
get tags(): string[];
|
|
71
|
+
addTag(value: string): void;
|
|
72
|
+
removeTag(value: string): void;
|
|
69
73
|
get lastReviewUtc(): CompactDateTime | null;
|
|
70
74
|
setStarredAt(value: CompactDateTime | null): void;
|
|
71
75
|
updateBayesianScore(alpha: number, beta: number, theta: number): void;
|
package/dist/models/Term.js
CHANGED
|
@@ -16,6 +16,7 @@ class Term extends Content_1.Content {
|
|
|
16
16
|
super(doc, shouldAcquire, shareSync);
|
|
17
17
|
this._reviewsView = new ArrayView_1.ArrayView(this, ['payload', 'reviews']);
|
|
18
18
|
this._impliedReviewsView = new ArrayView_1.ArrayView(this, ['payload', 'implied_reviews']);
|
|
19
|
+
this._tagsView = new ArrayView_1.ArrayView(this, ['payload', 'tags']);
|
|
19
20
|
}
|
|
20
21
|
static forUserPhrase(userId, textOrPhrase, senseRank, difficulty, phraseId) {
|
|
21
22
|
const now = shaxpir_common_1.ClockService.getClock().now();
|
|
@@ -145,6 +146,24 @@ class Term extends Content_1.Content {
|
|
|
145
146
|
this.checkDisposed("Term.starredAt");
|
|
146
147
|
return this.payload.starred_at;
|
|
147
148
|
}
|
|
149
|
+
get tags() {
|
|
150
|
+
this.checkDisposed("Term.tags");
|
|
151
|
+
return this._tagsView.values;
|
|
152
|
+
}
|
|
153
|
+
addTag(value) {
|
|
154
|
+
this.checkDisposed("Term.addTag");
|
|
155
|
+
const index = this._tagsView.indexOf(value);
|
|
156
|
+
if (index === -1) {
|
|
157
|
+
this._tagsView.push(value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
removeTag(value) {
|
|
161
|
+
this.checkDisposed("Term.removeTag");
|
|
162
|
+
const index = this._tagsView.indexOf(value);
|
|
163
|
+
if (index !== -1) {
|
|
164
|
+
this._tagsView.removeAt(index);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
148
167
|
get lastReviewUtc() {
|
|
149
168
|
this.checkDisposed("Term.lastReviewUtc");
|
|
150
169
|
return this.payload.last_review_utc;
|