Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
a9fc2258
Commit
a9fc2258
authored
Jul 25, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jul 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define API-only Annotation type
parent
f5244b36
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
15 deletions
+8
-15
annotations.ts
src/sidebar/services/annotations.ts
+2
-4
annotator.ts
src/types/annotator.ts
+2
-2
api.ts
src/types/api.ts
+3
-9
shared.ts
src/types/shared.ts
+1
-0
No files found.
src/sidebar/services/annotations.ts
View file @
a9fc2258
...
@@ -77,10 +77,8 @@ export class AnnotationsService {
...
@@ -77,10 +77,8 @@ export class AnnotationsService {
// We need a unique local/app identifier for this new annotation such
// We need a unique local/app identifier for this new annotation such
// that we might look it up later in the store. It won't have an ID yet,
// that we might look it up later in the store. It won't have an ID yet,
// as it has not been persisted to the service.
// as it has not been persisted to the service.
const
$tag
=
's:'
+
generateHexString
(
8
);
const
$tag
=
`s:
${
generateHexString
(
8
)}
`
;
const
annotation
:
Annotation
=
Object
.
assign
(
/** @type {Annotation} */
const
annotation
=
Object
.
assign
(
{
{
created
:
now
.
toISOString
(),
created
:
now
.
toISOString
(),
group
:
groupid
,
group
:
groupid
,
...
...
src/types/annotator.ts
View file @
a9fc2258
import
type
{
TinyEmitter
}
from
'tiny-emitter'
;
import
type
{
TinyEmitter
}
from
'tiny-emitter'
;
import
type
{
A
nnotation
,
Selector
,
Target
}
from
'./api'
;
import
type
{
A
PIAnnotationData
,
Selector
,
Target
}
from
'./api'
;
import
type
{
ClientAnnotationData
}
from
'./shared'
;
import
type
{
ClientAnnotationData
}
from
'./shared'
;
/**
/**
...
@@ -66,7 +66,7 @@ export type SegmentInfo = {
...
@@ -66,7 +66,7 @@ export type SegmentInfo = {
* the document.
* the document.
*/
*/
export
type
AnnotationData
=
ClientAnnotationData
&
export
type
AnnotationData
=
ClientAnnotationData
&
Pick
<
A
nnotation
,
'target'
|
'uri'
>
&
{
Pick
<
A
PIAnnotationData
,
'target'
|
'uri'
>
&
{
document
?:
DocumentMetadata
;
document
?:
DocumentMetadata
;
};
};
...
...
src/types/api.ts
View file @
a9fc2258
...
@@ -144,21 +144,13 @@ export type UserInfo = {
...
@@ -144,21 +144,13 @@ export type UserInfo = {
display_name
:
string
|
null
;
display_name
:
string
|
null
;
};
};
export
type
A
nnotation
=
ClientAnnotationData
&
{
export
type
A
PIAnnotationData
=
{
/**
/**
* The server-assigned ID for the annotation. This is only set once the
* The server-assigned ID for the annotation. This is only set once the
* annotation has been saved to the backend.
* annotation has been saved to the backend.
*/
*/
id
?:
string
;
id
?:
string
;
/**
* A locally-generated unique identifier for annotations.
*
* This is set for all annotations, whether they have been saved to the
* backend or not.
*/
$tag
:
string
;
references
?:
string
[];
references
?:
string
[];
created
:
string
;
created
:
string
;
flagged
?:
boolean
;
flagged
?:
boolean
;
...
@@ -205,6 +197,8 @@ export type Annotation = ClientAnnotationData & {
...
@@ -205,6 +197,8 @@ export type Annotation = ClientAnnotationData & {
user_info
?:
UserInfo
;
user_info
?:
UserInfo
;
};
};
export
type
Annotation
=
ClientAnnotationData
&
APIAnnotationData
;
/**
/**
* An annotation which has been saved to the backend and assigned an ID.
* An annotation which has been saved to the backend and assigned an ID.
*/
*/
...
...
src/types/shared.ts
View file @
a9fc2258
...
@@ -13,6 +13,7 @@ export type HighlightCluster =
...
@@ -13,6 +13,7 @@ export type HighlightCluster =
*/
*/
export
type
ClientAnnotationData
=
{
export
type
ClientAnnotationData
=
{
$cluster
?:
HighlightCluster
;
$cluster
?:
HighlightCluster
;
/**
/**
* Client-side identifier: set even if annotation does not have a
* Client-side identifier: set even if annotation does not have a
* server-provided `id` (i.e. is unsaved)
* server-provided `id` (i.e. is unsaved)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment