@bunizao/contracts 0.21.0 → 0.22.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.
package/dist/index.js CHANGED
@@ -174,6 +174,18 @@ var MOOD_TOPICS = [
174
174
  { id: "travel", zh: "出行旅行", en: "Travel & Transport" },
175
175
  { id: "daily-life", zh: "日常生活", en: "Daily Life" }
176
176
  ];
177
+ var MOOD_TOPIC_GROUPS = [
178
+ { id: "ai", zh: "AI", en: "AI", topics: ["ai"] },
179
+ { id: "tech", zh: "数码与折腾", en: "Tech & Tinkering", topics: ["devices", "apps-services", "coding"] },
180
+ { id: "study", zh: "学习", en: "Study", topics: ["study-school"] },
181
+ { id: "food", zh: "吃喝", en: "Food & Drink", topics: ["food-drink"] },
182
+ { id: "money", zh: "钱与消费", en: "Money & Shopping", topics: ["money-finance", "shopping-style"] },
183
+ { id: "people", zh: "朋友与感情", en: "Friends & Love", topics: ["friends", "romance"] },
184
+ { id: "feelings", zh: "心情与想法", en: "Feelings & Thoughts", topics: ["self-feelings", "reflections"] },
185
+ { id: "health", zh: "身体与睡眠", en: "Health & Sleep", topics: ["health-sleep"] },
186
+ { id: "media", zh: "音乐与娱乐", en: "Music & Media", topics: ["music", "media-entertainment", "internet-culture"] },
187
+ { id: "life", zh: "生活与出行", en: "Daily Life & Travel", topics: ["daily-life", "travel"] }
188
+ ];
177
189
  var MOOD_COMMENT_ORIGINS = ["telegram", "web"];
178
190
  // src/notify.ts
179
191
  var NOTIFY_CHANNELS = ["mood", "blog", "privacy", "announcement"];
@@ -339,6 +351,7 @@ export {
339
351
  MOOD_SEARCH_PATH,
340
352
  MOOD_SENTIMENT_LABELS,
341
353
  MOOD_TOPICS,
354
+ MOOD_TOPIC_GROUPS,
342
355
  MUSICKIT_TOKEN_PATH,
343
356
  NEWSLETTER_ANALYTICS_CLICK_ENDPOINT,
344
357
  NEWSLETTER_ANALYTICS_OPEN_ENDPOINT,
package/dist/mood.d.ts CHANGED
@@ -88,6 +88,61 @@ export declare const MOOD_TOPICS: readonly [{
88
88
  readonly en: 'Daily Life';
89
89
  }];
90
90
  export type MoodTopicId = (typeof MOOD_TOPICS)[number]['id'];
91
+ /** How the yearly view counts topics: eighteen bars are too fine to read a
92
+ year by, so it shows these ten. Posts keep their MOOD_TOPICS ids; every id
93
+ sits in exactly one group. */
94
+ export declare const MOOD_TOPIC_GROUPS: readonly [{
95
+ readonly id: 'ai';
96
+ readonly zh: 'AI';
97
+ readonly en: 'AI';
98
+ readonly topics: readonly ["ai"];
99
+ }, {
100
+ readonly id: 'tech';
101
+ readonly zh: '数码与折腾';
102
+ readonly en: 'Tech & Tinkering';
103
+ readonly topics: readonly ["devices", "apps-services", "coding"];
104
+ }, {
105
+ readonly id: 'study';
106
+ readonly zh: '学习';
107
+ readonly en: 'Study';
108
+ readonly topics: readonly ["study-school"];
109
+ }, {
110
+ readonly id: 'food';
111
+ readonly zh: '吃喝';
112
+ readonly en: 'Food & Drink';
113
+ readonly topics: readonly ["food-drink"];
114
+ }, {
115
+ readonly id: 'money';
116
+ readonly zh: '钱与消费';
117
+ readonly en: 'Money & Shopping';
118
+ readonly topics: readonly ["money-finance", "shopping-style"];
119
+ }, {
120
+ readonly id: 'people';
121
+ readonly zh: '朋友与感情';
122
+ readonly en: 'Friends & Love';
123
+ readonly topics: readonly ["friends", "romance"];
124
+ }, {
125
+ readonly id: 'feelings';
126
+ readonly zh: '心情与想法';
127
+ readonly en: 'Feelings & Thoughts';
128
+ readonly topics: readonly ["self-feelings", "reflections"];
129
+ }, {
130
+ readonly id: 'health';
131
+ readonly zh: '身体与睡眠';
132
+ readonly en: 'Health & Sleep';
133
+ readonly topics: readonly ["health-sleep"];
134
+ }, {
135
+ readonly id: 'media';
136
+ readonly zh: '音乐与娱乐';
137
+ readonly en: 'Music & Media';
138
+ readonly topics: readonly ["music", "media-entertainment", "internet-culture"];
139
+ }, {
140
+ readonly id: 'life';
141
+ readonly zh: '生活与出行';
142
+ readonly en: 'Daily Life & Travel';
143
+ readonly topics: readonly ["daily-life", "travel"];
144
+ }];
145
+ export type MoodTopicGroupId = (typeof MOOD_TOPIC_GROUPS)[number]['id'];
91
146
  export interface MoodSentiment {
92
147
  label: MoodSentimentLabel;
93
148
  score: number;
@@ -128,13 +183,19 @@ export interface MoodYearDay {
128
183
  temperature: number | null;
129
184
  }
130
185
  export interface MoodYearTopic {
131
- /** A MoodTopicId, kept as string: a snapshot can outlive a vocabulary change. */
132
- topic: string;
186
+ /** A MoodTopicGroupId, kept as string: a snapshot can outlive a vocabulary change. */
187
+ group: string;
188
+ /** Analysed posts with at least one topic in the group. */
133
189
  count: number;
134
190
  }
135
191
  export interface MoodYearWord {
192
+ /** The spelling the year used most. */
136
193
  word: string;
194
+ /** Posts that name it. */
137
195
  count: number;
196
+ /** Message ids of the newest posts that name it, newest first, at most
197
+ five: where the word came from. */
198
+ posts: number[];
138
199
  }
139
200
  /** One calendar year of the owner's own words. Forwards are left out: they
140
201
  are someone else's mood. Built once a day into KV, never per request. */
@@ -148,9 +209,10 @@ export interface MoodYear {
148
209
  /** Days with at least one post, ascending; empty days are absent. */
149
210
  days: MoodYearDay[];
150
211
  sentiment: Record<MoodSentimentLabel, number>;
151
- /** Most frequent first. */
212
+ /** Topic groups, most frequent first. */
152
213
  topics: MoodYearTopic[];
153
- /** Word-cloud keywords, most frequent first, at most 120. */
214
+ /** Word-cloud keywords used on at least two days, most distinctive first,
215
+ at most 120. */
154
216
  words: MoodYearWord[];
155
217
  generatedAt: string;
156
218
  }
package/dist/mood.js CHANGED
@@ -21,10 +21,23 @@ var MOOD_TOPICS = [
21
21
  { id: "travel", zh: "出行旅行", en: "Travel & Transport" },
22
22
  { id: "daily-life", zh: "日常生活", en: "Daily Life" }
23
23
  ];
24
+ var MOOD_TOPIC_GROUPS = [
25
+ { id: "ai", zh: "AI", en: "AI", topics: ["ai"] },
26
+ { id: "tech", zh: "数码与折腾", en: "Tech & Tinkering", topics: ["devices", "apps-services", "coding"] },
27
+ { id: "study", zh: "学习", en: "Study", topics: ["study-school"] },
28
+ { id: "food", zh: "吃喝", en: "Food & Drink", topics: ["food-drink"] },
29
+ { id: "money", zh: "钱与消费", en: "Money & Shopping", topics: ["money-finance", "shopping-style"] },
30
+ { id: "people", zh: "朋友与感情", en: "Friends & Love", topics: ["friends", "romance"] },
31
+ { id: "feelings", zh: "心情与想法", en: "Feelings & Thoughts", topics: ["self-feelings", "reflections"] },
32
+ { id: "health", zh: "身体与睡眠", en: "Health & Sleep", topics: ["health-sleep"] },
33
+ { id: "media", zh: "音乐与娱乐", en: "Music & Media", topics: ["music", "media-entertainment", "internet-culture"] },
34
+ { id: "life", zh: "生活与出行", en: "Daily Life & Travel", topics: ["daily-life", "travel"] }
35
+ ];
24
36
  var MOOD_COMMENT_ORIGINS = ["telegram", "web"];
25
37
  export {
26
38
  MOOD_AI_MODELS,
27
39
  MOOD_COMMENT_ORIGINS,
28
40
  MOOD_SENTIMENT_LABELS,
29
- MOOD_TOPICS
41
+ MOOD_TOPICS,
42
+ MOOD_TOPIC_GROUPS
30
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunizao/contracts",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Shared TypeScript contracts for buxx.me services and clients.",
5
5
  "type": "module",
6
6
  "sideEffects": false,