@shaxpir/duiduidui-models 1.0.1 → 1.2.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/dist/models/{content/ArrayView.d.ts → ArrayView.d.ts} +1 -1
- package/dist/models/{content/ArrayView.js → ArrayView.js} +14 -14
- package/dist/models/BayesianScore.d.ts +9 -0
- package/dist/models/BayesianScore.js +27 -0
- package/dist/models/{markup/ChangeModel.d.ts → ChangeModel.d.ts} +2 -3
- package/dist/models/{markup/ChangeModel.js → ChangeModel.js} +20 -10
- package/dist/models/{content/Content.d.ts → Content.d.ts} +9 -10
- package/dist/models/{content/Content.js → Content.js} +2 -6
- package/dist/models/{content/ContentKind.d.ts → ContentKind.d.ts} +3 -0
- package/dist/models/{content/ContentKind.js → ContentKind.js} +5 -1
- package/dist/models/{content/Device.d.ts → Device.d.ts} +15 -7
- package/dist/models/{content/Device.js → Device.js} +14 -18
- package/dist/models/Hanzi.d.ts +15 -0
- package/dist/models/{content/Manifest.d.ts → Manifest.d.ts} +7 -3
- package/dist/models/{content/Manifest.js → Manifest.js} +12 -8
- package/dist/models/{content/Media.d.ts → Media.d.ts} +2 -3
- package/dist/models/{content/Media.js → Media.js} +4 -5
- package/dist/models/{content/Metric.d.ts → Metric.d.ts} +2 -3
- package/dist/models/{content/Metric.js → Metric.js} +18 -20
- package/dist/models/{content/Model.d.ts → Model.d.ts} +3 -5
- package/dist/models/{content/Model.js → Model.js} +5 -6
- package/dist/models/{markup/Operation.d.ts → Operation.d.ts} +2 -5
- package/dist/models/{markup/Operation.js → Operation.js} +30 -25
- package/dist/models/Phrase.d.ts +39 -0
- package/dist/models/{content/Profile.d.ts → Profile.d.ts} +1 -2
- package/dist/models/{content/Profile.js → Profile.js} +7 -9
- package/dist/models/Progress.d.ts +26 -0
- package/dist/models/Progress.js +39 -0
- package/dist/models/Review.d.ts +14 -0
- package/dist/models/{content/Session.d.ts → Session.d.ts} +7 -15
- package/dist/models/Session.js +103 -0
- package/dist/models/Term.d.ts +36 -0
- package/dist/models/Term.js +82 -0
- package/dist/models/User.d.ts +32 -0
- package/dist/models/User.js +65 -0
- package/dist/models/Workspace.d.ts +37 -0
- package/dist/models/Workspace.js +94 -0
- package/dist/models/index.d.ts +22 -2
- package/dist/models/index.js +22 -2
- package/dist/repo/PermissiveJson1.d.ts +16 -16
- package/dist/repo/PermissiveJson1.js +17 -7
- package/dist/repo/ShareSync.d.ts +6 -6
- package/dist/repo/ShareSync.js +26 -19
- package/dist/repo/index.d.ts +1 -0
- package/dist/repo/index.js +1 -0
- package/dist/util/Encryption.d.ts +1 -1
- package/dist/util/index.d.ts +0 -6
- package/dist/util/index.js +0 -6
- package/lib/models/{content/ArrayView.ts → ArrayView.ts} +2 -2
- package/lib/models/BayesianScore.ts +32 -0
- package/lib/models/{markup/ChangeModel.ts → ChangeModel.ts} +3 -4
- package/lib/models/{content/Content.ts → Content.ts} +15 -18
- package/lib/models/{content/ContentKind.ts → ContentKind.ts} +6 -1
- package/lib/models/{content/Device.ts → Device.ts} +26 -22
- package/lib/models/Hanzi.ts +16 -0
- package/lib/models/{content/Manifest.ts → Manifest.ts} +15 -6
- package/lib/models/{content/Media.ts → Media.ts} +3 -4
- package/lib/models/Metric.ts +233 -0
- package/lib/models/{content/Model.ts → Model.ts} +4 -6
- package/lib/models/{markup/Operation.ts → Operation.ts} +6 -16
- package/lib/models/{content/Permissions.ts → Permissions.ts} +0 -2
- package/lib/models/Phrase.ts +53 -0
- package/lib/models/{content/Profile.ts → Profile.ts} +4 -6
- package/lib/models/Progress.ts +66 -0
- package/lib/models/Review.ts +18 -0
- package/lib/models/Session.ts +140 -0
- package/lib/models/Term.ts +139 -0
- package/lib/models/User.ts +97 -0
- package/lib/models/Workspace.ts +129 -0
- package/lib/models/index.ts +22 -2
- package/lib/repo/ShareSync.ts +9 -13
- package/lib/repo/index.ts +1 -0
- package/lib/util/Encryption.ts +1 -1
- package/lib/util/index.ts +0 -6
- package/package.json +4 -15
- package/dist/models/OutboundMessage.d.ts +0 -18
- package/dist/models/OutboundMessage.js +0 -25
- package/dist/models/content/Activity.d.ts +0 -10
- package/dist/models/content/Billing.d.ts +0 -144
- package/dist/models/content/Billing.js +0 -418
- package/dist/models/content/Book.d.ts +0 -77
- package/dist/models/content/Book.js +0 -407
- package/dist/models/content/Category.d.ts +0 -16
- package/dist/models/content/Category.js +0 -20
- package/dist/models/content/Checkpointable.d.ts +0 -21
- package/dist/models/content/Checkpointable.js +0 -156
- package/dist/models/content/Comment.d.ts +0 -19
- package/dist/models/content/Comment.js +0 -53
- package/dist/models/content/ConceptArt.d.ts +0 -31
- package/dist/models/content/ConceptArt.js +0 -84
- package/dist/models/content/Context.d.ts +0 -28
- package/dist/models/content/Context.js +0 -162
- package/dist/models/content/DevEnv.d.ts +0 -5
- package/dist/models/content/DevEnv.js +0 -9
- package/dist/models/content/Dictionary.d.ts +0 -31
- package/dist/models/content/Dictionary.js +0 -5
- package/dist/models/content/DictionaryEntry.d.ts +0 -20
- package/dist/models/content/DictionaryEntry.js +0 -2
- package/dist/models/content/ElasticModel.d.ts +0 -149
- package/dist/models/content/ElasticModel.js +0 -179
- package/dist/models/content/Environment.d.ts +0 -61
- package/dist/models/content/Environment.js +0 -124
- package/dist/models/content/ExportOptions.d.ts +0 -64
- package/dist/models/content/ExportOptions.js +0 -213
- package/dist/models/content/Folder.d.ts +0 -16
- package/dist/models/content/Folder.js +0 -33
- package/dist/models/content/Fragment.d.ts +0 -54
- package/dist/models/content/Fragment.js +0 -181
- package/dist/models/content/Hanzi.d.ts +0 -21
- package/dist/models/content/HighlightRule.d.ts +0 -9
- package/dist/models/content/HighlightRule.js +0 -2
- package/dist/models/content/Migration.d.ts +0 -68
- package/dist/models/content/Migration.js +0 -155
- package/dist/models/content/Phrase.d.ts +0 -8
- package/dist/models/content/Placeholder.d.ts +0 -8
- package/dist/models/content/Placeholder.js +0 -36
- package/dist/models/content/RichText.d.ts +0 -58
- package/dist/models/content/RichText.js +0 -79
- package/dist/models/content/Session.js +0 -173
- package/dist/models/content/Speech.d.ts +0 -67
- package/dist/models/content/Speech.js +0 -97
- package/dist/models/content/Stub.d.ts +0 -24
- package/dist/models/content/Stub.js +0 -179
- package/dist/models/content/Time.d.ts +0 -56
- package/dist/models/content/Time.js +0 -295
- package/dist/models/content/User.d.ts +0 -36
- package/dist/models/content/User.js +0 -95
- package/dist/models/content/Workspace.d.ts +0 -71
- package/dist/models/content/Workspace.js +0 -237
- package/dist/models/content/index.d.ts +0 -17
- package/dist/models/content/index.js +0 -34
- package/dist/models/legacy/LegacyBodyFormat.d.ts +0 -9
- package/dist/models/legacy/LegacyBodyFormat.js +0 -2
- package/dist/models/legacy/LegacyComment.d.ts +0 -12
- package/dist/models/legacy/LegacyComment.js +0 -2
- package/dist/models/legacy/LegacyContent.d.ts +0 -53
- package/dist/models/legacy/LegacyContent.js +0 -55
- package/dist/models/legacy/LegacyConversion.d.ts +0 -55
- package/dist/models/legacy/LegacyConversion.js +0 -401
- package/dist/models/legacy/LegacyFragment.d.ts +0 -21
- package/dist/models/legacy/LegacyFragment.js +0 -2
- package/dist/models/legacy/LegacyLocator.d.ts +0 -8
- package/dist/models/legacy/LegacyLocator.js +0 -31
- package/dist/models/legacy/LegacyOutboundMessage.d.ts +0 -16
- package/dist/models/legacy/LegacyOutboundMessage.js +0 -13
- package/dist/models/legacy/LegacyPicture.d.ts +0 -14
- package/dist/models/legacy/LegacyPicture.js +0 -2
- package/dist/models/legacy/LegacyProfile.d.ts +0 -9
- package/dist/models/legacy/LegacyProfile.js +0 -2
- package/dist/models/legacy/LegacySession.d.ts +0 -41
- package/dist/models/legacy/LegacySession.js +0 -35
- package/dist/models/legacy/LegacyStory.d.ts +0 -23
- package/dist/models/legacy/LegacyStory.js +0 -2
- package/dist/models/legacy/LegacyStub.d.ts +0 -15
- package/dist/models/legacy/LegacyStub.js +0 -2
- package/dist/models/legacy/LegacyTransaction.d.ts +0 -14
- package/dist/models/legacy/LegacyTransaction.js +0 -49
- package/dist/models/legacy/LegacyUser.d.ts +0 -28
- package/dist/models/legacy/LegacyUser.js +0 -32
- package/dist/models/legacy/LegacyWorkspace.d.ts +0 -23
- package/dist/models/legacy/LegacyWorkspace.js +0 -6
- package/dist/models/legacy/index.d.ts +0 -15
- package/dist/models/legacy/index.js +0 -32
- package/dist/models/markup/BodyFormat.d.ts +0 -14
- package/dist/models/markup/BodyFormat.js +0 -190
- package/dist/models/markup/DeltaOps.d.ts +0 -5
- package/dist/models/markup/DeltaOps.js +0 -74
- package/dist/models/markup/HtmlMarkup.d.ts +0 -4
- package/dist/models/markup/HtmlMarkup.js +0 -21
- package/dist/models/markup/index.d.ts +0 -4
- package/dist/models/markup/index.js +0 -21
- package/dist/util/Async.d.ts +0 -8
- package/dist/util/Async.js +0 -18
- package/dist/util/Base62.d.ts +0 -6
- package/dist/util/Base62.js +0 -47
- package/dist/util/BinarySearch.d.ts +0 -7
- package/dist/util/BinarySearch.js +0 -46
- package/dist/util/CachingHasher.d.ts +0 -8
- package/dist/util/CachingHasher.js +0 -41
- package/dist/util/Color.d.ts +0 -32
- package/dist/util/Color.js +0 -204
- package/dist/util/Dispatch.d.ts +0 -15
- package/dist/util/Dispatch.js +0 -79
- package/dist/util/EditDistance.d.ts +0 -13
- package/dist/util/EditDistance.js +0 -184
- package/dist/util/NumberFormat.d.ts +0 -14
- package/dist/util/NumberFormat.js +0 -224
- package/dist/util/Struct.d.ts +0 -4
- package/dist/util/Struct.js +0 -15
- package/dist/util/Template.d.ts +0 -16
- package/dist/util/Template.js +0 -128
- package/dist/util/Text.d.ts +0 -45
- package/dist/util/Text.js +0 -243
- package/dist/util/Tuples.d.ts +0 -9
- package/dist/util/Tuples.js +0 -135
- package/dist/util/Validate.d.ts +0 -4
- package/dist/util/Validate.js +0 -11
- package/dist/util/Vocabulary.d.ts +0 -3
- package/dist/util/Vocabulary.js +0 -35
- package/lib/models/content/Billing.ts +0 -558
- package/lib/models/content/DevEnv.ts +0 -5
- package/lib/models/content/DictionaryEntry.ts +0 -22
- package/lib/models/content/Hanzi.ts +0 -25
- package/lib/models/content/Phrase.ts +0 -10
- package/lib/models/content/Time.ts +0 -328
- package/lib/models/content/User.ts +0 -130
- package/lib/models/content/index.ts +0 -19
- package/lib/models/markup/DeltaOps.ts +0 -71
- package/lib/models/markup/index.ts +0 -6
- package/lib/util/Base62.ts +0 -47
- package/lib/util/CachingHasher.ts +0 -38
- package/lib/util/Dispatch.ts +0 -92
- package/lib/util/NumberFormat.ts +0 -194
- package/lib/util/Struct.ts +0 -14
- package/lib/util/Tuples.ts +0 -131
- /package/dist/models/{content/GeoLocation.d.ts → GeoLocation.d.ts} +0 -0
- /package/dist/models/{content/GeoLocation.js → GeoLocation.js} +0 -0
- /package/dist/models/{content/Hanzi.js → Hanzi.js} +0 -0
- /package/dist/models/{content/Permissions.d.ts → Permissions.d.ts} +0 -0
- /package/dist/models/{content/Permissions.js → Permissions.js} +0 -0
- /package/dist/models/{content/Phrase.js → Phrase.js} +0 -0
- /package/dist/models/{content/Activity.js → Review.js} +0 -0
- /package/dist/{models/markup → repo}/TextEditOps.d.ts +0 -0
- /package/dist/{models/markup → repo}/TextEditOps.js +0 -0
- /package/lib/models/{content/GeoLocation.ts → GeoLocation.ts} +0 -0
- /package/lib/{models/markup → repo}/TextEditOps.ts +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { BillingPayload } from "./Billing";
|
|
2
|
-
import { BookPayload } from "./Book";
|
|
3
|
-
import { Category } from './Category';
|
|
4
|
-
import { ContentId, ContentMeta, ContentRef } from './Content';
|
|
5
|
-
import { DictionaryPayload } from './Dictionary';
|
|
6
|
-
import { Connection, RobotLock } from "./Fragment";
|
|
7
|
-
import { ManifestEntry, ManifestMeta } from './Manifest';
|
|
8
|
-
import { MediaCropping, MediaPayload } from './Media';
|
|
9
|
-
import { MetricEntry } from './Metric';
|
|
10
|
-
import { MigrationPayload } from './Migration';
|
|
11
|
-
import { ProfilePayload } from "./Profile";
|
|
12
|
-
import { Format, RichTextFlavor } from './RichText';
|
|
13
|
-
import { SessionPayload } from "./Session";
|
|
14
|
-
import { CompactDate, CompactDateTime } from './Time';
|
|
15
|
-
import { ModernUserPayload } from './User';
|
|
16
|
-
import { JourneyEntry, WorkspacePayload } from "./Workspace";
|
|
17
|
-
export type ElasticBody = ManifestElasticBody | ContentElasticBody;
|
|
18
|
-
export interface ContentElasticBody {
|
|
19
|
-
meta: ContentMeta;
|
|
20
|
-
payload: ElasticPayload;
|
|
21
|
-
}
|
|
22
|
-
export type ElasticPayload = BillingPayload | BookPayload | MediaPayload | ProfilePayload | SessionPayload | ModernUserPayload | MigrationPayload | DictionaryPayload | CommentElasticPayload | MetricElasticPayload | FragmentElasticPayload | ConceptArtElasticPayload | RichTextElasticPayload | DeviceElasticPayload | WorkspaceElasticPayload;
|
|
23
|
-
export interface RichTextElasticPayload {
|
|
24
|
-
richtext_flavor: RichTextFlavor;
|
|
25
|
-
richtext_body_text: string;
|
|
26
|
-
richtext_body_format: Format[];
|
|
27
|
-
word_count: number;
|
|
28
|
-
}
|
|
29
|
-
export interface CommentElasticPayload extends RichTextElasticPayload {
|
|
30
|
-
anchor: ContentRef;
|
|
31
|
-
}
|
|
32
|
-
export interface FragmentElasticPayload extends RichTextElasticPayload {
|
|
33
|
-
name: string;
|
|
34
|
-
category: Category;
|
|
35
|
-
books: ContentId[];
|
|
36
|
-
gallery: ContentRef[];
|
|
37
|
-
connections: Connection[];
|
|
38
|
-
robot_lock: RobotLock;
|
|
39
|
-
}
|
|
40
|
-
export interface ConceptArtElasticPayload extends RichTextElasticPayload {
|
|
41
|
-
name: string;
|
|
42
|
-
media_ref: ContentRef;
|
|
43
|
-
references: ContentRef[];
|
|
44
|
-
cropping: MediaCropping;
|
|
45
|
-
}
|
|
46
|
-
export interface DeviceElasticPayload {
|
|
47
|
-
tree_handle_closed_entries: ContentId[];
|
|
48
|
-
media_download_failed_at_entries: MediaDownloadFailedAtEntry[];
|
|
49
|
-
}
|
|
50
|
-
export interface MediaDownloadFailedAtEntry {
|
|
51
|
-
media_ref: ContentRef;
|
|
52
|
-
at_utc_time: CompactDateTime;
|
|
53
|
-
attempt: number;
|
|
54
|
-
}
|
|
55
|
-
export interface ManifestElasticPayload {
|
|
56
|
-
manifest_entries: ManifestEntry[];
|
|
57
|
-
}
|
|
58
|
-
export interface MetricElasticPayload {
|
|
59
|
-
metric_name: string;
|
|
60
|
-
min_date: CompactDate;
|
|
61
|
-
max_date: CompactDate;
|
|
62
|
-
metric_entries: MetricEntry[];
|
|
63
|
-
}
|
|
64
|
-
export interface WorkspaceElasticPayload extends WorkspacePayload {
|
|
65
|
-
journey_entries: JourneyEntry[];
|
|
66
|
-
}
|
|
67
|
-
export interface ManifestElasticBody {
|
|
68
|
-
meta: ManifestMeta;
|
|
69
|
-
payload: ManifestElasticPayload;
|
|
70
|
-
}
|
|
71
|
-
export interface CommentElasticBody extends ContentElasticBody {
|
|
72
|
-
meta: ContentMeta;
|
|
73
|
-
payload: CommentElasticPayload;
|
|
74
|
-
}
|
|
75
|
-
export interface ConceptArtElasticBody extends ContentElasticBody {
|
|
76
|
-
meta: ContentMeta;
|
|
77
|
-
payload: ConceptArtElasticPayload;
|
|
78
|
-
}
|
|
79
|
-
export interface FragmentElasticBody extends ContentElasticBody {
|
|
80
|
-
meta: ContentMeta;
|
|
81
|
-
payload: FragmentElasticPayload;
|
|
82
|
-
}
|
|
83
|
-
export interface MetricElasticBody extends ContentElasticBody {
|
|
84
|
-
meta: ContentMeta;
|
|
85
|
-
payload: MetricElasticPayload;
|
|
86
|
-
}
|
|
87
|
-
export interface RichTextElasticBody extends ContentElasticBody {
|
|
88
|
-
meta: ContentMeta;
|
|
89
|
-
payload: RichTextElasticPayload;
|
|
90
|
-
}
|
|
91
|
-
export interface DeviceElasticBody extends ContentElasticBody {
|
|
92
|
-
meta: ContentMeta;
|
|
93
|
-
payload: DeviceElasticPayload;
|
|
94
|
-
}
|
|
95
|
-
export interface BillingElasticBody extends ContentElasticBody {
|
|
96
|
-
meta: ContentMeta;
|
|
97
|
-
payload: BillingPayload;
|
|
98
|
-
}
|
|
99
|
-
export interface BookElasticBody extends ContentElasticBody {
|
|
100
|
-
meta: ContentMeta;
|
|
101
|
-
payload: BookPayload;
|
|
102
|
-
}
|
|
103
|
-
export interface MediaElasticBody extends ContentElasticBody {
|
|
104
|
-
meta: ContentMeta;
|
|
105
|
-
payload: MediaPayload;
|
|
106
|
-
}
|
|
107
|
-
export interface ModernUserElasticBody extends ContentElasticBody {
|
|
108
|
-
meta: ContentMeta;
|
|
109
|
-
payload: ModernUserPayload;
|
|
110
|
-
}
|
|
111
|
-
export interface ProfileElasticBody extends ContentElasticBody {
|
|
112
|
-
meta: ContentMeta;
|
|
113
|
-
payload: ProfilePayload;
|
|
114
|
-
}
|
|
115
|
-
export interface SessionElasticBody extends ContentElasticBody {
|
|
116
|
-
meta: ContentMeta;
|
|
117
|
-
payload: SessionPayload;
|
|
118
|
-
}
|
|
119
|
-
export interface WorkspaceElasticBody extends ContentElasticBody {
|
|
120
|
-
meta: ContentMeta;
|
|
121
|
-
payload: WorkspaceElasticPayload;
|
|
122
|
-
}
|
|
123
|
-
export interface MigrationElasticBody extends ContentElasticBody {
|
|
124
|
-
meta: ContentMeta;
|
|
125
|
-
payload: MigrationPayload;
|
|
126
|
-
}
|
|
127
|
-
export interface DictionaryElasticBody extends ContentElasticBody {
|
|
128
|
-
meta: ContentMeta;
|
|
129
|
-
payload: DictionaryPayload;
|
|
130
|
-
}
|
|
131
|
-
export declare class ElasticModel {
|
|
132
|
-
static transform(data: any): ElasticBody;
|
|
133
|
-
private static transformRichText;
|
|
134
|
-
private static transformComment;
|
|
135
|
-
private static transformConceptArt;
|
|
136
|
-
private static transformFragment;
|
|
137
|
-
private static transformManifest;
|
|
138
|
-
private static transformDevice;
|
|
139
|
-
private static transformMetric;
|
|
140
|
-
private static transformWorkspace;
|
|
141
|
-
private static transformBilling;
|
|
142
|
-
private static transformBook;
|
|
143
|
-
private static transformMedia;
|
|
144
|
-
private static transformProfile;
|
|
145
|
-
private static transformSession;
|
|
146
|
-
private static transformUser;
|
|
147
|
-
private static transformMigration;
|
|
148
|
-
private static transformDictionary;
|
|
149
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElasticModel = void 0;
|
|
4
|
-
const Struct_1 = require("../../util/Struct");
|
|
5
|
-
const BodyFormat_1 = require("../markup/BodyFormat");
|
|
6
|
-
const ContentKind_1 = require("./ContentKind");
|
|
7
|
-
const Manifest_1 = require("./Manifest");
|
|
8
|
-
const Metric_1 = require("./Metric");
|
|
9
|
-
const Time_1 = require("./Time");
|
|
10
|
-
class ElasticModel {
|
|
11
|
-
static transform(data) {
|
|
12
|
-
if (data && data.meta && data.meta.kind) {
|
|
13
|
-
const kind = data.meta.kind;
|
|
14
|
-
if (kind === ContentKind_1.ContentKind.MANIFEST) {
|
|
15
|
-
return ElasticModel.transformManifest(data);
|
|
16
|
-
}
|
|
17
|
-
else if (kind === ContentKind_1.ContentKind.BILLING) {
|
|
18
|
-
return ElasticModel.transformBilling(data);
|
|
19
|
-
}
|
|
20
|
-
else if (kind === ContentKind_1.ContentKind.BOOK) {
|
|
21
|
-
return ElasticModel.transformBook(data);
|
|
22
|
-
}
|
|
23
|
-
else if (kind === ContentKind_1.ContentKind.COMMENT) {
|
|
24
|
-
return ElasticModel.transformComment(data);
|
|
25
|
-
}
|
|
26
|
-
else if (kind === ContentKind_1.ContentKind.CONCEPT_ART) {
|
|
27
|
-
return ElasticModel.transformConceptArt(data);
|
|
28
|
-
}
|
|
29
|
-
else if (kind === ContentKind_1.ContentKind.FRAGMENT) {
|
|
30
|
-
return ElasticModel.transformFragment(data);
|
|
31
|
-
}
|
|
32
|
-
else if (kind === ContentKind_1.ContentKind.MEDIA) {
|
|
33
|
-
return ElasticModel.transformMedia(data);
|
|
34
|
-
}
|
|
35
|
-
else if (kind === ContentKind_1.ContentKind.METRIC) {
|
|
36
|
-
return ElasticModel.transformMetric(data);
|
|
37
|
-
}
|
|
38
|
-
else if (kind === ContentKind_1.ContentKind.PROFILE) {
|
|
39
|
-
return ElasticModel.transformProfile(data);
|
|
40
|
-
}
|
|
41
|
-
else if (kind === ContentKind_1.ContentKind.SESSION) {
|
|
42
|
-
return ElasticModel.transformSession(data);
|
|
43
|
-
}
|
|
44
|
-
else if (kind === ContentKind_1.ContentKind.USER) {
|
|
45
|
-
return ElasticModel.transformUser(data);
|
|
46
|
-
}
|
|
47
|
-
else if (kind === ContentKind_1.ContentKind.WORKSPACE) {
|
|
48
|
-
return ElasticModel.transformWorkspace(data);
|
|
49
|
-
}
|
|
50
|
-
else if (kind === ContentKind_1.ContentKind.DEVICE) {
|
|
51
|
-
return ElasticModel.transformDevice(data);
|
|
52
|
-
}
|
|
53
|
-
else if (kind === ContentKind_1.ContentKind.MIGRATION) {
|
|
54
|
-
return ElasticModel.transformMigration(data);
|
|
55
|
-
}
|
|
56
|
-
else if (kind === ContentKind_1.ContentKind.DICTIONARY) {
|
|
57
|
-
return ElasticModel.transformDictionary(data);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
throw new Error("can't transform object for elastic: " + JSON.stringify(data));
|
|
61
|
-
}
|
|
62
|
-
// Rich-text transformations need to rewrite the `richtext_body.ops` as `body_text` and `body_format`
|
|
63
|
-
static transformRichText(body) {
|
|
64
|
-
const bodyFormat = BodyFormat_1.BodyFormatModel.fromDeltaOps(body.payload.richtext_body.ops);
|
|
65
|
-
const result = Struct_1.Struct.clone(body);
|
|
66
|
-
result.payload.richtext_body_text = bodyFormat.body;
|
|
67
|
-
result.payload.richtext_body_format = bodyFormat.format;
|
|
68
|
-
delete result.payload.richtext_body;
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
static transformComment(body) {
|
|
72
|
-
return ElasticModel.transformRichText(body);
|
|
73
|
-
}
|
|
74
|
-
static transformConceptArt(body) {
|
|
75
|
-
return ElasticModel.transformRichText(body);
|
|
76
|
-
}
|
|
77
|
-
static transformFragment(body) {
|
|
78
|
-
return ElasticModel.transformRichText(body);
|
|
79
|
-
}
|
|
80
|
-
// Manifest transformations need to rewrite the 'entries' map as an array.
|
|
81
|
-
static transformManifest(body) {
|
|
82
|
-
const entries = [];
|
|
83
|
-
Manifest_1.Manifest.forEachEntry(body, (e) => {
|
|
84
|
-
entries.push(e);
|
|
85
|
-
});
|
|
86
|
-
// Sort entries in order of descending timestamp (most recently updated are first)
|
|
87
|
-
try {
|
|
88
|
-
entries.sort((a, b) => -Time_1.Time.compareDateTime(a.at_utc_time, b.at_utc_time));
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
console.error(`error sorting manifest entries: ${JSON.stringify(body)}`);
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
meta: Struct_1.Struct.clone(body.meta),
|
|
95
|
-
payload: {
|
|
96
|
-
manifest_entries: entries
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
// Device transformations need to rewrite a few maps as arrays
|
|
101
|
-
static transformDevice(body) {
|
|
102
|
-
const result = Struct_1.Struct.clone(body);
|
|
103
|
-
const treeHandleClosed = Object.keys(body.payload.tree_handle_closed).sort();
|
|
104
|
-
const mediaDownloadFailedAtEntries = [];
|
|
105
|
-
if (body.payload.hasOwnProperty('media_download_failed_at')) {
|
|
106
|
-
const mediaDownloadFailedAtKeys = Object.keys(body.payload.media_download_failed_at).sort();
|
|
107
|
-
for (let i = 0; i < mediaDownloadFailedAtKeys.length; i++) {
|
|
108
|
-
const mediaRef = mediaDownloadFailedAtKeys[i];
|
|
109
|
-
const downloadFailure = body.payload.media_download_failed_at[mediaRef];
|
|
110
|
-
mediaDownloadFailedAtEntries.push({
|
|
111
|
-
media_ref: mediaRef,
|
|
112
|
-
at_utc_time: downloadFailure.at_utc_time,
|
|
113
|
-
attempt: downloadFailure.attempt
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
result.payload.tree_handle_closed_entries = treeHandleClosed;
|
|
118
|
-
result.payload.media_download_failed_at_entries = mediaDownloadFailedAtEntries;
|
|
119
|
-
delete result.payload.tree_handle_closed;
|
|
120
|
-
delete result.payload.media_download_failed_at;
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
// Metric transformations need to rewrite the 'entries' map as an array.
|
|
124
|
-
static transformMetric(body) {
|
|
125
|
-
const entries = [];
|
|
126
|
-
Metric_1.Metric.forEachEntry(body, (e) => {
|
|
127
|
-
entries.push(e);
|
|
128
|
-
});
|
|
129
|
-
const result = Struct_1.Struct.clone(body);
|
|
130
|
-
result.payload.metric_entries = entries;
|
|
131
|
-
delete result.payload.entries;
|
|
132
|
-
return result;
|
|
133
|
-
}
|
|
134
|
-
// Workspace transformations need to rewrite the 'journey' map an an array.
|
|
135
|
-
static transformWorkspace(body) {
|
|
136
|
-
const result = Struct_1.Struct.clone(body);
|
|
137
|
-
result.payload.journey_entries = [];
|
|
138
|
-
if (body.payload.hasOwnProperty('journey')) {
|
|
139
|
-
const journeyKeys = Object.keys(body.payload.journey).sort();
|
|
140
|
-
for (let i = 0; i < journeyKeys.length; i++) {
|
|
141
|
-
const journeyKey = journeyKeys[i];
|
|
142
|
-
result.payload.journey_entries.push({
|
|
143
|
-
key: journeyKey,
|
|
144
|
-
at_utc_time: body.payload.journey[journeyKey]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
delete result.payload.primary_device;
|
|
149
|
-
delete result.payload.primary_device_last_update;
|
|
150
|
-
delete result.payload.journey;
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
// All other types can be cloned without transformation.
|
|
154
|
-
static transformBilling(body) {
|
|
155
|
-
return Struct_1.Struct.clone(body);
|
|
156
|
-
}
|
|
157
|
-
static transformBook(body) {
|
|
158
|
-
return Struct_1.Struct.clone(body);
|
|
159
|
-
}
|
|
160
|
-
static transformMedia(body) {
|
|
161
|
-
return Struct_1.Struct.clone(body);
|
|
162
|
-
}
|
|
163
|
-
static transformProfile(body) {
|
|
164
|
-
return Struct_1.Struct.clone(body);
|
|
165
|
-
}
|
|
166
|
-
static transformSession(body) {
|
|
167
|
-
return Struct_1.Struct.clone(body);
|
|
168
|
-
}
|
|
169
|
-
static transformUser(body) {
|
|
170
|
-
return Struct_1.Struct.clone(body);
|
|
171
|
-
}
|
|
172
|
-
static transformMigration(body) {
|
|
173
|
-
return Struct_1.Struct.clone(body);
|
|
174
|
-
}
|
|
175
|
-
static transformDictionary(body) {
|
|
176
|
-
return Struct_1.Struct.clone(body);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
exports.ElasticModel = ElasticModel;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { GeoLocation } from "./GeoLocation";
|
|
3
|
-
export interface Versions {
|
|
4
|
-
shaxpir: string;
|
|
5
|
-
is_bundle_update?: boolean;
|
|
6
|
-
shaxpir_bundle?: string;
|
|
7
|
-
node_webkit?: string;
|
|
8
|
-
user_agent: string;
|
|
9
|
-
os_type: string;
|
|
10
|
-
os_platform?: NodeJS.Platform;
|
|
11
|
-
os_release?: string;
|
|
12
|
-
os_version?: string;
|
|
13
|
-
os_arch?: string;
|
|
14
|
-
browser?: BrowserDetails;
|
|
15
|
-
device?: DeviceDetails;
|
|
16
|
-
}
|
|
17
|
-
export interface DeviceDetails {
|
|
18
|
-
type?: string;
|
|
19
|
-
vendor?: string;
|
|
20
|
-
model?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface BrowserDetails {
|
|
23
|
-
name?: string;
|
|
24
|
-
version?: string;
|
|
25
|
-
major?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ScreenDimensions {
|
|
28
|
-
resolution: string;
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
scale: number;
|
|
32
|
-
}
|
|
33
|
-
export interface StorageDevice {
|
|
34
|
-
drive_type: string;
|
|
35
|
-
size_in_bytes: number;
|
|
36
|
-
}
|
|
37
|
-
export interface Screens {
|
|
38
|
-
count: number;
|
|
39
|
-
dimensions: ScreenDimensions[];
|
|
40
|
-
}
|
|
41
|
-
export interface Environment {
|
|
42
|
-
container_type?: string;
|
|
43
|
-
versions: Versions;
|
|
44
|
-
language: string;
|
|
45
|
-
location: GeoLocation;
|
|
46
|
-
memory?: number;
|
|
47
|
-
storage?: StorageDevice[];
|
|
48
|
-
screens?: Screens;
|
|
49
|
-
}
|
|
50
|
-
export declare class EnvironmentModel {
|
|
51
|
-
static readonly UNKNOWN_MAC_OS_VERSION: string;
|
|
52
|
-
static readonly UNKNOWN_WINDOWS_VERSION: string;
|
|
53
|
-
static readonly MICROSOFT_WINDOWS: string;
|
|
54
|
-
static readonly MAC_OS_X: string;
|
|
55
|
-
static readonly WINDOWS_NT: string;
|
|
56
|
-
static readonly DARWIN: string;
|
|
57
|
-
static readonly OSX: string;
|
|
58
|
-
static readonly WIN: string;
|
|
59
|
-
static readonly WIN32: string;
|
|
60
|
-
static getOsVersion(osType: string, osRelease: string): string;
|
|
61
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvironmentModel = void 0;
|
|
4
|
-
class EnvironmentModel {
|
|
5
|
-
static getOsVersion(osType, osRelease) {
|
|
6
|
-
// These lookup tables are organized in reverse-chronological order. When copying
|
|
7
|
-
// new entries into these lists, the new entries should be at the top.
|
|
8
|
-
if (osType === EnvironmentModel.WINDOWS_NT || osType === EnvironmentModel.MICROSOFT_WINDOWS) {
|
|
9
|
-
EnvironmentModel.MAC_OS_X;
|
|
10
|
-
// Lookup table comes from here... https://en.wikipedia.org/wiki/Windows_NT
|
|
11
|
-
if (osRelease.indexOf("10.0.22") === 0) {
|
|
12
|
-
return "Windows 11";
|
|
13
|
-
}
|
|
14
|
-
else if (osRelease.indexOf("10.0.") === 0) {
|
|
15
|
-
return "Windows 10";
|
|
16
|
-
}
|
|
17
|
-
else if (osRelease.indexOf("6.3.") === 0) {
|
|
18
|
-
return "Windows 8.1";
|
|
19
|
-
}
|
|
20
|
-
else if (osRelease.indexOf("6.2.") === 0) {
|
|
21
|
-
return "Windows 8";
|
|
22
|
-
}
|
|
23
|
-
else if (osRelease.indexOf("6.1.") === 0) {
|
|
24
|
-
return "Windows 7";
|
|
25
|
-
}
|
|
26
|
-
else if (osRelease.indexOf("6.0.") === 0) {
|
|
27
|
-
return "Windows Vista";
|
|
28
|
-
}
|
|
29
|
-
else if (osRelease.indexOf("5.2.") === 0 || osRelease.indexOf("5.1.") === 0) {
|
|
30
|
-
return "Windows XP";
|
|
31
|
-
}
|
|
32
|
-
else if (osRelease.indexOf("5.0.") === 0) {
|
|
33
|
-
return "Windows 2000";
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return EnvironmentModel.UNKNOWN_WINDOWS_VERSION;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else if (osType === EnvironmentModel.DARWIN || osType === EnvironmentModel.MAC_OS_X) {
|
|
40
|
-
// Lookup table comes from here...
|
|
41
|
-
// https://en.wikipedia.org/wiki/Darwin_(operating_system)
|
|
42
|
-
// https://user-agents.me/cfnetwork-version-list
|
|
43
|
-
if (osRelease.indexOf("24.") === 0) {
|
|
44
|
-
return "Mac OS Sequoia";
|
|
45
|
-
}
|
|
46
|
-
else if (osRelease.indexOf("23.") === 0) {
|
|
47
|
-
return "Mac OS Sonoma";
|
|
48
|
-
}
|
|
49
|
-
else if (osRelease.indexOf("22.") === 0) {
|
|
50
|
-
return "Mac OS Ventura";
|
|
51
|
-
}
|
|
52
|
-
else if (osRelease.indexOf("21.") === 0) {
|
|
53
|
-
return "Mac OS Monterey";
|
|
54
|
-
}
|
|
55
|
-
else if (osRelease.indexOf("20.") === 0) {
|
|
56
|
-
return "Mac OS Big Sur";
|
|
57
|
-
}
|
|
58
|
-
else if (osRelease.indexOf("19.") === 0) {
|
|
59
|
-
return "Mac OS Catalina";
|
|
60
|
-
}
|
|
61
|
-
else if (osRelease.indexOf("18.") === 0) {
|
|
62
|
-
return "Mac OS Mojave";
|
|
63
|
-
}
|
|
64
|
-
else if (osRelease.indexOf("17.") === 0) {
|
|
65
|
-
return "Mac OS High Sierra";
|
|
66
|
-
}
|
|
67
|
-
else if (osRelease.indexOf("16.") === 0) {
|
|
68
|
-
return "Mac OS Sierra";
|
|
69
|
-
}
|
|
70
|
-
else if (osRelease.indexOf("15.") === 0) {
|
|
71
|
-
return "Mac OS X El Capitan";
|
|
72
|
-
}
|
|
73
|
-
else if (osRelease.indexOf("14.") === 0) {
|
|
74
|
-
return "Mac OS X Yosemite";
|
|
75
|
-
}
|
|
76
|
-
else if (osRelease.indexOf("13.") === 0) {
|
|
77
|
-
return "Mac OS X Mavericks";
|
|
78
|
-
}
|
|
79
|
-
else if (osRelease.indexOf("12.") === 0) {
|
|
80
|
-
return "Mac OS X Mountain Lion";
|
|
81
|
-
}
|
|
82
|
-
else if (osRelease.indexOf("11.") === 0) {
|
|
83
|
-
return "Mac OS X Lion";
|
|
84
|
-
}
|
|
85
|
-
else if (osRelease.indexOf("10.") === 0) {
|
|
86
|
-
return "Mac OS X Snow Leopard";
|
|
87
|
-
}
|
|
88
|
-
else if (osRelease.indexOf("9.") === 0) {
|
|
89
|
-
return "Mac OS X Leopard";
|
|
90
|
-
}
|
|
91
|
-
else if (osRelease.indexOf("8.") === 0) {
|
|
92
|
-
return "Mac OS X Tiger";
|
|
93
|
-
}
|
|
94
|
-
else if (osRelease.indexOf("7.") === 0) {
|
|
95
|
-
return "Mac OS X Panther";
|
|
96
|
-
}
|
|
97
|
-
else if (osRelease.indexOf("6.") === 0) {
|
|
98
|
-
return "Mac OS X Jaguar";
|
|
99
|
-
}
|
|
100
|
-
else if (osRelease.indexOf("5.") === 0) {
|
|
101
|
-
return "Mac OS X Puma";
|
|
102
|
-
}
|
|
103
|
-
else if (osRelease.indexOf("1.4.1") === 0) {
|
|
104
|
-
return "Mac OS X Puma";
|
|
105
|
-
}
|
|
106
|
-
else if (osRelease.indexOf("1.3.1") === 0) {
|
|
107
|
-
return "Mac OS X Cheeta";
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return EnvironmentModel.UNKNOWN_MAC_OS_VERSION;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.EnvironmentModel = EnvironmentModel;
|
|
116
|
-
EnvironmentModel.UNKNOWN_MAC_OS_VERSION = "UNKNOWN MAC OS VERSION";
|
|
117
|
-
EnvironmentModel.UNKNOWN_WINDOWS_VERSION = "UNKNOWN WINDOWS VERSION";
|
|
118
|
-
EnvironmentModel.MICROSOFT_WINDOWS = "Microsoft Windows";
|
|
119
|
-
EnvironmentModel.MAC_OS_X = "Mac OS X";
|
|
120
|
-
EnvironmentModel.WINDOWS_NT = "Windows_NT";
|
|
121
|
-
EnvironmentModel.DARWIN = "Darwin";
|
|
122
|
-
EnvironmentModel.OSX = "osx";
|
|
123
|
-
EnvironmentModel.WIN = "win";
|
|
124
|
-
EnvironmentModel.WIN32 = "win32";
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { BookPayload } from "./Book";
|
|
2
|
-
import { Category } from "./Category";
|
|
3
|
-
export interface ExportOptions {
|
|
4
|
-
selected_format: ExportFormat;
|
|
5
|
-
formats: {
|
|
6
|
-
[key: string]: FormatOptions;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export interface FormatOptions {
|
|
10
|
-
include_toc: boolean;
|
|
11
|
-
include_synopsis: boolean;
|
|
12
|
-
manuscript?: ManuscriptOrNotebookOptions;
|
|
13
|
-
notebook?: ManuscriptOrNotebookOptions;
|
|
14
|
-
}
|
|
15
|
-
export interface ManuscriptOrNotebookOptions {
|
|
16
|
-
include: boolean;
|
|
17
|
-
categories: {
|
|
18
|
-
[key: string]: CategoryOptions;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface CategoryOptions {
|
|
22
|
-
toc: boolean;
|
|
23
|
-
name: NameStyle;
|
|
24
|
-
number: NumberStyle;
|
|
25
|
-
prefix: PrefixStyle;
|
|
26
|
-
brk: BreakStyle;
|
|
27
|
-
}
|
|
28
|
-
export declare enum ExportFormat {
|
|
29
|
-
EPUB = "epub",
|
|
30
|
-
HTML = "html",
|
|
31
|
-
DOCX = "docx"
|
|
32
|
-
}
|
|
33
|
-
export declare enum NameStyle {
|
|
34
|
-
TITLE = "title",
|
|
35
|
-
NONE = "none"
|
|
36
|
-
}
|
|
37
|
-
export declare enum NumberStyle {
|
|
38
|
-
DIGITS = "digits",
|
|
39
|
-
WORDS = "words",
|
|
40
|
-
NONE = "none"
|
|
41
|
-
}
|
|
42
|
-
export declare enum PrefixStyle {
|
|
43
|
-
CATEGORY = "category",
|
|
44
|
-
NONE = "none"
|
|
45
|
-
}
|
|
46
|
-
export declare enum BreakStyle {
|
|
47
|
-
PAGE = "page",
|
|
48
|
-
PROSE = "prose",
|
|
49
|
-
NONE = "none"
|
|
50
|
-
}
|
|
51
|
-
export declare enum FragmentContext {
|
|
52
|
-
MANUSCRIPT = "manuscript",
|
|
53
|
-
NOTEBOOK = "notebook"
|
|
54
|
-
}
|
|
55
|
-
export declare class ExportOptionsModel {
|
|
56
|
-
private static ALL_FORMATS;
|
|
57
|
-
static build(bookPayload: BookPayload): ExportOptions;
|
|
58
|
-
static makeDefaultOptions(): ExportOptions;
|
|
59
|
-
static makeDefaultOptionsForFormat(format: ExportFormat): any;
|
|
60
|
-
static makeDefaultCategoryOptionsForContext(context: FragmentContext): CategoryOptions;
|
|
61
|
-
static makeDefaultOptionsByCategory(context: FragmentContext, category: Category): any;
|
|
62
|
-
static makeOptionsForCustomCategoryByContext(context: FragmentContext): any;
|
|
63
|
-
static makeCategoryOptions(addToToc: boolean, nameStyle: NameStyle, numberStyle: NumberStyle, prefixStyle: PrefixStyle, breakStyle: BreakStyle): any;
|
|
64
|
-
}
|