@shaxpir/duiduidui-models 1.4.18 → 1.4.20

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.
@@ -10,7 +10,7 @@ class Billing extends Content_1.Content {
10
10
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.BILLING);
11
11
  }
12
12
  static create(userId, payload, createdAt) {
13
- const now = shaxpir_common_1.MultiClock.now();
13
+ const now = shaxpir_common_1.ClockService.getClock().now();
14
14
  // If the createdAt time is not provided, use the current time
15
15
  createdAt ??= now;
16
16
  const billingId = Billing.makeBillingId(userId);
@@ -8,7 +8,7 @@ const ContentKind_1 = require("./ContentKind");
8
8
  const Operation_1 = require("./Operation");
9
9
  class Device extends Content_1.Content {
10
10
  static create(userId, deviceId) {
11
- const now = shaxpir_common_1.MultiClock.now();
11
+ const now = shaxpir_common_1.ClockService.getClock().now();
12
12
  return repo_1.ShareSyncFactory.get().createContent({
13
13
  meta: {
14
14
  ref: deviceId,
@@ -14,7 +14,7 @@ class Manifest extends Model_1.Model {
14
14
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.MANIFEST);
15
15
  }
16
16
  static create(userId, createdAt) {
17
- const now = shaxpir_common_1.Time.utc();
17
+ const now = shaxpir_common_1.ClockService.getClock().utc();
18
18
  // If the createdAt time is not provided, use the current time
19
19
  const createdTime = createdAt ?? { utc_time: now };
20
20
  const manifestId = Manifest.makeManifestId(userId);
@@ -14,7 +14,7 @@ class Media extends Content_1.Content {
14
14
  return this.doc.data.payload;
15
15
  }
16
16
  static create(userId, mediaId, payload) {
17
- const now = shaxpir_common_1.MultiClock.now();
17
+ const now = shaxpir_common_1.ClockService.getClock().now();
18
18
  return repo_1.ShareSyncFactory.get().createContent({
19
19
  meta: {
20
20
  ref: mediaId,
@@ -35,7 +35,7 @@ class Metric extends Content_1.Content {
35
35
  maxDate = date;
36
36
  }
37
37
  }
38
- const now = shaxpir_common_1.MultiClock.now();
38
+ const now = shaxpir_common_1.ClockService.getClock().now();
39
39
  return repo_1.ShareSyncFactory.get().createContent({
40
40
  meta: {
41
41
  ref: metricId,
@@ -77,7 +77,7 @@ class BatchOperation {
77
77
  this.time = time;
78
78
  }
79
79
  else {
80
- this.time = shaxpir_common_1.MultiClock.now();
80
+ this.time = shaxpir_common_1.ClockService.getClock().now();
81
81
  }
82
82
  this.ops = [];
83
83
  }
@@ -11,7 +11,7 @@ class Profile extends Content_1.Content {
11
11
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.PROFILE);
12
12
  }
13
13
  static create(userId) {
14
- const now = shaxpir_common_1.MultiClock.now();
14
+ const now = shaxpir_common_1.ClockService.getClock().now();
15
15
  const profileId = Profile.makeProfileId(userId);
16
16
  return repo_1.ShareSyncFactory.get().createContent({
17
17
  meta: {
@@ -11,7 +11,7 @@ class Progress extends Content_1.Content {
11
11
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.PROGRESS);
12
12
  }
13
13
  static create(userId) {
14
- const now = shaxpir_common_1.MultiClock.now();
14
+ const now = shaxpir_common_1.ClockService.getClock().now();
15
15
  const progressId = Progress.makeProgressId(userId);
16
16
  return repo_1.ShareSyncFactory.get().createContent({
17
17
  meta: {
@@ -22,7 +22,7 @@ class Session extends Content_1.Content {
22
22
  return `${sessionId}_${at.utc_time}`;
23
23
  }
24
24
  static create(userId, deviceId) {
25
- let now = shaxpir_common_1.MultiClock.now();
25
+ let now = shaxpir_common_1.ClockService.getClock().now();
26
26
  let sessionId = Session.makeSessionId(userId);
27
27
  let sessionRef = Session.makeSessionRef(userId, now);
28
28
  return repo_1.ShareSyncFactory.get().createContent({
@@ -16,7 +16,7 @@ class Term extends Content_1.Content {
16
16
  this._reviewsView = new ArrayView_1.ArrayView(this, ['payload', 'reviews']);
17
17
  }
18
18
  static forUserPhrase(userId, textOrPhrase, senseRank, learnRank, phraseId) {
19
- const now = shaxpir_common_1.MultiClock.now();
19
+ const now = shaxpir_common_1.ClockService.getClock().now();
20
20
  // Handle overloaded parameters
21
21
  let phrase;
22
22
  if (typeof textOrPhrase === 'string') {
@@ -72,7 +72,7 @@ class Term extends Content_1.Content {
72
72
  });
73
73
  }
74
74
  static forBuiltinPhrase(userId, phrase) {
75
- const now = shaxpir_common_1.MultiClock.now();
75
+ const now = shaxpir_common_1.ClockService.getClock().now();
76
76
  const termId = Term.makeTermId(userId, phrase.text, phrase.sense_rank);
77
77
  return repo_1.ShareSyncFactory.get().createContent({
78
78
  meta: {
@@ -18,7 +18,7 @@ class User extends Content_1.Content {
18
18
  }
19
19
  static create(userId, payload, createdAt) {
20
20
  // User creation always happens in UTC time
21
- const now = shaxpir_common_1.MultiClock.utcNow();
21
+ const now = shaxpir_common_1.ClockService.getClock().now();
22
22
  // If the createdAt time is not provided, use the current time
23
23
  createdAt ??= now;
24
24
  return repo_1.ShareSyncFactory.get().createContent({
@@ -25,7 +25,7 @@ class Workspace extends Content_1.Content {
25
25
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.WORKSPACE);
26
26
  }
27
27
  static create(userId, payload) {
28
- const now = shaxpir_common_1.MultiClock.now();
28
+ const now = shaxpir_common_1.ClockService.getClock().now();
29
29
  const workspaceId = Workspace.makeWorkspaceId(userId);
30
30
  return repo_1.ShareSyncFactory.get().createContent({
31
31
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.4.18",
3
+ "version": "1.4.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@shaxpir/duiduidui-models": "^1.4.14",
20
20
  "@shaxpir/sharedb": "^6.0.6",
21
- "@shaxpir/shaxpir-common": "1.3.0",
21
+ "@shaxpir/shaxpir-common": "1.4.0",
22
22
  "ot-json1": "1.0.1",
23
23
  "ot-text-unicode": "4.0.0",
24
24
  "reconnecting-websocket": "4.4.0"