Skip to content

Commit

Permalink
Make OpenAlex field information available #13
Browse files Browse the repository at this point in the history
  • Loading branch information
erkannt committed Jun 26, 2024
1 parent aea8d81 commit 1503c24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/data/requests.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { NodeTerminal } from '@effect/platform-node'
import { Schema } from '@effect/schema'
import { Effect } from 'effect'
import * as LanguageCode from '../lib/LanguageCode.js'
import { FieldIdSchema } from '../lib/OpenAlex.js'
import * as Temporal from '../lib/Temporal.js'

const Requests = Schema.Array(
Schema.Struct({
timestamp: Temporal.InstantFromStringSchema,
language: Schema.optional(LanguageCode.LanguageCodeSchema, { nullable: true }),
fields: Schema.Array(FieldIdSchema),
}),
)

Expand Down
8 changes: 8 additions & 0 deletions src/lib/OpenAlex.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Schema } from '@effect/schema'
import { Brand } from 'effect'

type FieldId = string & Brand.Brand<'OpenAlexFieldId'>

const FieldId = Brand.nominal<FieldId>()

export const FieldIdSchema = Schema.String.pipe(Schema.fromBrand(FieldId))

0 comments on commit 1503c24

Please sign in to comment.