@shaxpir/duiduidui-models 1.29.0 → 1.30.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.
@@ -21,6 +21,7 @@ export interface TermSummary {
21
21
  implied_review_count: number;
22
22
  last_review_utc: CompactDateTime;
23
23
  user_tag_count: number;
24
+ is_user_created?: boolean;
24
25
  }
25
26
  export interface TermPayload extends BayesianScore {
26
27
  text: string;
@@ -48,6 +49,7 @@ export interface TermPayload extends BayesianScore {
48
49
  components?: PhraseExample[];
49
50
  examples?: PhraseExample[];
50
51
  keywords?: string[];
52
+ is_user_created?: boolean;
51
53
  pending_subtasks?: Record<string, {
52
54
  started_at: CompactDateTime;
53
55
  started_by: string;
@@ -64,7 +66,9 @@ export declare class Term extends Content {
64
66
  private _userTagsView;
65
67
  constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
66
68
  static forUserPhrase(userId: ContentId, text: string, senseRank: number, difficulty: number, type: RecordType, phraseId?: number): Term;
67
- static forUserPhrase(userId: ContentId, phrase: Phrase, type: RecordType): Term;
69
+ static forUserPhrase(userId: ContentId, phrase: Phrase, type: RecordType, options?: {
70
+ starred_at?: CompactDateTime | null;
71
+ }): Term;
68
72
  static forBuiltinPhrase(userId: ContentId, phrase: BuiltInPhrase): Term;
69
73
  get payload(): TermPayload;
70
74
  get text(): string;
@@ -19,16 +19,17 @@ class Term extends Content_1.Content {
19
19
  this._impliedReviewsView = new ArrayView_1.ArrayView(this, ['payload', 'implied_reviews']);
20
20
  this._userTagsView = new ArrayView_1.ArrayView(this, ['payload', 'user_tags']);
21
21
  }
22
- static forUserPhrase(userId, textOrPhrase, senseRankOrType, difficultyOrNothing, typeOrPhraseId, phraseId) {
22
+ static forUserPhrase(userId, textOrPhrase, senseRankOrType, difficultyOrOptions, typeOrPhraseId, phraseId) {
23
23
  const now = shaxpir_common_1.ClockService.getClock().now();
24
24
  // Handle overloaded parameters
25
25
  let phrase;
26
26
  let recordType;
27
27
  let resolvedPhraseId;
28
+ let starredAt = null;
28
29
  if (typeof textOrPhrase === 'string') {
29
30
  // First overload: (userId, text, senseRank, difficulty, type, phraseId?)
30
31
  const senseRank = senseRankOrType;
31
- const difficulty = difficultyOrNothing;
32
+ const difficulty = difficultyOrOptions;
32
33
  recordType = typeOrPhraseId;
33
34
  resolvedPhraseId = phraseId;
34
35
  // Create a minimal Phrase object from individual parameters
@@ -47,10 +48,12 @@ class Term extends Content_1.Content {
47
48
  };
48
49
  }
49
50
  else {
50
- // Second overload: (userId, phrase, type)
51
+ // Second overload: (userId, phrase, type, options?)
51
52
  phrase = textOrPhrase;
52
53
  recordType = senseRankOrType;
53
54
  resolvedPhraseId = undefined;
55
+ const options = difficultyOrOptions;
56
+ starredAt = options?.starred_at ?? null;
54
57
  }
55
58
  const termId = Term.makeTermId(userId, recordType, phrase.text, phrase.sense_rank);
56
59
  return repo_1.ShareSyncFactory.get().createContent({
@@ -78,7 +81,7 @@ class Term extends Content_1.Content {
78
81
  keywords: phrase.keywords,
79
82
  user_tags: phrase.tags || [],
80
83
  user_tag_count: (phrase.tags || []).length,
81
- starred_at: null,
84
+ starred_at: starredAt,
82
85
  alpha: 0.5,
83
86
  beta: 0.5,
84
87
  theta: 0.5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"