Skip to content

Commit a54e006

Browse files
Create an event for Rapid PREreviews
Refs #3184
1 parent fc13c2b commit a54e006

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

src/Events.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { Array, Context, Effect, Function, Layer, PubSub, Record, Schema, Struct, type Types, flow, pipe } from 'effect'
22
import * as CommentEvents from './Comments/Events.ts' // eslint-disable-line import/no-internal-modules
33
import * as DatasetReviewEvents from './DatasetReviews/Events.ts' // eslint-disable-line import/no-internal-modules
4+
import * as PreprintReviews from './PreprintReviews/Events.ts' // eslint-disable-line import/no-internal-modules
45
import * as PrereviewerEvents from './Prereviewers/Events.ts' // eslint-disable-line import/no-internal-modules
56
import * as ReviewRequestsEvents from './ReviewRequests/Events.ts' // eslint-disable-line import/no-internal-modules
67

78
export * from './Comments/Events.ts' // eslint-disable-line import/no-internal-modules
89
export * from './DatasetReviews/Events.ts' // eslint-disable-line import/no-internal-modules
10+
export * from './PreprintReviews/Events.ts' // eslint-disable-line import/no-internal-modules
911
export * from './Prereviewers/Events.ts' // eslint-disable-line import/no-internal-modules
1012
export * from './ReviewRequests/Events.ts' // eslint-disable-line import/no-internal-modules
1113

@@ -15,6 +17,7 @@ export const Event = Schema.Union(
1517
...CommentEvents.CommentEvent.members,
1618
...DatasetReviewEvents.DatasetReviewEvent.members,
1719
...ReviewRequestsEvents.ReviewRequestEvent.members,
20+
PreprintReviews.RapidPrereviewImported,
1821
PrereviewerEvents.RegisteredPrereviewerImported,
1922
PrereviewerEvents.PrereviewerRegistered,
2023
)

src/PreprintReviews/Events.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Schema } from 'effect'
2+
import * as Preprints from '../Preprints/index.ts'
3+
import { NonEmptyString, OrcidId, Temporal, Uuid } from '../types/index.ts'
4+
5+
export class RapidPrereviewImported extends Schema.TaggedClass<RapidPrereviewImported>()('RapidPrereviewImported', {
6+
author: Schema.Struct({
7+
persona: Schema.Literal('public', 'pseudonym'),
8+
orcidId: OrcidId.OrcidIdSchema,
9+
}),
10+
publishedAt: Temporal.InstantSchema,
11+
preprintId: Preprints.IndeterminatePreprintIdFromStringSchema,
12+
rapidPrereviewId: Uuid.UuidSchema,
13+
questions: Schema.Struct({
14+
availableCode: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
15+
availableData: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
16+
coherent: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
17+
dataLink: Schema.Option(NonEmptyString.NonEmptyStringSchema),
18+
ethics: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
19+
future: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
20+
limitations: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
21+
methods: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
22+
newData: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
23+
novel: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
24+
peerReview: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
25+
recommend: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
26+
reproducibility: Schema.Literal('yes', 'unsure', 'not applicable', 'no'),
27+
technicalComments: Schema.Option(NonEmptyString.NonEmptyStringSchema),
28+
editorialComments: Schema.Option(NonEmptyString.NonEmptyStringSchema),
29+
}),
30+
}) {}

test/fc.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,10 +2512,41 @@ export const event = (): fc.Arbitrary<Events.Event> =>
25122512
commentEvent(),
25132513
datasetReviewEvent(),
25142514
reviewRequestEvent(),
2515+
rapidPrereviewImported(),
25152516
registeredPrereviewerImported(),
25162517
prereviewerRegistered(),
25172518
)
25182519

2520+
export const rapidPrereviewImported = (): fc.Arbitrary<Events.RapidPrereviewImported> =>
2521+
fc
2522+
.record({
2523+
author: fc.record({
2524+
persona: constantFrom('public', 'pseudonym'),
2525+
orcidId: orcidId(),
2526+
}),
2527+
publishedAt: instant(),
2528+
preprintId: indeterminatePreprintIdWithDoi(),
2529+
rapidPrereviewId: uuid(),
2530+
questions: fc.record({
2531+
availableCode: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2532+
availableData: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2533+
coherent: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2534+
dataLink: maybe(nonEmptyString()),
2535+
ethics: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2536+
future: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2537+
limitations: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2538+
methods: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2539+
newData: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2540+
novel: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2541+
peerReview: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2542+
recommend: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2543+
reproducibility: constantFrom('yes', 'unsure', 'not applicable', 'no'),
2544+
technicalComments: maybe(nonEmptyString()),
2545+
editorialComments: maybe(nonEmptyString()),
2546+
}),
2547+
})
2548+
.map(args => new Events.RapidPrereviewImported(args))
2549+
25192550
export const registeredPrereviewerImported = (): fc.Arbitrary<Events.RegisteredPrereviewerImported> =>
25202551
fc
25212552
.record({

0 commit comments

Comments
 (0)