@shaxpir/duiduidui-models 1.6.6 → 1.6.8

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.
@@ -27,6 +27,7 @@ export interface ManifestPayload {
27
27
  profile: any;
28
28
  progress: any;
29
29
  session: any;
30
+ social: any;
30
31
  term: any;
31
32
  user: any;
32
33
  workspace: any;
@@ -33,6 +33,7 @@ class Manifest extends Model_1.Model {
33
33
  profile: {},
34
34
  progress: {},
35
35
  session: {},
36
+ social: {},
36
37
  term: {},
37
38
  user: {},
38
39
  workspace: {}
@@ -1,5 +1,5 @@
1
1
  import { Doc } from '@shaxpir/sharedb/lib/client';
2
- import { CompactDateTime } from '@shaxpir/shaxpir-common';
2
+ import { CompactDateTime, MultiTime } from '@shaxpir/shaxpir-common';
3
3
  import { ShareSync } from '../repo';
4
4
  import { Content, ContentBody, ContentId, ContentMeta } from "./Content";
5
5
  export declare enum FriendRequestStatus {
@@ -43,7 +43,7 @@ export interface SocialBody extends ContentBody {
43
43
  }
44
44
  export declare class Social extends Content {
45
45
  static makeSocialId(userId: ContentId): ContentId;
46
- static create(userId: ContentId): Social;
46
+ static create(userId: ContentId, createdAt?: MultiTime): Social;
47
47
  constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
48
48
  get payload(): SocialPayload;
49
49
  getOutgoingRequests(): FriendRequest[];
@@ -16,8 +16,8 @@ class Social extends Content_1.Content {
16
16
  static makeSocialId(userId) {
17
17
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.SOCIAL);
18
18
  }
19
- static create(userId) {
20
- const now = shaxpir_common_1.ClockService.getClock().now();
19
+ static create(userId, createdAt) {
20
+ const now = createdAt ?? shaxpir_common_1.ClockService.getClock().now();
21
21
  const socialId = Social.makeSocialId(userId);
22
22
  return repo_1.ShareSyncFactory.get().createContent({
23
23
  meta: {
@@ -431,6 +431,9 @@ class ShareSync {
431
431
  else if (kind === ContentKind_1.ContentKind.SESSION) {
432
432
  return new Session_1.Session(doc, shouldAcquire, shareSync);
433
433
  }
434
+ else if (kind === ContentKind_1.ContentKind.SOCIAL) {
435
+ return new models_1.Social(doc, shouldAcquire, shareSync);
436
+ }
434
437
  else if (kind === ContentKind_1.ContentKind.TERM) {
435
438
  return new models_1.Term(doc, shouldAcquire, shareSync);
436
439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"