@shaxpir/duiduidui-models 1.4.5 → 1.4.7

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.
@@ -23,6 +23,9 @@ export declare class Progress extends Content {
23
23
  static create(userId: ContentId): Progress;
24
24
  constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
25
25
  get payload(): ProgressPayload;
26
+ getUserRank(): number;
27
+ getCognitiveLoad(): number;
28
+ getPhrases(): Record<string, PhraseProgress>;
26
29
  setUserRank(value: number): void;
27
30
  setCognitiveLoad(value: number): void;
28
31
  updatePhraseProgress(phraseId: string, progress: PhraseProgress): void;
@@ -36,6 +36,18 @@ class Progress extends Content_1.Content {
36
36
  this.checkDisposed("Progress.payload");
37
37
  return this.doc.data.payload;
38
38
  }
39
+ getUserRank() {
40
+ this.checkDisposed("Progress.getUserRank");
41
+ return this.payload.user_rank;
42
+ }
43
+ getCognitiveLoad() {
44
+ this.checkDisposed("Progress.getCognitiveLoad");
45
+ return this.payload.cognitive_load;
46
+ }
47
+ getPhrases() {
48
+ this.checkDisposed("Progress.getPhrases");
49
+ return this.payload.phrases;
50
+ }
39
51
  setUserRank(value) {
40
52
  this.checkDisposed("Progress.setUserRank");
41
53
  if (this.payload.user_rank !== value) {
@@ -35,6 +35,14 @@ export declare class Term extends Content {
35
35
  static forUserPhrase(userId: ContentId, phrase: Phrase): Term;
36
36
  static forBuiltinPhrase(userId: ContentId, phrase: BuiltInPhrase): Term;
37
37
  get payload(): TermPayload;
38
+ getText(): string;
39
+ getSenseRank(): number;
40
+ getLearnRank(): number;
41
+ getAlpha(): number;
42
+ getBeta(): number;
43
+ getTheta(): number;
44
+ getReviews(): ReviewLike[];
45
+ getStarredAt(): CompactDateTime | null;
38
46
  setStarredAt(value: CompactDateTime | null): void;
39
47
  updateBayesianScore(alpha: number, beta: number, theta: number): void;
40
48
  addReview(review: ReviewLike): void;
@@ -64,8 +64,8 @@ class Term extends Content_1.Content {
64
64
  keywords: phrase.keywords,
65
65
  tags: phrase.tags,
66
66
  starred_at: null,
67
- alpha: 1,
68
- beta: 1,
67
+ alpha: 0.5,
68
+ beta: 0.5,
69
69
  theta: 0.5,
70
70
  reviews: []
71
71
  }
@@ -101,6 +101,38 @@ class Term extends Content_1.Content {
101
101
  this.checkDisposed("Term.payload");
102
102
  return this.doc.data.payload;
103
103
  }
104
+ getText() {
105
+ this.checkDisposed("Term.getText");
106
+ return this.payload.text;
107
+ }
108
+ getSenseRank() {
109
+ this.checkDisposed("Term.getSenseRank");
110
+ return this.payload.sense_rank;
111
+ }
112
+ getLearnRank() {
113
+ this.checkDisposed("Term.getLearnRank");
114
+ return this.payload.learn_rank;
115
+ }
116
+ getAlpha() {
117
+ this.checkDisposed("Term.getAlpha");
118
+ return this.payload.alpha;
119
+ }
120
+ getBeta() {
121
+ this.checkDisposed("Term.getBeta");
122
+ return this.payload.beta;
123
+ }
124
+ getTheta() {
125
+ this.checkDisposed("Term.getTheta");
126
+ return this.payload.theta;
127
+ }
128
+ getReviews() {
129
+ this.checkDisposed("Term.getReviews");
130
+ return this.payload.reviews;
131
+ }
132
+ getStarredAt() {
133
+ this.checkDisposed("Term.getStarredAt");
134
+ return this.payload.starred_at;
135
+ }
104
136
  setStarredAt(value) {
105
137
  this.checkDisposed("Term.setStarredAt");
106
138
  if (this.payload.starred_at !== value) {
@@ -12,10 +12,10 @@ export interface JourneyEntry {
12
12
  export interface WorkspacePayload {
13
13
  devices: ContentId[];
14
14
  sessions: MultiTime[];
15
- journey?: {
15
+ journey: {
16
16
  [key: string]: CompactDateTime;
17
17
  };
18
- global_tags?: TagFilterConfig;
18
+ global_tags: TagFilterConfig;
19
19
  }
20
20
  export interface WorkspaceBody extends ContentBody {
21
21
  meta: ContentMeta;
@@ -26,6 +26,7 @@ export declare class Workspace extends Content {
26
26
  private _sessionsView;
27
27
  constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
28
28
  get payload(): WorkspacePayload;
29
+ getGlobalTags(): TagFilterConfig;
29
30
  static makeWorkspaceId(userId: ContentId): ContentId;
30
31
  static create(userId: ContentId, deviceId: ContentId): Workspace;
31
32
  get sessions(): ArrayView<MultiTime>;
@@ -34,4 +35,5 @@ export declare class Workspace extends Content {
34
35
  hasJourneyDate(journeyKey: string): boolean;
35
36
  getJourneyDate(journeyKey: string): CompactDateTime;
36
37
  setJourneyDate(journeyKey: string, journeyDate: CompactDateTime): void;
38
+ setGlobalTags(tags: TagFilterConfig): void;
37
39
  }
@@ -17,6 +17,10 @@ class Workspace extends Content_1.Content {
17
17
  get payload() {
18
18
  return this.doc.data.payload;
19
19
  }
20
+ getGlobalTags() {
21
+ this.checkDisposed("Workspace.getGlobalTags");
22
+ return this.payload.global_tags;
23
+ }
20
24
  static makeWorkspaceId(userId) {
21
25
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.WORKSPACE);
22
26
  }
@@ -35,6 +39,7 @@ class Workspace extends Content_1.Content {
35
39
  payload: {
36
40
  devices: [deviceId],
37
41
  journey: {},
42
+ global_tags: {},
38
43
  sessions: []
39
44
  }
40
45
  });
@@ -66,28 +71,25 @@ class Workspace extends Content_1.Content {
66
71
  }
67
72
  hasJourneyDate(journeyKey) {
68
73
  this.checkDisposed("Workspace.hasJourneyDate");
69
- return this.payload.hasOwnProperty('journey') && this.payload.journey.hasOwnProperty(journeyKey);
74
+ return this.payload.journey.hasOwnProperty(journeyKey);
70
75
  }
71
76
  getJourneyDate(journeyKey) {
72
77
  this.checkDisposed("Workspace.getJourneyDate");
73
- if (this.payload.hasOwnProperty('journey')) {
74
- if (this.payload.journey.hasOwnProperty(journeyKey)) {
75
- return this.payload.journey[journeyKey];
76
- }
78
+ if (this.payload.journey.hasOwnProperty(journeyKey)) {
79
+ return this.payload.journey[journeyKey];
77
80
  }
78
81
  return null;
79
82
  }
80
83
  setJourneyDate(journeyKey, journeyDate) {
81
84
  this.checkDisposed("Workspace.setJourneyDate");
82
85
  const batch = new Operation_1.BatchOperation(this);
83
- if (this.payload.hasOwnProperty('journey')) {
84
- batch.setPathValue(['payload', 'journey', journeyKey], journeyDate);
85
- }
86
- else {
87
- const journey = {};
88
- journey[journeyKey] = journeyDate;
89
- batch.setPathValue(['payload', 'journey'], journey);
90
- }
86
+ batch.setPathValue(['payload', 'journey', journeyKey], journeyDate);
87
+ batch.commit();
88
+ }
89
+ setGlobalTags(tags) {
90
+ this.checkDisposed("Workspace.setGlobalTags");
91
+ const batch = new Operation_1.BatchOperation(this);
92
+ batch.setPathValue(['payload', 'global_tags'], tags);
91
93
  batch.commit();
92
94
  }
93
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"