@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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Comment = void 0;
|
|
4
|
+
const ShareSync_1 = require("../../repo/ShareSync");
|
|
5
|
+
const Operation_1 = require("../markup/Operation");
|
|
6
|
+
const ContentKind_1 = require("./ContentKind");
|
|
7
|
+
const RichText_1 = require("./RichText");
|
|
8
|
+
const Time_1 = require("./Time");
|
|
9
|
+
class Comment extends RichText_1.RichText {
|
|
10
|
+
static create(userId, anchorContentRef) {
|
|
11
|
+
const now = Time_1.MultiClock.now();
|
|
12
|
+
const shareSync = ShareSync_1.ShareSyncFactory.get();
|
|
13
|
+
const commentId = shareSync.makeContentId();
|
|
14
|
+
return shareSync.createContent({
|
|
15
|
+
meta: {
|
|
16
|
+
ref: commentId,
|
|
17
|
+
is_head: true,
|
|
18
|
+
kind: ContentKind_1.ContentKind.COMMENT,
|
|
19
|
+
id: commentId,
|
|
20
|
+
owner: userId,
|
|
21
|
+
created_at: now,
|
|
22
|
+
updated_at: now,
|
|
23
|
+
checkpoints: []
|
|
24
|
+
},
|
|
25
|
+
payload: {
|
|
26
|
+
anchor: anchorContentRef,
|
|
27
|
+
richtext_flavor: RichText_1.RichTextFlavor.quill,
|
|
28
|
+
richtext_body: { ops: [] },
|
|
29
|
+
word_count: 0
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
34
|
+
super(doc, shouldAcquire, shareSync);
|
|
35
|
+
}
|
|
36
|
+
get payload() {
|
|
37
|
+
this.checkDisposed("Comment.payload");
|
|
38
|
+
return this.doc.data.payload;
|
|
39
|
+
}
|
|
40
|
+
get anchor() {
|
|
41
|
+
this.checkDisposed("Comment.anchor");
|
|
42
|
+
return this.payload.anchor;
|
|
43
|
+
}
|
|
44
|
+
setAnchor(value) {
|
|
45
|
+
this.checkDisposed("Comment.setAnchor");
|
|
46
|
+
if (this.anchor !== value) {
|
|
47
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
48
|
+
batch.setPathValue(['payload', 'anchor'], value);
|
|
49
|
+
batch.commit();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.Comment = Comment;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference path="../../../decs.d.ts" />
|
|
2
|
+
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
3
|
+
import { ShareSync } from '../../repo/ShareSync';
|
|
4
|
+
import { ArrayView } from './ArrayView';
|
|
5
|
+
import { ContentBody, ContentId, ContentMeta, ContentRef } from './Content';
|
|
6
|
+
import { MediaCropping } from './Media';
|
|
7
|
+
import { RichText, RichTextPayload } from './RichText';
|
|
8
|
+
export interface ConceptArtPayload extends RichTextPayload {
|
|
9
|
+
name: string;
|
|
10
|
+
media_ref: ContentRef;
|
|
11
|
+
references: ContentRef[];
|
|
12
|
+
cropping: MediaCropping;
|
|
13
|
+
}
|
|
14
|
+
export interface ConceptArtBody extends ContentBody {
|
|
15
|
+
meta: ContentMeta;
|
|
16
|
+
payload: ConceptArtPayload;
|
|
17
|
+
}
|
|
18
|
+
export declare class ConceptArt extends RichText {
|
|
19
|
+
private _referencesView;
|
|
20
|
+
constructor(doc: Doc, isCreating: boolean, shareSync: ShareSync);
|
|
21
|
+
get payload(): ConceptArtPayload;
|
|
22
|
+
static create(userId: ContentId, conceptArtId: ContentId, payload: ConceptArtPayload): ConceptArt;
|
|
23
|
+
static makeConceptArtIdForMedia(mediaId: ContentId): ContentId;
|
|
24
|
+
get name(): string;
|
|
25
|
+
setName(value: string, newWordCount: number): void;
|
|
26
|
+
get mediaRef(): ContentId;
|
|
27
|
+
get cropping(): MediaCropping;
|
|
28
|
+
setCropping(value: MediaCropping): void;
|
|
29
|
+
get references(): ArrayView<ContentRef>;
|
|
30
|
+
updateReferrer(referrerRef: ContentRef): Promise<void>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConceptArt = 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 ArrayView_1 = require("./ArrayView");
|
|
8
|
+
const ContentKind_1 = require("./ContentKind");
|
|
9
|
+
const RichText_1 = require("./RichText");
|
|
10
|
+
const Time_1 = require("./Time");
|
|
11
|
+
class ConceptArt extends RichText_1.RichText {
|
|
12
|
+
constructor(doc, isCreating, shareSync) {
|
|
13
|
+
super(doc, isCreating, shareSync);
|
|
14
|
+
this._referencesView = new ArrayView_1.ArrayView(this, ['payload', 'references']);
|
|
15
|
+
}
|
|
16
|
+
get payload() {
|
|
17
|
+
this.checkDisposed("ConceptArt.payload");
|
|
18
|
+
return this.doc.data.payload;
|
|
19
|
+
}
|
|
20
|
+
static create(userId, conceptArtId, payload) {
|
|
21
|
+
const now = Time_1.MultiClock.now();
|
|
22
|
+
return ShareSync_1.ShareSyncFactory.get().createContent({
|
|
23
|
+
meta: {
|
|
24
|
+
ref: conceptArtId,
|
|
25
|
+
is_head: true,
|
|
26
|
+
kind: ContentKind_1.ContentKind.CONCEPT_ART,
|
|
27
|
+
id: conceptArtId,
|
|
28
|
+
owner: userId,
|
|
29
|
+
created_at: now,
|
|
30
|
+
updated_at: now,
|
|
31
|
+
checkpoints: []
|
|
32
|
+
},
|
|
33
|
+
payload: payload
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static makeConceptArtIdForMedia(mediaId) {
|
|
37
|
+
return CachingHasher_1.CachingHasher.makeMd5ContentId(mediaId + "-" + ContentKind_1.ContentKind.CONCEPT_ART);
|
|
38
|
+
}
|
|
39
|
+
get name() {
|
|
40
|
+
this.checkDisposed("ConceptArt.name");
|
|
41
|
+
return this.payload.name;
|
|
42
|
+
}
|
|
43
|
+
setName(value, newWordCount) {
|
|
44
|
+
this.checkDisposed("ConceptArt.setName");
|
|
45
|
+
if (this.name != value) {
|
|
46
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
47
|
+
batch.editPathText(['payload', 'name'], value);
|
|
48
|
+
if (this.wordCount != newWordCount) {
|
|
49
|
+
batch.setPathValue(['payload', 'word_count'], newWordCount);
|
|
50
|
+
}
|
|
51
|
+
batch.commit();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
get mediaRef() {
|
|
55
|
+
this.checkDisposed("ConceptArt.mediaRef");
|
|
56
|
+
return this.payload.media_ref;
|
|
57
|
+
}
|
|
58
|
+
get cropping() {
|
|
59
|
+
this.checkDisposed("ConceptArt.cropping");
|
|
60
|
+
return this.payload.cropping;
|
|
61
|
+
}
|
|
62
|
+
setCropping(value) {
|
|
63
|
+
this.checkDisposed("ConceptArt.setCropping");
|
|
64
|
+
if (this.cropping !== value) {
|
|
65
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
66
|
+
batch.setPathValue(['payload', 'cropping'], value);
|
|
67
|
+
batch.commit();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
get references() {
|
|
71
|
+
this.checkDisposed("ConceptArt.references");
|
|
72
|
+
return this._referencesView;
|
|
73
|
+
}
|
|
74
|
+
async updateReferrer(referrerRef) {
|
|
75
|
+
this.checkDisposed("ConceptArt.updateReferrer");
|
|
76
|
+
const shareSync = ShareSync_1.ShareSyncFactory.get();
|
|
77
|
+
const fragment = await shareSync.acquire(ContentKind_1.ContentKind.FRAGMENT, referrerRef);
|
|
78
|
+
if (fragment.gallery.indexOf(this.id) < 0) {
|
|
79
|
+
fragment.gallery.push(this.id);
|
|
80
|
+
}
|
|
81
|
+
fragment.release();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.ConceptArt = ConceptArt;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference path="../../../decs.d.ts" />
|
|
2
|
+
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
3
|
+
import { ShareSync } from '../../repo/ShareSync';
|
|
4
|
+
import { BillingPayload } from "./Billing";
|
|
5
|
+
import { ContentKind } from './ContentKind';
|
|
6
|
+
import { DevicePayload } from './Device';
|
|
7
|
+
import { HanziPayload } from './Hanzi';
|
|
8
|
+
import { Model } from './Model';
|
|
9
|
+
import { PhrasePayload } from './Phrase';
|
|
10
|
+
import { ProfilePayload } from "./Profile";
|
|
11
|
+
import { CompactDateTime, MultiTime } from './Time';
|
|
12
|
+
import { UserPayload } from './User';
|
|
13
|
+
import { MediaPayload } from './Media';
|
|
14
|
+
declare enum ContentIdBrand {
|
|
15
|
+
}
|
|
16
|
+
declare enum ContentRefBrand {
|
|
17
|
+
}
|
|
18
|
+
export type ContentId = string & ContentIdBrand;
|
|
19
|
+
export type ContentRef = (string & ContentRefBrand) | ContentId;
|
|
20
|
+
export interface ParsedContentRef {
|
|
21
|
+
id: ContentId;
|
|
22
|
+
kind?: ContentKind;
|
|
23
|
+
timestamp?: CompactDateTime;
|
|
24
|
+
}
|
|
25
|
+
export interface ContentBody {
|
|
26
|
+
meta: ContentMeta;
|
|
27
|
+
payload: ContentPayload;
|
|
28
|
+
}
|
|
29
|
+
export interface ContentMeta {
|
|
30
|
+
ref: ContentRef;
|
|
31
|
+
kind: ContentKind;
|
|
32
|
+
is_head: boolean;
|
|
33
|
+
id: ContentId;
|
|
34
|
+
owner: ContentId;
|
|
35
|
+
created_at: MultiTime;
|
|
36
|
+
updated_at: MultiTime;
|
|
37
|
+
}
|
|
38
|
+
export type ContentPayload = BillingPayload | HanziPayload | PhrasePayload | DevicePayload | MediaPayload | ProfilePayload | UserPayload;
|
|
39
|
+
export declare abstract class Content extends Model {
|
|
40
|
+
static ID_LENGTH: number;
|
|
41
|
+
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
42
|
+
get isHead(): boolean;
|
|
43
|
+
get meta(): ContentMeta;
|
|
44
|
+
get payload(): ContentPayload;
|
|
45
|
+
cloneContentBody(): ContentBody;
|
|
46
|
+
get id(): ContentId;
|
|
47
|
+
get updatedAt(): MultiTime;
|
|
48
|
+
get createdAt(): MultiTime;
|
|
49
|
+
get owner(): ContentId;
|
|
50
|
+
modelUpdated(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Content = void 0;
|
|
4
|
+
const Struct_1 = require("../../util/Struct");
|
|
5
|
+
const Model_1 = require("./Model");
|
|
6
|
+
var ContentIdBrand;
|
|
7
|
+
(function (ContentIdBrand) {
|
|
8
|
+
})(ContentIdBrand || (ContentIdBrand = {}));
|
|
9
|
+
var ContentRefBrand;
|
|
10
|
+
(function (ContentRefBrand) {
|
|
11
|
+
})(ContentRefBrand || (ContentRefBrand = {}));
|
|
12
|
+
class Content extends Model_1.Model {
|
|
13
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
14
|
+
super(doc, shouldAcquire, shareSync);
|
|
15
|
+
}
|
|
16
|
+
get isHead() {
|
|
17
|
+
this.checkDisposed("Content.isHead");
|
|
18
|
+
return this.meta.is_head;
|
|
19
|
+
}
|
|
20
|
+
get meta() {
|
|
21
|
+
this.checkDisposed("Content.meta");
|
|
22
|
+
return this.doc.data.meta;
|
|
23
|
+
}
|
|
24
|
+
get payload() {
|
|
25
|
+
this.checkDisposed("Content.payload");
|
|
26
|
+
return this.doc.data.payload;
|
|
27
|
+
}
|
|
28
|
+
cloneContentBody() {
|
|
29
|
+
this.checkDisposed("Content.cloneContentBody");
|
|
30
|
+
if (this.exists()) {
|
|
31
|
+
return Struct_1.Struct.clone(this.doc.data);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
get id() {
|
|
38
|
+
this.checkDisposed("Content.id");
|
|
39
|
+
return this.meta.id;
|
|
40
|
+
}
|
|
41
|
+
get updatedAt() {
|
|
42
|
+
this.checkDisposed("Content.updatedAt");
|
|
43
|
+
return this.meta.updated_at;
|
|
44
|
+
}
|
|
45
|
+
get createdAt() {
|
|
46
|
+
this.checkDisposed("Content.createdAt");
|
|
47
|
+
return this.meta.created_at;
|
|
48
|
+
}
|
|
49
|
+
get owner() {
|
|
50
|
+
this.checkDisposed("Content.owner");
|
|
51
|
+
return this.meta.owner;
|
|
52
|
+
}
|
|
53
|
+
async modelUpdated() {
|
|
54
|
+
this.checkDisposed("Content.modelUpdated");
|
|
55
|
+
this.acquire();
|
|
56
|
+
await this.shareSync.updateManifestForContent(this);
|
|
57
|
+
this.release();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.Content = Content;
|
|
61
|
+
Content.ID_LENGTH = 16;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentKind = void 0;
|
|
4
|
+
var ContentKind;
|
|
5
|
+
(function (ContentKind) {
|
|
6
|
+
// These are all the current Content subclasses
|
|
7
|
+
ContentKind["BILLING"] = "billing";
|
|
8
|
+
ContentKind["DEVICE"] = "device";
|
|
9
|
+
ContentKind["METRIC"] = "metric";
|
|
10
|
+
ContentKind["PROFILE"] = "profile";
|
|
11
|
+
ContentKind["SESSION"] = "session";
|
|
12
|
+
ContentKind["USER"] = "user";
|
|
13
|
+
ContentKind["MEDIA"] = "media";
|
|
14
|
+
// These are used in the ShareDB system, but for internal bookkeeping, not for Content subclasses.
|
|
15
|
+
ContentKind["MANIFEST"] = "manifest";
|
|
16
|
+
})(ContentKind || (exports.ContentKind = ContentKind = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference path="../../../decs.d.ts" />
|
|
2
|
+
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
3
|
+
import { ShareSync } from '../../repo/ShareSync';
|
|
4
|
+
import { JsonPath } from '../markup/Operation';
|
|
5
|
+
import { ArrayView } from './ArrayView';
|
|
6
|
+
import { BookPayload, BookStubArrayKey } from './Book';
|
|
7
|
+
import { Content, ContentBody, ContentId, ContentMeta, ContentRef } from "./Content";
|
|
8
|
+
import { Stub } from "./Stub";
|
|
9
|
+
import { WorkspacePayload, WorkspaceStubArrayKey } from './Workspace';
|
|
10
|
+
export type StubArrayKey = BookStubArrayKey | WorkspaceStubArrayKey;
|
|
11
|
+
export interface ContextBody extends ContentBody {
|
|
12
|
+
meta: ContentMeta;
|
|
13
|
+
payload: WorkspacePayload | BookPayload;
|
|
14
|
+
}
|
|
15
|
+
export declare abstract class Context extends Content {
|
|
16
|
+
protected _trashView: ArrayView<Stub>;
|
|
17
|
+
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
18
|
+
get trash(): ArrayView<Stub>;
|
|
19
|
+
abstract getStubArrayKeys(): StubArrayKey[];
|
|
20
|
+
abstract getStubArrayView(key: StubArrayKey): ArrayView<Stub>;
|
|
21
|
+
findPathToStub(ref: ContentRef): JsonPath;
|
|
22
|
+
removeStubAtPath(path: JsonPath, moveToTrash: boolean): void;
|
|
23
|
+
getStubAtPath(path: JsonPath): Stub;
|
|
24
|
+
setStubFieldValue(ref: ContentRef, fieldName: string, value: any): void;
|
|
25
|
+
editStubFieldText(ref: ContentRef, fieldName: string, value: string): void;
|
|
26
|
+
addFolder(stub: Stub, key: StubArrayKey, activeId?: ContentId): void;
|
|
27
|
+
mergeIncomingContext(incomingContextBody: ContextBody): boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Context = void 0;
|
|
4
|
+
const Struct_1 = require("../../util/Struct");
|
|
5
|
+
const Operation_1 = require("../markup/Operation");
|
|
6
|
+
const ArrayView_1 = require("./ArrayView");
|
|
7
|
+
const Content_1 = require("./Content");
|
|
8
|
+
const Stub_1 = require("./Stub");
|
|
9
|
+
class Context extends Content_1.Content {
|
|
10
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
11
|
+
super(doc, shouldAcquire, shareSync);
|
|
12
|
+
this._trashView = new ArrayView_1.ArrayView(this, ['payload', 'trash']);
|
|
13
|
+
}
|
|
14
|
+
get trash() {
|
|
15
|
+
this.checkDisposed("Context.trash");
|
|
16
|
+
return this._trashView;
|
|
17
|
+
}
|
|
18
|
+
findPathToStub(ref) {
|
|
19
|
+
this.checkDisposed("Context.findPathToStub");
|
|
20
|
+
const arrayKeys = this.getStubArrayKeys();
|
|
21
|
+
for (let i = 0, len = arrayKeys.length; i < len; i++) {
|
|
22
|
+
const key = arrayKeys[i];
|
|
23
|
+
const view = this.getStubArrayView(key);
|
|
24
|
+
if (view) {
|
|
25
|
+
const index = view.firstIndexWhere((stub) => {
|
|
26
|
+
return (Stub_1.Stubs.isContentStub(stub) && stub.ref == ref)
|
|
27
|
+
|| (Stub_1.Stubs.isFolderStub(stub) && stub.id == ref);
|
|
28
|
+
});
|
|
29
|
+
if (index >= 0) {
|
|
30
|
+
return ['payload', key, index];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
removeStubAtPath(path, moveToTrash) {
|
|
37
|
+
this.checkDisposed("Context.removeStubAtPath");
|
|
38
|
+
// Make sure this stub isn't already in the trash
|
|
39
|
+
const stubArrayKey = path[1];
|
|
40
|
+
if (stubArrayKey === "trash") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// If the stub has a parent, take note of it, so that we can reassign parentage for all orphans or the removed stub.
|
|
44
|
+
const stubToDelete = this.getStubAtPath(path);
|
|
45
|
+
const stubIdToDelete = Stub_1.Stubs.idFromStub(stubToDelete);
|
|
46
|
+
const grandparentId = stubToDelete.parent;
|
|
47
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
48
|
+
// Reparent all stubs that previously referred to this stub as their parent.
|
|
49
|
+
// If this stub has no parent, then remove the parent property from all of its children.
|
|
50
|
+
const stubArrayView = this.getStubArrayView(stubArrayKey);
|
|
51
|
+
for (let i = 0, len = stubArrayView.length; i < len; i++) {
|
|
52
|
+
const stub = stubArrayView.get(i);
|
|
53
|
+
if (stub.parent === stubIdToDelete) {
|
|
54
|
+
const pathToParentProperty = ['payload', stubArrayKey, i, 'parent'];
|
|
55
|
+
if (grandparentId) {
|
|
56
|
+
batch.replaceValueAtPath(pathToParentProperty, grandparentId);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
batch.removeValueAtPath(pathToParentProperty);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Remove the parentage of the deleted stub
|
|
64
|
+
if (grandparentId) {
|
|
65
|
+
const pathToParentProperty = Struct_1.Struct.clone(path);
|
|
66
|
+
pathToParentProperty.push('parent');
|
|
67
|
+
batch.removeValueAtPath(pathToParentProperty);
|
|
68
|
+
}
|
|
69
|
+
// Finally, either remove the deleted stub entirely, or move it to the trash.
|
|
70
|
+
if (moveToTrash) {
|
|
71
|
+
const trashStubCount = this._trashView.length;
|
|
72
|
+
batch.move(path, ['payload', 'trash', trashStubCount]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
batch.removeValueAtPath(path);
|
|
76
|
+
}
|
|
77
|
+
batch.commit();
|
|
78
|
+
}
|
|
79
|
+
getStubAtPath(path) {
|
|
80
|
+
this.checkDisposed("Context.getStubAtPath");
|
|
81
|
+
return Operation_1.JsonPathSelect.getValueAtPath(this.doc, path);
|
|
82
|
+
}
|
|
83
|
+
setStubFieldValue(ref, fieldName, value) {
|
|
84
|
+
this.checkDisposed("Context.setStubFieldValue");
|
|
85
|
+
const path = this.findPathToStub(ref);
|
|
86
|
+
if (fieldName !== 'label' && fieldName != 'category') {
|
|
87
|
+
throw new Error(`setting unexpected fieldName '${fieldName}' to value ${JSON.stringify(value)}`);
|
|
88
|
+
}
|
|
89
|
+
if (path !== null) {
|
|
90
|
+
path.push(fieldName);
|
|
91
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
92
|
+
batch.setPathValue(path, value);
|
|
93
|
+
batch.commit();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
editStubFieldText(ref, fieldName, value) {
|
|
97
|
+
this.checkDisposed("Context.setStubFieldValue");
|
|
98
|
+
const path = this.findPathToStub(ref);
|
|
99
|
+
if (fieldName !== 'label' && fieldName != 'category') {
|
|
100
|
+
throw new Error(`setting unexpected fieldName '${fieldName}' to value '${value}'`);
|
|
101
|
+
}
|
|
102
|
+
if (path !== null) {
|
|
103
|
+
path.push(fieldName);
|
|
104
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
105
|
+
batch.editPathText(path, value);
|
|
106
|
+
batch.commit();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
addFolder(stub, key, activeId) {
|
|
110
|
+
this.checkDisposed("Context.addFolder");
|
|
111
|
+
const stubArrayView = this.getStubArrayView(key);
|
|
112
|
+
Stub_1.Stubs.insertStubAtActivePoint(stub, stubArrayView, null, activeId, false);
|
|
113
|
+
}
|
|
114
|
+
mergeIncomingContext(incomingContextBody) {
|
|
115
|
+
let madeChanges = false;
|
|
116
|
+
// First, gather all the refs in this context, so that we can find any new incoming
|
|
117
|
+
// stubs that might need to be merged. It's important that we look through all potential
|
|
118
|
+
// stub arrays, because any individual stub may have been moved between arrays. We only
|
|
119
|
+
// want to merge in new stubs if they don't already exist anywhere in this context.
|
|
120
|
+
const stubIds = new Set();
|
|
121
|
+
const stubArrayKeys = this.getStubArrayKeys();
|
|
122
|
+
for (let i = 0; i < stubArrayKeys.length; i++) {
|
|
123
|
+
const stubArrayKey = stubArrayKeys[i];
|
|
124
|
+
const stubArrayView = this.getStubArrayView(stubArrayKey);
|
|
125
|
+
stubArrayView.forEach((idx, stub) => {
|
|
126
|
+
stubIds.add(Stub_1.Stubs.idFromStub(stub));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Next, merge in any new stubs from the incoming context.
|
|
130
|
+
const incomingPayload = incomingContextBody.payload;
|
|
131
|
+
for (let i = 0; i < stubArrayKeys.length; i++) {
|
|
132
|
+
const stubArrayKey = stubArrayKeys[i];
|
|
133
|
+
const stubArrayView = this.getStubArrayView(stubArrayKey);
|
|
134
|
+
if (incomingPayload.hasOwnProperty(stubArrayKey)) {
|
|
135
|
+
const incomingStubArray = incomingPayload[stubArrayKey];
|
|
136
|
+
for (let j = 0; j < incomingStubArray.length; j++) {
|
|
137
|
+
const incomingStub = incomingStubArray[j];
|
|
138
|
+
const incomingStubId = Stub_1.Stubs.idFromStub(incomingStub);
|
|
139
|
+
if (!stubIds.has(incomingStubId)) {
|
|
140
|
+
// This stub is not currently present in this context, so merge it in. We will
|
|
141
|
+
// attempt to add it to the corrent position in the array, but it's possible
|
|
142
|
+
// that the array has been reordered, so insertion of this stub might not be in
|
|
143
|
+
// quite the right position. But we're just trying to make sure that the stubs
|
|
144
|
+
// are all present, and this capabililty is only being included as a way of
|
|
145
|
+
// recovering from a migration bug that only affected a small number of users.
|
|
146
|
+
if (j < stubArrayView.length) {
|
|
147
|
+
stubArrayView.insert(j, incomingStub);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
stubArrayView.push(incomingStub);
|
|
151
|
+
}
|
|
152
|
+
// Add the new stub to the set of stubs we've already seen
|
|
153
|
+
stubIds.add(incomingStubId);
|
|
154
|
+
madeChanges = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return madeChanges;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.Context = Context;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DevEnv = void 0;
|
|
4
|
+
var DevEnv;
|
|
5
|
+
(function (DevEnv) {
|
|
6
|
+
DevEnv["LOCAL"] = "LOCAL";
|
|
7
|
+
DevEnv["STAGING"] = "STAGING";
|
|
8
|
+
DevEnv["PRODUCTION"] = "PRODUCTION";
|
|
9
|
+
})(DevEnv || (exports.DevEnv = DevEnv = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference path="../../../decs.d.ts" />
|
|
2
|
+
import { Doc } from '@shaxpir/sharedb/lib/client';
|
|
3
|
+
import { ShareSync } from '../../repo/ShareSync';
|
|
4
|
+
import { Content, ContentBody, ContentId, ContentMeta } from "./Content";
|
|
5
|
+
import { CompactDateTime } from './Time';
|
|
6
|
+
export interface LastSync {
|
|
7
|
+
at_utc_time: CompactDateTime;
|
|
8
|
+
}
|
|
9
|
+
export interface DevicePayload {
|
|
10
|
+
last_sync?: LastSync;
|
|
11
|
+
}
|
|
12
|
+
export interface DeviceBody extends ContentBody {
|
|
13
|
+
meta: ContentMeta;
|
|
14
|
+
payload: DevicePayload;
|
|
15
|
+
}
|
|
16
|
+
export declare class Device extends Content {
|
|
17
|
+
static makeProfleId(userId: ContentId): ContentId;
|
|
18
|
+
static create(userId: ContentId, deviceId: ContentId, theme: string, typeface: string, typesize: string): Device;
|
|
19
|
+
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
20
|
+
get payload(): DevicePayload;
|
|
21
|
+
get lastSyncAtUtcTime(): CompactDateTime;
|
|
22
|
+
setLastSyncAtUtcTime(value: CompactDateTime): void;
|
|
23
|
+
private ensureLastSyncAtUtcTimeExists;
|
|
24
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Device = 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 Device extends Content_1.Content {
|
|
11
|
+
static makeProfleId(userId) {
|
|
12
|
+
return CachingHasher_1.CachingHasher.makeMd5ContentId(userId + "-" + ContentKind_1.ContentKind.PROFILE);
|
|
13
|
+
}
|
|
14
|
+
static create(userId, deviceId, theme, typeface, typesize) {
|
|
15
|
+
const now = Time_1.MultiClock.now();
|
|
16
|
+
return ShareSync_1.ShareSyncFactory.get().createContent({
|
|
17
|
+
meta: {
|
|
18
|
+
ref: deviceId,
|
|
19
|
+
is_head: true,
|
|
20
|
+
kind: ContentKind_1.ContentKind.DEVICE,
|
|
21
|
+
id: deviceId,
|
|
22
|
+
owner: userId,
|
|
23
|
+
created_at: now,
|
|
24
|
+
updated_at: now
|
|
25
|
+
},
|
|
26
|
+
payload: {
|
|
27
|
+
last_sync: { at_utc_time: null }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
constructor(doc, shouldAcquire, shareSync) {
|
|
32
|
+
super(doc, shouldAcquire, shareSync);
|
|
33
|
+
}
|
|
34
|
+
get payload() {
|
|
35
|
+
this.checkDisposed("Device.payload");
|
|
36
|
+
return this.doc.data.payload;
|
|
37
|
+
}
|
|
38
|
+
get lastSyncAtUtcTime() {
|
|
39
|
+
this.checkDisposed("Device.lastSyncAtUtcTime");
|
|
40
|
+
this.ensureLastSyncAtUtcTimeExists();
|
|
41
|
+
return this.payload.last_sync.at_utc_time;
|
|
42
|
+
}
|
|
43
|
+
setLastSyncAtUtcTime(value) {
|
|
44
|
+
this.checkDisposed("Device.setLastSyncAtUtcTime");
|
|
45
|
+
this.ensureLastSyncAtUtcTimeExists();
|
|
46
|
+
if (this.lastSyncAtUtcTime !== value) {
|
|
47
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
48
|
+
batch.setPathValue(['payload', 'last_sync', 'at_utc_time'], value);
|
|
49
|
+
batch.commit();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
ensureLastSyncAtUtcTimeExists() {
|
|
53
|
+
this.checkDisposed("Device.ensureLastSyncAtUtcTimeExists");
|
|
54
|
+
// If the 'last_sync' field doesn't exist, add it first...
|
|
55
|
+
if (!this.payload.hasOwnProperty('last_sync')) {
|
|
56
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
57
|
+
batch.setPathValue(['payload', 'last_sync'], { at_utc_time: null });
|
|
58
|
+
batch.commit();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.Device = Device;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ContentMeta } from "./Content";
|
|
2
|
+
declare enum DictionaryIdBrand {
|
|
3
|
+
}
|
|
4
|
+
export type DictionaryId = (string & DictionaryIdBrand) | null;
|
|
5
|
+
export interface DictionaryEntry {
|
|
6
|
+
text: string;
|
|
7
|
+
repl?: string;
|
|
8
|
+
freq?: number;
|
|
9
|
+
score?: number;
|
|
10
|
+
phon?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ResolvedDictionary {
|
|
13
|
+
entries: {
|
|
14
|
+
[key: string]: DictionaryEntry;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface DictionaryBody {
|
|
18
|
+
meta: ContentMeta;
|
|
19
|
+
payload: DictionaryPayload;
|
|
20
|
+
}
|
|
21
|
+
export interface DictionaryPayload {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
include_dicts: DictionaryId[];
|
|
25
|
+
exclude_keys: string[];
|
|
26
|
+
entries: DictionaryEntry[];
|
|
27
|
+
}
|
|
28
|
+
export interface Dictionary extends DictionaryPayload {
|
|
29
|
+
resolved?: ResolvedDictionary;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface DictionaryEntry {
|
|
2
|
+
text: string;
|
|
3
|
+
rank: number;
|
|
4
|
+
learn_rank: number;
|
|
5
|
+
is_starred?: boolean;
|
|
6
|
+
tags: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface Pronouncable {
|
|
9
|
+
pinyin: string;
|
|
10
|
+
pinyin_tokenized?: string;
|
|
11
|
+
pinyin_normalized: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Definable {
|
|
14
|
+
definition: string;
|
|
15
|
+
definition_analysis: string;
|
|
16
|
+
translation?: string;
|
|
17
|
+
transliteration?: string;
|
|
18
|
+
function?: string;
|
|
19
|
+
usage?: string;
|
|
20
|
+
}
|