@shaxpir/duiduidui-models 1.4.7 → 1.4.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.
package/dist/models/Billing.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
2
|
+
import { MultiTime } from '@shaxpir/shaxpir-common';
|
|
2
3
|
import { ShareSync } from '../repo';
|
|
3
4
|
import { Content, ContentBody, ContentId, ContentMeta } from "./Content";
|
|
4
5
|
export interface BillingPayload {
|
|
@@ -10,7 +11,7 @@ export interface BillingBody extends ContentBody {
|
|
|
10
11
|
}
|
|
11
12
|
export declare class Billing extends Content {
|
|
12
13
|
static makeBillingId(userId: ContentId): ContentId;
|
|
13
|
-
static create(userId: ContentId, payload: BillingPayload): Billing;
|
|
14
|
+
static create(userId: ContentId, payload: BillingPayload, createdAt?: MultiTime): Billing;
|
|
14
15
|
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
15
16
|
get payload(): BillingPayload;
|
|
16
17
|
}
|
package/dist/models/Billing.js
CHANGED
|
@@ -9,8 +9,10 @@ class Billing extends Content_1.Content {
|
|
|
9
9
|
static makeBillingId(userId) {
|
|
10
10
|
return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.BILLING);
|
|
11
11
|
}
|
|
12
|
-
static create(userId, payload) {
|
|
12
|
+
static create(userId, payload, createdAt) {
|
|
13
13
|
const now = shaxpir_common_1.MultiClock.now();
|
|
14
|
+
// If the createdAt time is not provided, use the current time
|
|
15
|
+
createdAt ??= now;
|
|
14
16
|
const billingId = Billing.makeBillingId(userId);
|
|
15
17
|
return repo_1.ShareSyncFactory.get().createContent({
|
|
16
18
|
meta: {
|
|
@@ -18,8 +20,8 @@ class Billing extends Content_1.Content {
|
|
|
18
20
|
kind: ContentKind_1.ContentKind.BILLING,
|
|
19
21
|
id: billingId,
|
|
20
22
|
owner: userId,
|
|
21
|
-
created_at:
|
|
22
|
-
updated_at:
|
|
23
|
+
created_at: createdAt,
|
|
24
|
+
updated_at: createdAt
|
|
23
25
|
},
|
|
24
26
|
payload
|
|
25
27
|
});
|
|
@@ -34,7 +34,7 @@ export interface ManifestPayload {
|
|
|
34
34
|
export declare class Manifest extends Model {
|
|
35
35
|
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
36
36
|
static makeManifestId(userId: ContentId): ContentId;
|
|
37
|
-
static create(userId: ContentId): Manifest;
|
|
37
|
+
static create(userId: ContentId, createdAt?: SingleTime): Manifest;
|
|
38
38
|
get meta(): ManifestMeta;
|
|
39
39
|
get owner(): ContentId;
|
|
40
40
|
canUserView(userId: ContentId): boolean;
|
package/dist/models/Manifest.js
CHANGED
|
@@ -13,16 +13,16 @@ class Manifest extends Model_1.Model {
|
|
|
13
13
|
static makeManifestId(userId) {
|
|
14
14
|
return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.MANIFEST);
|
|
15
15
|
}
|
|
16
|
-
static create(userId) {
|
|
16
|
+
static create(userId, createdAt) {
|
|
17
17
|
const now = shaxpir_common_1.Time.utc();
|
|
18
|
+
// If the createdAt time is not provided, use the current time
|
|
19
|
+
const createdTime = createdAt ?? { utc_time: now };
|
|
18
20
|
const manifestId = Manifest.makeManifestId(userId);
|
|
19
21
|
return repo_1.ShareSyncFactory.get().createManifest({
|
|
20
22
|
meta: {
|
|
21
23
|
kind: ContentKind_1.ContentKind.MANIFEST,
|
|
22
24
|
ref: manifestId,
|
|
23
|
-
updated_at:
|
|
24
|
-
utc_time: now
|
|
25
|
-
},
|
|
25
|
+
updated_at: createdTime,
|
|
26
26
|
owner: userId
|
|
27
27
|
},
|
|
28
28
|
payload: {
|
package/dist/models/User.js
CHANGED
|
@@ -28,7 +28,7 @@ export declare class Workspace extends Content {
|
|
|
28
28
|
get payload(): WorkspacePayload;
|
|
29
29
|
getGlobalTags(): TagFilterConfig;
|
|
30
30
|
static makeWorkspaceId(userId: ContentId): ContentId;
|
|
31
|
-
static create(userId: ContentId,
|
|
31
|
+
static create(userId: ContentId, payload: WorkspacePayload): Workspace;
|
|
32
32
|
get sessions(): ArrayView<MultiTime>;
|
|
33
33
|
get devices(): ArrayView<ContentId>;
|
|
34
34
|
acquireSessionsFromDate(sessionId: ContentId, localDate: CompactDate): Promise<Session[]>;
|
package/dist/models/Workspace.js
CHANGED
|
@@ -24,7 +24,7 @@ class Workspace extends Content_1.Content {
|
|
|
24
24
|
static makeWorkspaceId(userId) {
|
|
25
25
|
return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.WORKSPACE);
|
|
26
26
|
}
|
|
27
|
-
static create(userId,
|
|
27
|
+
static create(userId, payload) {
|
|
28
28
|
const now = shaxpir_common_1.MultiClock.now();
|
|
29
29
|
const workspaceId = Workspace.makeWorkspaceId(userId);
|
|
30
30
|
return repo_1.ShareSyncFactory.get().createContent({
|
|
@@ -36,12 +36,7 @@ class Workspace extends Content_1.Content {
|
|
|
36
36
|
created_at: now,
|
|
37
37
|
updated_at: now
|
|
38
38
|
},
|
|
39
|
-
payload
|
|
40
|
-
devices: [deviceId],
|
|
41
|
-
journey: {},
|
|
42
|
-
global_tags: {},
|
|
43
|
-
sessions: []
|
|
44
|
-
}
|
|
39
|
+
payload
|
|
45
40
|
});
|
|
46
41
|
}
|
|
47
42
|
get sessions() {
|