@shaxpir/duiduidui-models 1.0.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/README.md +1 -0
- package/decs.d.ts +87 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +20 -0
- package/dist/models/OutboundMessage.d.ts +18 -0
- package/dist/models/OutboundMessage.js +25 -0
- package/dist/models/content/Activity.d.ts +10 -0
- package/dist/models/content/Activity.js +2 -0
- package/dist/models/content/ArrayView.d.ts +26 -0
- package/dist/models/content/ArrayView.js +174 -0
- package/dist/models/content/Billing.d.ts +144 -0
- package/dist/models/content/Billing.js +418 -0
- package/dist/models/content/Book.d.ts +77 -0
- package/dist/models/content/Book.js +407 -0
- package/dist/models/content/Category.d.ts +16 -0
- package/dist/models/content/Category.js +20 -0
- package/dist/models/content/Checkpointable.d.ts +21 -0
- package/dist/models/content/Checkpointable.js +156 -0
- package/dist/models/content/Comment.d.ts +19 -0
- package/dist/models/content/Comment.js +53 -0
- package/dist/models/content/ConceptArt.d.ts +31 -0
- package/dist/models/content/ConceptArt.js +84 -0
- package/dist/models/content/Content.d.ts +52 -0
- package/dist/models/content/Content.js +61 -0
- package/dist/models/content/ContentKind.d.ts +10 -0
- package/dist/models/content/ContentKind.js +16 -0
- package/dist/models/content/Context.d.ts +28 -0
- package/dist/models/content/Context.js +162 -0
- package/dist/models/content/DevEnv.d.ts +5 -0
- package/dist/models/content/DevEnv.js +9 -0
- package/dist/models/content/Device.d.ts +24 -0
- package/dist/models/content/Device.js +62 -0
- package/dist/models/content/Dictionary.d.ts +31 -0
- package/dist/models/content/Dictionary.js +5 -0
- package/dist/models/content/DictionaryEntry.d.ts +20 -0
- package/dist/models/content/DictionaryEntry.js +2 -0
- package/dist/models/content/ElasticModel.d.ts +149 -0
- package/dist/models/content/ElasticModel.js +179 -0
- package/dist/models/content/Environment.d.ts +61 -0
- package/dist/models/content/Environment.js +124 -0
- package/dist/models/content/ExportOptions.d.ts +64 -0
- package/dist/models/content/ExportOptions.js +213 -0
- package/dist/models/content/Folder.d.ts +16 -0
- package/dist/models/content/Folder.js +33 -0
- package/dist/models/content/Fragment.d.ts +54 -0
- package/dist/models/content/Fragment.js +181 -0
- package/dist/models/content/GeoLocation.d.ts +4 -0
- package/dist/models/content/GeoLocation.js +2 -0
- package/dist/models/content/Hanzi.d.ts +21 -0
- package/dist/models/content/Hanzi.js +2 -0
- package/dist/models/content/HighlightRule.d.ts +9 -0
- package/dist/models/content/HighlightRule.js +2 -0
- package/dist/models/content/Manifest.d.ts +42 -0
- package/dist/models/content/Manifest.js +114 -0
- package/dist/models/content/Media.d.ts +32 -0
- package/dist/models/content/Media.js +98 -0
- package/dist/models/content/Metric.d.ts +46 -0
- package/dist/models/content/Metric.js +183 -0
- package/dist/models/content/Migration.d.ts +68 -0
- package/dist/models/content/Migration.js +155 -0
- package/dist/models/content/Model.d.ts +45 -0
- package/dist/models/content/Model.js +280 -0
- package/dist/models/content/Permissions.d.ts +7 -0
- package/dist/models/content/Permissions.js +20 -0
- package/dist/models/content/Phrase.d.ts +8 -0
- package/dist/models/content/Phrase.js +2 -0
- package/dist/models/content/Placeholder.d.ts +8 -0
- package/dist/models/content/Placeholder.js +36 -0
- package/dist/models/content/Profile.d.ts +30 -0
- package/dist/models/content/Profile.js +95 -0
- package/dist/models/content/RichText.d.ts +58 -0
- package/dist/models/content/RichText.js +79 -0
- package/dist/models/content/Session.d.ts +39 -0
- package/dist/models/content/Session.js +173 -0
- package/dist/models/content/Speech.d.ts +67 -0
- package/dist/models/content/Speech.js +97 -0
- package/dist/models/content/Stub.d.ts +24 -0
- package/dist/models/content/Stub.js +179 -0
- package/dist/models/content/Time.d.ts +56 -0
- package/dist/models/content/Time.js +295 -0
- package/dist/models/content/User.d.ts +36 -0
- package/dist/models/content/User.js +95 -0
- package/dist/models/content/Workspace.d.ts +71 -0
- package/dist/models/content/Workspace.js +237 -0
- package/dist/models/content/index.d.ts +36 -0
- package/dist/models/content/index.js +53 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +21 -0
- package/dist/models/legacy/LegacyBodyFormat.d.ts +9 -0
- package/dist/models/legacy/LegacyBodyFormat.js +2 -0
- package/dist/models/legacy/LegacyComment.d.ts +12 -0
- package/dist/models/legacy/LegacyComment.js +2 -0
- package/dist/models/legacy/LegacyContent.d.ts +53 -0
- package/dist/models/legacy/LegacyContent.js +55 -0
- package/dist/models/legacy/LegacyConversion.d.ts +55 -0
- package/dist/models/legacy/LegacyConversion.js +401 -0
- package/dist/models/legacy/LegacyFragment.d.ts +21 -0
- package/dist/models/legacy/LegacyFragment.js +2 -0
- package/dist/models/legacy/LegacyLocator.d.ts +8 -0
- package/dist/models/legacy/LegacyLocator.js +31 -0
- package/dist/models/legacy/LegacyOutboundMessage.d.ts +16 -0
- package/dist/models/legacy/LegacyOutboundMessage.js +13 -0
- package/dist/models/legacy/LegacyPicture.d.ts +14 -0
- package/dist/models/legacy/LegacyPicture.js +2 -0
- package/dist/models/legacy/LegacyProfile.d.ts +9 -0
- package/dist/models/legacy/LegacyProfile.js +2 -0
- package/dist/models/legacy/LegacySession.d.ts +41 -0
- package/dist/models/legacy/LegacySession.js +35 -0
- package/dist/models/legacy/LegacyStory.d.ts +23 -0
- package/dist/models/legacy/LegacyStory.js +2 -0
- package/dist/models/legacy/LegacyStub.d.ts +15 -0
- package/dist/models/legacy/LegacyStub.js +2 -0
- package/dist/models/legacy/LegacyTransaction.d.ts +14 -0
- package/dist/models/legacy/LegacyTransaction.js +49 -0
- package/dist/models/legacy/LegacyUser.d.ts +28 -0
- package/dist/models/legacy/LegacyUser.js +32 -0
- package/dist/models/legacy/LegacyWorkspace.d.ts +23 -0
- package/dist/models/legacy/LegacyWorkspace.js +6 -0
- package/dist/models/legacy/index.d.ts +15 -0
- package/dist/models/legacy/index.js +32 -0
- package/dist/models/markup/BodyFormat.d.ts +14 -0
- package/dist/models/markup/BodyFormat.js +190 -0
- package/dist/models/markup/ChangeModel.d.ts +22 -0
- package/dist/models/markup/ChangeModel.js +107 -0
- package/dist/models/markup/DeltaOps.d.ts +5 -0
- package/dist/models/markup/DeltaOps.js +74 -0
- package/dist/models/markup/HtmlMarkup.d.ts +4 -0
- package/dist/models/markup/HtmlMarkup.js +21 -0
- package/dist/models/markup/Operation.d.ts +32 -0
- package/dist/models/markup/Operation.js +194 -0
- package/dist/models/markup/TextEditOps.d.ts +9 -0
- package/dist/models/markup/TextEditOps.js +50 -0
- package/dist/models/markup/index.d.ts +6 -0
- package/dist/models/markup/index.js +23 -0
- package/dist/repo/ConnectionListener.d.ts +9 -0
- package/dist/repo/ConnectionListener.js +21 -0
- package/dist/repo/PermissiveJson1.d.ts +58 -0
- package/dist/repo/PermissiveJson1.js +39 -0
- package/dist/repo/ShareSync.d.ts +60 -0
- package/dist/repo/ShareSync.js +348 -0
- package/dist/repo/index.d.ts +3 -0
- package/dist/repo/index.js +20 -0
- package/dist/util/Async.d.ts +8 -0
- package/dist/util/Async.js +18 -0
- package/dist/util/Base62.d.ts +6 -0
- package/dist/util/Base62.js +47 -0
- package/dist/util/BinarySearch.d.ts +7 -0
- package/dist/util/BinarySearch.js +46 -0
- package/dist/util/CachingHasher.d.ts +8 -0
- package/dist/util/CachingHasher.js +41 -0
- package/dist/util/Color.d.ts +32 -0
- package/dist/util/Color.js +204 -0
- package/dist/util/Dispatch.d.ts +15 -0
- package/dist/util/Dispatch.js +79 -0
- package/dist/util/EditDistance.d.ts +13 -0
- package/dist/util/EditDistance.js +184 -0
- package/dist/util/Encryption.d.ts +5 -0
- package/dist/util/Encryption.js +2 -0
- package/dist/util/Logging.d.ts +108 -0
- package/dist/util/Logging.js +412 -0
- package/dist/util/NumberFormat.d.ts +14 -0
- package/dist/util/NumberFormat.js +224 -0
- package/dist/util/Struct.d.ts +4 -0
- package/dist/util/Struct.js +15 -0
- package/dist/util/Template.d.ts +16 -0
- package/dist/util/Template.js +128 -0
- package/dist/util/Text.d.ts +45 -0
- package/dist/util/Text.js +243 -0
- package/dist/util/Tuples.d.ts +9 -0
- package/dist/util/Tuples.js +135 -0
- package/dist/util/Validate.d.ts +4 -0
- package/dist/util/Validate.js +11 -0
- package/dist/util/Vocabulary.d.ts +3 -0
- package/dist/util/Vocabulary.js +35 -0
- package/dist/util/index.d.ts +16 -0
- package/dist/util/index.js +33 -0
- package/lib/models/content/ArrayView.ts +203 -0
- package/lib/models/content/Billing.ts +558 -0
- package/lib/models/content/Content.ts +110 -0
- package/lib/models/content/ContentKind.ts +14 -0
- package/lib/models/content/DevEnv.ts +5 -0
- package/lib/models/content/Device.ts +86 -0
- package/lib/models/content/DictionaryEntry.ts +22 -0
- package/lib/models/content/GeoLocation.ts +4 -0
- package/lib/models/content/Hanzi.ts +25 -0
- package/lib/models/content/Manifest.ts +162 -0
- package/lib/models/content/Media.ts +126 -0
- package/lib/models/content/Model.ts +327 -0
- package/lib/models/content/Permissions.ts +21 -0
- package/lib/models/content/Phrase.ts +10 -0
- package/lib/models/content/Profile.ts +119 -0
- package/lib/models/content/Time.ts +328 -0
- package/lib/models/content/User.ts +130 -0
- package/lib/models/markup/ChangeModel.ts +95 -0
- package/lib/models/markup/DeltaOps.ts +71 -0
- package/lib/models/markup/Operation.ts +215 -0
- package/lib/models/markup/TextEditOps.ts +50 -0
- package/lib/repo/ConnectionListener.ts +25 -0
- package/lib/repo/PermissiveJson1.ts +14 -0
- package/lib/repo/ShareSync.ts +390 -0
- package/lib/util/Base62.ts +47 -0
- package/lib/util/CachingHasher.ts +38 -0
- package/lib/util/Dispatch.ts +92 -0
- package/lib/util/Encryption.ts +5 -0
- package/lib/util/Logging.ts +568 -0
- package/lib/util/NumberFormat.ts +194 -0
- package/lib/util/Struct.ts +14 -0
- package/lib/util/Tuples.ts +131 -0
- package/package.json +41 -0
- package/tsconfig.json +25 -0
- package/tslint.json +46 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Profile = void 0;
|
|
4
|
+
const ShareSync_1 = require("../../repo/ShareSync");
|
|
5
|
+
const CachingHasher_1 = require("../../util/CachingHasher");
|
|
6
|
+
const Operation_1 = require("../markup/Operation");
|
|
7
|
+
const Content_1 = require("./Content");
|
|
8
|
+
const ContentKind_1 = require("./ContentKind");
|
|
9
|
+
const Time_1 = require("./Time");
|
|
10
|
+
class Profile extends Content_1.Content {
|
|
11
|
+
static makeProfileId(userId) {
|
|
12
|
+
return CachingHasher_1.CachingHasher.makeMd5ContentId(userId + "-" + ContentKind_1.ContentKind.PROFILE);
|
|
13
|
+
}
|
|
14
|
+
static create(userId) {
|
|
15
|
+
const now = Time_1.MultiClock.now();
|
|
16
|
+
const profileId = Profile.makeProfileId(userId);
|
|
17
|
+
return ShareSync_1.ShareSyncFactory.get().createContent({
|
|
18
|
+
meta: {
|
|
19
|
+
ref: profileId,
|
|
20
|
+
is_head: true,
|
|
21
|
+
kind: ContentKind_1.ContentKind.PROFILE,
|
|
22
|
+
id: profileId,
|
|
23
|
+
owner: userId,
|
|
24
|
+
created_at: now,
|
|
25
|
+
updated_at: now
|
|
26
|
+
},
|
|
27
|
+
payload: {
|
|
28
|
+
username: null,
|
|
29
|
+
full_name: '',
|
|
30
|
+
avatar_media_ref: null,
|
|
31
|
+
avatar_cropping: null
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
36
|
+
super(doc, shouldAcquire, shareSync);
|
|
37
|
+
}
|
|
38
|
+
get payload() {
|
|
39
|
+
this.checkDisposed("Profile.payload");
|
|
40
|
+
return this.doc.data.payload;
|
|
41
|
+
}
|
|
42
|
+
get username() {
|
|
43
|
+
this.checkDisposed("Profile.username");
|
|
44
|
+
return this.payload.username;
|
|
45
|
+
}
|
|
46
|
+
setUsername(value) {
|
|
47
|
+
this.checkDisposed("Profile.setUsername");
|
|
48
|
+
if (this.username != value) {
|
|
49
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
50
|
+
batch.setPathValue(['payload', 'username'], value);
|
|
51
|
+
batch.commit();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
get fullName() {
|
|
55
|
+
this.checkDisposed("Profile.fullName");
|
|
56
|
+
return this.payload.full_name;
|
|
57
|
+
}
|
|
58
|
+
setFullName(value) {
|
|
59
|
+
this.checkDisposed("Profile.setFullName");
|
|
60
|
+
if (this.fullName !== value) {
|
|
61
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
62
|
+
batch.editPathText(['payload', 'full_name'], value);
|
|
63
|
+
batch.commit();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
get avatarMediaRef() {
|
|
67
|
+
this.checkDisposed("Profile.avatarMediaRef");
|
|
68
|
+
return this.payload.avatar_media_ref;
|
|
69
|
+
}
|
|
70
|
+
setAvatarMediaRef(value) {
|
|
71
|
+
this.checkDisposed("Profile.setAvatarMediaRef");
|
|
72
|
+
if (this.avatarMediaRef !== value) {
|
|
73
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
74
|
+
batch.setPathValue(['payload', 'avatar_media_ref'], value);
|
|
75
|
+
batch.commit();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
get avatarCropping() {
|
|
79
|
+
this.checkDisposed("Profile.avatarCropping");
|
|
80
|
+
return this.payload.avatar_cropping;
|
|
81
|
+
}
|
|
82
|
+
setAvatarCropping(value) {
|
|
83
|
+
this.checkDisposed("Profile.setAvatarCropping");
|
|
84
|
+
if (this.avatarCropping !== value) {
|
|
85
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
86
|
+
batch.setPathValue(['payload', 'avatar_cropping'], value);
|
|
87
|
+
batch.commit();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static async findByUsername(username) {
|
|
91
|
+
const shareSync = ShareSync_1.ShareSyncFactory.get();
|
|
92
|
+
return shareSync.findAndAcquire(ContentKind_1.ContentKind.PROFILE, { "payload.username": username });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.Profile = Profile;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference path="../../../decs.d.ts" />
|
|
2
|
+
import { Op as DeltaOp } from "@shaxpir/quill-delta";
|
|
3
|
+
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
4
|
+
import { ShareSync } from '../../repo/ShareSync';
|
|
5
|
+
import { Checkpointable } from './Checkpointable';
|
|
6
|
+
import { ContentId, ContentMeta } from "./Content";
|
|
7
|
+
import { MultiTime } from './Time';
|
|
8
|
+
export interface FormatAttr {
|
|
9
|
+
align?: string;
|
|
10
|
+
blockquote?: boolean;
|
|
11
|
+
bold?: boolean;
|
|
12
|
+
comment?: ContentId[];
|
|
13
|
+
header?: number;
|
|
14
|
+
highlight?: any[];
|
|
15
|
+
indent?: number;
|
|
16
|
+
italic?: boolean;
|
|
17
|
+
link?: string;
|
|
18
|
+
list?: "ordered" | "bullet";
|
|
19
|
+
script: "sub" | "super";
|
|
20
|
+
strike?: boolean;
|
|
21
|
+
underline?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface FormatEmbed {
|
|
24
|
+
divider?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface Format {
|
|
27
|
+
at: number;
|
|
28
|
+
len: number;
|
|
29
|
+
attr?: FormatAttr;
|
|
30
|
+
embed?: FormatEmbed;
|
|
31
|
+
}
|
|
32
|
+
export declare enum RichTextFlavor {
|
|
33
|
+
quill = "quill"
|
|
34
|
+
}
|
|
35
|
+
export interface QuillDoc {
|
|
36
|
+
ops: DeltaOp[];
|
|
37
|
+
}
|
|
38
|
+
export interface RichTextPayload {
|
|
39
|
+
richtext_flavor: RichTextFlavor;
|
|
40
|
+
richtext_body: QuillDoc;
|
|
41
|
+
word_count: number;
|
|
42
|
+
}
|
|
43
|
+
export interface RichTextBody {
|
|
44
|
+
meta: ContentMeta;
|
|
45
|
+
payload: RichTextPayload;
|
|
46
|
+
}
|
|
47
|
+
export declare abstract class RichText extends Checkpointable {
|
|
48
|
+
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
49
|
+
get payload(): RichTextPayload;
|
|
50
|
+
get richtextFlavor(): RichTextFlavor;
|
|
51
|
+
get richtextBody(): QuillDoc;
|
|
52
|
+
get wordCount(): number;
|
|
53
|
+
setWordCount(value: number): void;
|
|
54
|
+
get mediaIds(): ContentId[];
|
|
55
|
+
get commentIds(): ContentId[];
|
|
56
|
+
updateRichText(deltaOps: DeltaOp[], newWordCount: number): void;
|
|
57
|
+
beforeRestoreTo(checkpoint: Checkpointable, now: MultiTime): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RichText = exports.RichTextFlavor = void 0;
|
|
4
|
+
const util_1 = require("../../util");
|
|
5
|
+
const markup_1 = require("../markup");
|
|
6
|
+
const BodyFormat_1 = require("../markup/BodyFormat");
|
|
7
|
+
const Checkpointable_1 = require("./Checkpointable");
|
|
8
|
+
const ContentKind_1 = require("./ContentKind");
|
|
9
|
+
var RichTextFlavor;
|
|
10
|
+
(function (RichTextFlavor) {
|
|
11
|
+
RichTextFlavor["quill"] = "quill";
|
|
12
|
+
})(RichTextFlavor || (exports.RichTextFlavor = RichTextFlavor = {}));
|
|
13
|
+
class RichText extends Checkpointable_1.Checkpointable {
|
|
14
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
15
|
+
super(doc, shouldAcquire, shareSync);
|
|
16
|
+
}
|
|
17
|
+
get payload() {
|
|
18
|
+
this.checkDisposed("RichText.payload");
|
|
19
|
+
return this.doc.data.payload;
|
|
20
|
+
}
|
|
21
|
+
get richtextFlavor() {
|
|
22
|
+
this.checkDisposed("RichText.richtextFlavor");
|
|
23
|
+
return this.payload.richtext_flavor;
|
|
24
|
+
}
|
|
25
|
+
get richtextBody() {
|
|
26
|
+
this.checkDisposed("RichText.richtextBody");
|
|
27
|
+
return this.payload.richtext_body;
|
|
28
|
+
}
|
|
29
|
+
get wordCount() {
|
|
30
|
+
this.checkDisposed("RichText.wordCount");
|
|
31
|
+
return this.payload.word_count;
|
|
32
|
+
}
|
|
33
|
+
setWordCount(value) {
|
|
34
|
+
this.checkDisposed("RichText.setWordCount");
|
|
35
|
+
if (this.wordCount !== value) {
|
|
36
|
+
const batch = new markup_1.BatchOperation(this);
|
|
37
|
+
batch.setPathValue(['payload', 'word_count'], value);
|
|
38
|
+
batch.commit();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
get mediaIds() {
|
|
42
|
+
this.checkDisposed("RichText.mediaIds");
|
|
43
|
+
return BodyFormat_1.BodyFormatModel.getMediaIdsFromDeltaOps(this.richtextBody.ops);
|
|
44
|
+
}
|
|
45
|
+
get commentIds() {
|
|
46
|
+
this.checkDisposed("RichText.commentIds");
|
|
47
|
+
return BodyFormat_1.BodyFormatModel.getCommentIdsFromDeltaOps(this.richtextBody.ops);
|
|
48
|
+
}
|
|
49
|
+
updateRichText(deltaOps, newWordCount) {
|
|
50
|
+
this.checkDisposed("RichText.updateRichText");
|
|
51
|
+
const batch = new markup_1.BatchOperation(this);
|
|
52
|
+
batch.applyRichText(['payload', 'richtext_body'], deltaOps);
|
|
53
|
+
if (this.wordCount != newWordCount) {
|
|
54
|
+
batch.setPathValue(['payload', 'word_count'], newWordCount);
|
|
55
|
+
}
|
|
56
|
+
batch.commit();
|
|
57
|
+
}
|
|
58
|
+
async beforeRestoreTo(checkpoint, now) {
|
|
59
|
+
this.checkDisposed("RichText.beforeRestoreTo");
|
|
60
|
+
// Restore all embedded comments
|
|
61
|
+
const checkpointTimestamp = checkpoint.createdAt.utc_time;
|
|
62
|
+
const commentIds = this.commentIds;
|
|
63
|
+
if (commentIds.length > 0) {
|
|
64
|
+
for (let i = 0; i < commentIds.length; i++) {
|
|
65
|
+
const commentId = commentIds[i];
|
|
66
|
+
const commentHead = await this.shareSync.acquire(ContentKind_1.ContentKind.COMMENT, commentId);
|
|
67
|
+
const commentCheckpoint = await commentHead.acquireLatestCheckpointAt(checkpointTimestamp);
|
|
68
|
+
// If the HEAD comment is already the most recent checkpoint, or if the payload hasn't
|
|
69
|
+
// changed since that checkpoint was taken, then there's no need to restore this comment.
|
|
70
|
+
if (!commentCheckpoint.isHead && !util_1.Struct.equals(commentHead.payload, commentCheckpoint.payload)) {
|
|
71
|
+
await commentHead.restoreTo(commentCheckpoint, now);
|
|
72
|
+
}
|
|
73
|
+
commentCheckpoint.release();
|
|
74
|
+
commentHead.release();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.RichText = RichText;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference path="../../../decs.d.ts" />
|
|
2
|
+
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
3
|
+
import { ShareSync } from "../../repo/ShareSync";
|
|
4
|
+
import { Activity } from "./Activity";
|
|
5
|
+
import { Content, ContentBody, ContentId, ContentMeta } from "./Content";
|
|
6
|
+
import { Environment } from "./Environment";
|
|
7
|
+
import { MultiTime } from "./Time";
|
|
8
|
+
export interface SessionPayload {
|
|
9
|
+
start: MultiTime;
|
|
10
|
+
end: MultiTime;
|
|
11
|
+
tz_offset: number;
|
|
12
|
+
device_id: ContentId;
|
|
13
|
+
duration_minutes: number;
|
|
14
|
+
environment: Environment;
|
|
15
|
+
word_count: number;
|
|
16
|
+
activity: Activity[];
|
|
17
|
+
}
|
|
18
|
+
export interface SessionBody extends ContentBody {
|
|
19
|
+
meta: ContentMeta;
|
|
20
|
+
payload: SessionPayload;
|
|
21
|
+
}
|
|
22
|
+
export declare class Session extends Content {
|
|
23
|
+
static makeSessionId(userId: ContentId): ContentId;
|
|
24
|
+
static create(userId: ContentId, deviceId: ContentId, environment: Environment): Session;
|
|
25
|
+
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
26
|
+
get payload(): SessionPayload;
|
|
27
|
+
touch(): void;
|
|
28
|
+
get start(): MultiTime;
|
|
29
|
+
get end(): MultiTime;
|
|
30
|
+
get tzOffset(): number;
|
|
31
|
+
get durationMinutes(): number;
|
|
32
|
+
get deviceId(): ContentId;
|
|
33
|
+
get environment(): Environment;
|
|
34
|
+
get wordCount(): number;
|
|
35
|
+
setWordCount(value: number): void;
|
|
36
|
+
get activity(): Activity[];
|
|
37
|
+
recordActivity(newActivity: Activity): void;
|
|
38
|
+
modelUpdated(): Promise<void>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Session = void 0;
|
|
4
|
+
const ShareSync_1 = require("../../repo/ShareSync");
|
|
5
|
+
const CachingHasher_1 = require("../../util/CachingHasher");
|
|
6
|
+
const Struct_1 = require("../../util/Struct");
|
|
7
|
+
const Operation_1 = require("../markup/Operation");
|
|
8
|
+
const Content_1 = require("./Content");
|
|
9
|
+
const ContentKind_1 = require("./ContentKind");
|
|
10
|
+
const Metric_1 = require("./Metric");
|
|
11
|
+
const Time_1 = require("./Time");
|
|
12
|
+
const Workspace_1 = require("./Workspace");
|
|
13
|
+
class Session extends Content_1.Content {
|
|
14
|
+
static makeSessionId(userId) {
|
|
15
|
+
return CachingHasher_1.CachingHasher.makeMd5ContentId(userId + "-" + ContentKind_1.ContentKind.SESSION);
|
|
16
|
+
}
|
|
17
|
+
static create(userId, deviceId, environment) {
|
|
18
|
+
let now = Time_1.MultiClock.now();
|
|
19
|
+
let sessionId = Session.makeSessionId(userId);
|
|
20
|
+
let sessionRef = Content_1.Content.makeContentRef(sessionId, now.utc_time);
|
|
21
|
+
return ShareSync_1.ShareSyncFactory.get().createContent({
|
|
22
|
+
meta: {
|
|
23
|
+
ref: sessionRef,
|
|
24
|
+
is_head: false,
|
|
25
|
+
kind: ContentKind_1.ContentKind.SESSION,
|
|
26
|
+
id: sessionId,
|
|
27
|
+
owner: userId,
|
|
28
|
+
created_at: now,
|
|
29
|
+
updated_at: now
|
|
30
|
+
},
|
|
31
|
+
payload: {
|
|
32
|
+
start: now,
|
|
33
|
+
end: now,
|
|
34
|
+
tz_offset: (new Date()).getTimezoneOffset(),
|
|
35
|
+
duration_minutes: 0,
|
|
36
|
+
device_id: deviceId,
|
|
37
|
+
environment: environment,
|
|
38
|
+
word_count: 0,
|
|
39
|
+
activity: []
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
44
|
+
super(doc, shouldAcquire, shareSync);
|
|
45
|
+
}
|
|
46
|
+
get payload() {
|
|
47
|
+
this.checkDisposed("Session.payload");
|
|
48
|
+
return this.doc.data.payload;
|
|
49
|
+
}
|
|
50
|
+
touch() {
|
|
51
|
+
this.checkDisposed("Session.touch");
|
|
52
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
53
|
+
let nowUtc = batch.at.utc_time;
|
|
54
|
+
let nowLocal = batch.at.local_time;
|
|
55
|
+
let minutes = Time_1.Time.absDiffMinutes(nowUtc, this.start.utc_time);
|
|
56
|
+
batch.setPathValue(['payload', 'duration_minutes'], minutes);
|
|
57
|
+
batch.setPathValue(['payload', 'end', 'utc_time'], nowUtc);
|
|
58
|
+
batch.setPathValue(['payload', 'end', 'local_time'], nowLocal);
|
|
59
|
+
batch.commit();
|
|
60
|
+
}
|
|
61
|
+
get start() {
|
|
62
|
+
this.checkDisposed("Session.start");
|
|
63
|
+
return this.payload.start;
|
|
64
|
+
}
|
|
65
|
+
get end() {
|
|
66
|
+
this.checkDisposed("Session.end");
|
|
67
|
+
return this.payload.end;
|
|
68
|
+
}
|
|
69
|
+
get tzOffset() {
|
|
70
|
+
this.checkDisposed("Session.tzOffset");
|
|
71
|
+
return this.payload.tz_offset;
|
|
72
|
+
}
|
|
73
|
+
get durationMinutes() {
|
|
74
|
+
this.checkDisposed("Session.durationMinutes");
|
|
75
|
+
return this.payload.duration_minutes;
|
|
76
|
+
}
|
|
77
|
+
get deviceId() {
|
|
78
|
+
this.checkDisposed("Session.deviceId");
|
|
79
|
+
return this.payload.device_id;
|
|
80
|
+
}
|
|
81
|
+
get environment() {
|
|
82
|
+
this.checkDisposed("Session.environment");
|
|
83
|
+
return this.payload.environment;
|
|
84
|
+
}
|
|
85
|
+
get wordCount() {
|
|
86
|
+
this.checkDisposed("Session.wordCount");
|
|
87
|
+
return this.payload.word_count;
|
|
88
|
+
}
|
|
89
|
+
setWordCount(value) {
|
|
90
|
+
this.checkDisposed("Session.setWordCount");
|
|
91
|
+
if (this.wordCount !== value) {
|
|
92
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
93
|
+
batch.setPathValue(['payload', 'word_count'], value);
|
|
94
|
+
batch.commit();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
get activity() {
|
|
98
|
+
this.checkDisposed("Session.activity");
|
|
99
|
+
return this.payload.activity;
|
|
100
|
+
}
|
|
101
|
+
recordActivity(newActivity) {
|
|
102
|
+
this.checkDisposed("Session.recordActivity");
|
|
103
|
+
// TODO: instead of rebuilding the activity list completely on every change,
|
|
104
|
+
// update only the deeply-nested fields within the Activity array.
|
|
105
|
+
let newActivities = [];
|
|
106
|
+
let replaced = false;
|
|
107
|
+
// Iterate through the activities in the session, replacing any existing activities with new ones (having
|
|
108
|
+
// updated word-counts and timestamps) and summing them all up to produce the session-total-word-count.
|
|
109
|
+
let sessionWordCount = 0;
|
|
110
|
+
let existingActivities = this.payload.activity;
|
|
111
|
+
for (let i = 0, len = existingActivities.length; i < len; i++) {
|
|
112
|
+
let existingActivity = existingActivities[i];
|
|
113
|
+
if (existingActivity.id === newActivity.id) {
|
|
114
|
+
if (newActivity.hasOwnProperty("word_count")) {
|
|
115
|
+
sessionWordCount += newActivity.word_count;
|
|
116
|
+
}
|
|
117
|
+
newActivities.push(newActivity);
|
|
118
|
+
replaced = true;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
newActivities.push(existingActivity);
|
|
122
|
+
if (existingActivity.hasOwnProperty("word_count")) {
|
|
123
|
+
sessionWordCount += existingActivity.word_count;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (replaced === false) {
|
|
128
|
+
newActivities.push(newActivity);
|
|
129
|
+
if (newActivity.hasOwnProperty("word_count")) {
|
|
130
|
+
sessionWordCount += newActivity.word_count;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const now = Time_1.MultiClock.now();
|
|
134
|
+
const batch = new Operation_1.BatchOperation(this, now);
|
|
135
|
+
batch.setPathValue(['payload', 'end'], now);
|
|
136
|
+
if (this.wordCount !== sessionWordCount) {
|
|
137
|
+
batch.setPathValue(['payload', 'word_count'], sessionWordCount);
|
|
138
|
+
}
|
|
139
|
+
if (!Struct_1.Struct.equals(existingActivities, newActivities)) {
|
|
140
|
+
batch.setPathValue(['payload', 'activity'], newActivities);
|
|
141
|
+
}
|
|
142
|
+
batch.commit();
|
|
143
|
+
}
|
|
144
|
+
async modelUpdated() {
|
|
145
|
+
this.checkDisposed("Session.modelUpdated");
|
|
146
|
+
await super.modelUpdated();
|
|
147
|
+
const shareSync = this.shareSync;
|
|
148
|
+
const sessionId = this.id;
|
|
149
|
+
const userId = this.owner;
|
|
150
|
+
const date = Time_1.Time.dateFrom(this.createdAt.local_time);
|
|
151
|
+
const workspaceId = Workspace_1.Workspace.makeWorkspaceId(userId);
|
|
152
|
+
const workspace = await this.shareSync.acquire(ContentKind_1.ContentKind.WORKSPACE, workspaceId);
|
|
153
|
+
const sessionsOnDate = await workspace.acquireSessionsFromDate(sessionId, date);
|
|
154
|
+
workspace.release();
|
|
155
|
+
let wordCountOnDate = 0;
|
|
156
|
+
let minutesWritingOnDate = 0;
|
|
157
|
+
for (let i = 0, len = sessionsOnDate.length; i < len; i++) {
|
|
158
|
+
const sessionOnDate = sessionsOnDate[i];
|
|
159
|
+
wordCountOnDate += sessionOnDate.wordCount;
|
|
160
|
+
minutesWritingOnDate += sessionOnDate.durationMinutes;
|
|
161
|
+
sessionOnDate.release();
|
|
162
|
+
}
|
|
163
|
+
const wordCountMetricId = Metric_1.Metric.makeMetricId(userId, Metric_1.MetricName.WORD_COUNT);
|
|
164
|
+
const wordCountMetric = await shareSync.acquire(ContentKind_1.ContentKind.METRIC, wordCountMetricId);
|
|
165
|
+
wordCountMetric.setDateAmount(date, wordCountOnDate);
|
|
166
|
+
wordCountMetric.release();
|
|
167
|
+
const minutesWritingMetricId = Metric_1.Metric.makeMetricId(userId, Metric_1.MetricName.MINUTES_WRITING);
|
|
168
|
+
const minutesWritingMetric = await shareSync.acquire(ContentKind_1.ContentKind.METRIC, minutesWritingMetricId);
|
|
169
|
+
minutesWritingMetric.setDateAmount(date, minutesWritingOnDate);
|
|
170
|
+
minutesWritingMetric.release();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.Session = Session;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare enum SpeechDataType {
|
|
2
|
+
AUDIO_MP3 = "audio_mp3",
|
|
3
|
+
AUDIO_OGG = "audio_ogg",
|
|
4
|
+
META_WORD_MARKS = "meta_word_marks"
|
|
5
|
+
}
|
|
6
|
+
export declare enum SpeechProvider {
|
|
7
|
+
AWS = "aws",
|
|
8
|
+
ELEVEN_LABS = "eleven_labs"
|
|
9
|
+
}
|
|
10
|
+
export declare enum SpeechEngine {
|
|
11
|
+
STANDARD = "standard",
|
|
12
|
+
NEURAL = "neural"
|
|
13
|
+
}
|
|
14
|
+
export declare enum SpeechLanguage {
|
|
15
|
+
ENGLISH = "English"
|
|
16
|
+
}
|
|
17
|
+
export declare enum SpeechDialect {
|
|
18
|
+
US = "US",
|
|
19
|
+
AU = "AU",
|
|
20
|
+
GB = "GB",
|
|
21
|
+
IN = "IN"
|
|
22
|
+
}
|
|
23
|
+
export declare enum SpeechGender {
|
|
24
|
+
MALE = "Male",
|
|
25
|
+
FEMALE = "Female"
|
|
26
|
+
}
|
|
27
|
+
export declare enum SpeechAge {
|
|
28
|
+
ADULT = "Adult",
|
|
29
|
+
CHILD = "Child",
|
|
30
|
+
ELDERLY = "Elderly"
|
|
31
|
+
}
|
|
32
|
+
export interface SpeechMarkItem {
|
|
33
|
+
time: number;
|
|
34
|
+
type: string;
|
|
35
|
+
start: number;
|
|
36
|
+
end: number;
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class SpeechPersona {
|
|
40
|
+
static readonly AMY: SpeechPersona;
|
|
41
|
+
static readonly BRIAN: SpeechPersona;
|
|
42
|
+
static readonly EMMA: SpeechPersona;
|
|
43
|
+
static readonly IVY: SpeechPersona;
|
|
44
|
+
static readonly JOANNA: SpeechPersona;
|
|
45
|
+
static readonly JOEY: SpeechPersona;
|
|
46
|
+
static readonly JUSTIN: SpeechPersona;
|
|
47
|
+
static readonly KENDRA: SpeechPersona;
|
|
48
|
+
static readonly KEVIN: SpeechPersona;
|
|
49
|
+
static readonly KIMBERY: SpeechPersona;
|
|
50
|
+
static readonly MATTHEW: SpeechPersona;
|
|
51
|
+
static readonly SALLI: SpeechPersona;
|
|
52
|
+
static readonly DAVID: SpeechPersona;
|
|
53
|
+
static readonly RACHEL: SpeechPersona;
|
|
54
|
+
static readonly DEFAULT: SpeechPersona;
|
|
55
|
+
static readonly ALL: SpeechPersona[];
|
|
56
|
+
code: string;
|
|
57
|
+
name: string;
|
|
58
|
+
provider: SpeechProvider;
|
|
59
|
+
engine: SpeechEngine;
|
|
60
|
+
language: SpeechLanguage;
|
|
61
|
+
dialect: SpeechDialect;
|
|
62
|
+
gender: SpeechGender;
|
|
63
|
+
age: SpeechAge;
|
|
64
|
+
constructor(code: string, name: string, provider: SpeechProvider, engine: SpeechEngine, language: SpeechLanguage, dialect: SpeechDialect, gender: SpeechGender, age: SpeechAge);
|
|
65
|
+
static byName(name: string): SpeechPersona;
|
|
66
|
+
getLangaugeCode(): string;
|
|
67
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpeechPersona = exports.SpeechAge = exports.SpeechGender = exports.SpeechDialect = exports.SpeechLanguage = exports.SpeechEngine = exports.SpeechProvider = exports.SpeechDataType = void 0;
|
|
4
|
+
var SpeechDataType;
|
|
5
|
+
(function (SpeechDataType) {
|
|
6
|
+
SpeechDataType["AUDIO_MP3"] = "audio_mp3";
|
|
7
|
+
SpeechDataType["AUDIO_OGG"] = "audio_ogg";
|
|
8
|
+
SpeechDataType["META_WORD_MARKS"] = "meta_word_marks";
|
|
9
|
+
})(SpeechDataType || (exports.SpeechDataType = SpeechDataType = {}));
|
|
10
|
+
var SpeechProvider;
|
|
11
|
+
(function (SpeechProvider) {
|
|
12
|
+
SpeechProvider["AWS"] = "aws";
|
|
13
|
+
SpeechProvider["ELEVEN_LABS"] = "eleven_labs";
|
|
14
|
+
})(SpeechProvider || (exports.SpeechProvider = SpeechProvider = {}));
|
|
15
|
+
var SpeechEngine;
|
|
16
|
+
(function (SpeechEngine) {
|
|
17
|
+
SpeechEngine["STANDARD"] = "standard";
|
|
18
|
+
SpeechEngine["NEURAL"] = "neural";
|
|
19
|
+
})(SpeechEngine || (exports.SpeechEngine = SpeechEngine = {}));
|
|
20
|
+
;
|
|
21
|
+
var SpeechLanguage;
|
|
22
|
+
(function (SpeechLanguage) {
|
|
23
|
+
SpeechLanguage["ENGLISH"] = "English";
|
|
24
|
+
})(SpeechLanguage || (exports.SpeechLanguage = SpeechLanguage = {}));
|
|
25
|
+
;
|
|
26
|
+
var SpeechDialect;
|
|
27
|
+
(function (SpeechDialect) {
|
|
28
|
+
SpeechDialect["US"] = "US";
|
|
29
|
+
SpeechDialect["AU"] = "AU";
|
|
30
|
+
SpeechDialect["GB"] = "GB";
|
|
31
|
+
SpeechDialect["IN"] = "IN";
|
|
32
|
+
})(SpeechDialect || (exports.SpeechDialect = SpeechDialect = {}));
|
|
33
|
+
var SpeechGender;
|
|
34
|
+
(function (SpeechGender) {
|
|
35
|
+
SpeechGender["MALE"] = "Male";
|
|
36
|
+
SpeechGender["FEMALE"] = "Female";
|
|
37
|
+
})(SpeechGender || (exports.SpeechGender = SpeechGender = {}));
|
|
38
|
+
var SpeechAge;
|
|
39
|
+
(function (SpeechAge) {
|
|
40
|
+
SpeechAge["ADULT"] = "Adult";
|
|
41
|
+
SpeechAge["CHILD"] = "Child";
|
|
42
|
+
SpeechAge["ELDERLY"] = "Elderly";
|
|
43
|
+
})(SpeechAge || (exports.SpeechAge = SpeechAge = {}));
|
|
44
|
+
class SpeechPersona {
|
|
45
|
+
constructor(code, name, provider, engine, language, dialect, gender, age) {
|
|
46
|
+
this.code = code;
|
|
47
|
+
this.name = name;
|
|
48
|
+
this.provider = provider;
|
|
49
|
+
this.engine = engine;
|
|
50
|
+
this.language = language;
|
|
51
|
+
this.dialect = dialect;
|
|
52
|
+
this.gender = gender;
|
|
53
|
+
this.age = age;
|
|
54
|
+
}
|
|
55
|
+
static byName(name) {
|
|
56
|
+
name = name.toLowerCase();
|
|
57
|
+
for (let i = 0; i < SpeechPersona.ALL.length; i++) {
|
|
58
|
+
const persona = SpeechPersona.ALL[i];
|
|
59
|
+
if (persona.name.toLowerCase() == name) {
|
|
60
|
+
return persona;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
getLangaugeCode() {
|
|
66
|
+
if (this.language === SpeechLanguage.ENGLISH) {
|
|
67
|
+
if (this.dialect === SpeechDialect.US) {
|
|
68
|
+
return "en-US";
|
|
69
|
+
}
|
|
70
|
+
else if (this.dialect === SpeechDialect.GB) {
|
|
71
|
+
return "en-GB";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.SpeechPersona = SpeechPersona;
|
|
78
|
+
SpeechPersona.AMY = new SpeechPersona("00", "Amy", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.GB, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
79
|
+
SpeechPersona.BRIAN = new SpeechPersona("01", "Brian", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.GB, SpeechGender.MALE, SpeechAge.ADULT);
|
|
80
|
+
SpeechPersona.EMMA = new SpeechPersona("02", "Emma", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.GB, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
81
|
+
SpeechPersona.IVY = new SpeechPersona("03", "Ivy", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.FEMALE, SpeechAge.CHILD);
|
|
82
|
+
SpeechPersona.JOANNA = new SpeechPersona("04", "Joanna", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
83
|
+
SpeechPersona.JOEY = new SpeechPersona("05", "Joey", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.MALE, SpeechAge.ADULT);
|
|
84
|
+
SpeechPersona.JUSTIN = new SpeechPersona("06", "Justin", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.MALE, SpeechAge.CHILD);
|
|
85
|
+
SpeechPersona.KENDRA = new SpeechPersona("07", "Kendra", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
86
|
+
SpeechPersona.KEVIN = new SpeechPersona("08", "Kevin", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.MALE, SpeechAge.CHILD);
|
|
87
|
+
SpeechPersona.KIMBERY = new SpeechPersona("09", "Kimberly", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
88
|
+
SpeechPersona.MATTHEW = new SpeechPersona("0a", "Matthew", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.MALE, SpeechAge.ADULT);
|
|
89
|
+
SpeechPersona.SALLI = new SpeechPersona("0b", "Salli", SpeechProvider.AWS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
90
|
+
SpeechPersona.DAVID = new SpeechPersona("5FlhwUeTKmBbKy4nphG3", "David", SpeechProvider.ELEVEN_LABS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.MALE, SpeechAge.ADULT);
|
|
91
|
+
SpeechPersona.RACHEL = new SpeechPersona("nTeH5Tfb8NMpR0YHgOSI", "Rachel", SpeechProvider.ELEVEN_LABS, SpeechEngine.NEURAL, SpeechLanguage.ENGLISH, SpeechDialect.US, SpeechGender.FEMALE, SpeechAge.ADULT);
|
|
92
|
+
SpeechPersona.DEFAULT = SpeechPersona.JOANNA;
|
|
93
|
+
SpeechPersona.ALL = [
|
|
94
|
+
SpeechPersona.AMY, SpeechPersona.BRIAN, SpeechPersona.EMMA, SpeechPersona.IVY, SpeechPersona.JOANNA, SpeechPersona.JOEY,
|
|
95
|
+
SpeechPersona.JUSTIN, SpeechPersona.KENDRA, SpeechPersona.KEVIN, SpeechPersona.KIMBERY, SpeechPersona.MATTHEW, SpeechPersona.SALLI,
|
|
96
|
+
SpeechPersona.DAVID, SpeechPersona.RACHEL
|
|
97
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ArrayView } from "./ArrayView";
|
|
2
|
+
import { ContentId, ContentRef } from "./Content";
|
|
3
|
+
import { ContentKind } from "./ContentKind";
|
|
4
|
+
export interface Stub {
|
|
5
|
+
kind: ContentKind;
|
|
6
|
+
label: string;
|
|
7
|
+
parent?: ContentId;
|
|
8
|
+
children?: Stub[];
|
|
9
|
+
}
|
|
10
|
+
export interface FolderStub extends Stub {
|
|
11
|
+
id: ContentId;
|
|
12
|
+
}
|
|
13
|
+
export interface ContentStub extends Stub {
|
|
14
|
+
category?: string;
|
|
15
|
+
ref: ContentRef;
|
|
16
|
+
}
|
|
17
|
+
export declare class Stubs {
|
|
18
|
+
static idFromStub(stub: Stub): ContentId;
|
|
19
|
+
static refFromStub(stub: Stub): ContentRef;
|
|
20
|
+
static unflatten(stubs: Stub[]): Stub[];
|
|
21
|
+
static isFolderStub(stub: Stub): boolean;
|
|
22
|
+
static isContentStub(stub: Stub): boolean;
|
|
23
|
+
static insertStubAtActivePoint(stub: Stub, stubArrayView: ArrayView<Stub>, category: string, activeId: ContentId, defaultAtBeginning: boolean): number;
|
|
24
|
+
}
|